repo
stringlengths 2
99
| file
stringlengths 13
225
| code
stringlengths 0
18.3M
| file_length
int64 0
18.3M
| avg_line_length
float64 0
1.36M
| max_line_length
int64 0
4.26M
| extension_type
stringclasses 1
value |
|---|---|---|---|---|---|---|
s2anet
|
s2anet-master/mmdet/models/backbones/__init__.py
|
from .hrnet import HRNet
from .resnet import ResNet, make_res_layer
from .resnext import ResNeXt
from .ssd_vgg import SSDVGG
__all__ = ['ResNet', 'make_res_layer', 'ResNeXt', 'SSDVGG', 'HRNet']
| 195
| 27
| 68
|
py
|
s2anet
|
s2anet-master/mmdet/models/mask_heads/grid_head.py
|
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import kaiming_init, normal_init
from ..builder import build_loss
from ..registry import HEADS
from ..utils import ConvModule
@HEADS.register_module
class GridHead(nn.Module):
def __init__(self,
grid_points=9,
num_convs=8,
roi_feat_size=14,
in_channels=256,
conv_kernel_size=3,
point_feat_channels=64,
deconv_kernel_size=4,
class_agnostic=False,
loss_grid=dict(
type='CrossEntropyLoss', use_sigmoid=True,
loss_weight=15),
conv_cfg=None,
norm_cfg=dict(type='GN', num_groups=36)):
super(GridHead, self).__init__()
self.grid_points = grid_points
self.num_convs = num_convs
self.roi_feat_size = roi_feat_size
self.in_channels = in_channels
self.conv_kernel_size = conv_kernel_size
self.point_feat_channels = point_feat_channels
self.conv_out_channels = self.point_feat_channels * self.grid_points
self.class_agnostic = class_agnostic
self.conv_cfg = conv_cfg
self.norm_cfg = norm_cfg
if isinstance(norm_cfg, dict) and norm_cfg['type'] == 'GN':
assert self.conv_out_channels % norm_cfg['num_groups'] == 0
assert self.grid_points >= 4
self.grid_size = int(np.sqrt(self.grid_points))
if self.grid_size * self.grid_size != self.grid_points:
raise ValueError('grid_points must be a square number')
# the predicted heatmap is half of whole_map_size
if not isinstance(self.roi_feat_size, int):
raise ValueError('Only square RoIs are supporeted in Grid R-CNN')
self.whole_map_size = self.roi_feat_size * 4
# compute point-wise sub-regions
self.sub_regions = self.calc_sub_regions()
self.convs = []
for i in range(self.num_convs):
in_channels = (
self.in_channels if i == 0 else self.conv_out_channels)
stride = 2 if i == 0 else 1
padding = (self.conv_kernel_size - 1) // 2
self.convs.append(
ConvModule(
in_channels,
self.conv_out_channels,
self.conv_kernel_size,
stride=stride,
padding=padding,
conv_cfg=self.conv_cfg,
norm_cfg=self.norm_cfg,
bias=True))
self.convs = nn.Sequential(*self.convs)
self.deconv1 = nn.ConvTranspose2d(
self.conv_out_channels,
self.conv_out_channels,
kernel_size=deconv_kernel_size,
stride=2,
padding=(deconv_kernel_size - 2) // 2,
groups=grid_points)
self.norm1 = nn.GroupNorm(grid_points, self.conv_out_channels)
self.deconv2 = nn.ConvTranspose2d(
self.conv_out_channels,
grid_points,
kernel_size=deconv_kernel_size,
stride=2,
padding=(deconv_kernel_size - 2) // 2,
groups=grid_points)
# find the 4-neighbor of each grid point
self.neighbor_points = []
grid_size = self.grid_size
for i in range(grid_size): # i-th column
for j in range(grid_size): # j-th row
neighbors = []
if i > 0: # left: (i - 1, j)
neighbors.append((i - 1) * grid_size + j)
if j > 0: # up: (i, j - 1)
neighbors.append(i * grid_size + j - 1)
if j < grid_size - 1: # down: (i, j + 1)
neighbors.append(i * grid_size + j + 1)
if i < grid_size - 1: # right: (i + 1, j)
neighbors.append((i + 1) * grid_size + j)
self.neighbor_points.append(tuple(neighbors))
# total edges in the grid
self.num_edges = sum([len(p) for p in self.neighbor_points])
self.forder_trans = nn.ModuleList() # first-order feature transition
self.sorder_trans = nn.ModuleList() # second-order feature transition
for neighbors in self.neighbor_points:
fo_trans = nn.ModuleList()
so_trans = nn.ModuleList()
for _ in range(len(neighbors)):
# each transition module consists of a 5x5 depth-wise conv and
# 1x1 conv.
fo_trans.append(
nn.Sequential(
nn.Conv2d(
self.point_feat_channels,
self.point_feat_channels,
5,
stride=1,
padding=2,
groups=self.point_feat_channels),
nn.Conv2d(self.point_feat_channels,
self.point_feat_channels, 1)))
so_trans.append(
nn.Sequential(
nn.Conv2d(
self.point_feat_channels,
self.point_feat_channels,
5,
1,
2,
groups=self.point_feat_channels),
nn.Conv2d(self.point_feat_channels,
self.point_feat_channels, 1)))
self.forder_trans.append(fo_trans)
self.sorder_trans.append(so_trans)
self.loss_grid = build_loss(loss_grid)
def init_weights(self):
for m in self.modules():
if isinstance(m, nn.Conv2d) or isinstance(m, nn.Linear):
# TODO: compare mode = "fan_in" or "fan_out"
kaiming_init(m)
for m in self.modules():
if isinstance(m, nn.ConvTranspose2d):
normal_init(m, std=0.001)
nn.init.constant_(self.deconv2.bias, -np.log(0.99 / 0.01))
def forward(self, x):
assert x.shape[-1] == x.shape[-2] == self.roi_feat_size
# RoI feature transformation, downsample 2x
x = self.convs(x)
c = self.point_feat_channels
# first-order fusion
x_fo = [None for _ in range(self.grid_points)]
for i, points in enumerate(self.neighbor_points):
x_fo[i] = x[:, i * c:(i + 1) * c]
for j, point_idx in enumerate(points):
x_fo[i] = x_fo[i] + self.forder_trans[i][j](
x[:, point_idx * c:(point_idx + 1) * c])
# second-order fusion
x_so = [None for _ in range(self.grid_points)]
for i, points in enumerate(self.neighbor_points):
x_so[i] = x[:, i * c:(i + 1) * c]
for j, point_idx in enumerate(points):
x_so[i] = x_so[i] + self.sorder_trans[i][j](x_fo[point_idx])
# predicted heatmap with fused features
x2 = torch.cat(x_so, dim=1)
x2 = self.deconv1(x2)
x2 = F.relu(self.norm1(x2), inplace=True)
heatmap = self.deconv2(x2)
# predicted heatmap with original features (applicable during training)
if self.training:
x1 = x
x1 = self.deconv1(x1)
x1 = F.relu(self.norm1(x1), inplace=True)
heatmap_unfused = self.deconv2(x1)
else:
heatmap_unfused = heatmap
return dict(fused=heatmap, unfused=heatmap_unfused)
def calc_sub_regions(self):
"""Compute point specific representation regions.
See Grid R-CNN Plus (https://arxiv.org/abs/1906.05688) for details.
"""
# to make it consistent with the original implementation, half_size
# is computed as 2 * quarter_size, which is smaller
half_size = self.whole_map_size // 4 * 2
sub_regions = []
for i in range(self.grid_points):
x_idx = i // self.grid_size
y_idx = i % self.grid_size
if x_idx == 0:
sub_x1 = 0
elif x_idx == self.grid_size - 1:
sub_x1 = half_size
else:
ratio = x_idx / (self.grid_size - 1) - 0.25
sub_x1 = max(int(ratio * self.whole_map_size), 0)
if y_idx == 0:
sub_y1 = 0
elif y_idx == self.grid_size - 1:
sub_y1 = half_size
else:
ratio = y_idx / (self.grid_size - 1) - 0.25
sub_y1 = max(int(ratio * self.whole_map_size), 0)
sub_regions.append(
(sub_x1, sub_y1, sub_x1 + half_size, sub_y1 + half_size))
return sub_regions
def get_target(self, sampling_results, rcnn_train_cfg):
# mix all samples (across images) together.
pos_bboxes = torch.cat([res.pos_bboxes for res in sampling_results],
dim=0).cpu()
pos_gt_bboxes = torch.cat(
[res.pos_gt_bboxes for res in sampling_results], dim=0).cpu()
assert pos_bboxes.shape == pos_gt_bboxes.shape
# expand pos_bboxes to 2x of original size
x1 = pos_bboxes[:, 0] - (pos_bboxes[:, 2] - pos_bboxes[:, 0]) / 2
y1 = pos_bboxes[:, 1] - (pos_bboxes[:, 3] - pos_bboxes[:, 1]) / 2
x2 = pos_bboxes[:, 2] + (pos_bboxes[:, 2] - pos_bboxes[:, 0]) / 2
y2 = pos_bboxes[:, 3] + (pos_bboxes[:, 3] - pos_bboxes[:, 1]) / 2
pos_bboxes = torch.stack([x1, y1, x2, y2], dim=-1)
pos_bbox_ws = (pos_bboxes[:, 2] - pos_bboxes[:, 0]).unsqueeze(-1)
pos_bbox_hs = (pos_bboxes[:, 3] - pos_bboxes[:, 1]).unsqueeze(-1)
num_rois = pos_bboxes.shape[0]
map_size = self.whole_map_size
# this is not the final target shape
targets = torch.zeros((num_rois, self.grid_points, map_size, map_size),
dtype=torch.float)
# pre-compute interpolation factors for all grid points.
# the first item is the factor of x-dim, and the second is y-dim.
# for a 9-point grid, factors are like (1, 0), (0.5, 0.5), (0, 1)
factors = []
for j in range(self.grid_points):
x_idx = j // self.grid_size
y_idx = j % self.grid_size
factors.append((1 - x_idx / (self.grid_size - 1),
1 - y_idx / (self.grid_size - 1)))
radius = rcnn_train_cfg.pos_radius
radius2 = radius**2
for i in range(num_rois):
# ignore small bboxes
if (pos_bbox_ws[i] <= self.grid_size
or pos_bbox_hs[i] <= self.grid_size):
continue
# for each grid point, mark a small circle as positive
for j in range(self.grid_points):
factor_x, factor_y = factors[j]
gridpoint_x = factor_x * pos_gt_bboxes[i, 0] + (
1 - factor_x) * pos_gt_bboxes[i, 2]
gridpoint_y = factor_y * pos_gt_bboxes[i, 1] + (
1 - factor_y) * pos_gt_bboxes[i, 3]
cx = int((gridpoint_x - pos_bboxes[i, 0]) / pos_bbox_ws[i] *
map_size)
cy = int((gridpoint_y - pos_bboxes[i, 1]) / pos_bbox_hs[i] *
map_size)
for x in range(cx - radius, cx + radius + 1):
for y in range(cy - radius, cy + radius + 1):
if x >= 0 and x < map_size and y >= 0 and y < map_size:
if (x - cx)**2 + (y - cy)**2 <= radius2:
targets[i, j, y, x] = 1
# reduce the target heatmap size by a half
# proposed in Grid R-CNN Plus (https://arxiv.org/abs/1906.05688).
sub_targets = []
for i in range(self.grid_points):
sub_x1, sub_y1, sub_x2, sub_y2 = self.sub_regions[i]
sub_targets.append(targets[:, [i], sub_y1:sub_y2, sub_x1:sub_x2])
sub_targets = torch.cat(sub_targets, dim=1)
sub_targets = sub_targets.cuda()
return sub_targets
def loss(self, grid_pred, grid_targets):
loss_fused = self.loss_grid(grid_pred['fused'], grid_targets)
loss_unfused = self.loss_grid(grid_pred['unfused'], grid_targets)
loss_grid = loss_fused + loss_unfused
return dict(loss_grid=loss_grid)
def get_bboxes(self, det_bboxes, grid_pred, img_meta):
# TODO: refactoring
assert det_bboxes.shape[0] == grid_pred.shape[0]
det_bboxes = det_bboxes.cpu()
cls_scores = det_bboxes[:, [4]]
det_bboxes = det_bboxes[:, :4]
grid_pred = grid_pred.sigmoid().cpu()
R, c, h, w = grid_pred.shape
half_size = self.whole_map_size // 4 * 2
assert h == w == half_size
assert c == self.grid_points
# find the point with max scores in the half-sized heatmap
grid_pred = grid_pred.view(R * c, h * w)
pred_scores, pred_position = grid_pred.max(dim=1)
xs = pred_position % w
ys = pred_position // w
# get the position in the whole heatmap instead of half-sized heatmap
for i in range(self.grid_points):
xs[i::self.grid_points] += self.sub_regions[i][0]
ys[i::self.grid_points] += self.sub_regions[i][1]
# reshape to (num_rois, grid_points)
pred_scores, xs, ys = tuple(
map(lambda x: x.view(R, c), [pred_scores, xs, ys]))
# get expanded pos_bboxes
widths = (det_bboxes[:, 2] - det_bboxes[:, 0]).unsqueeze(-1)
heights = (det_bboxes[:, 3] - det_bboxes[:, 1]).unsqueeze(-1)
x1 = (det_bboxes[:, 0, None] - widths / 2)
y1 = (det_bboxes[:, 1, None] - heights / 2)
# map the grid point to the absolute coordinates
abs_xs = (xs.float() + 0.5) / w * widths + x1
abs_ys = (ys.float() + 0.5) / h * heights + y1
# get the grid points indices that fall on the bbox boundaries
x1_inds = [i for i in range(self.grid_size)]
y1_inds = [i * self.grid_size for i in range(self.grid_size)]
x2_inds = [
self.grid_points - self.grid_size + i
for i in range(self.grid_size)
]
y2_inds = [(i + 1) * self.grid_size - 1 for i in range(self.grid_size)]
# voting of all grid points on some boundary
bboxes_x1 = (abs_xs[:, x1_inds] * pred_scores[:, x1_inds]).sum(
dim=1, keepdim=True) / (
pred_scores[:, x1_inds].sum(dim=1, keepdim=True))
bboxes_y1 = (abs_ys[:, y1_inds] * pred_scores[:, y1_inds]).sum(
dim=1, keepdim=True) / (
pred_scores[:, y1_inds].sum(dim=1, keepdim=True))
bboxes_x2 = (abs_xs[:, x2_inds] * pred_scores[:, x2_inds]).sum(
dim=1, keepdim=True) / (
pred_scores[:, x2_inds].sum(dim=1, keepdim=True))
bboxes_y2 = (abs_ys[:, y2_inds] * pred_scores[:, y2_inds]).sum(
dim=1, keepdim=True) / (
pred_scores[:, y2_inds].sum(dim=1, keepdim=True))
bbox_res = torch.cat(
[bboxes_x1, bboxes_y1, bboxes_x2, bboxes_y2, cls_scores], dim=1)
bbox_res[:, [0, 2]].clamp_(min=0, max=img_meta[0]['img_shape'][1] - 1)
bbox_res[:, [1, 3]].clamp_(min=0, max=img_meta[0]['img_shape'][0] - 1)
return bbox_res
| 15,429
| 41.624309
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/models/mask_heads/maskiou_head.py
|
import numpy as np
import torch
import torch.nn as nn
from mmcv.cnn import kaiming_init, normal_init
from torch.nn.modules.utils import _pair
from mmdet.core import force_fp32
from ..builder import build_loss
from ..registry import HEADS
@HEADS.register_module
class MaskIoUHead(nn.Module):
"""Mask IoU Head.
This head predicts the IoU of predicted masks and corresponding gt masks.
"""
def __init__(self,
num_convs=4,
num_fcs=2,
roi_feat_size=14,
in_channels=256,
conv_out_channels=256,
fc_out_channels=1024,
num_classes=81,
loss_iou=dict(type='MSELoss', loss_weight=0.5)):
super(MaskIoUHead, self).__init__()
self.in_channels = in_channels
self.conv_out_channels = conv_out_channels
self.fc_out_channels = fc_out_channels
self.num_classes = num_classes
self.fp16_enabled = False
self.convs = nn.ModuleList()
for i in range(num_convs):
if i == 0:
# concatenation of mask feature and mask prediction
in_channels = self.in_channels + 1
else:
in_channels = self.conv_out_channels
stride = 2 if i == num_convs - 1 else 1
self.convs.append(
nn.Conv2d(
in_channels,
self.conv_out_channels,
3,
stride=stride,
padding=1))
roi_feat_size = _pair(roi_feat_size)
pooled_area = (roi_feat_size[0] // 2) * (roi_feat_size[1] // 2)
self.fcs = nn.ModuleList()
for i in range(num_fcs):
in_channels = (
self.conv_out_channels *
pooled_area if i == 0 else self.fc_out_channels)
self.fcs.append(nn.Linear(in_channels, self.fc_out_channels))
self.fc_mask_iou = nn.Linear(self.fc_out_channels, self.num_classes)
self.relu = nn.ReLU()
self.max_pool = nn.MaxPool2d(2, 2)
self.loss_iou = build_loss(loss_iou)
def init_weights(self):
for conv in self.convs:
kaiming_init(conv)
for fc in self.fcs:
kaiming_init(
fc,
a=1,
mode='fan_in',
nonlinearity='leaky_relu',
distribution='uniform')
normal_init(self.fc_mask_iou, std=0.01)
def forward(self, mask_feat, mask_pred):
mask_pred = mask_pred.sigmoid()
mask_pred_pooled = self.max_pool(mask_pred.unsqueeze(1))
x = torch.cat((mask_feat, mask_pred_pooled), 1)
for conv in self.convs:
x = self.relu(conv(x))
x = x.view(x.size(0), -1)
for fc in self.fcs:
x = self.relu(fc(x))
mask_iou = self.fc_mask_iou(x)
return mask_iou
@force_fp32(apply_to=('mask_iou_pred', ))
def loss(self, mask_iou_pred, mask_iou_targets):
pos_inds = mask_iou_targets > 0
if pos_inds.sum() > 0:
loss_mask_iou = self.loss_iou(mask_iou_pred[pos_inds],
mask_iou_targets[pos_inds])
else:
loss_mask_iou = mask_iou_pred * 0
return dict(loss_mask_iou=loss_mask_iou)
@force_fp32(apply_to=('mask_pred', ))
def get_target(self, sampling_results, gt_masks, mask_pred, mask_targets,
rcnn_train_cfg):
"""Compute target of mask IoU.
Mask IoU target is the IoU of the predicted mask (inside a bbox) and
the gt mask of corresponding gt mask (the whole instance).
The intersection area is computed inside the bbox, and the gt mask area
is computed with two steps, firstly we compute the gt area inside the
bbox, then divide it by the area ratio of gt area inside the bbox and
the gt area of the whole instance.
Args:
sampling_results (list[:obj:`SamplingResult`]): sampling results.
gt_masks (list[ndarray]): Gt masks (the whole instance) of each
image, binary maps with the same shape of the input image.
mask_pred (Tensor): Predicted masks of each positive proposal,
shape (num_pos, h, w).
mask_targets (Tensor): Gt mask of each positive proposal,
binary map of the shape (num_pos, h, w).
rcnn_train_cfg (dict): Training config for R-CNN part.
Returns:
Tensor: mask iou target (length == num positive).
"""
pos_proposals = [res.pos_bboxes for res in sampling_results]
pos_assigned_gt_inds = [
res.pos_assigned_gt_inds for res in sampling_results
]
# compute the area ratio of gt areas inside the proposals and
# the whole instance
area_ratios = map(self._get_area_ratio, pos_proposals,
pos_assigned_gt_inds, gt_masks)
area_ratios = torch.cat(list(area_ratios))
assert mask_targets.size(0) == area_ratios.size(0)
mask_pred = (mask_pred > rcnn_train_cfg.mask_thr_binary).float()
mask_pred_areas = mask_pred.sum((-1, -2))
# mask_pred and mask_targets are binary maps
overlap_areas = (mask_pred * mask_targets).sum((-1, -2))
# compute the mask area of the whole instance
gt_full_areas = mask_targets.sum((-1, -2)) / (area_ratios + 1e-7)
mask_iou_targets = overlap_areas / (
mask_pred_areas + gt_full_areas - overlap_areas)
return mask_iou_targets
def _get_area_ratio(self, pos_proposals, pos_assigned_gt_inds, gt_masks):
"""Compute area ratio of the gt mask inside the proposal and the gt
mask of the corresponding instance"""
num_pos = pos_proposals.size(0)
if num_pos > 0:
area_ratios = []
proposals_np = pos_proposals.cpu().numpy()
pos_assigned_gt_inds = pos_assigned_gt_inds.cpu().numpy()
# compute mask areas of gt instances (batch processing for speedup)
gt_instance_mask_area = gt_masks.sum((-1, -2))
for i in range(num_pos):
gt_mask = gt_masks[pos_assigned_gt_inds[i]]
# crop the gt mask inside the proposal
x1, y1, x2, y2 = proposals_np[i, :].astype(np.int32)
gt_mask_in_proposal = gt_mask[y1:y2 + 1, x1:x2 + 1]
ratio = gt_mask_in_proposal.sum() / (
gt_instance_mask_area[pos_assigned_gt_inds[i]] + 1e-7)
area_ratios.append(ratio)
area_ratios = torch.from_numpy(np.stack(area_ratios)).float().to(
pos_proposals.device)
else:
area_ratios = pos_proposals.new_zeros((0, ))
return area_ratios
@force_fp32(apply_to=('mask_iou_pred', ))
def get_mask_scores(self, mask_iou_pred, det_bboxes, det_labels):
"""Get the mask scores.
mask_score = bbox_score * mask_iou
"""
inds = range(det_labels.size(0))
mask_scores = mask_iou_pred[inds, det_labels +
1] * det_bboxes[inds, -1]
mask_scores = mask_scores.cpu().numpy()
det_labels = det_labels.cpu().numpy()
return [
mask_scores[det_labels == i] for i in range(self.num_classes - 1)
]
| 7,418
| 37.842932
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/models/mask_heads/__init__.py
|
from .fcn_mask_head import FCNMaskHead
from .fused_semantic_head import FusedSemanticHead
from .grid_head import GridHead
from .htc_mask_head import HTCMaskHead
from .maskiou_head import MaskIoUHead
__all__ = [
'FCNMaskHead', 'HTCMaskHead', 'FusedSemanticHead', 'GridHead',
'MaskIoUHead'
]
| 299
| 26.272727
| 66
|
py
|
s2anet
|
s2anet-master/mmdet/models/mask_heads/htc_mask_head.py
|
from ..registry import HEADS
from ..utils import ConvModule
from .fcn_mask_head import FCNMaskHead
@HEADS.register_module
class HTCMaskHead(FCNMaskHead):
def __init__(self, *args, **kwargs):
super(HTCMaskHead, self).__init__(*args, **kwargs)
self.conv_res = ConvModule(
self.conv_out_channels,
self.conv_out_channels,
1,
conv_cfg=self.conv_cfg,
norm_cfg=self.norm_cfg)
def init_weights(self):
super(HTCMaskHead, self).init_weights()
self.conv_res.init_weights()
def forward(self, x, res_feat=None, return_logits=True, return_feat=True):
if res_feat is not None:
res_feat = self.conv_res(res_feat)
x = x + res_feat
for conv in self.convs:
x = conv(x)
res_feat = x
outs = []
if return_logits:
x = self.upsample(x)
if self.upsample_method == 'deconv':
x = self.relu(x)
mask_pred = self.conv_logits(x)
outs.append(mask_pred)
if return_feat:
outs.append(res_feat)
return outs if len(outs) > 1 else outs[0]
| 1,178
| 29.230769
| 78
|
py
|
s2anet
|
s2anet-master/mmdet/models/mask_heads/fcn_mask_head.py
|
import mmcv
import numpy as np
import pycocotools.mask as mask_util
import torch
import torch.nn as nn
from torch.nn.modules.utils import _pair
from mmdet.core import auto_fp16, force_fp32, mask_target
from ..builder import build_loss
from ..registry import HEADS
from ..utils import ConvModule
@HEADS.register_module
class FCNMaskHead(nn.Module):
def __init__(self,
num_convs=4,
roi_feat_size=14,
in_channels=256,
conv_kernel_size=3,
conv_out_channels=256,
upsample_method='deconv',
upsample_ratio=2,
num_classes=81,
class_agnostic=False,
conv_cfg=None,
norm_cfg=None,
loss_mask=dict(
type='CrossEntropyLoss', use_mask=True, loss_weight=1.0)):
super(FCNMaskHead, self).__init__()
if upsample_method not in [None, 'deconv', 'nearest', 'bilinear']:
raise ValueError(
'Invalid upsample method {}, accepted methods '
'are "deconv", "nearest", "bilinear"'.format(upsample_method))
self.num_convs = num_convs
# WARN: roi_feat_size is reserved and not used
self.roi_feat_size = _pair(roi_feat_size)
self.in_channels = in_channels
self.conv_kernel_size = conv_kernel_size
self.conv_out_channels = conv_out_channels
self.upsample_method = upsample_method
self.upsample_ratio = upsample_ratio
self.num_classes = num_classes
self.class_agnostic = class_agnostic
self.conv_cfg = conv_cfg
self.norm_cfg = norm_cfg
self.fp16_enabled = False
self.loss_mask = build_loss(loss_mask)
self.convs = nn.ModuleList()
for i in range(self.num_convs):
in_channels = (
self.in_channels if i == 0 else self.conv_out_channels)
padding = (self.conv_kernel_size - 1) // 2
self.convs.append(
ConvModule(
in_channels,
self.conv_out_channels,
self.conv_kernel_size,
padding=padding,
conv_cfg=conv_cfg,
norm_cfg=norm_cfg))
upsample_in_channels = (
self.conv_out_channels if self.num_convs > 0 else in_channels)
if self.upsample_method is None:
self.upsample = None
elif self.upsample_method == 'deconv':
self.upsample = nn.ConvTranspose2d(
upsample_in_channels,
self.conv_out_channels,
self.upsample_ratio,
stride=self.upsample_ratio)
else:
self.upsample = nn.Upsample(
scale_factor=self.upsample_ratio, mode=self.upsample_method)
out_channels = 1 if self.class_agnostic else self.num_classes
logits_in_channel = (
self.conv_out_channels
if self.upsample_method == 'deconv' else upsample_in_channels)
self.conv_logits = nn.Conv2d(logits_in_channel, out_channels, 1)
self.relu = nn.ReLU(inplace=True)
self.debug_imgs = None
def init_weights(self):
for m in [self.upsample, self.conv_logits]:
if m is None:
continue
nn.init.kaiming_normal_(
m.weight, mode='fan_out', nonlinearity='relu')
nn.init.constant_(m.bias, 0)
@auto_fp16()
def forward(self, x):
for conv in self.convs:
x = conv(x)
if self.upsample is not None:
x = self.upsample(x)
if self.upsample_method == 'deconv':
x = self.relu(x)
mask_pred = self.conv_logits(x)
return mask_pred
def get_target(self, sampling_results, gt_masks, rcnn_train_cfg):
pos_proposals = [res.pos_bboxes for res in sampling_results]
pos_assigned_gt_inds = [
res.pos_assigned_gt_inds for res in sampling_results
]
mask_targets = mask_target(pos_proposals, pos_assigned_gt_inds,
gt_masks, rcnn_train_cfg)
return mask_targets
@force_fp32(apply_to=('mask_pred', ))
def loss(self, mask_pred, mask_targets, labels):
loss = dict()
if self.class_agnostic:
loss_mask = self.loss_mask(mask_pred, mask_targets,
torch.zeros_like(labels))
else:
loss_mask = self.loss_mask(mask_pred, mask_targets, labels)
loss['loss_mask'] = loss_mask
return loss
def get_seg_masks(self, mask_pred, det_bboxes, det_labels, rcnn_test_cfg,
ori_shape, scale_factor, rescale):
"""Get segmentation masks from mask_pred and bboxes.
Args:
mask_pred (Tensor or ndarray): shape (n, #class+1, h, w).
For single-scale testing, mask_pred is the direct output of
model, whose type is Tensor, while for multi-scale testing,
it will be converted to numpy array outside of this method.
det_bboxes (Tensor): shape (n, 4/5)
det_labels (Tensor): shape (n, )
img_shape (Tensor): shape (3, )
rcnn_test_cfg (dict): rcnn testing config
ori_shape: original image size
Returns:
list[list]: encoded masks
"""
if isinstance(mask_pred, torch.Tensor):
mask_pred = mask_pred.sigmoid().cpu().numpy()
assert isinstance(mask_pred, np.ndarray)
# when enabling mixed precision training, mask_pred may be float16
# numpy array
mask_pred = mask_pred.astype(np.float32)
cls_segms = [[] for _ in range(self.num_classes - 1)]
bboxes = det_bboxes.cpu().numpy()[:, :4]
labels = det_labels.cpu().numpy() + 1
if rescale:
img_h, img_w = ori_shape[:2]
else:
img_h = np.round(ori_shape[0] * scale_factor).astype(np.int32)
img_w = np.round(ori_shape[1] * scale_factor).astype(np.int32)
scale_factor = 1.0
for i in range(bboxes.shape[0]):
bbox = (bboxes[i, :] / scale_factor).astype(np.int32)
label = labels[i]
w = max(bbox[2] - bbox[0] + 1, 1)
h = max(bbox[3] - bbox[1] + 1, 1)
if not self.class_agnostic:
mask_pred_ = mask_pred[i, label, :, :]
else:
mask_pred_ = mask_pred[i, 0, :, :]
im_mask = np.zeros((img_h, img_w), dtype=np.uint8)
bbox_mask = mmcv.imresize(mask_pred_, (w, h))
bbox_mask = (bbox_mask > rcnn_test_cfg.mask_thr_binary).astype(
np.uint8)
im_mask[bbox[1]:bbox[1] + h, bbox[0]:bbox[0] + w] = bbox_mask
rle = mask_util.encode(
np.array(im_mask[:, :, np.newaxis], order='F'))[0]
cls_segms[label - 1].append(rle)
return cls_segms
| 7,043
| 37.703297
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/models/mask_heads/fused_semantic_head.py
|
import torch.nn as nn
import torch.nn.functional as F
from mmcv.cnn import kaiming_init
from mmdet.core import auto_fp16, force_fp32
from ..registry import HEADS
from ..utils import ConvModule
@HEADS.register_module
class FusedSemanticHead(nn.Module):
r"""Multi-level fused semantic segmentation head.
in_1 -> 1x1 conv ---
|
in_2 -> 1x1 conv -- |
||
in_3 -> 1x1 conv - ||
||| /-> 1x1 conv (mask prediction)
in_4 -> 1x1 conv -----> 3x3 convs (*4)
| \-> 1x1 conv (feature)
in_5 -> 1x1 conv ---
""" # noqa: W605
def __init__(self,
num_ins,
fusion_level,
num_convs=4,
in_channels=256,
conv_out_channels=256,
num_classes=183,
ignore_label=255,
loss_weight=0.2,
conv_cfg=None,
norm_cfg=None):
super(FusedSemanticHead, self).__init__()
self.num_ins = num_ins
self.fusion_level = fusion_level
self.num_convs = num_convs
self.in_channels = in_channels
self.conv_out_channels = conv_out_channels
self.num_classes = num_classes
self.ignore_label = ignore_label
self.loss_weight = loss_weight
self.conv_cfg = conv_cfg
self.norm_cfg = norm_cfg
self.fp16_enabled = False
self.lateral_convs = nn.ModuleList()
for i in range(self.num_ins):
self.lateral_convs.append(
ConvModule(
self.in_channels,
self.in_channels,
1,
conv_cfg=self.conv_cfg,
norm_cfg=self.norm_cfg,
inplace=False))
self.convs = nn.ModuleList()
for i in range(self.num_convs):
in_channels = self.in_channels if i == 0 else conv_out_channels
self.convs.append(
ConvModule(
in_channels,
conv_out_channels,
3,
padding=1,
conv_cfg=self.conv_cfg,
norm_cfg=self.norm_cfg))
self.conv_embedding = ConvModule(
conv_out_channels,
conv_out_channels,
1,
conv_cfg=self.conv_cfg,
norm_cfg=self.norm_cfg)
self.conv_logits = nn.Conv2d(conv_out_channels, self.num_classes, 1)
self.criterion = nn.CrossEntropyLoss(ignore_index=ignore_label)
def init_weights(self):
kaiming_init(self.conv_logits)
@auto_fp16()
def forward(self, feats):
x = self.lateral_convs[self.fusion_level](feats[self.fusion_level])
fused_size = tuple(x.shape[-2:])
for i, feat in enumerate(feats):
if i != self.fusion_level:
feat = F.interpolate(
feat, size=fused_size, mode='bilinear', align_corners=True)
x += self.lateral_convs[i](feat)
for i in range(self.num_convs):
x = self.convs[i](x)
mask_pred = self.conv_logits(x)
x = self.conv_embedding(x)
return mask_pred, x
@force_fp32(apply_to=('mask_pred', ))
def loss(self, mask_pred, labels):
labels = labels.squeeze(1).long()
loss_semantic_seg = self.criterion(mask_pred, labels)
loss_semantic_seg *= self.loss_weight
return loss_semantic_seg
| 3,554
| 32.224299
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/custom.py
|
import os.path as osp
import mmcv
import numpy as np
from torch.utils.data import Dataset
from .pipelines import Compose
from .registry import DATASETS
@DATASETS.register_module
class CustomDataset(Dataset):
"""Custom dataset for detection.
Annotation format:
[
{
'filename': 'a.jpg',
'width': 1280,
'height': 720,
'ann': {
'bboxes': <np.ndarray> (n, 4),
'labels': <np.ndarray> (n, ),
'bboxes_ignore': <np.ndarray> (k, 4), (optional field)
'labels_ignore': <np.ndarray> (k, 4) (optional field)
}
},
...
]
The `ann` field is optional for testing.
"""
CLASSES = None
def __init__(self,
ann_file,
pipeline,
data_root=None,
img_prefix='',
seg_prefix=None,
proposal_file=None,
test_mode=False):
self.ann_file = ann_file
self.data_root = data_root
self.img_prefix = img_prefix
self.seg_prefix = seg_prefix
self.proposal_file = proposal_file
self.test_mode = test_mode
# join paths if data_root is specified
if self.data_root is not None:
if not osp.isabs(self.ann_file):
self.ann_file = osp.join(self.data_root, self.ann_file)
if not (self.img_prefix is None or osp.isabs(self.img_prefix)):
self.img_prefix = osp.join(self.data_root, self.img_prefix)
if not (self.seg_prefix is None or osp.isabs(self.seg_prefix)):
self.seg_prefix = osp.join(self.data_root, self.seg_prefix)
if not (self.proposal_file is None
or osp.isabs(self.proposal_file)):
self.proposal_file = osp.join(self.data_root,
self.proposal_file)
# load annotations (and proposals)
self.img_infos = self.load_annotations(self.ann_file)
if self.proposal_file is not None:
self.proposals = self.load_proposals(self.proposal_file)
else:
self.proposals = None
# filter images with no annotation during training
if not test_mode:
valid_inds = self._filter_imgs()
self.img_infos = [self.img_infos[i] for i in valid_inds]
if self.proposals is not None:
self.proposals = [self.proposals[i] for i in valid_inds]
# set group flag for the sampler
if not self.test_mode:
self._set_group_flag()
# processing pipeline
self.pipeline = Compose(pipeline)
def __len__(self):
return len(self.img_infos)
def load_annotations(self, ann_file):
return mmcv.load(ann_file)
def load_proposals(self, proposal_file):
return mmcv.load(proposal_file)
def get_ann_info(self, idx):
return self.img_infos[idx]['ann']
def get_cat_ids(self, idx):
return self.data_infos[idx]['ann']['labels'].astype(np.int).tolist()
def pre_pipeline(self, results):
results['img_prefix'] = self.img_prefix
results['seg_prefix'] = self.seg_prefix
results['proposal_file'] = self.proposal_file
results['bbox_fields'] = []
results['mask_fields'] = []
def _filter_imgs(self, min_size=32):
"""Filter images too small."""
valid_inds = []
for i, img_info in enumerate(self.img_infos):
if min(img_info['width'], img_info['height']) >= min_size:
valid_inds.append(i)
return valid_inds
def _set_group_flag(self):
"""Set flag according to image aspect ratio.
Images with aspect ratio greater than 1 will be set as group 1,
otherwise group 0.
"""
self.flag = np.zeros(len(self), dtype=np.uint8)
for i in range(len(self)):
img_info = self.img_infos[i]
if img_info['width'] / img_info['height'] > 1:
self.flag[i] = 1
def _rand_another(self, idx):
pool = np.where(self.flag == self.flag[idx])[0]
return np.random.choice(pool)
def __getitem__(self, idx):
if self.test_mode:
return self.prepare_test_img(idx)
while True:
data = self.prepare_train_img(idx)
if data is None:
idx = self._rand_another(idx)
continue
return data
def prepare_train_img(self, idx):
img_info = self.img_infos[idx]
ann_info = self.get_ann_info(idx)
results = dict(img_info=img_info, ann_info=ann_info)
if self.proposals is not None:
results['proposals'] = self.proposals[idx]
self.pre_pipeline(results)
return self.pipeline(results)
def prepare_test_img(self, idx):
img_info = self.img_infos[idx]
results = dict(img_info=img_info)
if self.proposals is not None:
results['proposals'] = self.proposals[idx]
self.pre_pipeline(results)
return self.pipeline(results)
| 5,161
| 32.738562
| 76
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/voc.py
|
from .registry import DATASETS
from .xml_style import XMLDataset
@DATASETS.register_module
class VOCDataset(XMLDataset):
CLASSES = ('aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car',
'cat', 'chair', 'cow', 'diningtable', 'dog', 'horse',
'motorbike', 'person', 'pottedplant', 'sheep', 'sofa', 'train',
'tvmonitor')
def __init__(self, **kwargs):
super(VOCDataset, self).__init__(**kwargs)
if 'VOC2007' in self.img_prefix:
self.year = 2007
elif 'VOC2012' in self.img_prefix:
self.year = 2012
else:
raise ValueError('Cannot infer dataset year from img_prefix')
| 695
| 32.142857
| 78
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/registry.py
|
from mmdet.utils import Registry
DATASETS = Registry('dataset')
PIPELINES = Registry('pipeline')
| 98
| 18.8
| 32
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/cityscapes.py
|
from .coco import CocoDataset
from .registry import DATASETS
@DATASETS.register_module
class CityscapesDataset(CocoDataset):
CLASSES = ('person', 'rider', 'car', 'truck', 'bus', 'train', 'motorcycle',
'bicycle')
| 234
| 22.5
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/hrsc2016.py
|
import os
import os.path as osp
import xml.etree.ElementTree as ET
import mmcv
import numpy as np
from DOTA_devkit.hrsc2016_evaluation import voc_eval
from mmdet.core import norm_angle
from mmdet.core import rotated_box_to_poly_single
from .builder import DATASETS
from .xml_style import XMLDataset
@DATASETS.register_module
class HRSC2016Dataset(XMLDataset):
CLASSES = ('ship',)
def load_annotations(self, ann_file):
"""Load annotation from XML style ann_file.
Args:
ann_file (str): Path of XML file.
Returns:
list[dict]: Annotation info from XML file.
"""
data_infos = []
img_ids = mmcv.list_from_file(ann_file)
self.img_names = []
for img_id in img_ids:
filename = f'AllImages/{img_id}.bmp'
xml_path = osp.join(self.img_prefix, 'Annotations',
f'{img_id}.xml')
tree = ET.parse(xml_path)
root = tree.getroot()
width = int(root.find('Img_SizeWidth').text)
height = int(root.find('Img_SizeHeight').text)
self.img_names.append(img_id)
data_infos.append(
dict(id=img_id, filename=filename, width=width, height=height))
return data_infos
def get_ann_info(self, idx):
"""Get annotation from XML file by index.
Args:
idx (int): Index of data.
Returns:
dict: Annotation info of specified index.
"""
img_id = self.img_infos[idx]['id']
xml_path = osp.join(self.img_prefix, 'Annotations', f'{img_id}.xml')
tree = ET.parse(xml_path)
root = tree.getroot()
bboxes = []
labels = []
bboxes_ignore = []
labels_ignore = []
for obj in root.findall('HRSC_Objects')[0].findall('HRSC_Object'):
label = self.cat2label['ship']
difficult = int(obj.find('difficult').text)
bbox = []
for key in ['mbox_cx', 'mbox_cy', 'mbox_w', 'mbox_h', 'mbox_ang']:
bbox.append(obj.find(key).text)
# TODO: check whether it is necessary to use int
# Coordinates may be float type
cx, cy, w, h, a = list(map(float, bbox))
# set w the long side and h the short side
new_w, new_h = max(w, h), min(w, h)
# adjust angle
a = a if w > h else a + np.pi / 2
# normalize angle to [-np.pi/4, pi/4*3]
a = norm_angle(a)
bbox = [cx, cy, new_w, new_h, a]
ignore = False
if self.min_size:
assert not self.test_mode
if bbox[2] < self.min_size or bbox[3] < self.min_size:
ignore = True
if difficult or ignore:
bboxes_ignore.append(bbox)
labels_ignore.append(label)
else:
bboxes.append(bbox)
labels.append(label)
if not bboxes:
bboxes = np.zeros((0, 5))
labels = np.zeros((0,))
else:
bboxes = np.array(bboxes, ndmin=2)
labels = np.array(labels)
if not bboxes_ignore:
bboxes_ignore = np.zeros((0, 5))
labels_ignore = np.zeros((0,))
else:
bboxes_ignore = np.array(bboxes_ignore, ndmin=2)
labels_ignore = np.array(labels_ignore)
ann = dict(
bboxes=bboxes.astype(np.float32),
labels=labels.astype(np.int64),
bboxes_ignore=bboxes_ignore.astype(np.float32),
labels_ignore=labels_ignore.astype(np.int64))
return ann
def get_cat_ids(self, idx):
"""Get category ids in XML file by index.
Args:
idx (int): Index of data.
Returns:
list[int]: All categories in the image of specified index.
"""
cat_ids = []
img_id = self.img_infos[idx]['id']
xml_path = osp.join(self.img_prefix, 'Annotations', f'{img_id}.xml')
tree = ET.parse(xml_path)
root = tree.getroot()
for obj in root.findall('HRSC_Objects')[0].findall('HRSC_Object'):
label = self.cat2label['ship']
cat_ids.append(label)
return cat_ids
def evaluate(self, results, work_dir=None, gt_dir=None, imagesetfile=None):
results_path = osp.join(work_dir, 'results_txt')
mmcv.mkdir_or_exist(results_path)
print('Saving results to {}'.format(results_path))
self.result_to_txt(results, results_path)
detpath = osp.join(results_path, '{:s}.txt')
annopath = osp.join(gt_dir, '{:s}.xml') # data/HRSC2016/Test/Annotations/{:s}.xml
classaps = []
map = 0
for classname in self.CLASSES:
rec, prec, ap = voc_eval(detpath,
annopath,
imagesetfile,
classname,
ovthresh=0.5,
use_07_metric=True)
map = map + ap
print(classname, ': ', ap)
classaps.append(ap)
map = map / len(self.CLASSES)
print('map:', map)
classaps = 100 * np.array(classaps)
print('classaps: ', classaps)
# Saving results to disk
with open(osp.join(work_dir, 'eval_results.txt'), 'w') as f:
res_str = 'mAP:' + str(map) + '\n'
res_str += 'classaps: ' + ' '.join([str(x) for x in classaps])
f.write(res_str)
return map
def result_to_txt(self, results, results_path):
img_names = [img_info['id'] for img_info in self.img_infos]
assert len(results) == len(img_names), 'len(results) != len(img_names)'
for classname in self.CLASSES:
f_out = open(osp.join(results_path, classname + '.txt'), 'w')
print(classname + '.txt')
# per result represent one image
for img_id, result in enumerate(results):
for class_id, bboxes in enumerate(result):
if self.CLASSES[class_id] != classname:
continue
if bboxes.size != 0:
for bbox in bboxes:
score = bbox[5]
bbox = rotated_box_to_poly_single(bbox[:5])
temp_txt = '{} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f}\n'.format(
osp.splitext(img_names[img_id])[0], score, bbox[0], bbox[1], bbox[2], bbox[3], bbox[4],
bbox[5], bbox[6], bbox[7])
f_out.write(temp_txt)
f_out.close()
| 6,810
| 35.228723
| 119
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/dataset_wrappers.py
|
import bisect
import math
from collections import defaultdict
import numpy as np
from torch.utils.data.dataset import ConcatDataset as _ConcatDataset
from .registry import DATASETS
@DATASETS.register_module
class ConcatDataset(_ConcatDataset):
"""A wrapper of concatenated dataset.
Same as :obj:`torch.utils.data.dataset.ConcatDataset`, but
concat the group flag for image aspect ratio.
Args:
datasets (list[:obj:`Dataset`]): A list of datasets.
"""
def __init__(self, datasets):
super(ConcatDataset, self).__init__(datasets)
self.CLASSES = datasets[0].CLASSES
if hasattr(datasets[0], 'flag'):
flags = []
for i in range(0, len(datasets)):
flags.append(datasets[i].flag)
self.flag = np.concatenate(flags)
def get_cat_ids(self, idx):
if idx < 0:
if -idx > len(self):
raise ValueError(
'absolute value of index should not exceed dataset length')
idx = len(self) + idx
dataset_idx = bisect.bisect_right(self.cumulative_sizes, idx)
if dataset_idx == 0:
sample_idx = idx
else:
sample_idx = idx - self.cumulative_sizes[dataset_idx - 1]
return self.datasets[dataset_idx].get_cat_ids(sample_idx)
@DATASETS.register_module
class RepeatDataset(object):
"""A wrapper of repeated dataset.
The length of repeated dataset will be `times` larger than the original
dataset. This is useful when the data loading time is long but the dataset
is small. Using RepeatDataset can reduce the data loading time between
epochs.
Args:
dataset (:obj:`Dataset`): The dataset to be repeated.
times (int): Repeat times.
"""
def __init__(self, dataset, times):
self.dataset = dataset
self.times = times
self.CLASSES = dataset.CLASSES
if hasattr(self.dataset, 'flag'):
self.flag = np.tile(self.dataset.flag, times)
self._ori_len = len(self.dataset)
def __getitem__(self, idx):
return self.dataset[idx % self._ori_len]
def get_cat_ids(self, idx):
return self.dataset.get_cat_ids(idx % self._ori_len)
def __len__(self):
return self.times * self._ori_len
| 2,315
| 29.88
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/xml_style.py
|
import os.path as osp
import xml.etree.ElementTree as ET
import mmcv
import numpy as np
from .custom import CustomDataset
from .registry import DATASETS
@DATASETS.register_module
class XMLDataset(CustomDataset):
def __init__(self, min_size=None, **kwargs):
super(XMLDataset, self).__init__(**kwargs)
self.cat2label = {cat: i + 1 for i, cat in enumerate(self.CLASSES)}
self.min_size = min_size
def load_annotations(self, ann_file):
img_infos = []
img_ids = mmcv.list_from_file(ann_file)
for img_id in img_ids:
filename = 'JPEGImages/{}.jpg'.format(img_id)
xml_path = osp.join(self.img_prefix, 'Annotations',
'{}.xml'.format(img_id))
tree = ET.parse(xml_path)
root = tree.getroot()
size = root.find('size')
width = int(size.find('width').text)
height = int(size.find('height').text)
img_infos.append(
dict(id=img_id, filename=filename, width=width, height=height))
return img_infos
def get_ann_info(self, idx):
img_id = self.img_infos[idx]['id']
xml_path = osp.join(self.img_prefix, 'Annotations',
'{}.xml'.format(img_id))
tree = ET.parse(xml_path)
root = tree.getroot()
bboxes = []
labels = []
bboxes_ignore = []
labels_ignore = []
for obj in root.findall('object'):
name = obj.find('name').text
label = self.cat2label[name]
difficult = int(obj.find('difficult').text)
bnd_box = obj.find('bndbox')
bbox = [
int(bnd_box.find('xmin').text),
int(bnd_box.find('ymin').text),
int(bnd_box.find('xmax').text),
int(bnd_box.find('ymax').text)
]
ignore = False
if self.min_size:
assert not self.test_mode
w = bbox[2] - bbox[0]
h = bbox[3] - bbox[1]
if w < self.min_size or h < self.min_size:
ignore = True
if difficult or ignore:
bboxes_ignore.append(bbox)
labels_ignore.append(label)
else:
bboxes.append(bbox)
labels.append(label)
if not bboxes:
bboxes = np.zeros((0, 4))
labels = np.zeros((0, ))
else:
bboxes = np.array(bboxes, ndmin=2) - 1
labels = np.array(labels)
if not bboxes_ignore:
bboxes_ignore = np.zeros((0, 4))
labels_ignore = np.zeros((0, ))
else:
bboxes_ignore = np.array(bboxes_ignore, ndmin=2) - 1
labels_ignore = np.array(labels_ignore)
ann = dict(
bboxes=bboxes.astype(np.float32),
labels=labels.astype(np.int64),
bboxes_ignore=bboxes_ignore.astype(np.float32),
labels_ignore=labels_ignore.astype(np.int64))
return ann
| 3,070
| 34.298851
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/__init__.py
|
from .builder import build_dataset
from .cityscapes import CityscapesDataset
from .coco import CocoDataset
from .custom import CustomDataset
from .dataset_wrappers import ConcatDataset, RepeatDataset
from .loader import DistributedGroupSampler, GroupSampler, build_dataloader
from .registry import DATASETS
from .voc import VOCDataset
from .wider_face import WIDERFaceDataset
from .xml_style import XMLDataset
from .hrsc2016 import HRSC2016Dataset
from .dota import DotaDataset
__all__ = [
'CustomDataset', 'XMLDataset', 'CocoDataset', 'VOCDataset',
'CityscapesDataset', 'GroupSampler', 'DistributedGroupSampler',
'build_dataloader', 'ConcatDataset', 'RepeatDataset',
'WIDERFaceDataset', 'DATASETS', 'build_dataset',
'HRSC2016Dataset','DotaDataset'
]
| 773
| 34.181818
| 75
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/dota.py
|
import os.path as osp
import mmcv
import numpy as np
from DOTA_devkit.ResultMerge_multi_process import mergebypoly
from DOTA_devkit.dota_evaluation_task1 import voc_eval
from mmdet.core import rotated_box_to_poly_single
from .custom import CustomDataset
from .registry import DATASETS
@DATASETS.register_module
class DotaDataset(CustomDataset):
CLASSES = ('plane', 'baseball-diamond', 'bridge', 'ground-track-field',
'small-vehicle', 'large-vehicle', 'ship', 'tennis-court',
'basketball-court', 'storage-tank', 'soccer-ball-field',
'roundabout', 'harbor', 'swimming-pool', 'helicopter')
def evaluate(self, results, work_dir=None, gt_dir=None, imagesetfile=None):
dst_raw_path = osp.join(work_dir, 'results_before_nms')
dst_merge_path = osp.join(work_dir, 'results_after_nms')
mmcv.mkdir_or_exist(dst_raw_path)
mmcv.mkdir_or_exist(dst_merge_path)
print('Saving results to {}'.format(dst_raw_path))
self.result_to_txt(results, dst_raw_path)
print('Merge results to {}'.format(dst_merge_path))
mergebypoly(dst_raw_path, dst_merge_path)
print('Start evaluation')
detpath = osp.join(dst_merge_path, '{:s}.txt')
annopath = osp.join(gt_dir, '{:s}.txt')
classaps = []
map = 0
for classname in self.CLASSES:
rec, prec, ap = voc_eval(detpath,
annopath,
imagesetfile,
classname,
ovthresh=0.5,
use_07_metric=True)
map = map + ap
print(classname, ': ', ap)
classaps.append(ap)
map = map / len(self.CLASSES)
print('map:', map)
classaps = 100 * np.array(classaps)
print('classaps: ', classaps)
# Saving results to disk
with open(osp.join(work_dir, 'eval_results.txt'), 'w') as f:
res_str = 'mAP:' + str(map) + '\n'
res_str += 'classaps: ' + ' '.join([str(x) for x in classaps])
f.write(res_str)
return map
def result_to_txt(self, results, results_path):
img_names = [img_info['filename'] for img_info in self.img_infos]
assert len(results) == len(img_names), 'len(results) != len(img_names)'
for classname in self.CLASSES:
f_out = open(osp.join(results_path, classname + '.txt'), 'w')
print(classname + '.txt')
# per result represent one image
for img_id, result in enumerate(results):
for class_id, bboxes in enumerate(result):
if self.CLASSES[class_id] != classname:
continue
if bboxes.size != 0:
for bbox in bboxes:
score = bbox[5]
bbox = rotated_box_to_poly_single(bbox[:5])
temp_txt = '{} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f} {:.4f}\n'.format(
osp.splitext(img_names[img_id])[0], score, bbox[0], bbox[1], bbox[2], bbox[3], bbox[4],
bbox[5], bbox[6], bbox[7])
f_out.write(temp_txt)
f_out.close()
| 3,375
| 40.170732
| 119
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/builder.py
|
import copy
from mmdet.utils import build_from_cfg
from .dataset_wrappers import ConcatDataset, RepeatDataset
from .registry import DATASETS
def _concat_dataset(cfg, default_args=None):
ann_files = cfg['ann_file']
img_prefixes = cfg.get('img_prefix', None)
seg_prefixes = cfg.get('seg_prefixes', None)
proposal_files = cfg.get('proposal_file', None)
datasets = []
num_dset = len(ann_files)
for i in range(num_dset):
data_cfg = copy.deepcopy(cfg)
data_cfg['ann_file'] = ann_files[i]
if isinstance(img_prefixes, (list, tuple)):
data_cfg['img_prefix'] = img_prefixes[i]
if isinstance(seg_prefixes, (list, tuple)):
data_cfg['seg_prefix'] = seg_prefixes[i]
if isinstance(proposal_files, (list, tuple)):
data_cfg['proposal_file'] = proposal_files[i]
datasets.append(build_dataset(data_cfg, default_args))
return ConcatDataset(datasets)
def build_dataset(cfg, default_args=None):
if isinstance(cfg, (list, tuple)):
dataset = ConcatDataset([build_dataset(c, default_args) for c in cfg])
elif cfg['type'] == 'RepeatDataset':
dataset = RepeatDataset(
build_dataset(cfg['dataset'], default_args), cfg['times'])
elif isinstance(cfg['ann_file'], (list, tuple)):
dataset = _concat_dataset(cfg, default_args)
else:
dataset = build_from_cfg(cfg, DATASETS, default_args)
return dataset
| 1,457
| 33.714286
| 78
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/coco.py
|
import numpy as np
from pycocotools.coco import COCO
from .custom import CustomDataset
from .registry import DATASETS
@DATASETS.register_module
class CocoDataset(CustomDataset):
CLASSES = ('person', 'bicycle', 'car', 'motorcycle', 'airplane', 'bus',
'train', 'truck', 'boat', 'traffic_light', 'fire_hydrant',
'stop_sign', 'parking_meter', 'bench', 'bird', 'cat', 'dog',
'horse', 'sheep', 'cow', 'elephant', 'bear', 'zebra', 'giraffe',
'backpack', 'umbrella', 'handbag', 'tie', 'suitcase', 'frisbee',
'skis', 'snowboard', 'sports_ball', 'kite', 'baseball_bat',
'baseball_glove', 'skateboard', 'surfboard', 'tennis_racket',
'bottle', 'wine_glass', 'cup', 'fork', 'knife', 'spoon', 'bowl',
'banana', 'apple', 'sandwich', 'orange', 'broccoli', 'carrot',
'hot_dog', 'pizza', 'donut', 'cake', 'chair', 'couch',
'potted_plant', 'bed', 'dining_table', 'toilet', 'tv', 'laptop',
'mouse', 'remote', 'keyboard', 'cell_phone', 'microwave',
'oven', 'toaster', 'sink', 'refrigerator', 'book', 'clock',
'vase', 'scissors', 'teddy_bear', 'hair_drier', 'toothbrush')
def load_annotations(self, ann_file):
self.coco = COCO(ann_file)
self.cat_ids = self.coco.getCatIds()
self.cat2label = {
cat_id: i + 1
for i, cat_id in enumerate(self.cat_ids)
}
self.img_ids = self.coco.getImgIds()
img_infos = []
for i in self.img_ids:
info = self.coco.loadImgs([i])[0]
info['filename'] = info['file_name']
img_infos.append(info)
return img_infos
def get_ann_info(self, idx):
img_id = self.img_infos[idx]['id']
ann_ids = self.coco.getAnnIds(imgIds=[img_id])
ann_info = self.coco.loadAnns(ann_ids)
return self._parse_ann_info(self.img_infos[idx], ann_info)
def _filter_imgs(self, min_size=32):
"""Filter images too small or without ground truths."""
valid_inds = []
ids_with_ann = set(_['image_id'] for _ in self.coco.anns.values())
for i, img_info in enumerate(self.img_infos):
if self.img_ids[i] not in ids_with_ann:
continue
if min(img_info['width'], img_info['height']) >= min_size:
valid_inds.append(i)
return valid_inds
def _parse_ann_info(self, img_info, ann_info):
"""Parse bbox and mask annotation.
Args:
ann_info (list[dict]): Annotation info of an image.
with_mask (bool): Whether to parse mask annotations.
Returns:
dict: A dict containing the following keys: bboxes, bboxes_ignore,
labels, masks, seg_map. "masks" are raw annotations and not
decoded into binary masks.
"""
gt_bboxes = []
gt_labels = []
gt_bboxes_ignore = []
gt_masks_ann = []
for i, ann in enumerate(ann_info):
if ann.get('ignore', False):
continue
x1, y1, w, h = ann['bbox']
if ann['area'] <= 0 or w < 1 or h < 1:
continue
bbox = [x1, y1, x1 + w - 1, y1 + h - 1]
if ann.get('iscrowd', False):
gt_bboxes_ignore.append(bbox)
else:
gt_bboxes.append(bbox)
gt_labels.append(self.cat2label[ann['category_id']])
gt_masks_ann.append(ann['segmentation'])
if gt_bboxes:
gt_bboxes = np.array(gt_bboxes, dtype=np.float32)
gt_labels = np.array(gt_labels, dtype=np.int64)
else:
gt_bboxes = np.zeros((0, 4), dtype=np.float32)
gt_labels = np.array([], dtype=np.int64)
if gt_bboxes_ignore:
gt_bboxes_ignore = np.array(gt_bboxes_ignore, dtype=np.float32)
else:
gt_bboxes_ignore = np.zeros((0, 4), dtype=np.float32)
seg_map = img_info['filename'].replace('jpg', 'png')
ann = dict(
bboxes=gt_bboxes,
labels=gt_labels,
bboxes_ignore=gt_bboxes_ignore,
masks=gt_masks_ann,
seg_map=seg_map)
return ann
| 4,304
| 37.783784
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/wider_face.py
|
import os.path as osp
import xml.etree.ElementTree as ET
import mmcv
from .registry import DATASETS
from .xml_style import XMLDataset
@DATASETS.register_module
class WIDERFaceDataset(XMLDataset):
"""
Reader for the WIDER Face dataset in PASCAL VOC format.
Conversion scripts can be found in
https://github.com/sovrasov/wider-face-pascal-voc-annotations
"""
CLASSES = ('face', )
def __init__(self, **kwargs):
super(WIDERFaceDataset, self).__init__(**kwargs)
def load_annotations(self, ann_file):
img_infos = []
img_ids = mmcv.list_from_file(ann_file)
for img_id in img_ids:
filename = '{}.jpg'.format(img_id)
xml_path = osp.join(self.img_prefix, 'Annotations',
'{}.xml'.format(img_id))
tree = ET.parse(xml_path)
root = tree.getroot()
size = root.find('size')
width = int(size.find('width').text)
height = int(size.find('height').text)
folder = root.find('folder').text
img_infos.append(
dict(
id=img_id,
filename=osp.join(folder, filename),
width=width,
height=height))
return img_infos
| 1,301
| 29.27907
| 65
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/loader/sampler.py
|
from __future__ import division
import math
import numpy as np
import torch
from mmcv.runner.utils import get_dist_info
from torch.utils.data import DistributedSampler as _DistributedSampler
from torch.utils.data import Sampler
class DistributedSampler(_DistributedSampler):
def __init__(self, dataset, num_replicas=None, rank=None, shuffle=True):
super().__init__(dataset, num_replicas=num_replicas, rank=rank)
self.shuffle = shuffle
def __iter__(self):
# deterministically shuffle based on epoch
if self.shuffle:
g = torch.Generator()
g.manual_seed(self.epoch)
indices = torch.randperm(len(self.dataset), generator=g).tolist()
else:
indices = torch.arange(len(self.dataset)).tolist()
# add extra samples to make it evenly divisible
indices += indices[:(self.total_size - len(indices))]
assert len(indices) == self.total_size
# subsample
indices = indices[self.rank:self.total_size:self.num_replicas]
assert len(indices) == self.num_samples
return iter(indices)
class GroupSampler(Sampler):
def __init__(self, dataset, samples_per_gpu=1):
assert hasattr(dataset, 'flag')
self.dataset = dataset
self.samples_per_gpu = samples_per_gpu
self.flag = dataset.flag.astype(np.int64)
self.group_sizes = np.bincount(self.flag)
self.num_samples = 0
for i, size in enumerate(self.group_sizes):
self.num_samples += int(np.ceil(
size / self.samples_per_gpu)) * self.samples_per_gpu
def __iter__(self):
indices = []
for i, size in enumerate(self.group_sizes):
if size == 0:
continue
indice = np.where(self.flag == i)[0]
assert len(indice) == size
np.random.shuffle(indice)
num_extra = int(np.ceil(size / self.samples_per_gpu)
) * self.samples_per_gpu - len(indice)
indice = np.concatenate([indice, indice[:num_extra]])
indices.append(indice)
indices = np.concatenate(indices)
indices = [
indices[i * self.samples_per_gpu:(i + 1) * self.samples_per_gpu]
for i in np.random.permutation(
range(len(indices) // self.samples_per_gpu))
]
indices = np.concatenate(indices)
indices = indices.astype(np.int64).tolist()
assert len(indices) == self.num_samples
return iter(indices)
def __len__(self):
return self.num_samples
class DistributedGroupSampler(Sampler):
"""Sampler that restricts data loading to a subset of the dataset.
It is especially useful in conjunction with
:class:`torch.nn.parallel.DistributedDataParallel`. In such case, each
process can pass a DistributedSampler instance as a DataLoader sampler,
and load a subset of the original dataset that is exclusive to it.
.. note::
Dataset is assumed to be of constant size.
Arguments:
dataset: Dataset used for sampling.
num_replicas (optional): Number of processes participating in
distributed training.
rank (optional): Rank of the current process within num_replicas.
"""
def __init__(self,
dataset,
samples_per_gpu=1,
num_replicas=None,
rank=None):
_rank, _num_replicas = get_dist_info()
if num_replicas is None:
num_replicas = _num_replicas
if rank is None:
rank = _rank
self.dataset = dataset
self.samples_per_gpu = samples_per_gpu
self.num_replicas = num_replicas
self.rank = rank
self.epoch = 0
assert hasattr(self.dataset, 'flag')
self.flag = self.dataset.flag
self.group_sizes = np.bincount(self.flag)
self.num_samples = 0
for i, j in enumerate(self.group_sizes):
self.num_samples += int(
math.ceil(self.group_sizes[i] * 1.0 / self.samples_per_gpu /
self.num_replicas)) * self.samples_per_gpu
self.total_size = self.num_samples * self.num_replicas
def __iter__(self):
# deterministically shuffle based on epoch
g = torch.Generator()
g.manual_seed(self.epoch)
indices = []
for i, size in enumerate(self.group_sizes):
if size > 0:
indice = np.where(self.flag == i)[0]
assert len(indice) == size
indice = indice[list(torch.randperm(int(size),
generator=g))].tolist()
extra = int(
math.ceil(
size * 1.0 / self.samples_per_gpu / self.num_replicas)
) * self.samples_per_gpu * self.num_replicas - len(indice)
# pad indice
tmp = indice.copy()
for _ in range(extra // size):
indice.extend(tmp)
indice.extend(tmp[:extra % size])
indices.extend(indice)
assert len(indices) == self.total_size
indices = [
indices[j] for i in list(
torch.randperm(
len(indices) // self.samples_per_gpu, generator=g))
for j in range(i * self.samples_per_gpu, (i + 1) *
self.samples_per_gpu)
]
# subsample
offset = self.num_samples * self.rank
indices = indices[offset:offset + self.num_samples]
assert len(indices) == self.num_samples
return iter(indices)
def __len__(self):
return self.num_samples
def set_epoch(self, epoch):
self.epoch = epoch
| 5,832
| 34.567073
| 78
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/loader/build_loader.py
|
import platform
from functools import partial
from mmcv.parallel import collate
from mmcv.runner import get_dist_info
from torch.utils.data import DataLoader
from .sampler import DistributedGroupSampler, DistributedSampler, GroupSampler
if platform.system() != 'Windows':
# https://github.com/pytorch/pytorch/issues/973
import resource
rlimit = resource.getrlimit(resource.RLIMIT_NOFILE)
resource.setrlimit(resource.RLIMIT_NOFILE, (4096, rlimit[1]))
def build_dataloader(dataset,
imgs_per_gpu,
workers_per_gpu,
num_gpus=1,
dist=True,
**kwargs):
shuffle = kwargs.get('shuffle', True)
if dist:
rank, world_size = get_dist_info()
if shuffle:
sampler = DistributedGroupSampler(dataset, imgs_per_gpu,
world_size, rank)
else:
sampler = DistributedSampler(
dataset, world_size, rank, shuffle=False)
batch_size = imgs_per_gpu
num_workers = workers_per_gpu
else:
sampler = GroupSampler(dataset, imgs_per_gpu) if shuffle else None
batch_size = num_gpus * imgs_per_gpu
num_workers = num_gpus * workers_per_gpu
data_loader = DataLoader(
dataset,
batch_size=batch_size,
sampler=sampler,
num_workers=num_workers,
collate_fn=partial(collate, samples_per_gpu=imgs_per_gpu),
pin_memory=False,
**kwargs)
return data_loader
| 1,559
| 30.836735
| 78
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/loader/__init__.py
|
from .build_loader import build_dataloader
from .sampler import DistributedGroupSampler, GroupSampler
__all__ = ['GroupSampler', 'DistributedGroupSampler', 'build_dataloader']
| 177
| 34.6
| 73
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/pipelines/test_aug.py
|
import mmcv
from ..registry import PIPELINES
from .compose import Compose
@PIPELINES.register_module
class MultiScaleFlipAug(object):
def __init__(self, transforms, img_scale, flip=False):
self.transforms = Compose(transforms)
self.img_scale = img_scale if isinstance(img_scale,
list) else [img_scale]
assert mmcv.is_list_of(self.img_scale, tuple)
self.flip = flip
def __call__(self, results):
aug_data = []
flip_aug = [False, True] if self.flip else [False]
for scale in self.img_scale:
for flip in flip_aug:
_results = results.copy()
_results['scale'] = scale
_results['flip'] = flip
data = self.transforms(_results)
aug_data.append(data)
# list of dict to dict of list
aug_data_dict = {key: [] for key in aug_data[0]}
for data in aug_data:
for key, val in data.items():
aug_data_dict[key].append(val)
return aug_data_dict
def __repr__(self):
repr_str = self.__class__.__name__
repr_str += '(transforms={}, img_scale={}, flip={})'.format(
self.transforms, self.img_scale, self.flip)
return repr_str
| 1,312
| 32.666667
| 71
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/pipelines/loading.py
|
import os.path as osp
import warnings
import mmcv
import numpy as np
import pycocotools.mask as maskUtils
from ..registry import PIPELINES
@PIPELINES.register_module
class LoadImageFromFile(object):
def __init__(self, to_float32=False):
self.to_float32 = to_float32
def __call__(self, results):
if results['img_prefix'] is not None:
filename = osp.join(results['img_prefix'],
results['img_info']['filename'])
else:
filename = results['img_info']['filename']
img = mmcv.imread(filename)
if self.to_float32:
img = img.astype(np.float32)
results['filename'] = filename
results['img'] = img
results['img_shape'] = img.shape
results['ori_shape'] = img.shape
return results
def __repr__(self):
return self.__class__.__name__ + '(to_float32={})'.format(
self.to_float32)
@PIPELINES.register_module
class LoadAnnotations(object):
def __init__(self,
with_bbox=True,
with_label=True,
with_mask=False,
with_seg=False,
poly2mask=True,
skip_img_without_anno=True):
self.with_bbox = with_bbox
self.with_label = with_label
self.with_mask = with_mask
self.with_seg = with_seg
self.poly2mask = poly2mask
self.skip_img_without_anno = skip_img_without_anno
def _load_bboxes(self, results):
ann_info = results['ann_info']
results['gt_bboxes'] = ann_info['bboxes']
if len(results['gt_bboxes']) == 0 and self.skip_img_without_anno:
if results['img_prefix'] is not None:
file_path = osp.join(results['img_prefix'],
results['img_info']['filename'])
else:
file_path = results['img_info']['filename']
warnings.warn(
'Skip the image "{}" that has no valid gt bbox'.format(
file_path))
return None
results['gt_bboxes_ignore'] = ann_info.get('bboxes_ignore', None)
results['bbox_fields'].extend(['gt_bboxes', 'gt_bboxes_ignore'])
return results
def _load_labels(self, results):
results['gt_labels'] = results['ann_info']['labels']
return results
def _poly2mask(self, mask_ann, img_h, img_w):
if isinstance(mask_ann, list):
# polygon -- a single object might consist of multiple parts
# we merge all parts into one mask rle code
rles = maskUtils.frPyObjects(mask_ann, img_h, img_w)
rle = maskUtils.merge(rles)
elif isinstance(mask_ann['counts'], list):
# uncompressed RLE
rle = maskUtils.frPyObjects(mask_ann, img_h, img_w)
else:
# rle
rle = mask_ann
mask = maskUtils.decode(rle)
return mask
def _load_masks(self, results):
h, w = results['img_info']['height'], results['img_info']['width']
gt_masks = results['ann_info']['masks']
if self.poly2mask:
gt_masks = [self._poly2mask(mask, h, w) for mask in gt_masks]
results['gt_masks'] = gt_masks
results['mask_fields'].append('gt_masks')
return results
def _load_semantic_seg(self, results):
results['gt_semantic_seg'] = mmcv.imread(
osp.join(results['seg_prefix'], results['ann_info']['seg_map']),
flag='unchanged').squeeze()
return results
def __call__(self, results):
if self.with_bbox:
results = self._load_bboxes(results)
if results is None:
return None
if self.with_label:
results = self._load_labels(results)
if self.with_mask:
results = self._load_masks(results)
if self.with_seg:
results = self._load_semantic_seg(results)
return results
def __repr__(self):
repr_str = self.__class__.__name__
repr_str += ('(with_bbox={}, with_label={}, with_mask={},'
' with_seg={})').format(self.with_bbox, self.with_label,
self.with_mask, self.with_seg)
return repr_str
@PIPELINES.register_module
class LoadProposals(object):
def __init__(self, num_max_proposals=None):
self.num_max_proposals = num_max_proposals
def __call__(self, results):
proposals = results['proposals']
if proposals.shape[1] not in (4, 5):
raise AssertionError(
'proposals should have shapes (n, 4) or (n, 5), '
'but found {}'.format(proposals.shape))
proposals = proposals[:, :4]
if self.num_max_proposals is not None:
proposals = proposals[:self.num_max_proposals]
if len(proposals) == 0:
proposals = np.array([0, 0, 0, 0], dtype=np.float32)
results['proposals'] = proposals
results['bbox_fields'].append('proposals')
return results
def __repr__(self):
return self.__class__.__name__ + '(num_max_proposals={})'.format(
self.num_max_proposals)
| 5,246
| 33.519737
| 77
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/pipelines/compose.py
|
import collections
from mmdet.utils import build_from_cfg
from ..registry import PIPELINES
@PIPELINES.register_module
class Compose(object):
def __init__(self, transforms):
assert isinstance(transforms, collections.abc.Sequence)
self.transforms = []
for transform in transforms:
if isinstance(transform, dict):
transform = build_from_cfg(transform, PIPELINES)
self.transforms.append(transform)
elif callable(transform):
self.transforms.append(transform)
else:
raise TypeError('transform must be callable or a dict')
def __call__(self, data):
for t in self.transforms:
data = t(data)
if data is None:
return None
return data
def __repr__(self):
format_string = self.__class__.__name__ + '('
for t in self.transforms:
format_string += '\n'
format_string += ' {0}'.format(t)
format_string += '\n)'
return format_string
| 1,073
| 28.833333
| 71
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/pipelines/formating.py
|
from collections.abc import Sequence
import mmcv
import numpy as np
import torch
from mmcv.parallel import DataContainer as DC
from ..registry import PIPELINES
def to_tensor(data):
"""Convert objects of various python types to :obj:`torch.Tensor`.
Supported types are: :class:`numpy.ndarray`, :class:`torch.Tensor`,
:class:`Sequence`, :class:`int` and :class:`float`.
"""
if isinstance(data, torch.Tensor):
return data
elif isinstance(data, np.ndarray):
return torch.from_numpy(data)
elif isinstance(data, Sequence) and not mmcv.is_str(data):
return torch.tensor(data)
elif isinstance(data, int):
return torch.LongTensor([data])
elif isinstance(data, float):
return torch.FloatTensor([data])
else:
raise TypeError('type {} cannot be converted to tensor.'.format(
type(data)))
@PIPELINES.register_module
class ToTensor(object):
def __init__(self, keys):
self.keys = keys
def __call__(self, results):
for key in self.keys:
results[key] = to_tensor(results[key])
return results
def __repr__(self):
return self.__class__.__name__ + '(keys={})'.format(self.keys)
@PIPELINES.register_module
class ImageToTensor(object):
def __init__(self, keys):
self.keys = keys
def __call__(self, results):
for key in self.keys:
results[key] = to_tensor(results[key].transpose(2, 0, 1))
return results
def __repr__(self):
return self.__class__.__name__ + '(keys={})'.format(self.keys)
@PIPELINES.register_module
class Transpose(object):
def __init__(self, keys, order):
self.keys = keys
self.order = order
def __call__(self, results):
for key in self.keys:
results[key] = results[key].transpose(self.order)
return results
def __repr__(self):
return self.__class__.__name__ + '(keys={}, order={})'.format(
self.keys, self.order)
@PIPELINES.register_module
class ToDataContainer(object):
def __init__(self,
fields=(dict(key='img', stack=True), dict(key='gt_bboxes'),
dict(key='gt_labels'))):
self.fields = fields
def __call__(self, results):
for field in self.fields:
field = field.copy()
key = field.pop('key')
results[key] = DC(results[key], **field)
return results
def __repr__(self):
return self.__class__.__name__ + '(fields={})'.format(self.fields)
@PIPELINES.register_module
class DefaultFormatBundle(object):
"""Default formatting bundle.
It simplifies the pipeline of formatting common fields, including "img",
"proposals", "gt_bboxes", "gt_labels", "gt_masks" and "gt_semantic_seg".
These fields are formatted as follows.
- img: (1)transpose, (2)to tensor, (3)to DataContainer (stack=True)
- proposals: (1)to tensor, (2)to DataContainer
- gt_bboxes: (1)to tensor, (2)to DataContainer
- gt_bboxes_ignore: (1)to tensor, (2)to DataContainer
- gt_labels: (1)to tensor, (2)to DataContainer
- gt_masks: (1)to tensor, (2)to DataContainer (cpu_only=True)
- gt_semantic_seg: (1)unsqueeze dim-0 (2)to tensor,
(3)to DataContainer (stack=True)
"""
def __call__(self, results):
if 'img' in results:
img = np.ascontiguousarray(results['img'].transpose(2, 0, 1))
results['img'] = DC(to_tensor(img), stack=True)
for key in ['proposals', 'gt_bboxes', 'gt_bboxes_ignore', 'gt_labels','gt_clusters']:
if key not in results:
continue
results[key] = DC(to_tensor(results[key]))
if 'gt_masks' in results:
results['gt_masks'] = DC(results['gt_masks'], cpu_only=True)
if 'gt_semantic_seg' in results:
results['gt_semantic_seg'] = DC(
to_tensor(results['gt_semantic_seg'][None, ...]), stack=True)
return results
def __repr__(self):
return self.__class__.__name__
@PIPELINES.register_module
class Collect(object):
"""
Collect data from the loader relevant to the specific task.
This is usually the last stage of the data loader pipeline. Typically keys
is set to some subset of "img", "proposals", "gt_bboxes",
"gt_bboxes_ignore", "gt_labels", and/or "gt_masks".
The "img_meta" item is always populated. The contents of the "img_meta"
dictionary depends on "meta_keys". By default this includes:
- "img_shape": shape of the image input to the network as a tuple
(h, w, c). Note that images may be zero padded on the bottom/right
if the batch tensor is larger than this shape.
- "scale_factor": a float indicating the preprocessing scale
- "flip": a boolean indicating if image flip transform was used
- "filename": path to the image file
- "ori_shape": original shape of the image as a tuple (h, w, c)
- "pad_shape": image shape after padding
- "img_norm_cfg": a dict of normalization information:
- mean - per channel mean subtraction
- std - per channel std divisor
- to_rgb - bool indicating if bgr was converted to rgb
"""
def __init__(self,
keys,
meta_keys=('filename', 'ori_shape', 'img_shape', 'pad_shape',
'scale_factor', 'flip', 'img_norm_cfg')):
self.keys = keys
self.meta_keys = meta_keys
def __call__(self, results):
data = {}
img_meta = {}
for key in self.meta_keys:
img_meta[key] = results[key]
data['img_meta'] = DC(img_meta, cpu_only=True)
for key in self.keys:
data[key] = results[key]
return data
def __repr__(self):
return self.__class__.__name__ + '(keys={}, meta_keys={})'.format(
self.keys, self.meta_keys)
| 6,008
| 31.13369
| 93
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/pipelines/__init__.py
|
from .compose import Compose
from .formating import (Collect, ImageToTensor, ToDataContainer, ToTensor,
Transpose, to_tensor)
from .loading import LoadAnnotations, LoadImageFromFile, LoadProposals
from .test_aug import MultiScaleFlipAug
from .transforms import (Albu, Expand, MinIoURandomCrop, Normalize, Pad,
PhotoMetricDistortion, RandomCrop, RandomFlip, Resize,
SegResizeFlipPadRescale)
from .transforms_rotated import (PesudoRotatedRandomFlip,
PesudoRotatedResize, RotatedRandomFlip,
RotatedResize, RandomRotate)
__all__ = [
'Compose', 'to_tensor', 'ToTensor', 'ImageToTensor', 'ToDataContainer',
'Transpose', 'Collect', 'LoadAnnotations', 'LoadImageFromFile',
'LoadProposals', 'MultiScaleFlipAug', 'Resize', 'RandomFlip', 'Pad',
'RandomCrop', 'Normalize', 'SegResizeFlipPadRescale', 'MinIoURandomCrop',
'Expand', 'PhotoMetricDistortion', 'Albu', 'RotatedRandomFlip',
'RotatedResize', 'RandomRotate'
]
| 1,071
| 50.047619
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/pipelines/transforms_rotated.py
|
import random
import cv2
import numpy as np
from mmdet.core import poly_to_rotated_box_np, rotated_box_to_poly_np, norm_angle
from .transforms import RandomFlip, Resize
from ..registry import PIPELINES
@PIPELINES.register_module
class RotatedRandomFlip(RandomFlip):
def bbox_flip(self, bboxes, img_shape):
"""Flip bboxes horizontally.
Args:
bboxes(ndarray): shape (..., 5*k)
img_shape(tuple): (height, width)
"""
assert bboxes.shape[-1] % 5 == 0
w = img_shape[1]
# x_ctr and angle
bboxes[..., 0::5] = w - bboxes[..., 0::5] - 1
bboxes[..., 4::5] = norm_angle(np.pi - bboxes[..., 4::5])
return bboxes
@PIPELINES.register_module
class RotatedResize(Resize):
def _resize_bboxes(self, results):
img_shape = results['img_shape']
for key in results.get('bbox_fields', []):
polys = rotated_box_to_poly_np(results[key]) # to 8 points
polys = polys * results['scale_factor']
if polys.shape[0] != 0:
polys[:, 0::2] = np.clip(polys[:, 0::2], 0, img_shape[1] - 1)
polys[:, 1::2] = np.clip(polys[:, 1::2], 0, img_shape[0] - 1)
rboxes = poly_to_rotated_box_np(polys) # to x,y,w,h,angle
results[key] = rboxes
@PIPELINES.register_module
class PesudoRotatedRandomFlip(RandomFlip):
def __call__(self, results):
return results
@PIPELINES.register_module
class PesudoRotatedResize(Resize):
def __call__(self, results):
results['scale_factor'] = 1.0
return results
@PIPELINES.register_module
class RandomRotate(object):
def __init__(self,
rate=0.5,
angles=[30, 60, 90, 120, 150],
auto_bound=False):
self.rate = rate
self.angles = angles
# new image shape or not
self.auto_bound = auto_bound
@property
def rand_angle(self):
return random.sample(self.angles, 1)[0]
@property
def is_rotate(self):
return np.random.rand() > self.rate
def apply_image(self, img, bound_h, bound_w, interp=cv2.INTER_LINEAR):
"""
img should be a numpy array, formatted as Height * Width * Nchannels
"""
if len(img) == 0:
return img
return cv2.warpAffine(img, self.rm_image, (bound_w, bound_h), flags=interp)
def apply_coords(self, coords):
"""
coords should be a N * 2 array-like, containing N couples of (x, y) points
"""
if len(coords) == 0:
return coords
coords = np.asarray(coords, dtype=float)
return cv2.transform(coords[:, np.newaxis, :], self.rm_coords)[:, 0, :]
def apply_segmentation(self, segmentation):
segmentation = self.apply_image(segmentation, interp=cv2.INTER_NEAREST)
return segmentation
def create_rotation_matrix(self, center, angle, bound_h, bound_w, offset=0):
center = (center[0] + offset, center[1] + offset)
rm = cv2.getRotationMatrix2D(tuple(center), angle, 1)
if self.auto_bound:
# Find the coordinates of the center of rotation in the new image
# The only point for which we know the future coordinates is the center of the image
rot_im_center = cv2.transform(
center[None, None, :] + offset, rm)[0, 0, :]
new_center = np.array(
[bound_w / 2, bound_h / 2]) + offset - rot_im_center
# shift the rotation center to the new coordinates
rm[:, 2] += new_center
return rm
def filter_border(self, bboxes, h, w):
x_ctr, y_ctr = bboxes[:, 0], bboxes[:, 1]
keep_inds = (x_ctr > 0) & (x_ctr < w) & (y_ctr > 0) & (y_ctr < h)
return keep_inds
def __call__(self, results):
# return the results directly if not rotate
if not self.is_rotate:
results['rotate'] = False
return results
h, w, c = results['img_shape']
img = results['img']
# angle for rotate
angle = self.rand_angle
results['rotate'] = True
results['rotate_angle'] = angle
image_center = np.array((w / 2, h / 2))
abs_cos, abs_sin = abs(np.cos(angle)), abs(np.sin(angle))
if self.auto_bound:
# find the new width and height bounds
bound_w, bound_h = np.rint(
[h * abs_sin + w * abs_cos, h * abs_cos + w * abs_sin]
).astype(int)
else:
bound_w, bound_h = w, h
self.rm_coords = self.create_rotation_matrix(
image_center, angle, bound_h, bound_w)
# Needed because of this problem https://github.com/opencv/opencv/issues/11784
self.rm_image = self.create_rotation_matrix(
image_center, angle, bound_h, bound_w, offset=-0.5)
# rotate img
img = self.apply_image(img, bound_h, bound_w)
results['img'] = img
results['img_shape'] = (bound_h, bound_w, c)
# rotate bboxes
gt_bboxes = results.get('gt_bboxes', [])
labels = results.get('gt_labels', [])
polys = rotated_box_to_poly_np(gt_bboxes).reshape(-1, 2)
polys = self.apply_coords(polys).reshape(-1, 8)
gt_bboxes = poly_to_rotated_box_np(polys)
keep_inds = self.filter_border(gt_bboxes, bound_h, bound_w)
gt_bboxes = gt_bboxes[keep_inds, :]
labels = labels[keep_inds]
if len(gt_bboxes) == 0:
return None
results['gt_bboxes'] = gt_bboxes
results['gt_labels'] = labels
return results
| 5,635
| 33.365854
| 96
|
py
|
s2anet
|
s2anet-master/mmdet/datasets/pipelines/transforms.py
|
import inspect
import albumentations
import mmcv
import numpy as np
from albumentations import Compose
from imagecorruptions import corrupt
from numpy import random
from mmdet.core.evaluation.bbox_overlaps import bbox_overlaps
from ..registry import PIPELINES
@PIPELINES.register_module
class Resize(object):
"""Resize images & bbox & mask.
This transform resizes the input image to some scale. Bboxes and masks are
then resized with the same scale factor. If the input dict contains the key
"scale", then the scale in the input dict is used, otherwise the specified
scale in the init method is used.
`img_scale` can either be a tuple (single-scale) or a list of tuple
(multi-scale). There are 3 multiscale modes:
- `ratio_range` is not None: randomly sample a ratio from the ratio range
and multiply it with the image scale.
- `ratio_range` is None and `multiscale_mode` == "range": randomly sample a
scale from the a range.
- `ratio_range` is None and `multiscale_mode` == "value": randomly sample a
scale from multiple scales.
Args:
img_scale (tuple or list[tuple]): Images scales for resizing.
multiscale_mode (str): Either "range" or "value".
ratio_range (tuple[float]): (min_ratio, max_ratio)
keep_ratio (bool): Whether to keep the aspect ratio when resizing the
image.
"""
def __init__(self,
img_scale=None,
multiscale_mode='range',
ratio_range=None,
keep_ratio=True):
if img_scale is None:
self.img_scale = None
else:
if isinstance(img_scale, list):
self.img_scale = img_scale
else:
self.img_scale = [img_scale]
assert mmcv.is_list_of(self.img_scale, tuple)
if ratio_range is not None:
# mode 1: given a scale and a range of image ratio
assert len(self.img_scale) == 1
else:
# mode 2: given multiple scales or a range of scales
assert multiscale_mode in ['value', 'range']
self.multiscale_mode = multiscale_mode
self.ratio_range = ratio_range
self.keep_ratio = keep_ratio
@staticmethod
def random_select(img_scales):
assert mmcv.is_list_of(img_scales, tuple)
scale_idx = np.random.randint(len(img_scales))
img_scale = img_scales[scale_idx]
return img_scale, scale_idx
@staticmethod
def random_sample(img_scales):
assert mmcv.is_list_of(img_scales, tuple) and len(img_scales) == 2
img_scale_long = [max(s) for s in img_scales]
img_scale_short = [min(s) for s in img_scales]
long_edge = np.random.randint(
min(img_scale_long),
max(img_scale_long) + 1)
short_edge = np.random.randint(
min(img_scale_short),
max(img_scale_short) + 1)
img_scale = (long_edge, short_edge)
return img_scale, None
@staticmethod
def random_sample_ratio(img_scale, ratio_range):
assert isinstance(img_scale, tuple) and len(img_scale) == 2
min_ratio, max_ratio = ratio_range
assert min_ratio <= max_ratio
ratio = np.random.random_sample() * (max_ratio - min_ratio) + min_ratio
scale = int(img_scale[0] * ratio), int(img_scale[1] * ratio)
return scale, None
def _random_scale(self, results):
if self.ratio_range is not None:
scale, scale_idx = self.random_sample_ratio(
self.img_scale[0], self.ratio_range)
elif len(self.img_scale) == 1:
scale, scale_idx = self.img_scale[0], 0
elif self.multiscale_mode == 'range':
scale, scale_idx = self.random_sample(self.img_scale)
elif self.multiscale_mode == 'value':
scale, scale_idx = self.random_select(self.img_scale)
else:
raise NotImplementedError
results['scale'] = scale
results['scale_idx'] = scale_idx
def _resize_img(self, results):
if self.keep_ratio:
img, scale_factor = mmcv.imrescale(
results['img'], results['scale'], return_scale=True)
else:
img, w_scale, h_scale = mmcv.imresize(
results['img'], results['scale'], return_scale=True)
scale_factor = np.array([w_scale, h_scale, w_scale, h_scale],
dtype=np.float32)
results['img'] = img
results['img_shape'] = img.shape
results['pad_shape'] = img.shape # in case that there is no padding
results['scale_factor'] = scale_factor
results['keep_ratio'] = self.keep_ratio
def _resize_bboxes(self, results):
img_shape = results['img_shape']
for key in results.get('bbox_fields', []):
bboxes = results[key] * results['scale_factor']
if bboxes.shape[0] != 0:
bboxes[:, 0::2] = np.clip(bboxes[:, 0::2], 0, img_shape[1] - 1)
bboxes[:, 1::2] = np.clip(bboxes[:, 1::2], 0, img_shape[0] - 1)
results[key] = bboxes
def _resize_masks(self, results):
for key in results.get('mask_fields', []):
if results[key] is None:
continue
if self.keep_ratio:
masks = [
mmcv.imrescale(
mask, results['scale_factor'], interpolation='nearest')
for mask in results[key]
]
else:
mask_size = (results['img_shape'][1], results['img_shape'][0])
masks = [
mmcv.imresize(mask, mask_size, interpolation='nearest')
for mask in results[key]
]
results[key] = masks
def __call__(self, results):
if 'scale' not in results:
self._random_scale(results)
self._resize_img(results)
self._resize_bboxes(results)
self._resize_masks(results)
return results
def __repr__(self):
repr_str = self.__class__.__name__
repr_str += ('(img_scale={}, multiscale_mode={}, ratio_range={}, '
'keep_ratio={})').format(self.img_scale,
self.multiscale_mode,
self.ratio_range,
self.keep_ratio)
return repr_str
@PIPELINES.register_module
class RandomFlip(object):
"""Flip the image & bbox & mask.
If the input dict contains the key "flip", then the flag will be used,
otherwise it will be randomly decided by a ratio specified in the init
method.
Args:
flip_ratio (float, optional): The flipping probability.
"""
def __init__(self, flip_ratio=None):
self.flip_ratio = flip_ratio
if flip_ratio is not None:
assert flip_ratio >= 0 and flip_ratio <= 1
def bbox_flip(self, bboxes, img_shape):
"""Flip bboxes horizontally.
Args:
bboxes(ndarray): shape (..., 4*k)
img_shape(tuple): (height, width)
"""
assert bboxes.shape[-1] % 4 == 0
w = img_shape[1]
flipped = bboxes.copy()
flipped[..., 0::4] = w - bboxes[..., 2::4] - 1
flipped[..., 2::4] = w - bboxes[..., 0::4] - 1
return flipped
def __call__(self, results):
if 'flip' not in results:
flip = True if np.random.rand() < self.flip_ratio else False
results['flip'] = flip
if results['flip']:
# flip image
results['img'] = mmcv.imflip(results['img'])
# flip bboxes
for key in results.get('bbox_fields', []):
results[key] = self.bbox_flip(results[key],
results['img_shape'])
# flip masks
for key in results.get('mask_fields', []):
results[key] = [mask[:, ::-1] for mask in results[key]]
return results
def __repr__(self):
return self.__class__.__name__ + '(flip_ratio={})'.format(
self.flip_ratio)
@PIPELINES.register_module
class Pad(object):
"""Pad the image & mask.
There are two padding modes: (1) pad to a fixed size and (2) pad to the
minimum size that is divisible by some number.
Args:
size (tuple, optional): Fixed padding size.
size_divisor (int, optional): The divisor of padded size.
pad_val (float, optional): Padding value, 0 by default.
"""
def __init__(self, size=None, size_divisor=None, pad_val=0):
self.size = size
self.size_divisor = size_divisor
self.pad_val = pad_val
# only one of size and size_divisor should be valid
assert size is not None or size_divisor is not None
assert size is None or size_divisor is None
def _pad_img(self, results):
if self.size is not None:
padded_img = mmcv.impad(results['img'], self.size)
elif self.size_divisor is not None:
padded_img = mmcv.impad_to_multiple(
results['img'], self.size_divisor, pad_val=self.pad_val)
results['img'] = padded_img
results['pad_shape'] = padded_img.shape
results['pad_fixed_size'] = self.size
results['pad_size_divisor'] = self.size_divisor
def _pad_masks(self, results):
pad_shape = results['pad_shape'][:2]
for key in results.get('mask_fields', []):
padded_masks = [
mmcv.impad(mask, pad_shape, pad_val=self.pad_val)
for mask in results[key]
]
results[key] = np.stack(padded_masks, axis=0)
def __call__(self, results):
self._pad_img(results)
self._pad_masks(results)
return results
def __repr__(self):
repr_str = self.__class__.__name__
repr_str += '(size={}, size_divisor={}, pad_val={})'.format(
self.size, self.size_divisor, self.pad_val)
return repr_str
@PIPELINES.register_module
class Normalize(object):
"""Normalize the image.
Args:
mean (sequence): Mean values of 3 channels.
std (sequence): Std values of 3 channels.
to_rgb (bool): Whether to convert the image from BGR to RGB,
default is true.
"""
def __init__(self, mean, std, to_rgb=True):
self.mean = np.array(mean, dtype=np.float32)
self.std = np.array(std, dtype=np.float32)
self.to_rgb = to_rgb
def __call__(self, results):
results['img'] = mmcv.imnormalize(results['img'], self.mean, self.std,
self.to_rgb)
results['img_norm_cfg'] = dict(
mean=self.mean, std=self.std, to_rgb=self.to_rgb)
return results
def __repr__(self):
repr_str = self.__class__.__name__
repr_str += '(mean={}, std={}, to_rgb={})'.format(
self.mean, self.std, self.to_rgb)
return repr_str
@PIPELINES.register_module
class RandomCrop(object):
"""Random crop the image & bboxes & masks.
Args:
crop_size (tuple): Expected size after cropping, (h, w).
"""
def __init__(self, crop_size):
self.crop_size = crop_size
def __call__(self, results):
img = results['img']
margin_h = max(img.shape[0] - self.crop_size[0], 0)
margin_w = max(img.shape[1] - self.crop_size[1], 0)
offset_h = np.random.randint(0, margin_h + 1)
offset_w = np.random.randint(0, margin_w + 1)
crop_y1, crop_y2 = offset_h, offset_h + self.crop_size[0]
crop_x1, crop_x2 = offset_w, offset_w + self.crop_size[1]
# crop the image
img = img[crop_y1:crop_y2, crop_x1:crop_x2, :]
img_shape = img.shape
results['img'] = img
results['img_shape'] = img_shape
# crop bboxes accordingly and clip to the image boundary
for key in results.get('bbox_fields', []):
bbox_offset = np.array([offset_w, offset_h, offset_w, offset_h],
dtype=np.float32)
bboxes = results[key] - bbox_offset
bboxes[:, 0::2] = np.clip(bboxes[:, 0::2], 0, img_shape[1] - 1)
bboxes[:, 1::2] = np.clip(bboxes[:, 1::2], 0, img_shape[0] - 1)
results[key] = bboxes
# filter out the gt bboxes that are completely cropped
if 'gt_bboxes' in results:
gt_bboxes = results['gt_bboxes']
valid_inds = (gt_bboxes[:, 2] > gt_bboxes[:, 0]) & (
gt_bboxes[:, 3] > gt_bboxes[:, 1])
# if no gt bbox remains after cropping, just skip this image
if not np.any(valid_inds):
return None
results['gt_bboxes'] = gt_bboxes[valid_inds, :]
if 'gt_labels' in results:
results['gt_labels'] = results['gt_labels'][valid_inds]
# filter and crop the masks
if 'gt_masks' in results:
valid_gt_masks = []
for i in np.where(valid_inds)[0]:
gt_mask = results['gt_masks'][i][crop_y1:crop_y2, crop_x1:
crop_x2]
valid_gt_masks.append(gt_mask)
results['gt_masks'] = valid_gt_masks
return results
def __repr__(self):
return self.__class__.__name__ + '(crop_size={})'.format(
self.crop_size)
@PIPELINES.register_module
class SegResizeFlipPadRescale(object):
"""A sequential transforms to semantic segmentation maps.
The same pipeline as input images is applied to the semantic segmentation
map, and finally rescale it by some scale factor. The transforms include:
1. resize
2. flip
3. pad
4. rescale (so that the final size can be different from the image size)
Args:
scale_factor (float): The scale factor of the final output.
"""
def __init__(self, scale_factor=1):
self.scale_factor = scale_factor
def __call__(self, results):
if results['keep_ratio']:
gt_seg = mmcv.imrescale(
results['gt_semantic_seg'],
results['scale'],
interpolation='nearest')
else:
gt_seg = mmcv.imresize(
results['gt_semantic_seg'],
results['scale'],
interpolation='nearest')
if results['flip']:
gt_seg = mmcv.imflip(gt_seg)
if gt_seg.shape != results['pad_shape']:
gt_seg = mmcv.impad(gt_seg, results['pad_shape'][:2])
if self.scale_factor != 1:
gt_seg = mmcv.imrescale(
gt_seg, self.scale_factor, interpolation='nearest')
results['gt_semantic_seg'] = gt_seg
return results
def __repr__(self):
return self.__class__.__name__ + '(scale_factor={})'.format(
self.scale_factor)
@PIPELINES.register_module
class PhotoMetricDistortion(object):
"""Apply photometric distortion to image sequentially, every transformation
is applied with a probability of 0.5. The position of random contrast is in
second or second to last.
1. random brightness
2. random contrast (mode 0)
3. convert color from BGR to HSV
4. random saturation
5. random hue
6. convert color from HSV to BGR
7. random contrast (mode 1)
8. randomly swap channels
Args:
brightness_delta (int): delta of brightness.
contrast_range (tuple): range of contrast.
saturation_range (tuple): range of saturation.
hue_delta (int): delta of hue.
"""
def __init__(self,
brightness_delta=32,
contrast_range=(0.5, 1.5),
saturation_range=(0.5, 1.5),
hue_delta=18):
self.brightness_delta = brightness_delta
self.contrast_lower, self.contrast_upper = contrast_range
self.saturation_lower, self.saturation_upper = saturation_range
self.hue_delta = hue_delta
def __call__(self, results):
img = results['img']
# random brightness
if random.randint(2):
delta = random.uniform(-self.brightness_delta,
self.brightness_delta)
img += delta
# mode == 0 --> do random contrast first
# mode == 1 --> do random contrast last
mode = random.randint(2)
if mode == 1:
if random.randint(2):
alpha = random.uniform(self.contrast_lower,
self.contrast_upper)
img *= alpha
# convert color from BGR to HSV
img = mmcv.bgr2hsv(img)
# random saturation
if random.randint(2):
img[..., 1] *= random.uniform(self.saturation_lower,
self.saturation_upper)
# random hue
if random.randint(2):
img[..., 0] += random.uniform(-self.hue_delta, self.hue_delta)
img[..., 0][img[..., 0] > 360] -= 360
img[..., 0][img[..., 0] < 0] += 360
# convert color from HSV to BGR
img = mmcv.hsv2bgr(img)
# random contrast
if mode == 0:
if random.randint(2):
alpha = random.uniform(self.contrast_lower,
self.contrast_upper)
img *= alpha
# randomly swap channels
if random.randint(2):
img = img[..., random.permutation(3)]
results['img'] = img
return results
def __repr__(self):
repr_str = self.__class__.__name__
repr_str += ('(brightness_delta={}, contrast_range={}, '
'saturation_range={}, hue_delta={})').format(
self.brightness_delta, self.contrast_range,
self.saturation_range, self.hue_delta)
return repr_str
@PIPELINES.register_module
class Expand(object):
"""Random expand the image & bboxes.
Randomly place the original image on a canvas of 'ratio' x original image
size filled with mean values. The ratio is in the range of ratio_range.
Args:
mean (tuple): mean value of dataset.
to_rgb (bool): if need to convert the order of mean to align with RGB.
ratio_range (tuple): range of expand ratio.
"""
def __init__(self,
mean=(0, 0, 0),
to_rgb=True,
ratio_range=(1, 4),
seg_ignore_label=None):
self.to_rgb = to_rgb
self.ratio_range = ratio_range
if to_rgb:
self.mean = mean[::-1]
else:
self.mean = mean
self.min_ratio, self.max_ratio = ratio_range
self.seg_ignore_label = seg_ignore_label
def __call__(self, results):
if random.randint(2):
return results
img, boxes = [results[k] for k in ('img', 'gt_bboxes')]
h, w, c = img.shape
ratio = random.uniform(self.min_ratio, self.max_ratio)
expand_img = np.full((int(h * ratio), int(w * ratio), c),
self.mean).astype(img.dtype)
left = int(random.uniform(0, w * ratio - w))
top = int(random.uniform(0, h * ratio - h))
expand_img[top:top + h, left:left + w] = img
boxes = boxes + np.tile((left, top), 2).astype(boxes.dtype)
results['img'] = expand_img
results['gt_bboxes'] = boxes
if 'gt_masks' in results:
expand_gt_masks = []
for mask in results['gt_masks']:
expand_mask = np.full((int(h * ratio), int(w * ratio)),
0).astype(mask.dtype)
expand_mask[top:top + h, left:left + w] = mask
expand_gt_masks.append(expand_mask)
results['gt_masks'] = expand_gt_masks
# not tested
if 'gt_semantic_seg' in results:
assert self.seg_ignore_label is not None
gt_seg = results['gt_semantic_seg']
expand_gt_seg = np.full((int(h * ratio), int(w * ratio)),
self.seg_ignore_label).astype(gt_seg.dtype)
expand_gt_seg[top:top + h, left:left + w] = gt_seg
results['gt_semantic_seg'] = expand_gt_seg
return results
def __repr__(self):
repr_str = self.__class__.__name__
repr_str += '(mean={}, to_rgb={}, ratio_range={}, ' \
'seg_ignore_label={})'.format(
self.mean, self.to_rgb, self.ratio_range,
self.seg_ignore_label)
return repr_str
@PIPELINES.register_module
class MinIoURandomCrop(object):
"""Random crop the image & bboxes, the cropped patches have minimum IoU
requirement with original image & bboxes, the IoU threshold is randomly
selected from min_ious.
Args:
min_ious (tuple): minimum IoU threshold
crop_size (tuple): Expected size after cropping, (h, w).
"""
def __init__(self, min_ious=(0.1, 0.3, 0.5, 0.7, 0.9), min_crop_size=0.3):
# 1: return ori img
self.sample_mode = (1, *min_ious, 0)
self.min_crop_size = min_crop_size
def __call__(self, results):
img, boxes, labels = [
results[k] for k in ('img', 'gt_bboxes', 'gt_labels')
]
h, w, c = img.shape
while True:
mode = random.choice(self.sample_mode)
if mode == 1:
return results
min_iou = mode
for i in range(50):
new_w = random.uniform(self.min_crop_size * w, w)
new_h = random.uniform(self.min_crop_size * h, h)
# h / w in [0.5, 2]
if new_h / new_w < 0.5 or new_h / new_w > 2:
continue
left = random.uniform(w - new_w)
top = random.uniform(h - new_h)
patch = np.array(
(int(left), int(top), int(left + new_w), int(top + new_h)))
overlaps = bbox_overlaps(
patch.reshape(-1, 4), boxes.reshape(-1, 4)).reshape(-1)
if overlaps.min() < min_iou:
continue
# center of boxes should inside the crop img
center = (boxes[:, :2] + boxes[:, 2:]) / 2
mask = ((center[:, 0] > patch[0]) * (center[:, 1] > patch[1]) *
(center[:, 0] < patch[2]) * (center[:, 1] < patch[3]))
if not mask.any():
continue
boxes = boxes[mask]
labels = labels[mask]
# adjust boxes
img = img[patch[1]:patch[3], patch[0]:patch[2]]
boxes[:, 2:] = boxes[:, 2:].clip(max=patch[2:])
boxes[:, :2] = boxes[:, :2].clip(min=patch[:2])
boxes -= np.tile(patch[:2], 2)
results['img'] = img
results['gt_bboxes'] = boxes
results['gt_labels'] = labels
if 'gt_masks' in results:
valid_masks = [
results['gt_masks'][i] for i in range(len(mask))
if mask[i]
]
results['gt_masks'] = [
gt_mask[patch[1]:patch[3], patch[0]:patch[2]]
for gt_mask in valid_masks
]
# not tested
if 'gt_semantic_seg' in results:
results['gt_semantic_seg'] = results['gt_semantic_seg'][
patch[1]:patch[3], patch[0]:patch[2]]
return results
def __repr__(self):
repr_str = self.__class__.__name__
repr_str += '(min_ious={}, min_crop_size={})'.format(
self.min_ious, self.min_crop_size)
return repr_str
@PIPELINES.register_module
class Corrupt(object):
def __init__(self, corruption, severity=1):
self.corruption = corruption
self.severity = severity
def __call__(self, results):
results['img'] = corrupt(
results['img'].astype(np.uint8),
corruption_name=self.corruption,
severity=self.severity)
return results
def __repr__(self):
repr_str = self.__class__.__name__
repr_str += '(corruption={}, severity={})'.format(
self.corruption, self.severity)
return repr_str
@PIPELINES.register_module
class Albu(object):
def __init__(self,
transforms,
bbox_params=None,
keymap=None,
update_pad_shape=False,
skip_img_without_anno=False):
"""
Adds custom transformations from Albumentations lib.
Please, visit `https://albumentations.readthedocs.io`
to get more information.
transforms (list): list of albu transformations
bbox_params (dict): bbox_params for albumentation `Compose`
keymap (dict): contains {'input key':'albumentation-style key'}
skip_img_without_anno (bool): whether to skip the image
if no ann left after aug
"""
self.transforms = transforms
self.filter_lost_elements = False
self.update_pad_shape = update_pad_shape
self.skip_img_without_anno = skip_img_without_anno
# A simple workaround to remove masks without boxes
if (isinstance(bbox_params, dict) and 'label_fields' in bbox_params
and 'filter_lost_elements' in bbox_params):
self.filter_lost_elements = True
self.origin_label_fields = bbox_params['label_fields']
bbox_params['label_fields'] = ['idx_mapper']
del bbox_params['filter_lost_elements']
self.bbox_params = (
self.albu_builder(bbox_params) if bbox_params else None)
self.aug = Compose([self.albu_builder(t) for t in self.transforms],
bbox_params=self.bbox_params)
if not keymap:
self.keymap_to_albu = {
'img': 'image',
'gt_masks': 'masks',
'gt_bboxes': 'bboxes'
}
else:
self.keymap_to_albu = keymap
self.keymap_back = {v: k for k, v in self.keymap_to_albu.items()}
def albu_builder(self, cfg):
"""Import a module from albumentations.
Inherits some of `build_from_cfg` logic.
Args:
cfg (dict): Config dict. It should at least contain the key "type".
Returns:
obj: The constructed object.
"""
assert isinstance(cfg, dict) and "type" in cfg
args = cfg.copy()
obj_type = args.pop("type")
if mmcv.is_str(obj_type):
obj_cls = getattr(albumentations, obj_type)
elif inspect.isclass(obj_type):
obj_cls = obj_type
else:
raise TypeError(
'type must be a str or valid type, but got {}'.format(
type(obj_type)))
if 'transforms' in args:
args['transforms'] = [
self.albu_builder(transform)
for transform in args['transforms']
]
return obj_cls(**args)
@staticmethod
def mapper(d, keymap):
"""
Dictionary mapper.
Renames keys according to keymap provided.
Args:
d (dict): old dict
keymap (dict): {'old_key':'new_key'}
Returns:
dict: new dict.
"""
updated_dict = {}
for k, v in zip(d.keys(), d.values()):
new_k = keymap.get(k, k)
updated_dict[new_k] = d[k]
return updated_dict
def __call__(self, results):
# dict to albumentations format
results = self.mapper(results, self.keymap_to_albu)
if 'bboxes' in results:
# to list of boxes
if isinstance(results['bboxes'], np.ndarray):
results['bboxes'] = [x for x in results['bboxes']]
# add pseudo-field for filtration
if self.filter_lost_elements:
results['idx_mapper'] = np.arange(len(results['bboxes']))
results = self.aug(**results)
if 'bboxes' in results:
if isinstance(results['bboxes'], list):
results['bboxes'] = np.array(
results['bboxes'], dtype=np.float32)
# filter label_fields
if self.filter_lost_elements:
results['idx_mapper'] = np.arange(len(results['bboxes']))
for label in self.origin_label_fields:
results[label] = np.array(
[results[label][i] for i in results['idx_mapper']])
if 'masks' in results:
results['masks'] = [
results['masks'][i] for i in results['idx_mapper']
]
if (not len(results['idx_mapper'])
and self.skip_img_without_anno):
return None
if 'gt_labels' in results:
if isinstance(results['gt_labels'], list):
results['gt_labels'] = np.array(results['gt_labels'])
# back to the original format
results = self.mapper(results, self.keymap_back)
# update final shape
if self.update_pad_shape:
results['pad_shape'] = results['img'].shape
return results
def __repr__(self):
repr_str = self.__class__.__name__
repr_str += '(transformations={})'.format(self.transformations)
return repr_str
| 29,903
| 34.813174
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/utils/registry.py
|
import inspect
import mmcv
class Registry(object):
def __init__(self, name):
self._name = name
self._module_dict = dict()
def __repr__(self):
format_str = self.__class__.__name__ + '(name={}, items={})'.format(
self._name, list(self._module_dict.keys()))
return format_str
@property
def name(self):
return self._name
@property
def module_dict(self):
return self._module_dict
def get(self, key):
return self._module_dict.get(key, None)
def _register_module(self, module_class):
"""Register a module.
Args:
module (:obj:`nn.Module`): Module to be registered.
"""
if not inspect.isclass(module_class):
raise TypeError('module must be a class, but got {}'.format(
type(module_class)))
module_name = module_class.__name__
if module_name in self._module_dict:
raise KeyError('{} is already registered in {}'.format(
module_name, self.name))
self._module_dict[module_name] = module_class
def register_module(self, cls):
self._register_module(cls)
return cls
def build_from_cfg(cfg, registry, default_args=None):
"""Build a module from config dict.
Args:
cfg (dict): Config dict. It should at least contain the key "type".
registry (:obj:`Registry`): The registry to search the type from.
default_args (dict, optional): Default initialization arguments.
Returns:
obj: The constructed object.
"""
assert isinstance(cfg, dict) and 'type' in cfg
assert isinstance(default_args, dict) or default_args is None
args = cfg.copy()
obj_type = args.pop('type')
if mmcv.is_str(obj_type):
obj_cls = registry.get(obj_type)
if obj_cls is None:
raise KeyError('{} is not in the {} registry'.format(
obj_type, registry.name))
elif inspect.isclass(obj_type):
obj_cls = obj_type
else:
raise TypeError('type must be a str or valid type, but got {}'.format(
type(obj_type)))
if default_args is not None:
for name, value in default_args.items():
args.setdefault(name, value)
return obj_cls(**args)
| 2,304
| 28.935065
| 78
|
py
|
s2anet
|
s2anet-master/mmdet/utils/flops_counter.py
|
# Modified from flops-counter.pytorch by Vladislav Sovrasov
# original repo: https://github.com/sovrasov/flops-counter.pytorch
# MIT License
# Copyright (c) 2018 Vladislav Sovrasov
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import sys
import numpy as np
import torch
import torch.nn as nn
from torch.nn.modules.batchnorm import _BatchNorm
from torch.nn.modules.conv import _ConvNd, _ConvTransposeMixin
from torch.nn.modules.pooling import (_AdaptiveAvgPoolNd, _AdaptiveMaxPoolNd,
_AvgPoolNd, _MaxPoolNd)
CONV_TYPES = (_ConvNd, )
DECONV_TYPES = (_ConvTransposeMixin, )
LINEAR_TYPES = (nn.Linear, )
POOLING_TYPES = (_AvgPoolNd, _MaxPoolNd, _AdaptiveAvgPoolNd,
_AdaptiveMaxPoolNd)
RELU_TYPES = (nn.ReLU, nn.PReLU, nn.ELU, nn.LeakyReLU, nn.ReLU6)
BN_TYPES = (_BatchNorm, )
UPSAMPLE_TYPES = (nn.Upsample, )
SUPPORTED_TYPES = (
CONV_TYPES + DECONV_TYPES + LINEAR_TYPES + POOLING_TYPES + RELU_TYPES +
BN_TYPES + UPSAMPLE_TYPES)
def get_model_complexity_info(model,
input_res,
print_per_layer_stat=True,
as_strings=True,
input_constructor=None,
ost=sys.stdout):
assert type(input_res) is tuple
assert len(input_res) >= 2
flops_model = add_flops_counting_methods(model)
flops_model.eval().start_flops_count()
if input_constructor:
input = input_constructor(input_res)
_ = flops_model(**input)
else:
batch = torch.ones(()).new_empty(
(1, *input_res),
dtype=next(flops_model.parameters()).dtype,
device=next(flops_model.parameters()).device)
flops_model(batch)
if print_per_layer_stat:
print_model_with_flops(flops_model, ost=ost)
flops_count = flops_model.compute_average_flops_cost()
params_count = get_model_parameters_number(flops_model)
flops_model.stop_flops_count()
if as_strings:
return flops_to_string(flops_count), params_to_string(params_count)
return flops_count, params_count
def flops_to_string(flops, units='GMac', precision=2):
if units is None:
if flops // 10**9 > 0:
return str(round(flops / 10.**9, precision)) + ' GMac'
elif flops // 10**6 > 0:
return str(round(flops / 10.**6, precision)) + ' MMac'
elif flops // 10**3 > 0:
return str(round(flops / 10.**3, precision)) + ' KMac'
else:
return str(flops) + ' Mac'
else:
if units == 'GMac':
return str(round(flops / 10.**9, precision)) + ' ' + units
elif units == 'MMac':
return str(round(flops / 10.**6, precision)) + ' ' + units
elif units == 'KMac':
return str(round(flops / 10.**3, precision)) + ' ' + units
else:
return str(flops) + ' Mac'
def params_to_string(params_num):
"""converting number to string
:param float params_num: number
:returns str: number
>>> params_to_string(1e9)
'1000.0 M'
>>> params_to_string(2e5)
'200.0 k'
>>> params_to_string(3e-9)
'3e-09'
"""
if params_num // 10**6 > 0:
return str(round(params_num / 10**6, 2)) + ' M'
elif params_num // 10**3:
return str(round(params_num / 10**3, 2)) + ' k'
else:
return str(params_num)
def print_model_with_flops(model, units='GMac', precision=3, ost=sys.stdout):
total_flops = model.compute_average_flops_cost()
def accumulate_flops(self):
if is_supported_instance(self):
return self.__flops__ / model.__batch_counter__
else:
sum = 0
for m in self.children():
sum += m.accumulate_flops()
return sum
def flops_repr(self):
accumulated_flops_cost = self.accumulate_flops()
return ', '.join([
flops_to_string(
accumulated_flops_cost, units=units, precision=precision),
'{:.3%} MACs'.format(accumulated_flops_cost / total_flops),
self.original_extra_repr()
])
def add_extra_repr(m):
m.accumulate_flops = accumulate_flops.__get__(m)
flops_extra_repr = flops_repr.__get__(m)
if m.extra_repr != flops_extra_repr:
m.original_extra_repr = m.extra_repr
m.extra_repr = flops_extra_repr
assert m.extra_repr != m.original_extra_repr
def del_extra_repr(m):
if hasattr(m, 'original_extra_repr'):
m.extra_repr = m.original_extra_repr
del m.original_extra_repr
if hasattr(m, 'accumulate_flops'):
del m.accumulate_flops
model.apply(add_extra_repr)
print(model, file=ost)
model.apply(del_extra_repr)
def get_model_parameters_number(model):
params_num = sum(p.numel() for p in model.parameters() if p.requires_grad)
return params_num
def add_flops_counting_methods(net_main_module):
# adding additional methods to the existing module object,
# this is done this way so that each function has access to self object
net_main_module.start_flops_count = start_flops_count.__get__(
net_main_module)
net_main_module.stop_flops_count = stop_flops_count.__get__(
net_main_module)
net_main_module.reset_flops_count = reset_flops_count.__get__(
net_main_module)
net_main_module.compute_average_flops_cost = \
compute_average_flops_cost.__get__(net_main_module)
net_main_module.reset_flops_count()
# Adding variables necessary for masked flops computation
net_main_module.apply(add_flops_mask_variable_or_reset)
return net_main_module
def compute_average_flops_cost(self):
"""
A method that will be available after add_flops_counting_methods() is
called on a desired net object.
Returns current mean flops consumption per image.
"""
batches_count = self.__batch_counter__
flops_sum = 0
for module in self.modules():
if is_supported_instance(module):
flops_sum += module.__flops__
return flops_sum / batches_count
def start_flops_count(self):
"""
A method that will be available after add_flops_counting_methods() is
called on a desired net object.
Activates the computation of mean flops consumption per image.
Call it before you run the network.
"""
add_batch_counter_hook_function(self)
self.apply(add_flops_counter_hook_function)
def stop_flops_count(self):
"""
A method that will be available after add_flops_counting_methods() is
called on a desired net object.
Stops computing the mean flops consumption per image.
Call whenever you want to pause the computation.
"""
remove_batch_counter_hook_function(self)
self.apply(remove_flops_counter_hook_function)
def reset_flops_count(self):
"""
A method that will be available after add_flops_counting_methods() is
called on a desired net object.
Resets statistics computed so far.
"""
add_batch_counter_variables_or_reset(self)
self.apply(add_flops_counter_variable_or_reset)
def add_flops_mask(module, mask):
def add_flops_mask_func(module):
if isinstance(module, torch.nn.Conv2d):
module.__mask__ = mask
module.apply(add_flops_mask_func)
def remove_flops_mask(module):
module.apply(add_flops_mask_variable_or_reset)
def is_supported_instance(module):
if isinstance(module, SUPPORTED_TYPES):
return True
else:
return False
def empty_flops_counter_hook(module, input, output):
module.__flops__ += 0
def upsample_flops_counter_hook(module, input, output):
output_size = output[0]
batch_size = output_size.shape[0]
output_elements_count = batch_size
for val in output_size.shape[1:]:
output_elements_count *= val
module.__flops__ += int(output_elements_count)
def relu_flops_counter_hook(module, input, output):
active_elements_count = output.numel()
module.__flops__ += int(active_elements_count)
def linear_flops_counter_hook(module, input, output):
input = input[0]
batch_size = input.shape[0]
module.__flops__ += int(batch_size * input.shape[1] * output.shape[1])
def pool_flops_counter_hook(module, input, output):
input = input[0]
module.__flops__ += int(np.prod(input.shape))
def bn_flops_counter_hook(module, input, output):
module.affine
input = input[0]
batch_flops = np.prod(input.shape)
if module.affine:
batch_flops *= 2
module.__flops__ += int(batch_flops)
def deconv_flops_counter_hook(conv_module, input, output):
# Can have multiple inputs, getting the first one
input = input[0]
batch_size = input.shape[0]
input_height, input_width = input.shape[2:]
kernel_height, kernel_width = conv_module.kernel_size
in_channels = conv_module.in_channels
out_channels = conv_module.out_channels
groups = conv_module.groups
filters_per_channel = out_channels // groups
conv_per_position_flops = (
kernel_height * kernel_width * in_channels * filters_per_channel)
active_elements_count = batch_size * input_height * input_width
overall_conv_flops = conv_per_position_flops * active_elements_count
bias_flops = 0
if conv_module.bias is not None:
output_height, output_width = output.shape[2:]
bias_flops = out_channels * batch_size * output_height * output_height
overall_flops = overall_conv_flops + bias_flops
conv_module.__flops__ += int(overall_flops)
def conv_flops_counter_hook(conv_module, input, output):
# Can have multiple inputs, getting the first one
input = input[0]
batch_size = input.shape[0]
output_dims = list(output.shape[2:])
kernel_dims = list(conv_module.kernel_size)
in_channels = conv_module.in_channels
out_channels = conv_module.out_channels
groups = conv_module.groups
filters_per_channel = out_channels // groups
conv_per_position_flops = np.prod(
kernel_dims) * in_channels * filters_per_channel
active_elements_count = batch_size * np.prod(output_dims)
if conv_module.__mask__ is not None:
# (b, 1, h, w)
output_height, output_width = output.shape[2:]
flops_mask = conv_module.__mask__.expand(batch_size, 1, output_height,
output_width)
active_elements_count = flops_mask.sum()
overall_conv_flops = conv_per_position_flops * active_elements_count
bias_flops = 0
if conv_module.bias is not None:
bias_flops = out_channels * active_elements_count
overall_flops = overall_conv_flops + bias_flops
conv_module.__flops__ += int(overall_flops)
def batch_counter_hook(module, input, output):
batch_size = 1
if len(input) > 0:
# Can have multiple inputs, getting the first one
input = input[0]
batch_size = len(input)
else:
print('Warning! No positional inputs found for a module, '
'assuming batch size is 1.')
module.__batch_counter__ += batch_size
def add_batch_counter_variables_or_reset(module):
module.__batch_counter__ = 0
def add_batch_counter_hook_function(module):
if hasattr(module, '__batch_counter_handle__'):
return
handle = module.register_forward_hook(batch_counter_hook)
module.__batch_counter_handle__ = handle
def remove_batch_counter_hook_function(module):
if hasattr(module, '__batch_counter_handle__'):
module.__batch_counter_handle__.remove()
del module.__batch_counter_handle__
def add_flops_counter_variable_or_reset(module):
if is_supported_instance(module):
module.__flops__ = 0
def add_flops_counter_hook_function(module):
if is_supported_instance(module):
if hasattr(module, '__flops_handle__'):
return
if isinstance(module, CONV_TYPES):
handle = module.register_forward_hook(conv_flops_counter_hook)
elif isinstance(module, RELU_TYPES):
handle = module.register_forward_hook(relu_flops_counter_hook)
elif isinstance(module, LINEAR_TYPES):
handle = module.register_forward_hook(linear_flops_counter_hook)
elif isinstance(module, POOLING_TYPES):
handle = module.register_forward_hook(pool_flops_counter_hook)
elif isinstance(module, BN_TYPES):
handle = module.register_forward_hook(bn_flops_counter_hook)
elif isinstance(module, UPSAMPLE_TYPES):
handle = module.register_forward_hook(upsample_flops_counter_hook)
elif isinstance(module, DECONV_TYPES):
handle = module.register_forward_hook(deconv_flops_counter_hook)
else:
handle = module.register_forward_hook(empty_flops_counter_hook)
module.__flops_handle__ = handle
def remove_flops_counter_hook_function(module):
if is_supported_instance(module):
if hasattr(module, '__flops_handle__'):
module.__flops_handle__.remove()
del module.__flops_handle__
# --- Masked flops counting
# Also being run in the initialization
def add_flops_mask_variable_or_reset(module):
if is_supported_instance(module):
module.__mask__ = None
| 14,351
| 32.069124
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/utils/__init__.py
|
from .flops_counter import get_model_complexity_info
from .registry import Registry, build_from_cfg
__all__ = ['Registry', 'build_from_cfg', 'get_model_complexity_info']
| 171
| 33.4
| 69
|
py
|
s2anet
|
s2anet-master/mmdet/ops/context_block.py
|
import torch
from mmcv.cnn import constant_init, kaiming_init
from torch import nn
def last_zero_init(m):
if isinstance(m, nn.Sequential):
constant_init(m[-1], val=0)
else:
constant_init(m, val=0)
class ContextBlock(nn.Module):
def __init__(self,
inplanes,
ratio,
pooling_type='att',
fusion_types=('channel_add', )):
super(ContextBlock, self).__init__()
assert pooling_type in ['avg', 'att']
assert isinstance(fusion_types, (list, tuple))
valid_fusion_types = ['channel_add', 'channel_mul']
assert all([f in valid_fusion_types for f in fusion_types])
assert len(fusion_types) > 0, 'at least one fusion should be used'
self.inplanes = inplanes
self.ratio = ratio
self.planes = int(inplanes * ratio)
self.pooling_type = pooling_type
self.fusion_types = fusion_types
if pooling_type == 'att':
self.conv_mask = nn.Conv2d(inplanes, 1, kernel_size=1)
self.softmax = nn.Softmax(dim=2)
else:
self.avg_pool = nn.AdaptiveAvgPool2d(1)
if 'channel_add' in fusion_types:
self.channel_add_conv = nn.Sequential(
nn.Conv2d(self.inplanes, self.planes, kernel_size=1),
nn.LayerNorm([self.planes, 1, 1]),
nn.ReLU(inplace=True), # yapf: disable
nn.Conv2d(self.planes, self.inplanes, kernel_size=1))
else:
self.channel_add_conv = None
if 'channel_mul' in fusion_types:
self.channel_mul_conv = nn.Sequential(
nn.Conv2d(self.inplanes, self.planes, kernel_size=1),
nn.LayerNorm([self.planes, 1, 1]),
nn.ReLU(inplace=True), # yapf: disable
nn.Conv2d(self.planes, self.inplanes, kernel_size=1))
else:
self.channel_mul_conv = None
self.reset_parameters()
def reset_parameters(self):
if self.pooling_type == 'att':
kaiming_init(self.conv_mask, mode='fan_in')
self.conv_mask.inited = True
if self.channel_add_conv is not None:
last_zero_init(self.channel_add_conv)
if self.channel_mul_conv is not None:
last_zero_init(self.channel_mul_conv)
def spatial_pool(self, x):
batch, channel, height, width = x.size()
if self.pooling_type == 'att':
input_x = x
# [N, C, H * W]
input_x = input_x.view(batch, channel, height * width)
# [N, 1, C, H * W]
input_x = input_x.unsqueeze(1)
# [N, 1, H, W]
context_mask = self.conv_mask(x)
# [N, 1, H * W]
context_mask = context_mask.view(batch, 1, height * width)
# [N, 1, H * W]
context_mask = self.softmax(context_mask)
# [N, 1, H * W, 1]
context_mask = context_mask.unsqueeze(-1)
# [N, 1, C, 1]
context = torch.matmul(input_x, context_mask)
# [N, C, 1, 1]
context = context.view(batch, channel, 1, 1)
else:
# [N, C, 1, 1]
context = self.avg_pool(x)
return context
def forward(self, x):
# [N, C, 1, 1]
context = self.spatial_pool(x)
out = x
if self.channel_mul_conv is not None:
# [N, C, 1, 1]
channel_mul_term = torch.sigmoid(self.channel_mul_conv(context))
out = out * channel_mul_term
if self.channel_add_conv is not None:
# [N, C, 1, 1]
channel_add_term = self.channel_add_conv(context)
out = out + channel_add_term
return out
| 3,766
| 34.87619
| 76
|
py
|
s2anet
|
s2anet-master/mmdet/ops/__init__.py
|
from .context_block import ContextBlock
from .dcn import (DeformConv, DeformConvPack, DeformRoIPooling,
DeformRoIPoolingPack, ModulatedDeformConv,
ModulatedDeformConvPack, ModulatedDeformRoIPoolingPack,
deform_conv, deform_roi_pooling, modulated_deform_conv)
from .masked_conv import MaskedConv2d
from .nms import nms, soft_nms
from .nms_rotated import nms_rotated
from .roi_align import RoIAlign, roi_align
from .roi_align_rotated import RoIAlignRotated
from .roi_pool import RoIPool, roi_pool
from .sigmoid_focal_loss import SigmoidFocalLoss, sigmoid_focal_loss
from .ml_nms_rotated import ml_nms_rotated
from .box_iou_rotated_diff import box_iou_rotated_differentiable
__all__ = [
'nms', 'soft_nms', 'RoIAlign', 'roi_align', 'RoIPool', 'roi_pool',
'DeformConv', 'DeformConvPack', 'DeformRoIPooling', 'DeformRoIPoolingPack',
'ModulatedDeformRoIPoolingPack', 'ModulatedDeformConv',
'ModulatedDeformConvPack', 'deform_conv', 'modulated_deform_conv',
'deform_roi_pooling', 'SigmoidFocalLoss', 'sigmoid_focal_loss',
'MaskedConv2d', 'ContextBlock',
'RoIAlignRotated', 'ml_nms_rotated', 'nms_rotated', 'box_iou_rotated_differentiable'
]
| 1,217
| 45.846154
| 88
|
py
|
s2anet
|
s2anet-master/mmdet/ops/dcn/deform_pool.py
|
import torch
import torch.nn as nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from . import deform_pool_cuda
class DeformRoIPoolingFunction(Function):
@staticmethod
def forward(ctx,
data,
rois,
offset,
spatial_scale,
out_size,
out_channels,
no_trans,
group_size=1,
part_size=None,
sample_per_part=4,
trans_std=.0):
# TODO: support unsquare RoIs
out_h, out_w = _pair(out_size)
assert isinstance(out_h, int) and isinstance(out_w, int)
assert out_h == out_w
out_size = out_h # out_h and out_w must be equal
ctx.spatial_scale = spatial_scale
ctx.out_size = out_size
ctx.out_channels = out_channels
ctx.no_trans = no_trans
ctx.group_size = group_size
ctx.part_size = out_size if part_size is None else part_size
ctx.sample_per_part = sample_per_part
ctx.trans_std = trans_std
assert 0.0 <= ctx.trans_std <= 1.0
if not data.is_cuda:
raise NotImplementedError
n = rois.shape[0]
output = data.new_empty(n, out_channels, out_size, out_size)
output_count = data.new_empty(n, out_channels, out_size, out_size)
deform_pool_cuda.deform_psroi_pooling_cuda_forward(
data, rois, offset, output, output_count, ctx.no_trans,
ctx.spatial_scale, ctx.out_channels, ctx.group_size, ctx.out_size,
ctx.part_size, ctx.sample_per_part, ctx.trans_std)
if data.requires_grad or rois.requires_grad or offset.requires_grad:
ctx.save_for_backward(data, rois, offset)
ctx.output_count = output_count
return output
@staticmethod
@once_differentiable
def backward(ctx, grad_output):
if not grad_output.is_cuda:
raise NotImplementedError
data, rois, offset = ctx.saved_tensors
output_count = ctx.output_count
grad_input = torch.zeros_like(data)
grad_rois = None
grad_offset = torch.zeros_like(offset)
deform_pool_cuda.deform_psroi_pooling_cuda_backward(
grad_output, data, rois, offset, output_count, grad_input,
grad_offset, ctx.no_trans, ctx.spatial_scale, ctx.out_channels,
ctx.group_size, ctx.out_size, ctx.part_size, ctx.sample_per_part,
ctx.trans_std)
return (grad_input, grad_rois, grad_offset, None, None, None, None,
None, None, None, None)
deform_roi_pooling = DeformRoIPoolingFunction.apply
class DeformRoIPooling(nn.Module):
def __init__(self,
spatial_scale,
out_size,
out_channels,
no_trans,
group_size=1,
part_size=None,
sample_per_part=4,
trans_std=.0):
super(DeformRoIPooling, self).__init__()
self.spatial_scale = spatial_scale
self.out_size = _pair(out_size)
self.out_channels = out_channels
self.no_trans = no_trans
self.group_size = group_size
self.part_size = out_size if part_size is None else part_size
self.sample_per_part = sample_per_part
self.trans_std = trans_std
def forward(self, data, rois, offset):
if self.no_trans:
offset = data.new_empty(0)
return deform_roi_pooling(data, rois, offset, self.spatial_scale,
self.out_size, self.out_channels,
self.no_trans, self.group_size,
self.part_size, self.sample_per_part,
self.trans_std)
class DeformRoIPoolingPack(DeformRoIPooling):
def __init__(self,
spatial_scale,
out_size,
out_channels,
no_trans,
group_size=1,
part_size=None,
sample_per_part=4,
trans_std=.0,
num_offset_fcs=3,
deform_fc_channels=1024):
super(DeformRoIPoolingPack,
self).__init__(spatial_scale, out_size, out_channels, no_trans,
group_size, part_size, sample_per_part, trans_std)
self.num_offset_fcs = num_offset_fcs
self.deform_fc_channels = deform_fc_channels
if not no_trans:
seq = []
ic = self.out_size[0] * self.out_size[1] * self.out_channels
for i in range(self.num_offset_fcs):
if i < self.num_offset_fcs - 1:
oc = self.deform_fc_channels
else:
oc = self.out_size[0] * self.out_size[1] * 2
seq.append(nn.Linear(ic, oc))
ic = oc
if i < self.num_offset_fcs - 1:
seq.append(nn.ReLU(inplace=True))
self.offset_fc = nn.Sequential(*seq)
self.offset_fc[-1].weight.data.zero_()
self.offset_fc[-1].bias.data.zero_()
def forward(self, data, rois):
assert data.size(1) == self.out_channels
if self.no_trans:
offset = data.new_empty(0)
return deform_roi_pooling(data, rois, offset, self.spatial_scale,
self.out_size, self.out_channels,
self.no_trans, self.group_size,
self.part_size, self.sample_per_part,
self.trans_std)
else:
n = rois.shape[0]
offset = data.new_empty(0)
x = deform_roi_pooling(data, rois, offset, self.spatial_scale,
self.out_size, self.out_channels, True,
self.group_size, self.part_size,
self.sample_per_part, self.trans_std)
offset = self.offset_fc(x.view(n, -1))
offset = offset.view(n, 2, self.out_size[0], self.out_size[1])
return deform_roi_pooling(data, rois, offset, self.spatial_scale,
self.out_size, self.out_channels,
self.no_trans, self.group_size,
self.part_size, self.sample_per_part,
self.trans_std)
class ModulatedDeformRoIPoolingPack(DeformRoIPooling):
def __init__(self,
spatial_scale,
out_size,
out_channels,
no_trans,
group_size=1,
part_size=None,
sample_per_part=4,
trans_std=.0,
num_offset_fcs=3,
num_mask_fcs=2,
deform_fc_channels=1024):
super(ModulatedDeformRoIPoolingPack,
self).__init__(spatial_scale, out_size, out_channels, no_trans,
group_size, part_size, sample_per_part, trans_std)
self.num_offset_fcs = num_offset_fcs
self.num_mask_fcs = num_mask_fcs
self.deform_fc_channels = deform_fc_channels
if not no_trans:
offset_fc_seq = []
ic = self.out_size[0] * self.out_size[1] * self.out_channels
for i in range(self.num_offset_fcs):
if i < self.num_offset_fcs - 1:
oc = self.deform_fc_channels
else:
oc = self.out_size[0] * self.out_size[1] * 2
offset_fc_seq.append(nn.Linear(ic, oc))
ic = oc
if i < self.num_offset_fcs - 1:
offset_fc_seq.append(nn.ReLU(inplace=True))
self.offset_fc = nn.Sequential(*offset_fc_seq)
self.offset_fc[-1].weight.data.zero_()
self.offset_fc[-1].bias.data.zero_()
mask_fc_seq = []
ic = self.out_size[0] * self.out_size[1] * self.out_channels
for i in range(self.num_mask_fcs):
if i < self.num_mask_fcs - 1:
oc = self.deform_fc_channels
else:
oc = self.out_size[0] * self.out_size[1]
mask_fc_seq.append(nn.Linear(ic, oc))
ic = oc
if i < self.num_mask_fcs - 1:
mask_fc_seq.append(nn.ReLU(inplace=True))
else:
mask_fc_seq.append(nn.Sigmoid())
self.mask_fc = nn.Sequential(*mask_fc_seq)
self.mask_fc[-2].weight.data.zero_()
self.mask_fc[-2].bias.data.zero_()
def forward(self, data, rois):
assert data.size(1) == self.out_channels
if self.no_trans:
offset = data.new_empty(0)
return deform_roi_pooling(data, rois, offset, self.spatial_scale,
self.out_size, self.out_channels,
self.no_trans, self.group_size,
self.part_size, self.sample_per_part,
self.trans_std)
else:
n = rois.shape[0]
offset = data.new_empty(0)
x = deform_roi_pooling(data, rois, offset, self.spatial_scale,
self.out_size, self.out_channels, True,
self.group_size, self.part_size,
self.sample_per_part, self.trans_std)
offset = self.offset_fc(x.view(n, -1))
offset = offset.view(n, 2, self.out_size[0], self.out_size[1])
mask = self.mask_fc(x.view(n, -1))
mask = mask.view(n, 1, self.out_size[0], self.out_size[1])
return deform_roi_pooling(
data, rois, offset, self.spatial_scale, self.out_size,
self.out_channels, self.no_trans, self.group_size,
self.part_size, self.sample_per_part, self.trans_std) * mask
| 10,212
| 39.367589
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/ops/dcn/deform_conv.py
|
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from . import deform_conv_cuda
class DeformConvFunction(Function):
@staticmethod
def forward(ctx,
input,
offset,
weight,
stride=1,
padding=0,
dilation=1,
groups=1,
deformable_groups=1,
im2col_step=64):
if input is not None and input.dim() != 4:
raise ValueError(
"Expected 4D tensor as input, got {}D tensor instead.".format(
input.dim()))
ctx.stride = _pair(stride)
ctx.padding = _pair(padding)
ctx.dilation = _pair(dilation)
ctx.groups = groups
ctx.deformable_groups = deformable_groups
ctx.im2col_step = im2col_step
ctx.save_for_backward(input, offset, weight)
output = input.new_empty(
DeformConvFunction._output_size(input, weight, ctx.padding,
ctx.dilation, ctx.stride))
ctx.bufs_ = [input.new_empty(0), input.new_empty(0)] # columns, ones
if not input.is_cuda:
raise NotImplementedError
else:
cur_im2col_step = min(ctx.im2col_step, input.shape[0])
assert (input.shape[0] %
cur_im2col_step) == 0, 'im2col step must divide batchsize'
deform_conv_cuda.deform_conv_forward_cuda(
input, weight, offset, output, ctx.bufs_[0], ctx.bufs_[1],
weight.size(3), weight.size(2), ctx.stride[1], ctx.stride[0],
ctx.padding[1], ctx.padding[0], ctx.dilation[1],
ctx.dilation[0], ctx.groups, ctx.deformable_groups,
cur_im2col_step)
return output
@staticmethod
@once_differentiable
def backward(ctx, grad_output):
input, offset, weight = ctx.saved_tensors
grad_input = grad_offset = grad_weight = None
if not grad_output.is_cuda:
raise NotImplementedError
else:
cur_im2col_step = min(ctx.im2col_step, input.shape[0])
assert (input.shape[0] %
cur_im2col_step) == 0, 'im2col step must divide batchsize'
if ctx.needs_input_grad[0] or ctx.needs_input_grad[1]:
grad_input = torch.zeros_like(input)
grad_offset = torch.zeros_like(offset)
deform_conv_cuda.deform_conv_backward_input_cuda(
input, offset, grad_output, grad_input,
grad_offset, weight, ctx.bufs_[0], weight.size(3),
weight.size(2), ctx.stride[1], ctx.stride[0],
ctx.padding[1], ctx.padding[0], ctx.dilation[1],
ctx.dilation[0], ctx.groups, ctx.deformable_groups,
cur_im2col_step)
if ctx.needs_input_grad[2]:
grad_weight = torch.zeros_like(weight)
deform_conv_cuda.deform_conv_backward_parameters_cuda(
input, offset, grad_output,
grad_weight, ctx.bufs_[0], ctx.bufs_[1], weight.size(3),
weight.size(2), ctx.stride[1], ctx.stride[0],
ctx.padding[1], ctx.padding[0], ctx.dilation[1],
ctx.dilation[0], ctx.groups, ctx.deformable_groups, 1,
cur_im2col_step)
return (grad_input, grad_offset, grad_weight, None, None, None, None,
None)
@staticmethod
def _output_size(input, weight, padding, dilation, stride):
channels = weight.size(0)
output_size = (input.size(0), channels)
for d in range(input.dim() - 2):
in_size = input.size(d + 2)
pad = padding[d]
kernel = dilation[d] * (weight.size(d + 2) - 1) + 1
stride_ = stride[d]
output_size += ((in_size + (2 * pad) - kernel) // stride_ + 1, )
if not all(map(lambda s: s > 0, output_size)):
raise ValueError(
"convolution input is too small (output would be {})".format(
'x'.join(map(str, output_size))))
return output_size
class ModulatedDeformConvFunction(Function):
@staticmethod
def forward(ctx,
input,
offset,
mask,
weight,
bias=None,
stride=1,
padding=0,
dilation=1,
groups=1,
deformable_groups=1):
ctx.stride = stride
ctx.padding = padding
ctx.dilation = dilation
ctx.groups = groups
ctx.deformable_groups = deformable_groups
ctx.with_bias = bias is not None
if not ctx.with_bias:
bias = input.new_empty(1) # fake tensor
if not input.is_cuda:
raise NotImplementedError
if weight.requires_grad or mask.requires_grad or offset.requires_grad \
or input.requires_grad:
ctx.save_for_backward(input, offset, mask, weight, bias)
output = input.new_empty(
ModulatedDeformConvFunction._infer_shape(ctx, input, weight))
ctx._bufs = [input.new_empty(0), input.new_empty(0)]
deform_conv_cuda.modulated_deform_conv_cuda_forward(
input, weight, bias, ctx._bufs[0], offset, mask, output,
ctx._bufs[1], weight.shape[2], weight.shape[3], ctx.stride,
ctx.stride, ctx.padding, ctx.padding, ctx.dilation, ctx.dilation,
ctx.groups, ctx.deformable_groups, ctx.with_bias)
return output
@staticmethod
@once_differentiable
def backward(ctx, grad_output):
if not grad_output.is_cuda:
raise NotImplementedError
input, offset, mask, weight, bias = ctx.saved_tensors
grad_input = torch.zeros_like(input)
grad_offset = torch.zeros_like(offset)
grad_mask = torch.zeros_like(mask)
grad_weight = torch.zeros_like(weight)
grad_bias = torch.zeros_like(bias)
deform_conv_cuda.modulated_deform_conv_cuda_backward(
input, weight, bias, ctx._bufs[0], offset, mask, ctx._bufs[1],
grad_input, grad_weight, grad_bias, grad_offset, grad_mask,
grad_output, weight.shape[2], weight.shape[3], ctx.stride,
ctx.stride, ctx.padding, ctx.padding, ctx.dilation, ctx.dilation,
ctx.groups, ctx.deformable_groups, ctx.with_bias)
if not ctx.with_bias:
grad_bias = None
return (grad_input, grad_offset, grad_mask, grad_weight, grad_bias,
None, None, None, None, None)
@staticmethod
def _infer_shape(ctx, input, weight):
n = input.size(0)
channels_out = weight.size(0)
height, width = input.shape[2:4]
kernel_h, kernel_w = weight.shape[2:4]
height_out = (height + 2 * ctx.padding -
(ctx.dilation * (kernel_h - 1) + 1)) // ctx.stride + 1
width_out = (width + 2 * ctx.padding -
(ctx.dilation * (kernel_w - 1) + 1)) // ctx.stride + 1
return n, channels_out, height_out, width_out
deform_conv = DeformConvFunction.apply
modulated_deform_conv = ModulatedDeformConvFunction.apply
class DeformConv(nn.Module):
def __init__(self,
in_channels,
out_channels,
kernel_size,
stride=1,
padding=0,
dilation=1,
groups=1,
deformable_groups=1,
bias=False):
super(DeformConv, self).__init__()
assert not bias
assert in_channels % groups == 0, \
'in_channels {} cannot be divisible by groups {}'.format(
in_channels, groups)
assert out_channels % groups == 0, \
'out_channels {} cannot be divisible by groups {}'.format(
out_channels, groups)
self.in_channels = in_channels
self.out_channels = out_channels
self.kernel_size = _pair(kernel_size)
self.stride = _pair(stride)
self.padding = _pair(padding)
self.dilation = _pair(dilation)
self.groups = groups
self.deformable_groups = deformable_groups
self.weight = nn.Parameter(
torch.Tensor(out_channels, in_channels // self.groups,
*self.kernel_size))
self.reset_parameters()
def reset_parameters(self):
n = self.in_channels
for k in self.kernel_size:
n *= k
stdv = 1. / math.sqrt(n)
self.weight.data.uniform_(-stdv, stdv)
def forward(self, x, offset):
# return deform_conv(x, offset, self.weight, self.stride, self.padding,
# self.dilation, self.groups, self.deformable_groups)
# To fix an assert error in deform_conv_cuda.cpp:128
# input image is smaller than kernel
input_pad = (
x.size(2) < self.kernel_size[0] or x.size(3) < self.kernel_size[1])
if input_pad:
pad_h = max(self.kernel_size[0] - x.size(2), 0)
pad_w = max(self.kernel_size[1] - x.size(3), 0)
x = F.pad(x, (0, pad_w, 0, pad_h), 'constant', 0).contiguous()
offset = F.pad(offset, (0, pad_w, 0, pad_h), 'constant',
0).contiguous()
out = deform_conv(x, offset, self.weight, self.stride, self.padding,
self.dilation, self.groups, self.deformable_groups)
if input_pad:
out = out[:, :, :out.size(2) - pad_h, :out.size(3) -
pad_w].contiguous()
return out
class DeformConvPack(DeformConv):
def __init__(self, *args, **kwargs):
super(DeformConvPack, self).__init__(*args, **kwargs)
self.conv_offset = nn.Conv2d(
self.in_channels,
self.deformable_groups * 2 * self.kernel_size[0] *
self.kernel_size[1],
kernel_size=self.kernel_size,
stride=_pair(self.stride),
padding=_pair(self.padding),
bias=True)
self.init_offset()
def init_offset(self):
self.conv_offset.weight.data.zero_()
self.conv_offset.bias.data.zero_()
def forward(self, x):
offset = self.conv_offset(x)
return deform_conv(x, offset, self.weight, self.stride, self.padding,
self.dilation, self.groups, self.deformable_groups)
class ModulatedDeformConv(nn.Module):
def __init__(self,
in_channels,
out_channels,
kernel_size,
stride=1,
padding=0,
dilation=1,
groups=1,
deformable_groups=1,
bias=True):
super(ModulatedDeformConv, self).__init__()
self.in_channels = in_channels
self.out_channels = out_channels
self.kernel_size = _pair(kernel_size)
self.stride = stride
self.padding = padding
self.dilation = dilation
self.groups = groups
self.deformable_groups = deformable_groups
self.with_bias = bias
self.weight = nn.Parameter(
torch.Tensor(out_channels, in_channels // groups,
*self.kernel_size))
if bias:
self.bias = nn.Parameter(torch.Tensor(out_channels))
else:
self.register_parameter('bias', None)
self.reset_parameters()
def reset_parameters(self):
n = self.in_channels
for k in self.kernel_size:
n *= k
stdv = 1. / math.sqrt(n)
self.weight.data.uniform_(-stdv, stdv)
if self.bias is not None:
self.bias.data.zero_()
def forward(self, x, offset, mask):
return modulated_deform_conv(x, offset, mask, self.weight, self.bias,
self.stride, self.padding, self.dilation,
self.groups, self.deformable_groups)
class ModulatedDeformConvPack(ModulatedDeformConv):
def __init__(self, *args, **kwargs):
super(ModulatedDeformConvPack, self).__init__(*args, **kwargs)
self.conv_offset_mask = nn.Conv2d(
self.in_channels,
self.deformable_groups * 3 * self.kernel_size[0] *
self.kernel_size[1],
kernel_size=self.kernel_size,
stride=_pair(self.stride),
padding=_pair(self.padding),
bias=True)
self.init_offset()
def init_offset(self):
self.conv_offset_mask.weight.data.zero_()
self.conv_offset_mask.bias.data.zero_()
def forward(self, x):
out = self.conv_offset_mask(x)
o1, o2, mask = torch.chunk(out, 3, dim=1)
offset = torch.cat((o1, o2), dim=1)
mask = torch.sigmoid(mask)
return modulated_deform_conv(x, offset, mask, self.weight, self.bias,
self.stride, self.padding, self.dilation,
self.groups, self.deformable_groups)
| 13,344
| 36.591549
| 80
|
py
|
s2anet
|
s2anet-master/mmdet/ops/dcn/__init__.py
|
from .deform_conv import (DeformConv, DeformConvPack, ModulatedDeformConv,
ModulatedDeformConvPack, deform_conv,
modulated_deform_conv)
from .deform_pool import (DeformRoIPooling, DeformRoIPoolingPack,
ModulatedDeformRoIPoolingPack, deform_roi_pooling)
__all__ = [
'DeformConv', 'DeformConvPack', 'ModulatedDeformConv',
'ModulatedDeformConvPack', 'DeformRoIPooling', 'DeformRoIPoolingPack',
'ModulatedDeformRoIPoolingPack', 'deform_conv', 'modulated_deform_conv',
'deform_roi_pooling'
]
| 582
| 43.846154
| 76
|
py
|
s2anet
|
s2anet-master/mmdet/ops/orn/__init__.py
|
from .modules.ORConv import ORConv2d
from .functions import rotation_invariant_encoding,RotationInvariantPooling
| 113
| 37
| 75
|
py
|
s2anet
|
s2anet-master/mmdet/ops/orn/functions/active_rotating_filter.py
|
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from torch import nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from .. import orn_cuda
#import _C
class _ActiveRotatingFilter(Function):
@staticmethod
def forward(ctx, input, indices):
indices = indices.byte()
ctx.input = input
output = orn_cuda.arf_forward(input, indices)
ctx.save_for_backward(indices)
return output
@staticmethod
@once_differentiable
def backward(ctx, grad_output):
indices, = ctx.saved_tensors
input = ctx.input
grad_input = orn_cuda.arf_backward(indices, grad_output)
return grad_input, None
active_rotating_filter = _ActiveRotatingFilter.apply
class ActiveRotatingFilter(nn.Module):
def __init__(self, indices):
super(ActiveRotatingFilter, self).__init__()
self.indices = indices
def forward(self, input):
return active_rotating_filter(input, self.indices)
if __name__ == "__main__":
import math
def get_indices(nOrientation, nRotation, kernel_size, mode='fast'):
kernel_indices = {
1: {
0: (1,),
45: (1,),
90: (1,),
135: (1,),
180: (1,),
225: (1,),
270: (1,),
315: (1,)
},
3: {
0: (1,2,3,4,5,6,7,8,9),
45: (2,3,6,1,5,9,4,7,8),
90: (3,6,9,2,5,8,1,4,7),
135: (6,9,8,3,5,7,2,1,4),
180: (9,8,7,6,5,4,3,2,1),
225: (8,7,4,9,5,1,6,3,2),
270: (7,4,1,8,5,2,9,6,3),
315: (4,1,2,7,5,3,8,9,6)
}
}
delta_orientation = 360 / nOrientation
delta_rotation = 360 / nRotation
kH, kW = kernel_size
indices = torch.ByteTensor(nOrientation * kH * kW, nRotation)
for i in range(0, nOrientation):
for j in range(0, kH * kW):
for k in range(0, nRotation):
angle = delta_rotation * k
layer = (i + math.floor(angle / delta_orientation)) % nOrientation
kernel = kernel_indices[kW][angle][j]
indices[i * kH * kW + j, k] = int(layer * kH * kW + kernel)
return indices.view(nOrientation, kH, kW, nRotation)
out_channels = 4
in_channels = 2
nOrientation = 8
nRotation = 8
kernel_size = 3
input = torch.randn(out_channels, in_channels, nOrientation, kernel_size, kernel_size)
input.requires_grad = True
input = input.double()
indices = get_indices(nOrientation, nRotation, (kernel_size, kernel_size))
input = input.cuda()
indices = indices.cuda()
output = active_rotating_filter(input, indices)
print(output.size())
res = torch.autograd.gradcheck(active_rotating_filter, (input, indices), raise_exception=True)
print(res)
| 2,736
| 27.510417
| 96
|
py
|
s2anet
|
s2anet-master/mmdet/ops/orn/functions/rotation_invariant_pooling.py
|
import torch
from torch import nn
from torch.nn import functional as F
class RotationInvariantPooling(nn.Module):
def __init__(self, nInputPlane, nOrientation=8):
super(RotationInvariantPooling, self).__init__()
self.nInputPlane = nInputPlane
self.nOrientation = nOrientation
hiddent_dim = int(nInputPlane / nOrientation)
self.conv = nn.Sequential(
nn.Conv2d(hiddent_dim, nInputPlane, 1, 1),
nn.BatchNorm2d(nInputPlane),
)
def forward(self, x):
# x: [N, c, 1, w]
## first, max_pooling along orientation.
N, c, h, w = x.size()
x = x.view(N, -1, self.nOrientation, h, w)
x, _ = x.max(dim=2, keepdim=False) # [N, nInputPlane/nOrientation, 1, w]
# MODIFIED
# x = self.conv(x) # [N, nInputPlane, 1, w]
return x
if __name__ == '__main__':
inst = RotationInvariantPooling(512, 8)
input = torch.randn(8, 512, 1, 25)
output = inst(input)
print(output.size())
| 940
| 26.676471
| 76
|
py
|
s2anet
|
s2anet-master/mmdet/ops/orn/functions/__init__.py
|
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from .active_rotating_filter import active_rotating_filter
from .active_rotating_filter import ActiveRotatingFilter
from .rotation_invariant_encoding import rotation_invariant_encoding
from .rotation_invariant_encoding import RotationInvariantEncoding
from .rotation_invariant_pooling import RotationInvariantPooling
__all__ = ['ActiveRotatingFilter', 'active_rotating_filter', 'rotation_invariant_encoding', 'RotationInvariantEncoding', 'RotationInvariantPooling']
| 551
| 60.333333
| 148
|
py
|
s2anet
|
s2anet-master/mmdet/ops/orn/functions/rotation_invariant_encoding.py
|
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
import torch
from torch import nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from .. import orn_cuda
class _RotationInvariantEncoding(Function):
@staticmethod
def forward(ctx, input, nOrientation, return_direction=False):
ctx.nOrientation = nOrientation
ctx.return_direction = return_direction
mainDirection, output = orn_cuda.rie_forward(input, nOrientation)
if return_direction:
ctx.save_for_backward(input, mainDirection)
ctx.mark_non_differentiable(mainDirection)
return output, mainDirection
else:
ctx.save_for_backward(input)
ctx.mainDirection = mainDirection
return output
@staticmethod
@once_differentiable
def backward(ctx, grad_output):
if ctx.return_direction:
input, mainDirection = ctx.saved_tensors
else:
input, = ctx.saved_tensors
mainDirection = ctx.mainDirection
grad_input = orn_cuda.rie_backward(mainDirection, grad_output, ctx.nOrientation)
return grad_input, None, None
rotation_invariant_encoding = _RotationInvariantEncoding.apply
class RotationInvariantEncoding(nn.Module):
def __init__(self, nOrientation, return_direction=False):
super(RotationInvariantEncoding, self).__init__()
self.nOrientation = nOrientation
self.return_direction = return_direction
def forward(self, input):
return rotation_invariant_encoding(input, self.nOrientation, self.return_direction)
if __name__ == '__main__':
nOrientation = 8
input = torch.randn(2,8,1,1).double()#.cuda()
input.requires_grad = True
output = rotation_invariant_encoding(input, nOrientation)
# check grad
res = torch.autograd.gradcheck(rotation_invariant_encoding, (input, nOrientation), raise_exception=True)
print(res)
| 1,900
| 31.775862
| 106
|
py
|
s2anet
|
s2anet-master/mmdet/ops/orn/modules/ORConv.py
|
from __future__ import absolute_import
import math
import torch
from torch.nn.parameter import Parameter
import torch.nn.functional as F
from torch.nn.modules import Conv2d
from torch.nn.modules.utils import _pair
from ..functions import active_rotating_filter
class ORConv2d(Conv2d):
def __init__(self, in_channels, out_channels, kernel_size=3, arf_config=None, stride=1,
padding=0, dilation=1, groups=1, bias=True):
self.nOrientation, self.nRotation = _pair(arf_config)
assert (math.log(self.nOrientation) + 1e-5) % math.log(2) < 1e-3, 'invalid nOrientation {}'.format(self.nOrientation)
assert (math.log(self.nRotation) + 1e-5) % math.log(2) < 1e-3, 'invalid nRotation {}'.format(self.nRotation)
super(ORConv2d, self).__init__(
in_channels, out_channels, kernel_size,
stride, padding, dilation, groups, bias)
self.register_buffer("indices", self.get_indices())
# re-create weight/bias
# self.weight.data.resize_(out_channels, in_channels, self.nOrientation, *self.kernel_size)
# if bias:
# self.bias.data.resize_(out_channels * self.nRotation)
self.weight = Parameter(torch.Tensor(out_channels, in_channels, self.nOrientation, *self.kernel_size))
if bias:
self.bias = Parameter(torch.Tensor(out_channels * self.nRotation))
self.reset_parameters()
def reset_parameters(self):
n = self.in_channels * self.nOrientation
for k in self.kernel_size:
n *= k
self.weight.data.normal_(0, math.sqrt(2.0 / n))
if self.bias is not None:
self.bias.data.zero_()
def get_indices(self, mode='fast'):
kernel_indices = {
1: {
0: (1,),
45: (1,),
90: (1,),
135: (1,),
180: (1,),
225: (1,),
270: (1,),
315: (1,)
},
3: {
0: (1,2,3,4,5,6,7,8,9),
45: (2,3,6,1,5,9,4,7,8),
90: (3,6,9,2,5,8,1,4,7),
135: (6,9,8,3,5,7,2,1,4),
180: (9,8,7,6,5,4,3,2,1),
225: (8,7,4,9,5,1,6,3,2),
270: (7,4,1,8,5,2,9,6,3),
315: (4,1,2,7,5,3,8,9,6)
}
}
delta_orientation = 360 / self.nOrientation
delta_rotation = 360 / self.nRotation
kH, kW = self.kernel_size
indices = torch.ByteTensor(self.nOrientation * kH * kW, self.nRotation)
for i in range(0, self.nOrientation):
for j in range(0, kH * kW):
for k in range(0, self.nRotation):
angle = delta_rotation * k
layer = (i + math.floor(angle / delta_orientation)) % self.nOrientation
kernel = kernel_indices[kW][angle][j]
indices[i * kH * kW + j, k] = int(layer * kH * kW + kernel)
return indices.view(self.nOrientation, kH, kW, self.nRotation)
def rotate_arf(self):
return active_rotating_filter(self.weight, self.indices)
def forward(self, input):
return F.conv2d(input, self.rotate_arf(), self.bias, self.stride,
self.padding, self.dilation, self.groups)
def __repr__(self):
arf_config = '[{}]'.format(self.nOrientation) \
if self.nOrientation == self.nRotation \
else '[{}-{}]'.format(self.nOrientation, self.nRotation)
s = ('{name}({arf_config} {in_channels}, {out_channels}, kernel_size={kernel_size}'
', stride={stride}')
if self.padding != (0,) * len(self.padding):
s += ', padding={padding}'
if self.dilation != (1,) * len(self.dilation):
s += ', dilation={dilation}'
if self.output_padding != (0,) * len(self.output_padding):
s += ', output_padding={output_padding}'
if self.groups != 1:
s += ', groups={groups}'
if self.bias is None:
s += ', bias=False'
s += ')'
return s.format(name=self.__class__.__name__, arf_config=arf_config, **self.__dict__)
| 3,732
| 35.960396
| 121
|
py
|
s2anet
|
s2anet-master/mmdet/ops/orn/modules/__init__.py
|
from .ORConv import ORConv2d
#from .ORConv_v2 import ORConv2d_v2
#__all__ = ['ORConv2d', 'ORConv2d_v2']
__all__ = ['ORConv2d']
| 128
| 20.5
| 38
|
py
|
s2anet
|
s2anet-master/mmdet/ops/box_iou_rotated/__init__.py
|
from .box_iou_rotated_cuda import box_iou_rotated
__all__ = ['box_iou_rotated']
| 81
| 19.5
| 49
|
py
|
s2anet
|
s2anet-master/mmdet/ops/ml_nms_rotated/__init__.py
|
from .ml_nms_rotated_cuda import ml_nms_rotated
__all__=['ml_nms_rotated']
| 76
| 18.25
| 47
|
py
|
s2anet
|
s2anet-master/mmdet/ops/masked_conv/masked_conv.py
|
import math
import torch
import torch.nn as nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from . import masked_conv2d_cuda
class MaskedConv2dFunction(Function):
@staticmethod
def forward(ctx, features, mask, weight, bias, padding=0, stride=1):
assert mask.dim() == 3 and mask.size(0) == 1
assert features.dim() == 4 and features.size(0) == 1
assert features.size()[2:] == mask.size()[1:]
pad_h, pad_w = _pair(padding)
stride_h, stride_w = _pair(stride)
if stride_h != 1 or stride_w != 1:
raise ValueError(
'Stride could not only be 1 in masked_conv2d currently.')
if not features.is_cuda:
raise NotImplementedError
out_channel, in_channel, kernel_h, kernel_w = weight.size()
batch_size = features.size(0)
out_h = int(
math.floor((features.size(2) + 2 * pad_h -
(kernel_h - 1) - 1) / stride_h + 1))
out_w = int(
math.floor((features.size(3) + 2 * pad_w -
(kernel_h - 1) - 1) / stride_w + 1))
mask_inds = torch.nonzero(mask[0] > 0)
output = features.new_zeros(batch_size, out_channel, out_h, out_w)
if mask_inds.numel() > 0:
mask_h_idx = mask_inds[:, 0].contiguous()
mask_w_idx = mask_inds[:, 1].contiguous()
data_col = features.new_zeros(in_channel * kernel_h * kernel_w,
mask_inds.size(0))
masked_conv2d_cuda.masked_im2col_forward(features, mask_h_idx,
mask_w_idx, kernel_h,
kernel_w, pad_h, pad_w,
data_col)
masked_output = torch.addmm(1, bias[:, None], 1,
weight.view(out_channel, -1), data_col)
masked_conv2d_cuda.masked_col2im_forward(masked_output, mask_h_idx,
mask_w_idx, out_h, out_w,
out_channel, output)
return output
@staticmethod
@once_differentiable
def backward(ctx, grad_output):
return (None, ) * 5
masked_conv2d = MaskedConv2dFunction.apply
class MaskedConv2d(nn.Conv2d):
"""A MaskedConv2d which inherits the official Conv2d.
The masked forward doesn't implement the backward function and only
supports the stride parameter to be 1 currently.
"""
def __init__(self,
in_channels,
out_channels,
kernel_size,
stride=1,
padding=0,
dilation=1,
groups=1,
bias=True):
super(MaskedConv2d,
self).__init__(in_channels, out_channels, kernel_size, stride,
padding, dilation, groups, bias)
def forward(self, input, mask=None):
if mask is None: # fallback to the normal Conv2d
return super(MaskedConv2d, self).forward(input)
else:
return masked_conv2d(input, mask, self.weight, self.bias,
self.padding)
| 3,375
| 36.511111
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/ops/masked_conv/__init__.py
|
from .masked_conv import MaskedConv2d, masked_conv2d
__all__ = ['masked_conv2d', 'MaskedConv2d']
| 98
| 23.75
| 52
|
py
|
s2anet
|
s2anet-master/mmdet/ops/sigmoid_focal_loss/sigmoid_focal_loss.py
|
import torch.nn as nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from . import sigmoid_focal_loss_cuda
class SigmoidFocalLossFunction(Function):
@staticmethod
def forward(ctx, input, target, gamma=2.0, alpha=0.25):
ctx.save_for_backward(input, target)
num_classes = input.shape[1]
ctx.num_classes = num_classes
ctx.gamma = gamma
ctx.alpha = alpha
loss = sigmoid_focal_loss_cuda.forward(input, target, num_classes,
gamma, alpha)
return loss
@staticmethod
@once_differentiable
def backward(ctx, d_loss):
input, target = ctx.saved_tensors
num_classes = ctx.num_classes
gamma = ctx.gamma
alpha = ctx.alpha
d_loss = d_loss.contiguous()
d_input = sigmoid_focal_loss_cuda.backward(input, target, d_loss,
num_classes, gamma, alpha)
return d_input, None, None, None, None
sigmoid_focal_loss = SigmoidFocalLossFunction.apply
# TODO: remove this module
class SigmoidFocalLoss(nn.Module):
def __init__(self, gamma, alpha):
super(SigmoidFocalLoss, self).__init__()
self.gamma = gamma
self.alpha = alpha
def forward(self, logits, targets):
assert logits.is_cuda
loss = sigmoid_focal_loss(logits, targets, self.gamma, self.alpha)
return loss.sum()
def __repr__(self):
tmpstr = self.__class__.__name__ + '(gamma={}, alpha={})'.format(
self.gamma, self.alpha)
return tmpstr
| 1,637
| 28.781818
| 77
|
py
|
s2anet
|
s2anet-master/mmdet/ops/sigmoid_focal_loss/__init__.py
|
from .sigmoid_focal_loss import SigmoidFocalLoss, sigmoid_focal_loss
__all__ = ['SigmoidFocalLoss', 'sigmoid_focal_loss']
| 123
| 30
| 68
|
py
|
s2anet
|
s2anet-master/mmdet/ops/roi_align/roi_align.py
|
import torch.nn as nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from . import roi_align_cuda
class RoIAlignFunction(Function):
@staticmethod
def forward(ctx, features, rois, out_size, spatial_scale, sample_num=0):
out_h, out_w = _pair(out_size)
assert isinstance(out_h, int) and isinstance(out_w, int)
ctx.spatial_scale = spatial_scale
ctx.sample_num = sample_num
ctx.save_for_backward(rois)
ctx.feature_size = features.size()
batch_size, num_channels, data_height, data_width = features.size()
num_rois = rois.size(0)
output = features.new_zeros(num_rois, num_channels, out_h, out_w)
if features.is_cuda:
roi_align_cuda.forward(features, rois, out_h, out_w, spatial_scale,
sample_num, output)
else:
raise NotImplementedError
return output
@staticmethod
@once_differentiable
def backward(ctx, grad_output):
feature_size = ctx.feature_size
spatial_scale = ctx.spatial_scale
sample_num = ctx.sample_num
rois = ctx.saved_tensors[0]
assert (feature_size is not None and grad_output.is_cuda)
batch_size, num_channels, data_height, data_width = feature_size
out_w = grad_output.size(3)
out_h = grad_output.size(2)
grad_input = grad_rois = None
if ctx.needs_input_grad[0]:
grad_input = rois.new_zeros(batch_size, num_channels, data_height,
data_width)
roi_align_cuda.backward(grad_output.contiguous(), rois, out_h,
out_w, spatial_scale, sample_num,
grad_input)
return grad_input, grad_rois, None, None, None
roi_align = RoIAlignFunction.apply
class RoIAlign(nn.Module):
def __init__(self,
out_size,
spatial_scale,
sample_num=0,
use_torchvision=False):
super(RoIAlign, self).__init__()
self.out_size = _pair(out_size)
self.spatial_scale = float(spatial_scale)
self.sample_num = int(sample_num)
self.use_torchvision = use_torchvision
def forward(self, features, rois):
if self.use_torchvision:
from torchvision.ops import roi_align as tv_roi_align
return tv_roi_align(features, rois, self.out_size,
self.spatial_scale, self.sample_num)
else:
return roi_align(features, rois, self.out_size, self.spatial_scale,
self.sample_num)
def __repr__(self):
format_str = self.__class__.__name__
format_str += '(out_size={}, spatial_scale={}, sample_num={}'.format(
self.out_size, self.spatial_scale, self.sample_num)
format_str += ', use_torchvision={})'.format(self.use_torchvision)
return format_str
| 3,068
| 33.875
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/ops/roi_align/gradcheck.py
|
import os.path as osp
import sys
import numpy as np
import torch
from torch.autograd import gradcheck
sys.path.append(osp.abspath(osp.join(__file__, '../../')))
from roi_align import RoIAlign # noqa: E402, isort:skip
feat_size = 15
spatial_scale = 1.0 / 8
img_size = feat_size / spatial_scale
num_imgs = 2
num_rois = 20
batch_ind = np.random.randint(num_imgs, size=(num_rois, 1))
rois = np.random.rand(num_rois, 4) * img_size * 0.5
rois[:, 2:] += img_size * 0.5
rois = np.hstack((batch_ind, rois))
feat = torch.randn(
num_imgs, 16, feat_size, feat_size, requires_grad=True, device='cuda:0')
rois = torch.from_numpy(rois).float().cuda()
inputs = (feat, rois)
print('Gradcheck for roi align...')
test = gradcheck(RoIAlign(3, spatial_scale), inputs, atol=1e-3, eps=1e-3)
print(test)
test = gradcheck(RoIAlign(3, spatial_scale, 2), inputs, atol=1e-3, eps=1e-3)
print(test)
| 879
| 27.387097
| 76
|
py
|
s2anet
|
s2anet-master/mmdet/ops/roi_align/__init__.py
|
from .roi_align import RoIAlign, roi_align
__all__ = ['roi_align', 'RoIAlign']
| 80
| 19.25
| 42
|
py
|
s2anet
|
s2anet-master/mmdet/ops/box_iou_rotated_diff/box_iou_rotated_diff.py
|
"""
Differentiable IoU calculation for rotated boxes
Most of the code is adapted from https://github.com/lilanxiao/Rotated_IoU
"""
import torch
from .box_intersection_2d import oriented_box_intersection_2d
def rotated_box_to_poly(rotated_boxes: torch.Tensor):
""" Transform rotated boxes to polygons
Args:
rotated_boxes (Tensor): (x, y, w, h, a) with shape (n, 5)
Return:
polys (Tensor): 4 corner points (x, y) of polygons with shape (n, 4, 2)
"""
cs = torch.cos(rotated_boxes[:, 4])
ss = torch.sin(rotated_boxes[:, 4])
w = rotated_boxes[:, 2] - 1
h = rotated_boxes[:, 3] - 1
x_ctr = rotated_boxes[:, 0]
y_ctr = rotated_boxes[:, 1]
x1 = x_ctr + cs * (w / 2.0) - ss * (-h / 2.0)
x2 = x_ctr + cs * (w / 2.0) - ss * (h / 2.0)
x3 = x_ctr + cs * (-w / 2.0) - ss * (h / 2.0)
x4 = x_ctr + cs * (-w / 2.0) - ss * (-h / 2.0)
y1 = y_ctr + ss * (w / 2.0) + cs * (-h / 2.0)
y2 = y_ctr + ss * (w / 2.0) + cs * (h / 2.0)
y3 = y_ctr + ss * (-w / 2.0) + cs * (h / 2.0)
y4 = y_ctr + ss * (-w / 2.0) + cs * (-h / 2.0)
polys = torch.stack([x1, y1, x2, y2, x3, y3, x4, y4], dim=-1)
polys = polys.reshape(-1, 4, 2) # to (n, 4, 2)
return polys
def box_iou_rotated_differentiable(boxes1: torch.Tensor, boxes2: torch.Tensor, iou_only: bool = True):
"""Calculate IoU between rotated boxes
Args:
box1 (torch.Tensor): (n, 5)
box2 (torch.Tensor): (n, 5)
iou_only: Whether to keep other vars, e.g., polys, unions. Default True to drop these vars.
Returns:
iou (torch.Tensor): (n, )
polys1 (torch.Tensor): (n, 4, 2)
polys2 (torch.Tensor): (n, 4, 2)
U (torch.Tensor): (n) area1 + area2 - inter_area
"""
# transform to polygons
polys1 = rotated_box_to_poly(boxes1)
polys2 = rotated_box_to_poly(boxes2)
# calculate insection areas
inter_area, _ = oriented_box_intersection_2d(polys1, polys2)
area1 = boxes1[..., 2] * boxes1[..., 3]
area2 = boxes2[..., 2] * boxes2[..., 3]
union = area1 + area2 - inter_area
iou = inter_area / union
if iou_only:
return iou
else:
return iou, union, polys1, polys2,
| 2,207
| 32.454545
| 102
|
py
|
s2anet
|
s2anet-master/mmdet/ops/box_iou_rotated_diff/box_intersection_2d.py
|
'''
torch implementation of 2d oriented box intersection
author: lanxiao li
Modified by csuhan:
Remove the `batch` indice in a tensor.
This setting is more suitable for mmdet.
'''
import torch
from .sort_vertices_cuda import sort_vertices_forward
EPSILON = 1e-8
def get_intersection_points(polys1: torch.Tensor, polys2: torch.Tensor):
"""Find intersection points of rectangles
Convention: if two edges are collinear, there is no intersection point
Args:
polys1 (torch.Tensor): n, 4, 2
polys2 (torch.Tensor): n, 4, 2
Returns:
intersectons (torch.Tensor): n, 4, 4, 2
mask (torch.Tensor) : n, 4, 4; bool
"""
# build edges from corners
line1 = torch.cat([polys1, polys1[..., [1, 2, 3, 0], :]],
dim=2) # n, 4, 4: Box, edge, point
line2 = torch.cat([polys2, polys2[..., [1, 2, 3, 0], :]], dim=2)
# duplicate data to pair each edges from the boxes
# (n, 4, 4) -> (n, 4, 4, 4) : Box, edge1, edge2, point
line1_ext = line1.unsqueeze(2).repeat([1, 1, 4, 1])
line2_ext = line2.unsqueeze(1).repeat([1, 4, 1, 1])
x1 = line1_ext[..., 0]
y1 = line1_ext[..., 1]
x2 = line1_ext[..., 2]
y2 = line1_ext[..., 3]
x3 = line2_ext[..., 0]
y3 = line2_ext[..., 1]
x4 = line2_ext[..., 2]
y4 = line2_ext[..., 3]
# math: https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection
num = (x1-x2)*(y3-y4) - (y1-y2)*(x3-x4)
den_t = (x1-x3)*(y3-y4) - (y1-y3)*(x3-x4)
t = den_t / num
t[num == .0] = -1.
mask_t = (t > 0) * (t < 1) # intersection on line segment 1
den_u = (x1-x2)*(y1-y3) - (y1-y2)*(x1-x3)
u = -den_u / num
u[num == .0] = -1.
mask_u = (u > 0) * (u < 1) # intersection on line segment 2
mask = mask_t * mask_u
# overwrite with EPSILON. otherwise numerically unstable
t = den_t / (num + EPSILON)
intersections = torch.stack([x1 + t*(x2-x1), y1 + t*(y2-y1)], dim=-1)
intersections = intersections * mask.float().unsqueeze(-1)
return intersections, mask
def get_in_box_points(polys1: torch.Tensor, polys2: torch.Tensor):
"""check if corners of poly1 lie in poly2
Convention: if a corner is exactly on the edge of the other box, it's also a valid point
Args:
polys1 (torch.Tensor): (n, 4, 2)
polys2 (torch.Tensor): (n, 4, 2)
Returns:
c1_in_2: (n, 4) Bool
"""
a = polys2[..., 0:1, :] # (n, 1, 2)
b = polys2[..., 1:2, :] # (n, 1, 2)
d = polys2[..., 3:4, :] # (n, 1, 2)
ab = b - a # (n, 1, 2)
am = polys1 - a # (n, 4, 2)
ad = d - a # (n, 1, 2)
p_ab = torch.sum(ab * am, dim=-1) # (n, 4)
norm_ab = torch.sum(ab * ab, dim=-1) # (n, 1)
p_ad = torch.sum(ad * am, dim=-1) # (n, 4)
norm_ad = torch.sum(ad * ad, dim=-1) # (n, 1)
# NOTE: the expression looks ugly but is stable if the two boxes are exactly the same
# also stable with different scale of bboxes
cond1 = (p_ab / norm_ab > - 1e-6) * \
(p_ab / norm_ab < 1 + 1e-6) # (n, 4)
cond2 = (p_ad / norm_ad > - 1e-6) * \
(p_ad / norm_ad < 1 + 1e-6) # (n, 4)
return cond1 * cond2
def build_vertices(polys1: torch.Tensor, polys2: torch.Tensor,
c1_in_2: torch.Tensor, c2_in_1: torch.Tensor,
inters: torch.Tensor, mask_inter: torch.Tensor):
"""find vertices of intersection area
Args:
polys1 (torch.Tensor): (n, 4, 2)
polys2 (torch.Tensor): (n, 4, 2)
c1_in_2 (torch.Tensor): Bool, (n, 4)
c2_in_1 (torch.Tensor): Bool, (n, 4)
inters (torch.Tensor): (n, 4, 4, 2)
mask_inter (torch.Tensor): (n, 4, 4)
Returns:
vertices (torch.Tensor): (n, 24, 2) vertices of intersection area. only some elements are valid
mask (torch.Tensor): (n, 24) indicates valid elements in vertices
"""
# NOTE: inter has elements equals zero and has zeros gradient (masked by multiplying with 0).
# can be used as trick
n = polys1.size(0)
# (n, 4+4+16, 2)
vertices = torch.cat([polys1, polys2, inters.view(
[n, -1, 2])], dim=1)
# Bool (n, 4+4+16)
mask = torch.cat([c1_in_2, c2_in_1, mask_inter.view([n, -1])], dim=1)
return vertices, mask
def sort_indices(vertices: torch.Tensor, mask: torch.Tensor):
"""[summary]
Args:
vertices (torch.Tensor): float (n, 24, 2)
mask (torch.Tensor): bool (n, 24)
Returns:
sorted_index: bool (n, 9)
Note:
why 9? the polygon has maximal 8 vertices. +1 to duplicate the first element.
the index should have following structure:
(A, B, C, ... , A, X, X, X)
and X indicates the index of arbitary elements in the last 16 (intersections not corners) with
value 0 and mask False. (cause they have zero value and zero gradient)
"""
# here we pad dim 0 to be consistent with the `sort_vertices_forward` function
vertices = vertices.unsqueeze(0)
mask = mask.unsqueeze(0)
num_valid = torch.sum(mask.int(), dim=2).int() # (B, N)
mean = torch.sum(vertices * mask.float().unsqueeze(-1), dim=2,
keepdim=True) / num_valid.unsqueeze(-1).unsqueeze(-1)
# normalization makes sorting easier
vertices_normalized = vertices - mean
return sort_vertices_forward(vertices_normalized, mask, num_valid).squeeze(0).long()
def calculate_area(idx_sorted: torch.Tensor, vertices: torch.Tensor):
"""calculate area of intersection
Args:
idx_sorted (torch.Tensor): (n, 9)
vertices (torch.Tensor): (n, 24, 2)
return:
area: (n), area of intersection
selected: (n, 9, 2), vertices of polygon with zero padding
"""
idx_ext = idx_sorted.unsqueeze(-1).repeat([1, 1, 2])
selected = torch.gather(vertices, 1, idx_ext)
total = selected[..., 0:-1, 0]*selected[..., 1:, 1] - \
selected[..., 0:-1, 1]*selected[..., 1:, 0]
total = torch.sum(total, dim=1)
area = torch.abs(total) / 2
return area, selected
def oriented_box_intersection_2d(polys1: torch.Tensor, polys2: torch.Tensor):
"""calculate intersection area of 2d rectangles
Args:
polys1 (torch.Tensor): (n, 4, 2)
polys2 (torch.Tensor): (n, 4, 2)
Returns:
area: (n,), area of intersection
selected: (n, 9, 2), vertices of polygon with zero padding
"""
# find intersection points
inters, mask_inter = get_intersection_points(polys1, polys2)
# find inter points
c12 = get_in_box_points(polys1, polys2)
c21 = get_in_box_points(polys2, polys1)
# build vertices
vertices, mask = build_vertices(
polys1, polys2, c12, c21, inters, mask_inter)
# getting sorted indices
sorted_indices = sort_indices(vertices, mask)
# calculate areas using torch.gather
return calculate_area(sorted_indices, vertices)
| 6,963
| 35.460733
| 103
|
py
|
s2anet
|
s2anet-master/mmdet/ops/box_iou_rotated_diff/__init__.py
|
from .box_iou_rotated_diff import box_iou_rotated_differentiable
__all__ = ['box_iou_rotated_differentiable']
| 110
| 36
| 64
|
py
|
s2anet
|
s2anet-master/mmdet/ops/nms_rotated/__init__.py
|
from . import nms_rotated_cuda
__all__ = ['nms_rotated']
def nms_rotated(dets, iou_thr):
if dets.shape[0] == 0:
return dets
keep_inds = nms_rotated_cuda.nms_rotated(dets[:, :5], dets[:, 5], iou_thr)
dets = dets[keep_inds, :]
return dets, keep_inds
| 275
| 22
| 78
|
py
|
s2anet
|
s2anet-master/mmdet/ops/roi_pool/roi_pool.py
|
import torch
import torch.nn as nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from . import roi_pool_cuda
class RoIPoolFunction(Function):
@staticmethod
def forward(ctx, features, rois, out_size, spatial_scale):
assert features.is_cuda
out_h, out_w = _pair(out_size)
assert isinstance(out_h, int) and isinstance(out_w, int)
ctx.save_for_backward(rois)
num_channels = features.size(1)
num_rois = rois.size(0)
out_size = (num_rois, num_channels, out_h, out_w)
output = features.new_zeros(out_size)
argmax = features.new_zeros(out_size, dtype=torch.int)
roi_pool_cuda.forward(features, rois, out_h, out_w, spatial_scale,
output, argmax)
ctx.spatial_scale = spatial_scale
ctx.feature_size = features.size()
ctx.argmax = argmax
return output
@staticmethod
@once_differentiable
def backward(ctx, grad_output):
assert grad_output.is_cuda
spatial_scale = ctx.spatial_scale
feature_size = ctx.feature_size
argmax = ctx.argmax
rois = ctx.saved_tensors[0]
assert feature_size is not None
grad_input = grad_rois = None
if ctx.needs_input_grad[0]:
grad_input = grad_output.new_zeros(feature_size)
roi_pool_cuda.backward(grad_output.contiguous(), rois, argmax,
spatial_scale, grad_input)
return grad_input, grad_rois, None, None
roi_pool = RoIPoolFunction.apply
class RoIPool(nn.Module):
def __init__(self, out_size, spatial_scale, use_torchvision=False):
super(RoIPool, self).__init__()
self.out_size = _pair(out_size)
self.spatial_scale = float(spatial_scale)
self.use_torchvision = use_torchvision
def forward(self, features, rois):
if self.use_torchvision:
from torchvision.ops import roi_pool as tv_roi_pool
return tv_roi_pool(features, rois, self.out_size,
self.spatial_scale)
else:
return roi_pool(features, rois, self.out_size, self.spatial_scale)
def __repr__(self):
format_str = self.__class__.__name__
format_str += '(out_size={}, spatial_scale={}'.format(
self.out_size, self.spatial_scale)
format_str += ', use_torchvision={})'.format(self.use_torchvision)
return format_str
| 2,544
| 32.486842
| 78
|
py
|
s2anet
|
s2anet-master/mmdet/ops/roi_pool/gradcheck.py
|
import os.path as osp
import sys
import torch
from torch.autograd import gradcheck
sys.path.append(osp.abspath(osp.join(__file__, '../../')))
from roi_pool import RoIPool # noqa: E402, isort:skip
feat = torch.randn(4, 16, 15, 15, requires_grad=True).cuda()
rois = torch.Tensor([[0, 0, 0, 50, 50], [0, 10, 30, 43, 55],
[1, 67, 40, 110, 120]]).cuda()
inputs = (feat, rois)
print('Gradcheck for roi pooling...')
test = gradcheck(RoIPool(4, 1.0 / 8), inputs, eps=1e-5, atol=1e-3)
print(test)
| 513
| 29.235294
| 66
|
py
|
s2anet
|
s2anet-master/mmdet/ops/roi_pool/__init__.py
|
from .roi_pool import RoIPool, roi_pool
__all__ = ['roi_pool', 'RoIPool']
| 75
| 18
| 39
|
py
|
s2anet
|
s2anet-master/mmdet/ops/roi_align_rotated/__init__.py
|
from .roi_align_rotated import RoIAlignRotated
__all__ = ['RoIAlignRotated']
| 78
| 18.75
| 46
|
py
|
s2anet
|
s2anet-master/mmdet/ops/roi_align_rotated/roi_align_rotated.py
|
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
from torch import nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from .roi_align_rotated_cuda import roi_align_rotated_forward, roi_align_rotated_backward
class _ROIAlignRotated(Function):
@staticmethod
def forward(ctx, input, roi, out_size, spatial_scale, sampling_ratio):
ctx.save_for_backward(roi)
ctx.out_size = out_size
ctx.spatial_scale = spatial_scale
ctx.sample_num = sampling_ratio
ctx.input_shape = input.size()
output = roi_align_rotated_forward(
input, roi, spatial_scale, out_size[0], out_size[1], sampling_ratio
)
return output
@staticmethod
@once_differentiable
def backward(ctx, grad_output):
(rois,) = ctx.saved_tensors
output_size = ctx.out_size
spatial_scale = ctx.spatial_scale
sampling_ratio = ctx.sample_num
bs, ch, h, w = ctx.input_shape
grad_input = roi_align_rotated_backward(
grad_output,
rois,
spatial_scale,
output_size[0],
output_size[1],
bs,
ch,
h,
w,
sampling_ratio,
)
return grad_input, None, None, None, None, None
roi_align_rotated = _ROIAlignRotated.apply
class RoIAlignRotated(nn.Module):
def __init__(self, out_size, spatial_scale, sample_num):
"""
Args:
out_size (tuple): h, w
spatial_scale (float): scale the input boxes by this number
sample_num (int): number of inputs samples to take for each output
sample. 0 to take samples densely.
Note:
roi_align_rotated supports continuous coordinate by default:
Given a continuous coordinate c, its two neighboring pixel indices (in our
pixel model) are computed by floor(c - 0.5) and ceil(c - 0.5). For example,
c=1.3 has pixel neighbors with discrete indices [0] and [1] (which are sampled
from the underlying signal at continuous coordinates 0.5 and 1.5).
"""
super(RoIAlignRotated, self).__init__()
self.out_size = _pair(out_size)
self.spatial_scale = spatial_scale
self.sample_num = sample_num
def forward(self, input, rois):
"""
Args:
input: NCHW images
rois: Bx6 boxes. First column is the index into N.
The other 5 columns are (x_ctr, y_ctr, width, height, angle_degrees).
"""
assert rois.dim() == 2 and rois.size(1) == 6
orig_dtype = input.dtype
if orig_dtype == torch.float16:
input = input.float()
rois = rois.float()
return roi_align_rotated(
input, rois, self.out_size, self.spatial_scale, self.sample_num
).to(dtype=orig_dtype)
def __repr__(self):
tmpstr = self.__class__.__name__ + "("
tmpstr += "out_size=" + str(self.out_size[0])
tmpstr += ", spatial_scale=" + str(self.spatial_scale)
tmpstr += ", sample_num=" + str(self.sample_num)
tmpstr += ")"
return tmpstr
| 3,281
| 33.914894
| 90
|
py
|
s2anet
|
s2anet-master/mmdet/ops/nms/nms_wrapper.py
|
import numpy as np
import torch
from . import nms_cpu, nms_cuda
from .soft_nms_cpu import soft_nms_cpu
def nms(dets, iou_thr, device_id=None):
"""Dispatch to either CPU or GPU NMS implementations.
The input can be either a torch tensor or numpy array. GPU NMS will be used
if the input is a gpu tensor or device_id is specified, otherwise CPU NMS
will be used. The returned type will always be the same as inputs.
Arguments:
dets (torch.Tensor or np.ndarray): bboxes with scores.
iou_thr (float): IoU threshold for NMS.
device_id (int, optional): when `dets` is a numpy array, if `device_id`
is None, then cpu nms is used, otherwise gpu_nms will be used.
Returns:
tuple: kept bboxes and indice, which is always the same data type as
the input.
"""
# convert dets (tensor or numpy array) to tensor
if isinstance(dets, torch.Tensor):
is_numpy = False
dets_th = dets
elif isinstance(dets, np.ndarray):
is_numpy = True
device = 'cpu' if device_id is None else 'cuda:{}'.format(device_id)
dets_th = torch.from_numpy(dets).to(device)
else:
raise TypeError(
'dets must be either a Tensor or numpy array, but got {}'.format(
type(dets)))
# execute cpu or cuda nms
if dets_th.shape[0] == 0:
inds = dets_th.new_zeros(0, dtype=torch.long)
else:
if dets_th.is_cuda:
inds = nms_cuda.nms(dets_th, iou_thr)
else:
inds = nms_cpu.nms(dets_th, iou_thr)
if is_numpy:
inds = inds.cpu().numpy()
return dets[inds, :], inds
def soft_nms(dets, iou_thr, method='linear', sigma=0.5, min_score=1e-3):
if isinstance(dets, torch.Tensor):
is_tensor = True
dets_np = dets.detach().cpu().numpy()
elif isinstance(dets, np.ndarray):
is_tensor = False
dets_np = dets
else:
raise TypeError(
'dets must be either a Tensor or numpy array, but got {}'.format(
type(dets)))
method_codes = {'linear': 1, 'gaussian': 2}
if method not in method_codes:
raise ValueError('Invalid method for SoftNMS: {}'.format(method))
new_dets, inds = soft_nms_cpu(
dets_np,
iou_thr,
method=method_codes[method],
sigma=sigma,
min_score=min_score)
if is_tensor:
return dets.new_tensor(new_dets), dets.new_tensor(
inds, dtype=torch.long)
else:
return new_dets.astype(np.float32), inds.astype(np.int64)
| 2,580
| 31.670886
| 79
|
py
|
s2anet
|
s2anet-master/mmdet/ops/nms/__init__.py
|
from .nms_wrapper import nms, soft_nms
__all__ = ['nms', 'soft_nms']
| 70
| 16.75
| 38
|
py
|
Simple-Vanilla-LSTM
|
Simple-Vanilla-LSTM-master/VanillaLSTM.py
|
import numpy as np
class RecurrentNeuralNetwork:
def __init__ (self, xs, ys, rl, eo, lr):
#initial input
self.x = np.zeros(xs)
#input size
self.xs = xs
#expected output
self.y = np.zeros(ys)
#output size
self.ys = ys
#weight matrix for interpreting results from LSTM cell
self.w = np.random.random((ys, ys))
#matrix used in RMSprop
self.G = np.zeros_like(self.w)
#length of the recurrent network - number of recurrences
self.rl = rl
#learning rate
self.lr = lr
#array for storing inputs
self.ia = np.zeros((rl+1,xs))
#array for storing cell states
self.ca = np.zeros((rl+1,ys))
#array for storing outputs
self.oa = np.zeros((rl+1,ys))
#array for storing hidden states
self.ha = np.zeros((rl+1,ys))
self.af = np.zeros((rl+1,ys))
self.ai = np.zeros((rl+1,ys))
self.ac = np.zeros((rl+1,ys))
self.ao = np.zeros((rl+1,ys))
#array of expected output values
self.eo = np.vstack((np.zeros(eo.shape[0]), eo.T))
#declare LSTM cell - add ability to declare multiple cells in future
self.LSTM = LSTM(xs, ys, rl, lr)
def sigmoid(self, x):
return 1 / (1 + np.exp(-x))
def dsigmoid(self, x):
return self.sigmoid(x) * (1 - self.sigmoid(x))
def forwardProp(self):
#loop through recurrences - start at 1 so the 0th entry of all arrays will be an array of 0's
for i in range(1, self.rl+1):
#set input for LSTM cell, combination of input (previous output) and previous hidden state
self.LSTM.x = np.hstack((self.ha[i-1], self.x))
#run forward prop on the LSTM cell, retrieve cell state and hidden state
cs, hs, f, inp, c, o = self.LSTM.forwardProp()
#store input
maxI = np.argmax(self.x)
self.x = np.zeros_like(self.x)
self.x[maxI] = 1
self.ia[i] = self.x #Use np.argmax?
#store cell state
self.ca[i] = cs
#store hidden state
self.ha[i] = hs
self.af[i] = f
self.ai[i] = inp
self.ac[i] = c
self.ao[i] = o
#calculate output by multiplying hidden state with weight matrix
self.oa[i] = self.sigmoid(np.dot(self.w, hs))
self.x = self.eo[i-1]
#return all outputs
return self.oa
def backProp(self):
totalError = 0
dfcs = np.zeros(self.ys)
dfhs = np.zeros(self.ys)
#initialize matrices for gradient updates
tfu = np.zeros((self.ys, self.xs+self.ys))
tiu = np.zeros((self.ys, self.xs+self.ys))
tcu = np.zeros((self.ys, self.xs+self.ys))
tou = np.zeros((self.ys, self.xs+self.ys))
tu = np.zeros((self.ys,self.ys))
#loop backwards through recurrences
for i in range(self.rl, -1, -1):
#error = calculatedOutput - expectedOutput
error = self.oa[i] - self.eo[i]
#calculate update for weight matrix
tu += np.dot(np.atleast_2d(error * self.dsigmoid(self.oa[i])), np.atleast_2d(self.ha[i]).T)
#propagate error back to exit of LSTM cell
error = np.dot(error, self.w)
#set input values of LSTM cell for recurrence i
self.LSTM.x = np.hstack((self.ha[i-1], self.ia[i]))
#set cell state of LSTM cell for recurrence i
self.LSTM.cs = self.ca[i]
#call the LSTM cell's backprop, retreive gradient updates
fu, iu, cu, ou, dfcs, dfhs = self.LSTM.backProp(error, self.ca[i-1], self.af[i], self.ai[i], self.ac[i], self.ao[i], dfcs, dfhs)
#calculate total error (not necesarry, used to measure training progress)
totalError += np.sum(error)
#accumulate all gradient updates
tfu += fu
tiu += iu
tcu += cu
tou += ou
#update LSTM matrices with average of accumulated gradient updates
self.LSTM.update(tfu/self.rl, tiu/self.rl, tcu/self.rl, tou/self.rl)
#update weight matrix with average of accumulated gradient updates
self.update(tu/self.rl)
#return total error of this iteration
return totalError
def update(self, u):
#vanilla implementation of RMSprop
self.G = 0.9 * self.G + 0.1 * u**2
self.w -= self.lr/np.sqrt(self.G + 1e-8) * u
return
def sample(self):
#loop through recurrences - start at 1 so the 0th entry of all arrays will be an array of 0's
for i in range(1, self.rl+1):
#set input for LSTM cell, combination of input (previous output) and previous hidden state
self.LSTM.x = np.hstack((self.ha[i-1], self.x))
#run forward prop on the LSTM cell, retrieve cell state and hidden state
cs, hs, f, inp, c, o = self.LSTM.forwardProp()
#store input
maxI = np.argmax(self.x)
self.x = np.zeros_like(self.x)
self.x[maxI] = 1
self.ia[i] = self.x #Use np.argmax?
#store cell state
self.ca[i] = cs
#store hidden state
self.ha[i] = hs
self.af[i] = f
self.ai[i] = inp
self.ac[i] = c
self.ao[i] = o
#calculate output by multiplying hidden state with weight matrix
self.oa[i] = self.sigmoid(np.dot(self.w, hs))
maxI = np.argmax(self.oa[i])
newX = np.zeros_like(self.x)
newX[maxI] = 1
self.x = newX
#return all outputs
return self.oa
class LSTM:
def __init__ (self, xs, ys, rl, lr):
self.x = np.zeros(xs+ys)
self.xs = xs + ys
self.y = np.zeros(ys)
self.ys = ys
self.cs = np.zeros(ys)
self.rl = rl
self.lr = lr
self.f = np.random.random((ys, xs+ys))
self.i = np.random.random((ys, xs+ys))
self.c = np.random.random((ys, xs+ys))
self.o = np.random.random((ys, xs+ys))
self.Gf = np.zeros_like(self.f)
self.Gi = np.zeros_like(self.i)
self.Gc = np.zeros_like(self.c)
self.Go = np.zeros_like(self.o)
def sigmoid(self, x):
return 1 / (1 + np.exp(-x))
def dsigmoid(self, x):
return self.sigmoid(x) * (1 - self.sigmoid(x))
def tangent(self, x):
return np.tanh(x)
def dtangent(self, x):
return 1 - np.tanh(x)**2
def forwardProp(self):
f = self.sigmoid(np.dot(self.f, self.x))
self.cs *= f
i = self.sigmoid(np.dot(self.i, self.x))
c = self.tangent(np.dot(self.c, self.x))
self.cs += i * c
o = self.sigmoid(np.dot(self.o, self.x))
self.y = o * self.tangent(self.cs)
return self.cs, self.y, f, i, c, o
def backProp(self, e, pcs, f, i, c, o, dfcs, dfhs):
e = np.clip(e + dfhs, -6, 6)
do = self.tangent(self.cs) * e
ou = np.dot(np.atleast_2d(do * self.dtangent(o)).T, np.atleast_2d(self.x))
dcs = np.clip(e * o * self.dtangent(self.cs) + dfcs, -6, 6)
dc = dcs * i
cu = np.dot(np.atleast_2d(dc * self.dtangent(c)).T, np.atleast_2d(self.x))
di = dcs * c
iu = np.dot(np.atleast_2d(di * self.dsigmoid(i)).T, np.atleast_2d(self.x))
df = dcs * pcs
fu = np.dot(np.atleast_2d(df * self.dsigmoid(f)).T, np.atleast_2d(self.x))
dpcs = dcs * f
dphs = np.dot(dc, self.c)[:self.ys] + np.dot(do, self.o)[:self.ys] + np.dot(di, self.i)[:self.ys] + np.dot(df, self.f)[:self.ys]
return fu, iu, cu, ou, dpcs, dphs
def update(self, fu, iu, cu, ou):
self.Gf = 0.9 * self.Gf + 0.1 * fu**2
self.Gi = 0.9 * self.Gi + 0.1 * iu**2
self.Gc = 0.9 * self.Gc + 0.1 * cu**2
self.Go = 0.9 * self.Go + 0.1 * ou**2
self.f -= self.lr/np.sqrt(self.Gf + 1e-8) * fu
self.i -= self.lr/np.sqrt(self.Gi + 1e-8) * iu
self.c -= self.lr/np.sqrt(self.Gc + 1e-8) * cu
self.o -= self.lr/np.sqrt(self.Go + 1e-8) * ou
return
def LoadText():
with open("C:\\Users\\Kevin\\Documents\\shakespeare.txt", "r") as text_file:
data = text_file.read()
text = list(data)
outputSize = len(text)
data = list(set(text))
uniqueWords, dataSize = len(data), len(data)
returnData = np.zeros((uniqueWords, dataSize))
for i in range(0, dataSize):
returnData[i][i] = 1
returnData = np.append(returnData, np.atleast_2d(data), axis=0)
output = np.zeros((uniqueWords, outputSize))
for i in range(0, outputSize):
index = np.where(np.asarray(data) == text[i])
output[:,i] = returnData[0:-1,index[0]].astype(float).ravel()
return returnData, uniqueWords, output, outputSize, data
def ExportText(output, data):
finalOutput = np.zeros_like(output)
prob = np.zeros_like(output[0])
outputText = ""
print(len(data))
print(output.shape[0])
for i in range(0, output.shape[0]):
for j in range(0, output.shape[1]):
prob[j] = output[i][j] / np.sum(output[i])
outputText += np.random.choice(data, p=prob)
with open("C:\\Users\\Kevin\\Documents\\output.txt", "w") as text_file:
text_file.write(outputText)
return
#Begin program
print("Beginning")
iterations = 5000
learningRate = 0.001
returnData, numCategories, expectedOutput, outputSize, data = LoadText()
print("Done Reading")
RNN = RecurrentNeuralNetwork(numCategories, numCategories, outputSize, expectedOutput, learningRate)
for i in range(1, iterations):
RNN.forwardProp()
error = RNN.backProp()
print("Error on iteration ", i, ": ", error)
if error > -100 and error < 100 or i % 100 == 0:
seed = np.zeros_like(RNN.x)
maxI = np.argmax(np.random.random(RNN.x.shape))
seed[maxI] = 1
RNN.x = seed
output = RNN.sample()
print(output)
ExportText(output, data)
print("Done Writing")
print("Complete")
| 10,289
| 37.977273
| 140
|
py
|
xaesa
|
xaesa-master/modified_widgets.py
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 2 15:02:40 2022
@author: kalinko
"""
from init import QTVer
if QTVer == 4:
from PyQt4 import QtGui, QtCore
if QTVer == 5:
from PyQt5 import QtWidgets as QtGui
from PyQt5 import QtCore
class QLineEditScroll(QtGui.QLineEdit):
KEY_shift = QtCore.Qt.Key_Shift
KEY_ctrl = QtCore.Qt.Key_Control
def __init__(self, base_change_constant = 1, *args, **kwargs):
QtGui.QLineEdit.__init__(self, *args, **kwargs)
self.shiftKeyPressed = False
self.ctrlKeyPressed = False
self.base_change_constant = base_change_constant
def keyPressEvent(self, event):
print(event.key())
if event.key() == QLineEditScroll.KEY_shift:
self.shiftKeyPressed = True
if event.key() == QLineEditScroll.KEY_ctrl:
self.ctrlKeyPressed = True
QtGui.QLineEdit.keyPressEvent(self, event)
def keyReleaseEvent(self, event):
if event.key() == QLineEditScroll.KEY_shift:
self.shiftKeyPressed = False
if event.key() == QLineEditScroll.KEY_ctrl:
self.ctrlKeyPressed = False
QtGui.QLineEdit.keyReleaseEvent(self, event)
def wheelEvent(self, event):
if self.hasFocus():
bc = self.base_change_constant
delta = bc if event.angleDelta().y() > 0 else -bc
if self.shiftKeyPressed:
delta = bc*10 if event.angleDelta().y() > 0 else -10*bc
if self.ctrlKeyPressed:
delta = bc*0.1 if event.angleDelta().y() > 0 else -0.1*bc
ctext = self.text()
try: self.setText('{:.2f}'.format(float(ctext)+delta))
except: pass
# fn = self.font()
# fn.setPointSize(fn.pointSize() + delta)
# self.setFont(fn)
event.accept()
else: event.ignore()
| 1,917
| 32.649123
| 73
|
py
|
xaesa
|
xaesa-master/xaesa_viewer.py
|
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 6 11:20:43 2018
@author: akali
"""
from init import QTVer
if QTVer == 4:
from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
if QTVer == 5:
from PyQt5 import QtWidgets as QtGui
from PyQt5 import QtCore
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
import matplotlib.pyplot as plt
class xaesa_viewer(QtGui.QWidget):
def __init__(self, parent=None):
super(xaesa_viewer, self).__init__()
self.x_data = [] #list with arrays
self.y_data = []
self.labels = [] #list with labels for each line
self.x_caption = ""
self.y_caption = ""
# mode = 0 - each line new color
# mode = 1 - combine 2 lines with the same color (for FT comparison)
self.mode = 0
self.plotXRange = [] #two element [min, max] (for XANES)
self.horizontalLine = []
self.lines = []
self.initUI()
def initUI(self):
#Figures
self.fig = plt.figure(2, figsize=(15, 6))
# self.ax_exafs = self.fig.add_subplot(111)
self.canv = FigureCanvas(self.fig)
self.tbar = NavigationToolbar(self.canv, self)
fnt = self.tbar.font()
fnt.setPointSize(20)
self.tbar.setFont(fnt)
# plt.tight_layout()
lfig = QtGui.QVBoxLayout()
lfig.addWidget(self.tbar)
lfig.addWidget(self.canv)
self.setLayout(lfig)
self.canv.draw()
def plot(self):
plt.clf()
self.ax_exafs = self.fig.add_subplot(111)
if self.mode == 0: #compare exafs
for i in range(len(self.x_data)):
l, = self.ax_exafs.plot(self.x_data[i], self.y_data[i], label = self.labels[i])
self.ax_exafs.set_xlabel(self.x_caption)
self.ax_exafs.set_ylabel(self.y_caption)
# self.ax_exafs.set_xlabel('Wavevector k, $\AA^{-1}$')
# self.ax_exafs.set_ylabel('EXAFS, $\AA^{-2}$')
if self.horizontalLine != []:
self.ax_exafs.axhline(y=1, linewidth=0.5, color = 'k', linestyle='--',)
if self.plotXRange != []:
self.ax_exafs.set_xlim(self.plotXRange)
self.lines.append(l)
if self.mode == 1: #compare ft
for i in range(len(self.r)/2):
line1, = self.ax_exafs.plot(self.x_data[2*i], self.y_data[2*i], label = self.labels[i])
line2, = self.ax_exafs.plot(self.x_data[2*i+1], self.y_data[2*i+1])
line2.set_color(line1.get_color())
line2.set_linestyle('dotted')
self.ax_exafs.set_xlabel(self.x_caption)
self.ax_exafs.set_ylabel(self.y_caption)
# self.ax_exafs.set_xlabel('Distance R, $\AA$')
# self.ax_exafs.set_ylabel('Fourier transform, $\AA^{-3}$')
self.lines.append(line1)
self.lines1.append(line2)
self.fig.canvas.mpl_connect('pick_event', self.onpick)
self.fig.tight_layout()
box = self.ax_exafs.get_position()
self.ax_exafs.set_position([box.x0, box.y0, box.width * 0.7, box.height])
leg = self.ax_exafs.legend(loc='center left', bbox_to_anchor=(1, 0.5))
# we will set up a dict mapping legend line to orig line, and enable
# picking on the legend line
self.lined = dict()
for legline, origline in zip(leg.get_lines(), self.lines):
legline.set_picker(5) # 5 pts tolerance
self.lined[legline] = origline
if self.mode == 1:
self.lined1 = dict()
for legline, origline in zip(leg.get_lines(), self.lines1):
# legline.set_picker(5) # 5 pts tolerance
self.lined1[legline] = origline
self.canv.draw()
def onpick(self, event):
# on the pick event, find the orig line corresponding to the
# legend proxy line, and toggle the visibility
legline = event.artist
origline = self.lined[legline]
vis = not origline.get_visible()
origline.set_visible(vis)
if self.mode == 1:
origline = self.lined1[legline]
origline.set_visible(vis)
# Change the alpha on the line in the legend so we can see what lines
# have been toggled
if vis:
legline.set_alpha(1.0)
else:
legline.set_alpha(0.2)
self.fig.canvas.draw()
class xaesaViewerWindow(QtGui.QDialog):
def __init__(self, parent=None):
super(xaesaViewerWindow, self).__init__()
self.viewer = xaesa_viewer(self)
self.btnCancel = QtGui.QPushButton('Exit')
self.btnCancel.clicked.connect(self.cancel)
lout = QtGui.QGridLayout()
lout.addWidget(self.viewer)
lout.addWidget(self.btnCancel)
self.setLayout(lout)
# self.setCentralWidget(self.wid)
# self.show()
def closeEvent(self, event):
super(xaesaViewerWindow, self).closeEvent(event)
def cancel(self):
plt.close(2)
self.close()
#
#if __name__ == '__main__':
# app = QtGui.QApplication(argv)
#
# main = TestWindow()
#
# exit(app.exec_())
| 5,904
| 32.174157
| 104
|
py
|
xaesa
|
xaesa-master/xaesa_xes_class.py
|
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 2 15:07:33 2018
@author: akali
"""
from numpy import concatenate, logical_and, polyfit, where, zeros, sum
from scipy.integrate import simps
from scipy.interpolate import Rbf
class xaesa_xes_class():
def __init__(self):
self.name = ""
#raw data loaded from experimantal file
self.energy = [] #1D array
self.energyRebined = []
self.energyOriginal = []
self.xes = []
self.xesBackground = []
self.xesBkgrCorrected = []
self.xesAreaNorm = []
self.xesMaxNorm = []
self.xesRebinned = []
self.xesOriginal = []
self.incidentEnergy = 0
#energy windows for background removal
self.E0 = 0
self.E1 = 0
self.E2 = 0
self.E3 = 0
#energy window for area normalization
self.eAreaNormMin = 0
self.eAreaNormMax = 0
self.eMinRebin = 0
self.emaxRemin = 0
self.deRebin = 0
def removeBackground(self, polPower=1):
where1 = where( logical_and(self.energy > self.E0, self.energy < self.E1) )
where2 = where( logical_and(self.energy > self.E2, self.energy < self.E3) )
energy_sliced = concatenate( (self.energy[where1], self.energy[where2]) )
xes_sliced = concatenate( (self.xes[where1], self.xes[where2]) )
pf = polyfit(energy_sliced, xes_sliced, polPower)
self.xesBackground = zeros(len(self.energy))
for i in range(polPower+1):
self.xesBackground = self.xesBackground + self.energy**(polPower-i) * pf[i]
self.xesBkgrCorrected = self.xes - self.xesBackground
def areaNormalize(self):
where3 = where( logical_and(self.energy > self.eAreaNormMin, self.energy < self.eAreaNormMax) )
self.xesAreaNorm = self.xesBkgrCorrected / simps(self.xesBkgrCorrected[where3], self.energy[where3])
print("Integral", simps(self.xesBkgrCorrected[where3], self.energy[where3]))
print("Sum", sum(self.xesBkgrCorrected[where3]))
def maxNormalize(self):
pass
def rebin():
pass
class xaesa_transient_class():
def __init__(self):
self.name = ""
self.energy = [] #1D array
self.transient = []
self.energySmooth = []
self.transientSmooth = []
#energy window for smoothing
self.eSmoothMin = 0
self.eSmoothMax = 0
self.smoothFactor = 0.0001
def smoothTransient(self, smFactor = 0.0001):
where3 = where( logical_and(self.energy > self.eSmoothMin, self.energy < self.eSmoothMax ) )
spl = Rbf( self.energy[where3],self.transient[where3],
function = 'multiquadric',
epsilon = 3,
smooth = smFactor )
self.energySmooth = self.energy[where3]
self.transientSmooth = spl(self.energy[where3])
class xaesa_kinetic_class():
def __init__(self):
self.time = [] #1D array
self.kinetic = []
| 3,276
| 29.915094
| 108
|
py
|
xaesa
|
xaesa-master/xaesa_fit.py
|
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 24 15:55:28 2016
@author: sasha
"""
import os
from .init import QTVer
if QTVer == 4:
from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
if QTVer == 5:
from PyQt5 import QtWidgets as QtGui
from PyQt5 import QtCore
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.widgets import SpanSelector
from scipy.interpolate import InterpolatedUnivariateSpline
from scipy.optimize import least_squares, curve_fit
from .xaesa_ft import FT, BFTWindow, BFT, GETPHASE
from .xaesa_constants_formulas import windowGauss10
#from tkinter.filedialog import askopenfilename, asksaveasfilename
#from tkinter import Tk
import gc
def exafsfit_lsq(x, k, exafs, amp, pha, parametrs, var_par, nr_shells, kpow):
#create mixed array with variables and params
XX = np.zeros(len(var_par))
varcnt = 0
parcnt = 0
for i in range(len(var_par)):
if(var_par[i]==1): #variable
XX[i] = x[varcnt]
varcnt = varcnt + 1
else:
XX[i] = parametrs[parcnt]
parcnt = parcnt + 1
# print("x", x)
#print("XX", XX)
chi_model = np.zeros(len(k))
for i in range(nr_shells):
chi_model = chi_model + (XX[i*7]/(k*XX[i*7+1]**2)) * amp[i] * \
np.exp(-2*XX[i*7+2]*k*k + (2/3)*XX[i*7+4]*k**4 - (4/45)*XX[i*7+6]*k**6) * \
np.sin(2*k*XX[i*7+1] - (4/3)*XX[i*7+3]*k**3 + (4/15)*XX[i*7+5]*k**5 + pha[i])
# chi_model = SO2 * (x[2]/(k*x[3]*x[3])) * amp * exp(-2*x[4]*k*k) * sin(2*k*x[3] + pha)
return chi_model*k**kpow - exafs
def exafsfit(x, N, R, sigma2):
k = x[0]
amp = x[1]
pha= x[2]
SO2 = x[3]
# dE0 = X[4]
# C4 = X[5]
# C5 = X[6]
# C6 = X[7]
chi_model = SO2 * (N/(k*R*R)) * amp * np.exp(-2*sigma2*k*k) * np.sin(2*k*R + pha)
return chi_model*k*k
class FitWindow(QtGui.QDialog):
def __init__(self):
super(FitWindow, self).__init__()
self.bft = []
self.k = []
self.kamp = [[]]
self.kpha = [[] ]
self.amp_orig = [[]]
self.pha_orig = [[]]
self.fit_result = []
self.initUI()
def initUI(self):
self.shellnr = 1
self.savedshellnr = 1
self.isfitted = 0
self.fig = plt.figure(3, figsize=(12, 6))
self.ax_bft = plt.subplot2grid((1,2), (0,0))
self.ax_bftft = plt.subplot2grid((1,2), (0,1))
self.canv = FigureCanvas(self.fig)
self.tbar = NavigationToolbar(self.canv, self)
self.fig.tight_layout()
# self.lblNrShells = QtGui.QLabel("Number of shells")
# self.edtNrShells = QtGui.QLineEdit("1")
self.lblkmin = QtGui.QLabel("K min")
self.lblkmax = QtGui.QLabel("K max")
self.lbldk = QtGui.QLabel("dK")
self.edtkmin = QtGui.QLineEdit("0.5")
self.edtkmax = QtGui.QLineEdit("15")
self.edtdk = QtGui.QLineEdit("0.05")
self.lblMaxiterations = QtGui.QLabel("Max number of iterations")
self.edtMaxiterations = QtGui.QLineEdit("1000")
self.tabShells = QtGui.QTabWidget()
self.tabs = []
self.tabs.append(QtGui.QFrame())
self.tabShells.addTab(self.tabs[0],"Shell 1")
self.ltShell = []
self.shellN = []
self.shellR = []
self.shellSigma = []
self.shellC3 = []
self.shellC4 = []
self.shellC5 = []
self.shellC6 = []
# self.shellE0 = []
self.shellAmp = []
self.shellPha = []
lblN = QtGui.QLabel("N")
lblR = QtGui.QLabel("R")
lblSigma = QtGui.QLabel("Sigma")
lblC3 = QtGui.QLabel("C3")
lblC4 = QtGui.QLabel("C4")
lblC5 = QtGui.QLabel("C5")
lblC6 = QtGui.QLabel("C6")
# lblE0 = QtGui.QLabel("E0")
lblAmp = QtGui.QLabel("Ampl")
lblPha = QtGui.QLabel("Phase")
self.ltShell.append(QtGui.QGridLayout())
self.shellN.append( [QtGui.QLineEdit("4"), QtGui.QLineEdit("0"), QtGui.QLineEdit("8"), QtGui.QCheckBox()])
self.shellR.append([QtGui.QLineEdit("2"), QtGui.QLineEdit("0"), QtGui.QLineEdit("4"), QtGui.QCheckBox()])
self.shellSigma.append([QtGui.QLineEdit("0.001"), QtGui.QLineEdit("0"), QtGui.QLineEdit("1"), QtGui.QCheckBox()])
self.shellC3.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("-0.1"), QtGui.QLineEdit("0.1"), QtGui.QCheckBox()])
self.shellC4.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("-0.1"), QtGui.QLineEdit("0.1"), QtGui.QCheckBox()])
self.shellC5.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("-0.1"), QtGui.QLineEdit("0.1"), QtGui.QCheckBox()])
self.shellC6.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("-0.1"), QtGui.QLineEdit("0.1"), QtGui.QCheckBox()])
# self.shellE0.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("0"), QtGui.QLineEdit("0"), QtGui.QLineEdit("0.0001"), QtGui.QCheckBox()])
self.shellAmp.append(QtGui.QComboBox())
self.shellPha.append(QtGui.QComboBox())
self.shellAmp[-1].addItem("")
self.shellPha[-1].addItem("")
self.shellAmp[-1].currentIndexChanged.connect(self.AmpChanged)
self.shellPha[-1].currentIndexChanged.connect(self.PhaChanged)
self.shellN[len(self.shellN)-1][3].setChecked(True)
self.shellR[len(self.shellR)-1][3].setChecked(True)
self.shellSigma[len(self.shellSigma)-1][3].setChecked(True)
self.ltShell[0].addWidget(lblN, 0, 0)
self.ltShell[0].addWidget(lblR, 1, 0)
self.ltShell[0].addWidget(lblSigma, 2, 0)
self.ltShell[0].addWidget(lblC3, 3, 0)
self.ltShell[0].addWidget(lblC4, 4, 0)
self.ltShell[0].addWidget(lblC5, 5, 0)
self.ltShell[0].addWidget(lblC6, 6, 0)
# self.ltShell[0].addWidget(lblE0, 7, 0)
self.ltShell[0].addWidget(lblAmp, 7, 0)
self.ltShell[0].addWidget(lblPha, 8, 0)
for i in range(4):
self.ltShell[0].addWidget(self.shellN[0][i], 0, 2*i+1)
self.ltShell[0].addWidget(self.shellR[0][i], 1, 2*i+1)
self.ltShell[0].addWidget(self.shellSigma[0][i], 2, 2*i+1)
self.ltShell[0].addWidget(self.shellC3[0][i], 3, 2*i+1)
self.ltShell[0].addWidget(self.shellC4[0][i], 4, 2*i+1)
self.ltShell[0].addWidget(self.shellC5[0][i], 5, 2*i+1)
self.ltShell[0].addWidget(self.shellC6[0][i], 6, 2*i+1)
# self.ltShell[0].addWidget(self.shellE0[0][i], 7, 2*i+1)
self.ltShell[0].addWidget(self.shellAmp[0], 7, 1, 1, 7)
self.ltShell[0].addWidget(self.shellPha[0], 8, 1, 1, 7)
# self.shellAmp[0].addItem("E:/work/development/xaslib/fit/amp0001.dat")
# self.shellPha[0].addItem("E:/work/development/xaslib/fit/pha0001.dat")
for j in range(7):
self.ltShell[0].addWidget(QtGui.QLabel("Min. limit"), j, 2)
self.ltShell[0].addWidget(QtGui.QLabel("Max. limit"), j, 4)
# self.ltShell[0].addWidget(QtGui.QLabel("Accuracy"), j, 6)
self.tabs[0].setLayout(self.ltShell[0])
self.lblFuncEval = QtGui.QLabel("Number of function evaluations done")
self.edtFuncEval = QtGui.QLineEdit()
self.lblFitMessage = QtGui.QLabel("Termination reason")
self.edtFitMessage = QtGui.QLineEdit()
self.lblOptimality = QtGui.QLabel("Cost function")
self.edtOptimality = QtGui.QLineEdit()
lfit = QtGui.QGridLayout()
lfit.addWidget(self.lblFitMessage, 0, 0)
lfit.addWidget(self.edtFitMessage, 0, 1)
lfit.addWidget(self.lblFuncEval, 1, 0)
lfit.addWidget(self.edtFuncEval, 1, 1)
lfit.addWidget(self.lblOptimality, 2, 0)
lfit.addWidget(self.edtOptimality, 2, 1)
self.btnFit = QtGui.QPushButton('Fit')
self.btnFit.clicked.connect(self.Fit_leastsquares)
self.btnSaveFit = QtGui.QPushButton('Save Fit results')
self.btnSaveFit.clicked.connect(self.saveFit)
self.btnApply = QtGui.QPushButton('Apply')
self.btnApply.clicked.connect(self.apply)
self.btnCancel = QtGui.QPushButton('Cancel')
self.btnCancel.clicked.connect(self.cancel)
self.btnAddShell = QtGui.QPushButton('Add shell')
self.btnAddShell.clicked.connect(self.addshell)
self.btnRemoveShell = QtGui.QPushButton('Remove shell')
self.btnRemoveShell.clicked.connect(self.removeshell)
self.btnOpenAmp = QtGui.QPushButton('Open amplitude file(s) ...')
self.btnOpenAmp.clicked.connect(self.openamp)
self.btnOpenPha = QtGui.QPushButton('Open phase file(s) ...')
self.btnOpenPha.clicked.connect(self.openpha)
self.btnOpenFeff = QtGui.QPushButton('Open feff file(s) ...')
self.btnOpenFeff.clicked.connect(self.openfeff)
self.btnCalcFeff = QtGui.QPushButton('Calculatye feff file(s) ...')
self.btnCalcFeff.clicked.connect(self.calcfeff)
self.btnSaveFitResults = QtGui.QPushButton('Save fit Results ...')
# self.btnSaveFitResults.clicked.connect(self.saveFitResults)
lb = QtGui.QGridLayout()
lb.addWidget(self.btnOpenAmp, 0,0)
lb.addWidget(self.btnOpenPha, 0,1)
lb.addWidget(self.btnOpenFeff, 1,0)
lb.addWidget(self.btnCalcFeff, 1,1)
lb.addWidget(self.btnAddShell, 2,0)
lb.addWidget(self.btnRemoveShell, 2,1)
lfig = QtGui.QGridLayout()
lfig.addWidget(self.tbar, 0, 0)
lfig.addWidget(self.canv, 1, 0, 2, 1)
lfig.addLayout(lfit, 3, 0)
lfig.addWidget(self.btnFit, 4, 0)
lfig.addWidget(self.btnSaveFit, 5, 0)
lfig.addWidget(self.btnApply, 6, 0)
lfig.addWidget(self.btnCancel, 7, 0)
lfig.addWidget(self.lblkmin, 0,1)
lfig.addWidget(self.edtkmin, 0,2)
lfig.addWidget(self.lblkmax, 0,3)
lfig.addWidget(self.edtkmax, 0,4)
lfig.addWidget(self.lbldk, 0,5)
lfig.addWidget(self.edtdk, 0,6)
lfig.addWidget(self.lblMaxiterations, 1, 1)
lfig.addWidget(self.edtMaxiterations, 1, 2, 1, 4)
lfig.addWidget(self.tabShells, 2, 1, 2, 6)
lfig.addLayout(lb, 4,1, 2, 6)
self.setLayout(lfig)
def updateUI(self):
if self.savedshellnr > 1:
for i in range(0,self.savedshellnr-1):
self.addshell()
self.edtkmin.setText("{:.2f}".format(self.ksettings[0][0]))
self.edtkmax.setText("{:.2f}".format(self.ksettings[0][1]))
self.edtdk.setText("{:.3f}".format(self.ksettings[0][2]))
if self.isfitted == 1: #fill with saved fitting params
self.edtOptimality.setText("{:E}".format(self.costfunction))
for i in range(self.shellnr):
self.shellN[i][0].setText("{:.4f}".format(self.fit_params[i][0][0]))
self.shellN[i][1].setText("{:.4f}".format(self.fit_params[i][0][1]))
self.shellN[i][2].setText("{:.4f}".format(self.fit_params[i][0][2]))
self.shellN[i][3].setChecked(bool(self.fit_params[i][0][3]))
self.shellR[i][0].setText("{:.4f}".format(self.fit_params[i][1][0]))
self.shellR[i][1].setText("{:.4f}".format(self.fit_params[i][1][1]))
self.shellR[i][2].setText("{:.4f}".format(self.fit_params[i][1][2]))
self.shellR[i][3].setChecked(bool(self.fit_params[i][1][3]))
self.shellSigma[i][0].setText("{:.4f}".format(self.fit_params[i][2][0]))
self.shellSigma[i][1].setText("{:.4f}".format(self.fit_params[i][2][1]))
self.shellSigma[i][2].setText("{:.4f}".format(self.fit_params[i][2][2]))
self.shellSigma[i][3].setChecked(bool(self.fit_params[i][2][3]))
self.shellC3[i][0].setText("{:.4E}".format(self.fit_params[i][3][0]))
self.shellC3[i][1].setText("{:.4f}".format(self.fit_params[i][3][1]))
self.shellC3[i][2].setText("{:.4f}".format(self.fit_params[i][3][2]))
self.shellC3[i][3].setChecked(bool(self.fit_params[i][3][3]))
self.shellC4[i][0].setText("{:.4E}".format(self.fit_params[i][4][0]))
self.shellC4[i][1].setText("{:.4f}".format(self.fit_params[i][4][1]))
self.shellC4[i][2].setText("{:.4f}".format(self.fit_params[i][4][2]))
self.shellC4[i][3].setChecked(bool(self.fit_params[i][4][3]))
self.shellC5[i][0].setText("{:.4E}".format(self.fit_params[i][5][0]))
self.shellC5[i][1].setText("{:.4f}".format(self.fit_params[i][5][1]))
self.shellC5[i][2].setText("{:.4f}".format(self.fit_params[i][5][2]))
self.shellC5[i][3].setChecked(bool(self.fit_params[i][5][3]))
self.shellC6[i][0].setText("{:.4E}".format(self.fit_params[i][6][0]))
self.shellC6[i][1].setText("{:.4f}".format(self.fit_params[i][6][1]))
self.shellC6[i][2].setText("{:.4f}".format(self.fit_params[i][6][2]))
self.shellC6[i][3].setChecked(bool(self.fit_params[i][6][3]))
# for i in range(int(len(self.fit_amps)/2)):
self.kamp[i] = self.fit_amps[2*i]
self.amp_orig[i] = self.fit_amps[2*i+1]
self.kpha[i] = self.fit_phases[2*i]
self.pha_orig[i] = self.fit_phases[2*i+1]
# print(self.fit_amps)
pass
def Fit_curvefit(self):
kstart = float(self.edtkmin.text())
kend = float(self.edtkmax.text())
dk = float(self.edtdk.text())
common_k = np.arange(kstart, kend, dk)
guess = [0,0,0]
guess[0] = float(self.shellN[0][0].text())
guess[1] = float(self.shellR[0][0].text())
guess[2] = float(self.shellSigma[0][0].text())
varbounds = []
varbounds.append( ( float(self.shellN[0][1].text()), float(self.shellR[0][1].text()), float(self.shellSigma[0][1].text()) ) )
varbounds.append( ( float(self.shellN[0][2].text()), float(self.shellR[0][2].text()), float(self.shellSigma[0][2].text()) ) )
kamp, amp_orig = np.genfromtxt("E:/work/development/xaslib/fit/amp0001.dat", usecols=(1,0), unpack=True)
kpha, pha_orig = np.genfromtxt("E:/work/development/xaslib/fit/pha0001.dat", usecols=(1,0), unpack=True)
splamp = InterpolatedUnivariateSpline(kamp,amp_orig)
splpha = InterpolatedUnivariateSpline(kpha, pha_orig)
splbft = InterpolatedUnivariateSpline(self.k, self.bft)
amp = splamp(common_k)
pha = splpha(common_k)
common_bft = splbft(common_k)
# lsq_result = least_squares(exafsfit, np.array(X), \
# method = 'lm',
## bounds = varbounds,
# args=(self.k, self.bft, amp, pha, 1))
# print(lsq_result.x)
x = []
x.append(common_k)
x.append(amp)
x.append(pha)
x.append(1)
popt, pcov = curve_fit(exafsfit, x, common_bft , \
#method = 'lm',
bounds = varbounds,
p0 = guess)
self.ax_bft.clear()
self.ax_bftft.clear()
self.ax_bft.plot(self.k, self.bft)
# self.ax_bft.plot(self.k, exafsfit(lsq_result.x, self.k, self.bft, amp, pha, 1)+self.bft)
# self.ax_bft.plot(self.k, exafsfit(X, self.k, self.bft, amp, pha, 1)+self.bft)
self.ax_bft.plot(common_k, exafsfit(x, popt[0], popt[1], popt[2]))
print(popt)
print(pcov)
self.canv.draw()
def Fit_leastsquares(self):
for i in range(self.shellnr):
if(self.kamp[i]==[]):
QtGui.QMessageBox.information(self,"Load Amplitude", "Amplitude in shell {:d} not loaded".format(i+1))
return
if(self.kpha[i]==[]):
QtGui.QMessageBox.information(self,"Load Phase", "Phase in shell {:d} not loaded".format(i+1))
return
kstart = float(self.edtkmin.text())
kend = float(self.edtkmax.text())
dk = float(self.edtdk.text())
self.common_k = np.arange(kstart, kend, dk)
maxiterations = int(self.edtMaxiterations.text())
#prepare variable and parameter array
splbft = InterpolatedUnivariateSpline(self.k, self.bft)
self.common_bft = splbft(self.common_k)
varbounds = [[],[]]
par = []
var_par = []
X = []
edtVarBoxes = []
amp = []
pha = []
for i in range(self.shellnr):
if self.shellN[i][3].isChecked():
X.append(float(self.shellN[i][0].text()))
varbounds[0].append(float(self.shellN[i][1].text()))
varbounds[1].append(float(self.shellN[i][2].text()))
var_par.append(1)
edtVarBoxes.append(self.shellN[i][0])
else:
par.append(float(self.shellN[i][0].text()))
var_par.append(0)
if self.shellR[i][3].isChecked():
X.append(float(self.shellR[i][0].text()))
varbounds[0].append(float(self.shellR[i][1].text()))
varbounds[1].append(float(self.shellR[i][2].text()))
var_par.append(1)
edtVarBoxes.append(self.shellR[i][0])
else:
par.append(float(self.shellR[i][0].text()))
var_par.append(0)
if self.shellSigma[i][3].isChecked():
X.append(float(self.shellSigma[i][0].text()))
varbounds[0].append(float(self.shellSigma[i][1].text()))
varbounds[1].append(float(self.shellSigma[i][2].text()))
var_par.append(1)
edtVarBoxes.append(self.shellSigma[i][0])
else:
par.append(float(self.shellSigma[i][0].text()))
var_par.append(0)
if self.shellC3[i][3].isChecked():
X.append(float(self.shellC3[i][0].text()))
varbounds[0].append(float(self.shellC3[i][1].text()))
varbounds[1].append(float(self.shellC3[i][2].text()))
var_par.append(1)
edtVarBoxes.append(self.shellC3[i][0])
else:
par.append(float(self.shellC3[i][0].text()))
var_par.append(0)
if self.shellC4[i][3].isChecked():
X.append(float(self.shellC4[i][0].text()))
varbounds[0].append(float(self.shellC4[i][1].text()))
varbounds[1].append(float(self.shellC4[i][2].text()))
var_par.append(1)
edtVarBoxes.append(self.shellC4[i][0])
else:
par.append(float(self.shellC4[i][0].text()))
var_par.append(0)
if self.shellC5[i][3].isChecked():
X.append(float(self.shellC5[i][0].text()))
varbounds[0].append(float(self.shellC5[i][1].text()))
varbounds[1].append(float(self.shellC5[i][2].text()))
var_par.append(1)
edtVarBoxes.append(self.shellC5[i][0])
else:
par.append(float(self.shellC5[i][0].text()))
var_par.append(0)
if self.shellC6[i][3].isChecked():
X.append(float(self.shellC6[i][0].text()))
varbounds[0].append(float(self.shellC6[i][1].text()))
varbounds[1].append(float(self.shellC6[i][2].text()))
var_par.append(1)
edtVarBoxes.append(self.shellC6[i][0])
else:
par.append(float(self.shellC6[i][0].text()))
var_par.append(0)
splamp = InterpolatedUnivariateSpline(self.kamp[i], self.amp_orig[i])
splpha = InterpolatedUnivariateSpline(self.kpha[i], self.pha_orig[i])
amp.append(splamp(self.common_k))
pha.append(splpha(self.common_k))
varbounds[0] = tuple(varbounds[0])
varbounds[1] = tuple(varbounds[1])
lsq_result = least_squares(exafsfit_lsq, np.array(X), \
# method = 'dogbox',
ftol = 1e-12,
max_nfev = maxiterations,
bounds = varbounds,
# tr_solver = 'lsmr',
# jac = '3-point',
# loss='soft_l1',
# f_scale=0.1,
verbose = 0,
# x_scale = [1,1,0.001],
args=(self.common_k, self.common_bft, amp, pha, par, var_par, self.shellnr, 2))
self.edtFuncEval.setText("{:d}".format(lsq_result.nfev))
self.edtOptimality.setText("{:e}".format(lsq_result.cost))
self.edtFitMessage.setText(lsq_result.message)
for i in range(len(lsq_result.x)):
if i in [0,1,2]:
edtVarBoxes[i].setText("{:.5f}".format(lsq_result.x[i]))
else:
edtVarBoxes[i].setText("{:.2E}".format(lsq_result.x[i]))
self.window = windowGauss10(self.common_k, kstart, kend)
self.bftw = self.common_bft * self.window
self.r, self.fr, self.fi = FT(self.common_k, self.bftw, 0, 4, 0.02)
self.efr = np.sqrt(self.fr*self.fr + self.fi*self.fi)
self.efi = self.fi * (-1)
self.fit_result = exafsfit_lsq(lsq_result.x, self.common_k, self.common_bft, amp, pha, par, var_par, self.shellnr, 2)+self.common_bft
fit_result_w = self.fit_result * self.window
self.res_r, res_fr, res_fi = FT(self.common_k, fit_result_w, 0, 4, 0.02)
self.res_efr = np.sqrt(res_fr*res_fr + res_fi*res_fi)
self.res_efi = res_fi * (-1)
self.ax_bft.clear()
self.ax_bftft.clear()
self.ax_bft.plot(self.k, self.bft)
self.ax_bft.plot(self.common_k, self.fit_result)
self.ax_bftft.clear()
line1, line2 = self.ax_bftft.plot( self.r, self.efr, self.r, self.efi)
line1.set_color('b')
line2.set_color('b')
line2.set_linestyle('dotted')
line1, line2 = self.ax_bftft.plot( self.res_r, self.res_efr, self.res_r, self.res_efi)
line1.set_color('r')
line2.set_color('r')
line2.set_linestyle('dotted')
self.canv.draw()
def apply(self):
self.fit_params = []
self.fit_amps = []
self.fit_phases = []
self.ksettings = []
for i in range(self.shellnr):
self.fit_params.append([ [float(self.shellN[i][0].text()),
float(self.shellN[i][1].text()),
float(self.shellN[i][2].text()),
int(self.shellN[i][3].isChecked())],
[float(self.shellR[i][0].text()),
float(self.shellR[i][1].text()),
float(self.shellR[i][2].text()),
int(self.shellR[i][3].isChecked())],
[float(self.shellSigma[i][0].text()),
float(self.shellSigma[i][1].text()),
float(self.shellSigma[i][2].text()),
int(self.shellSigma[i][3].isChecked())],
[float(self.shellC3[i][0].text()),
float(self.shellC3[i][1].text()),
float(self.shellC3[i][2].text()),
int(self.shellC3[i][3].isChecked())],
[float(self.shellC4[i][0].text()),
float(self.shellC4[i][1].text()),
float(self.shellC4[i][2].text()),
int(self.shellC4[i][3].isChecked())],
[float(self.shellC5[i][0].text()),
float(self.shellC5[i][1].text()),
float(self.shellC5[i][2].text()),
int(self.shellC5[i][3].isChecked())],
[float(self.shellC6[i][0].text()),
float(self.shellC6[i][1].text()),
float(self.shellC6[i][2].text()),
int(self.shellC6[i][3].isChecked())]])
self.fit_amps.append( self.kamp[i])
self.fit_amps.append( self.amp_orig[i])
self.fit_phases.append( self.kpha[i])
self.fit_phases.append( self.pha_orig[i])
self.costfunction = float(self.edtOptimality.text())
self.ksettings.append( [float(self.edtkmin.text()),
float(self.edtkmax.text()),
float(self.edtdk.text())] )
self.accept()
def cancel(self):
self.close()
def bftft(self):
self.window = windowGauss10(self.k, self.k[0], self.k[len(self.k)-1])
self.bftw = self.bft * self.window
self.r, self.fr, self.fi = FT(self.k, self.bftw, 0, 4, 0.02)
self.efr = np.sqrt(self.fr*self.fr + self.fi*self.fi)
self.efi = self.fi * (-1)
def plot(self):
self.ax_bft.clear()
self.ax_bftft.clear()
self.ax_bft.plot(self.k, self.bft)
line1, line2 = self.ax_bftft.plot( self.r, self.efr, self.r, self.efi)
line1.set_color('b')
line2.set_color('b')
line2.set_linestyle('dotted')
if(self.fit_result != []):
kstart = float(self.edtkmin.text())
kend = float(self.edtkmax.text())
dk = float(self.edtdk.text())
self.common_k = np.arange(kstart, kend, dk)
self.ax_bft.plot(self.common_k, self.fit_result)
def openamp(self):
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.ExistingFiles)
dlg.setAcceptMode(0) # open dialog
dlg.setNameFilters(["All files (*.*)", "Amplitude files (*.amp)"])
# dlg.setDirectory(os.getcwd())
if dlg.exec():
self.fnamp = dlg.selectedFiles()
else:
return
self.fnamp.sort()
for i in range(len(self.shellAmp)):
self.shellAmp[i].addItems(self.fnamp)
def openpha(self):
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.ExistingFiles)
dlg.setAcceptMode(0) # open dialog
dlg.setNameFilters(["All files (*.*)", "Amplitude files (*.pha)"])
# dlg.setDirectory(os.getcwd())
if dlg.exec():
self.fnpha = dlg.selectedFiles()
else:
return
self.fnpha.sort()
for i in range(len(self.shellPha)):
self.shellPha[i].addItems(self.fnpha)
def openfeff(self):
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.ExistingFiles)
dlg.setAcceptMode(0) # open dialog
dlg.setNameFilters(["All files (*.*)"])
# dlg.setDirectory(os.getcwd())
if dlg.exec():
self.fnfeff = dlg.selectedFiles()
else:
return
self.fnfeff.sort()
#Extract amplitude and phase from feff files and save to disk
for i in range(len(self.fnfeff)):
state = 0
data = []
f = open(self.fnfeff[i])
for line in f:
print(line)
cols = line.split()
if cols[0] == '-----------------------------------------------------------------------':
state = 1
continue
if cols[0] =='k':
state = 2
continue
if state == 1:
r = float(cols[2])
state = 0
continue
if state == 2:
data.append(cols)
new_data_amp = []
new_data_pha = []
for j in range(len(data)):
k = float(data[j][0])
pha = float(data[j][1]) + float(data[j][3])
amp = float(data[j][2]) * np.exp( -2 * r / float(data[j][5])) * float(data[j][4])
new_data_amp.append([k, amp])
new_data_pha.append([k, pha])
np.savetxt(self.fnfeff[i] + '.amp', new_data_amp)
np.savetxt(self.fnfeff[i] + '.pha', new_data_pha)
for j in range(len(self.shellPha)):
self.shellAmp[j].addItem(self.fnfeff[i] + '.amp')
for j in range(len(self.shellPha)):
self.shellPha[j].addItem(self.fnfeff[i] + '.pha')
def calcfeff(self):
#TODO
pass
def addshell(self):
self.tabs.append(QtGui.QFrame())
caption = "Shell"+str(self.shellnr+1)
self.tabShells.addTab(self.tabs[self.shellnr], caption)
lblN = QtGui.QLabel("N")
lblR = QtGui.QLabel("R")
lblSigma = QtGui.QLabel("Sigma")
lblC3 = QtGui.QLabel("C3")
lblC4 = QtGui.QLabel("C4")
lblC5 = QtGui.QLabel("C5")
lblC6 = QtGui.QLabel("C6")
# lblE0 = QtGui.QLabel("E0")
lblAmp = QtGui.QLabel("Amplitude")
lblPha = QtGui.QLabel("Phase")
self.ltShell.append(QtGui.QGridLayout())
self.shellN.append( [QtGui.QLineEdit("4"), QtGui.QLineEdit("0"), QtGui.QLineEdit("8"), QtGui.QCheckBox()])
self.shellR.append([QtGui.QLineEdit("2"), QtGui.QLineEdit("0"), QtGui.QLineEdit("4"), QtGui.QCheckBox()])
self.shellSigma.append([QtGui.QLineEdit("0.001"), QtGui.QLineEdit("0"), QtGui.QLineEdit("1"), QtGui.QCheckBox()])
self.shellC3.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("-0.1"), QtGui.QLineEdit("0.1"), QtGui.QCheckBox()])
self.shellC4.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("-0.1"), QtGui.QLineEdit("0.1"), QtGui.QCheckBox()])
self.shellC5.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("-0.1"), QtGui.QLineEdit("0.1"), QtGui.QCheckBox()])
self.shellC6.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("-0.1"), QtGui.QLineEdit("0.1"), QtGui.QCheckBox()])
# self.shellE0.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("0"), QtGui.QLineEdit("0"), QtGui.QLineEdit("0.0001"), QtGui.QCheckBox()])
self.shellAmp.append(QtGui.QComboBox())
self.shellPha.append(QtGui.QComboBox())
self.shellAmp[-1].currentIndexChanged.connect(self.AmpChanged)
self.shellPha[-1].currentIndexChanged.connect(self.PhaChanged)
self.shellN[len(self.shellN)-1][3].setChecked(True)
self.shellR[len(self.shellR)-1][3].setChecked(True)
self.shellSigma[len(self.shellSigma)-1][3].setChecked(True)
AllItemsAmp = [self.shellAmp[0].itemText(i) for i in range(self.shellAmp[0].count())]
AllItemsPha = [self.shellPha[0].itemText(i) for i in range(self.shellPha[0].count())]
self.shellAmp[len(self.shellAmp)-1].addItems(AllItemsAmp)
self.shellPha[len(self.shellPha)-1].addItems(AllItemsPha)
self.ltShell[self.shellnr].addWidget(lblN, 0, 0)
self.ltShell[self.shellnr].addWidget(lblR, 1, 0)
self.ltShell[self.shellnr].addWidget(lblSigma, 2, 0)
self.ltShell[self.shellnr].addWidget(lblC3, 3, 0)
self.ltShell[self.shellnr].addWidget(lblC4, 4, 0)
self.ltShell[self.shellnr].addWidget(lblC5, 5, 0)
self.ltShell[self.shellnr].addWidget(lblC6, 6, 0)
# self.ltShell[self.shellnr].addWidget(lblE0, 7, 0)
self.ltShell[self.shellnr].addWidget(lblAmp, 7, 0)
self.ltShell[self.shellnr].addWidget(lblPha, 8, 0)
for i in range(4):
self.ltShell[self.shellnr].addWidget(self.shellN[self.shellnr][i], 0, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellR[self.shellnr][i], 1, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellSigma[self.shellnr][i], 2, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellC3[self.shellnr][i], 3, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellC4[self.shellnr][i], 4, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellC5[self.shellnr][i], 5, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellC6[self.shellnr][i], 6, 2*i+1)
# self.ltShell[self.shellnr].addWidget(self.shellE0[self.shellnr][i], 7, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellAmp[self.shellnr], 7, 1, 1, 7)
self.ltShell[self.shellnr].addWidget(self.shellPha[self.shellnr], 8, 1, 1, 7)
for j in range(7):
self.ltShell[self.shellnr].addWidget(QtGui.QLabel("Min. limit"), j, 2)
self.ltShell[self.shellnr].addWidget(QtGui.QLabel("Max. limit"), j, 4)
# self.ltShell[self.shellnr].addWidget(QtGui.QLabel("Accuracy"), j, 6)
self.tabs[self.shellnr].setLayout(self.ltShell[self.shellnr])
self.kamp.append([])
self.kpha.append([])
self.amp_orig.append([])
self.pha_orig.append([])
self.shellnr = self.shellnr +1
def removeshell(self):
self.tabs.pop()
self.tabShells.removeTab(self.shellnr-1)
self.ltShell.pop()
self.shellN.pop()
self.shellR.pop()
self.shellSigma.pop()
self.shellC3.pop()
self.shellC4.pop()
self.shellC5.pop()
self.shellC6.pop()
# self.shellE0.pop()
self.shellAmp.pop()
self.shellPha.pop()
self.kamp.pop()
self.kpha.pop()
self.amp_orig.pop()
self.pha_orig.pop()
self.shellnr = self.shellnr -1
gc.collect()
def AmpChanged(self):
which_shell = -1
sender = self.sender()
for i in range(len(self.shellAmp)):
if self.shellAmp[i] == sender:
which_shell = i
if self.shellAmp[which_shell].currentText() == "":
return
ampk, ampo = np.genfromtxt(self.shellAmp[which_shell].currentText(), usecols=(0,1), unpack=True)
self.kamp[which_shell] = ampk
self.amp_orig[which_shell] = ampo
def PhaChanged(self):
which_shell = -1
sender = self.sender()
for i in range(len(self.shellPha)):
if self.shellPha[i] == sender:
which_shell = i
if self.shellPha[which_shell].currentText() == "":
return
phak, phao = np.genfromtxt(self.shellPha[which_shell].currentText(), usecols=(0,1), unpack=True)
self.kpha[which_shell] = phak
self.pha_orig[which_shell] = phao
def saveFit(self):
fn = self.savefiledialog_qtgui()
if fn == "":
return
column_captions = ""
save_data = []
for i in range(self.shellnr):
column_captions = column_captions + "Shell{:d} ".format(i)
values = []
values.append(float(self.shellN[i][0].text()))
values.append(float(self.shellR[i][0].text()))
values.append(float(self.shellSigma[i][0].text()))
values.append(float(self.shellC3[i][0].text()))
values.append(float(self.shellC4[i][0].text()))
values.append(float(self.shellC5[i][0].text()))
values.append(float(self.shellC6[i][0].text()))
save_data.append(values)
np.savetxt(fn + ".fitdata", np.transpose(save_data), header=column_captions)
column_captions = "k exafs_fit exafs_exp"
save_array = []
save_array.append(self.common_k)
save_array.append(self.fit_result)
save_array.append(self.common_bft)
np.savetxt(fn + ".fitexafs", np.transpose(save_array), header=column_captions)
column_captions = "r_fit ft_real_fit ft_im_fit r_exp ft_real_exp ft_im_exp"
save_array = []
save_array.append(self.res_r)
save_array.append(self.res_efr)
save_array.append(self.res_efi)
save_array.append(self.r)
save_array.append(self.efr)
save_array.append(self.efi)
np.savetxt(fn + ".fitft", np.transpose(save_array), header=column_captions)
def savefiledialog_qtgui(self):
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.AnyFile)
dlg.setAcceptMode(1) # save dialog
dlg.setNameFilters(["All files (*.*)"])
# dlg.setDirectory(self.currentdir)
if dlg.exec_():
flist = dlg.selectedFiles()
return flist[0]
else:
return ""
| 38,370
| 40.392665
| 142
|
py
|
xaesa
|
xaesa-master/xaesaGUI.py
|
# -*- coding: utf-8 -*-
#"""
#Created on Fri Oct 7 12:25:31 2016
#
#@author: sasha
#"""
XAESA_VERSION = "0.07"
GUI_SETTINGS_ID = "XAESA" + XAESA_VERSION
import sys
from sys import exit, argv, version
from os import path, getcwd, getpid
import matplotlib.pyplot as plt
from matplotlib import __version__ as mpl_version
__path__=[path.dirname(path.abspath(__file__))]
from .init import QTVer
from .xaesa_exafs_class import xaesa_exafs_class
from .xaesa_xes_class import xaesa_xes_class, xaesa_transient_class
from .xaesa_settings import xaesa_settings
from .xaesa_viewer import xaesa_viewer, xaesaViewerWindow
from .xaesa_rxes import xaesa_rxes, xaesaRxesWindow
import modified_widgets as modwid
import tooltiptexts as ttt
import h5py
import copy as c
def show_exception_and_exit(exc_type, exc_value, tb):
import traceback
traceback.print_exception(exc_type, exc_value, tb)
# raw_input("Press key to exit.")
# sys.exit(-1)
sys.excepthook = show_exception_and_exit
if QTVer == 4:
from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
print("Python version: " + str(version))
print("Qt version: " + str(QtCore.qVersion()))
print("MatPlotLib version: " + str(mpl_version))
print("h5py version: " + h5py.version.version)
print("HDF5 version: " + h5py.version.hdf5_version)
if QTVer == 5:
from PyQt5 import QtWidgets as QtGui
from PyQt5 import QtCore
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
print("Python version: " + str(version))
print("Qt version: " + str(QtCore.qVersion()))
print("MatPlotLib version: " + str(mpl_version))
print("h5py version: " + h5py.version.version)
print("HDF5 version: " + h5py.version.hdf5_version)
from numpy import asarray, fromstring, genfromtxt, gradient, argmax, zeros, sqrt, sin, transpose, \
array, savetxt, copy, delete, arange, exp, argmin, concatenate, all, diff, \
append, where, absolute, logical_and, reshape, max, min, average, sum
#from .ft import FT, BFTWindow, BFT, GETPHASE
#from scipy.interpolate import UnivariateSpline
from scipy.interpolate import Rbf #, UnivariateSpline
from scipy.interpolate import InterpolatedUnivariateSpline
from timeit import default_timer as timer
from .xaesa_deglitch import DGWindow
from .xaesa_fit import FitWindow
from .xaesa_rdf import RdfWindow, MyStream
from .compare import CompareWindow
from .xaesa_lincombination import LCWindow
from .xaesa_pca import PCAWindow
from scipy.integrate import simps
#from matplotlib.widgets import RectangleSelector
polPowerXES = 1
def format_coord(x, y):
return 'x=%1.4f, y=%1.4f' % (x, y)
class MyWindow(QtGui.QMainWindow):
# def resizeEvent(self,resizeEvent):
#
# print("Information!","Window has been resized...")
def __init__(self):
super(MyWindow, self).__init__()
self.exafs_fluo = 0 #0 - exafs, 1 - fluo
self.calcmju = 1 #calculate mju or take already calculated from file
self.skiplines = 0
self.energycol = 0
self.exafscol = 1
self.refcol = -1
self.i0col = 1
self.i1col = 2
self.i2col = -1
self.fluocol = [11,12,13,15,16,17]
self.setWindowTitle("XAESA - X-ray Absorption and Emission Analytics")
self.dataClasses = []
self.copiedparamsXAS = []
self.copiedparamsXES = []
self.initUI()
self.showMaximized()
def initUI(self):
exitAction = QtGui.QAction('&Exit', self)
exitAction.setShortcut('Ctrl+Q')
exitAction.setStatusTip('Exit application')
exitAction.triggered.connect(QtGui.qApp.quit)
savehdf5Action = QtGui.QAction('Save analysis &to hdf5 ...', self)
savehdf5Action.setShortcut('Ctrl+S')
savehdf5Action.triggered.connect(self.savehdf5)
openhdf5Action = QtGui.QAction('Open analysis &from hdf5 ...', self)
openhdf5Action.setShortcut('Ctrl+A')
openhdf5Action.triggered.connect(self.openhdf5)
openNexusAction = QtGui.QAction('Open Nexus file ...', self)
openNexusAction.setShortcut('Ctrl+N')
openNexusAction.triggered.connect(self.openNexus)
ampPhaSaveAction = QtGui.QAction('Save amplitude and phase ...', self)
ampPhaSaveAction.triggered.connect(self.ampPhaSave)
# rxesAction = QtGui.QAction('Plot RXES plane ...', self)
# rxesAction.triggered.connect(self.makeRxesPlane, lambda: self.compare('i0'))
menubar = self.menuBar()
fileMenu = menubar.addMenu('&File')
fileMenu.addAction(savehdf5Action)
fileMenu.addAction(openhdf5Action)
fileMenu.addAction(openNexusAction)
fileMenu.addAction(exitAction)
toolsMenu = menubar.addMenu('&Tools')
toolsMenu.addAction(ampPhaSaveAction)
toolsMenu.addAction('Plot RXES plane ...', lambda: self.makeRxesPlane(False))
toolsMenu.addAction('Plot RXES plane (energy transfer) ...', lambda: self.makeRxesPlane(True))
toolsMenu.addAction('Shift energy scale according reference (last selected spectrum)', self.shiftEnergyRef)
settingsMenu = menubar.addMenu('&Settings')
self.xaesaSettings = xaesa_settings()
# self.edtTest = QtGui.QLineEdit('1')
action = QtGui.QWidgetAction(self)
action.setDefaultWidget(self.xaesaSettings)
settingsMenu.addAction(action)
statusBar = self.statusBar()
self.prgbar = QtGui.QProgressBar()
self.lblStatus = QtGui.QLabel("Start with opening experimental files or previously saved project.")
self.lblnpoints = QtGui.QLabel()
self.lblCurrentFile = QtGui.QLabel()
statusBar.addWidget(self.lblStatus)
statusBar.addWidget(self.prgbar)
statusBar.addWidget(self.lblnpoints)
statusBar.addWidget(self.lblCurrentFile)
self.current = -1
self.currentdir = getcwd()
self.currenthdf5 = getcwd()
wid = QtGui.QWidget(self)
self.setCentralWidget(wid)
#list with spectra
#from several text files or single hdf5 file
self.lstSpectra = QtGui.QListWidget()
self.lstSpectra.itemClicked.connect(self.lstSpectraItemClicked)
self.lstSpectra.itemDoubleClicked.connect(self.lstSpectraItemDoubleClicked)
self.lstSpectra.itemActivated.connect(self.lstSpectraItemClicked)
self.lstSpectra.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
# self.lstSpectra.setDragDropMode(QtGui.QAbstractItemView.DragDrop)
self.lstSpectra.setDragDropMode(QtGui.QAbstractItemView.InternalMove)
self.lstSpectra.setDefaultDropAction(QtCore.Qt.MoveAction)
self.lstSpectra.installEventFilter(self)
# self.lstSpectra.indexesMoved.connect(self.lstSpectraLayoutChanged)
# self.lstSpectraModel = self.lstSpectra.model()
# self.lstSpectraModel.layoutChanged.connect(self.lstSpectraLayoutChanged)
self.lstSpectra.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.lstSpectra.customContextMenuRequested.connect(self.listItemRightClicked)
self.lstSpectraMenu= QtGui.QMenu()
self.lstSpectraMenu.addAction("Remove Item", self.removefile)
self.lstSpectraMenu.addSeparator()
self.lstSpectraMenu.addAction("DW factor correction", self.dwcorrection)
self.lstSpectraMenu.addAction("Shift energy scale by constant", self.shiftenergyscale)
self.lstSpectraMenu.addSeparator()
self.lstSpectraMenu.addAction("Compare mu", self.comparemju)
self.lstSpectraMenu.addAction("Compare EXAFS", self.compareexafs)
self.lstSpectraMenu.addAction("Compare FT", self.compareft)
self.lstSpectraMenu.addAction("Compare BFT", self.comparebft)
self.lstSpectraMenu.addSeparator()
self.lstSpectraMenu.addAction("Spectra difference", self.spectradifference)
self.lstSpectraMenu.addSeparator()
self.lstSpectraMenu.addAction("Duplicate", self.duplicate)
#open button
self.btnOpen = QtGui.QPushButton('Open File(s) ...')
self.btnRemoveFile = QtGui.QPushButton('Remove File(s) ...')
self.btnOpen.clicked.connect(self.openfile)
self.btnRemoveFile.clicked.connect(self.removefile)
self.lblSkipLines = QtGui.QLabel("Skip lines")
self.lblDataX = QtGui.QLabel("Energy")
self.lblDataY = QtGui.QLabel("mu")
self.lblDataY1 = QtGui.QLabel("mu ref")
self.lblI0Col = QtGui.QLabel("I0")
self.lblI1Col = QtGui.QLabel("I1")
self.lblI2Col = QtGui.QLabel("I2")
# self.lblFluoCols = QtGui.QLabel("Fluo columns")
self.edtSkipLines = QtGui.QLineEdit(str(self.skiplines))
self.edtEnergyCol = QtGui.QLineEdit(str(self.energycol))
self.edtExafsCol = QtGui.QLineEdit(str(self.exafscol))
self.edtRefCol = QtGui.QLineEdit(str(self.refcol))
self.edtI0Col = QtGui.QLineEdit(str(self.i0col))
self.edtICol = QtGui.QLineEdit(str(self.i1col))
self.edtI2Col = QtGui.QLineEdit(str(self.i2col))
self.edtFluoCols = QtGui.QLineEdit("11 12 13 15 16 17")
self.edtFluoCols.hide()
self.edtSkipLines.setFixedWidth(50)
self.edtSkipLines.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.edtEnergyCol.setFixedWidth(50)
self.edtEnergyCol.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.edtExafsCol.setFixedWidth(50)
self.edtExafsCol.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.edtRefCol.setFixedWidth(50)
self.edtRefCol.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.edtI0Col.setFixedWidth(50)
self.edtI0Col.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.edtICol.setFixedWidth(50)
self.edtICol.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
self.edtI2Col.setFixedWidth(50)
self.edtI2Col.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
# self.edtFluoCols.setFixedWidth(175)
# self.edtFluoCols.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
g1 = QtGui.QHBoxLayout()
g2 = QtGui.QHBoxLayout()
g3 = QtGui.QHBoxLayout()
self.gb1 = QtGui.QGroupBox()
self.gb2 = QtGui.QGroupBox()
self.gb3 = QtGui.QGroupBox()
self.gb1.setLayout(g1)
self.gb2.setLayout(g2)
self.gb3.setLayout(g3)
self.gb1.setFlat(True)
self.gb2.setFlat(True)
self.gb3.setFlat(True)
#experiment type
self.chkDataTypeMju = QtGui.QPushButton("mu")
self.chkDataTypeXes = QtGui.QPushButton("XES")
self.chkDataTypeExafs = QtGui.QPushButton("EXAFS")
self.chkDataTypeTrans = QtGui.QPushButton("Transient")
self.chkDataTypeTrans.setVisible(False)
self.chkDataTypeMju.setCheckable(True)
self.chkDataTypeXes.setCheckable(True)
self.chkDataTypeExafs.setCheckable(True)
self.chkDataTypeTrans.setCheckable(True)
self.chkDataTypeMju.setAutoExclusive(True)
self.chkDataTypeXes.setAutoExclusive(True)
self.chkDataTypeExafs.setAutoExclusive(True)
self.chkDataTypeTrans.setAutoExclusive(True)
self.chkDataTypeMju.setStyleSheet("QPushButton:checked { color:green }")
self.chkDataTypeXes.setStyleSheet("QPushButton:checked { color:green }")
self.chkDataTypeExafs.setStyleSheet("QPushButton:checked { color:green }")
self.chkDataTypeTrans.setStyleSheet("QPushButton:checked { color:green }")
self.chkDataTypeMju.clicked.connect(self.adaptOpeningParams)
self.chkDataTypeXes.clicked.connect(self.adaptOpeningParams)
self.chkDataTypeExafs.clicked.connect(self.adaptOpeningParams)
self.chkDataTypeTrans.clicked.connect(self.adaptOpeningParams)
# self.chkMjuOrExafs = QtGui.QPushButton("Absorption")
# self.chkMjuOrExafs1 = QtGui.QPushButton("EXAFS")
self.chkCalcMju = QtGui.QPushButton("Calculate absorption")
self.chkCalcMju.setCheckable(True)
self.chkCalcMju.setStyleSheet("QPushButton:checked { color:green }")
self.chkCalcMju.clicked.connect(self.adaptOpeningParams)
self.chkTransOrFluo = QtGui.QPushButton("Transmission")
self.chkTransOrFluo1 = QtGui.QPushButton("Fluorescence")
self.chkTransOrFluo.clicked.connect(self.adaptOpeningParams)
self.chkTransOrFluo1.clicked.connect(self.adaptOpeningParams)
self.chkTransOrFluo.setCheckable(True)
self.chkTransOrFluo1.setCheckable(True)
# self.chkMjuOrExafs.setCheckable(True)
# self.chkMjuOrExafs1.setCheckable(True)
self.chkTransOrFluo.setAutoExclusive(True)
self.chkTransOrFluo1.setAutoExclusive(True)
# self.chkMjuOrExafs.setAutoExclusive(True)
# self.chkMjuOrExafs1.setAutoExclusive(True)
self.chkTransOrFluo.setStyleSheet("QPushButton:checked { color:green }")
self.chkTransOrFluo1.setStyleSheet("QPushButton:checked { color:green }")
# self.chkMjuOrExafs.setStyleSheet("QPushButton:checked { color:green }")
# self.chkMjuOrExafs1.setStyleSheet("QPushButton:checked { color:green }")
self.chkTransOrFluo.setChecked(True)
self.chkDataTypeMju.setChecked(True)
g1.addWidget(self.chkDataTypeMju)
g1.addWidget(self.chkDataTypeXes)
g1.addWidget(self.chkDataTypeExafs)
g1.addWidget(self.chkDataTypeTrans)
g2.addWidget(self.chkCalcMju)
g3.addWidget(self.chkTransOrFluo)
g3.addWidget(self.chkTransOrFluo1)
lopenparams = QtGui.QGridLayout()
lopenparams.addWidget(self.gb1, 0, 0, 1, 8)
lopenparams.addWidget(self.lblSkipLines, 1, 0, alignment=QtCore.Qt.AlignRight)
lopenparams.addWidget(self.edtSkipLines, 1, 1, alignment=QtCore.Qt.AlignLeft)
lopenparams.addWidget(self.lblDataX, 1, 2, alignment=QtCore.Qt.AlignRight)
lopenparams.addWidget(self.edtEnergyCol, 1, 3, alignment=QtCore.Qt.AlignLeft)
lopenparams.addWidget(self.lblDataY, 1, 4, alignment=QtCore.Qt.AlignRight)
lopenparams.addWidget(self.edtExafsCol, 1, 5, alignment=QtCore.Qt.AlignLeft)
lopenparams.addWidget(self.lblDataY1, 1, 6, alignment=QtCore.Qt.AlignRight)
lopenparams.addWidget(self.edtRefCol, 1, 7, alignment=QtCore.Qt.AlignLeft)
lopenparams.addWidget(self.gb2, 2, 0, 1, 3)
lopenparams.addWidget(self.gb3, 2, 3, 1, 5)
lopenparams.addWidget(self.lblI0Col, 3, 0, alignment=QtCore.Qt.AlignRight)
lopenparams.addWidget(self.edtI0Col, 3, 1, alignment=QtCore.Qt.AlignLeft)
lopenparams.addWidget(self.lblI1Col, 3, 2, alignment=QtCore.Qt.AlignRight)
lopenparams.addWidget(self.edtICol, 3, 3, 1, 3, alignment=QtCore.Qt.AlignLeft)
lopenparams.addWidget(self.lblI2Col, 3, 6, alignment=QtCore.Qt.AlignRight)
lopenparams.addWidget(self.edtI2Col, 3, 7, alignment=QtCore.Qt.AlignLeft)
lopenparams.addWidget(self.edtFluoCols, 3, 3, 1, 3, alignment=QtCore.Qt.AlignLeft)
lh = QtGui.QHBoxLayout()
l1 = QtGui.QVBoxLayout()
lh.addWidget(self.btnOpen)
lh.addWidget(self.btnRemoveFile)
l1.addLayout(lh)
l1.addLayout(lopenparams)
l1.addWidget(self.lstSpectra)
##################### XAS FIGURES
#Figures
self.fig = plt.figure(0)
self.ax_abs2 = plt.subplot2grid((2,3), (0,0), fig=self.fig)
self.ax_abs = self.ax_abs2.twinx()
#init lines
self.abs_scatter, = self.ax_abs.plot([], [], 'o', picker=True)
self.abs_scatter.set_markersize(2)
self.mjub_line, self.mju0_mjub_line = self.ax_abs.plot([], [], [], [])
self.mjub_line.set_color('orange')
self.mju0_mjub_line.set_color('orange')
self.deriv_line, = self.ax_abs2.plot([],[])
self.deriv_line.set_color('b')
self.deriv_line.set_alpha(0.3)
self.lineEs = self.ax_abs.axvline(0, color='firebrick', linestyle='--',
lw=2,
picker=True,
pickradius=2)
self.lineE0 = self.ax_abs.axvline(0, color='deeppink', linestyle='--',
lw=2,
picker=True,
pickradius=2)
self.lineE1 = self.ax_abs.axvline(0, color='olive', linestyle='--',
lw=2,
picker=True,
pickradius=2)
self.lineE2 = self.ax_abs.axvline(0, color='steelblue', linestyle='--',
lw=2,
picker=True,
pickradius=2)
self.lineE3 = self.ax_abs.axvline(0, color='purple', linestyle='--',
lw=2,
picker=True,
pickradius=2)
# drag and drop E lines
# self.c = self.ax_abs.get_figure().canvas
# self.sid = self.c.mpl_connect('pick_event', self.pick_a_line)
self.fig.canvas.mpl_connect('pick_event', self.pick_a_line)
self.ax_abs.set_xlabel('Energy, eV')
self.ax_abs.set_ylabel('Absorption, a.u.')
self.ax_exafs = plt.subplot2grid((2,3), (1,0), fig=self.fig)
self.exafs_line, = self.ax_exafs.plot([], [], label = "EXAFS")
self.exafs_line.set_color('k')
self.exafssm_line, = self.ax_exafs.plot([], [], label = "zlc")
self.exafssm_line.set_color('r')
self.ax_exafs_legend = self.ax_exafs.legend(handles=[self.exafs_line, self.exafssm_line])
self.ax_exafs.axhline(y=0, linewidth=1, color = 'k')
self.ax_exafssm = plt.subplot2grid((2,3), (0,1), colspan=2, fig=self.fig)
self.ax_exafssm.axhline(y=0, linewidth=1, color = 'k')
self.exafsd_line, = self.ax_exafssm.plot([], [], label = "EXAFS zlc")
self.bftexafs_line, = self.ax_exafssm.plot( [], [], label = "BFT")
self.bftexafs_line.set_color('r')
self.ax_exafs.set_xlabel('Wavevector k, $\AA^{-1}$')
self.ax_exafs.set_ylabel('EXAFS, $\AA^{-2}$')
self.ax_exafssm.set_xlabel('Wavevector k, $\AA^{-1}$')
self.ax_exafssm.set_ylabel('EXAFS, $\AA^{-2}$')
self.ax_exafsm_legend = self.ax_exafssm.legend(handles=[self.exafsd_line, self.bftexafs_line])
self.ax_ft = plt.subplot2grid((2,3), (1,1), colspan=2, fig=self.fig)
self.efr_line, self.efi_line = self.ax_ft.plot( [], [], [], [], label = "FT")
self.efr_line.set_color('g')
self.efi_line.set_color('g')
self.efi_line.set_linestyle('dotted')
self.efrsm_line, self.efism_line = self.ax_ft.plot([], [], [], [], label = "FT zlc")
self.efrsm_line.set_color('b')
self.efism_line.set_color('b')
self.efism_line.set_linestyle('dotted')
self.bftwinr_line, self.bftwini_line = self.ax_ft.plot([], [], [], [], label = "BFT FT")
self.bftwinr_line.set_color('r')
self.bftwini_line.set_color('r')
self.bftwini_line.set_linestyle('dotted')
self.ax_ft_legend = self.ax_ft.legend(handles=[self.efr_line, self.efrsm_line, self.bftwinr_line])
self.canv = FigureCanvas(self.fig)
self.tbar = NavigationToolbar(self.canv, self)
fnt = self.tbar.font()
fnt.setPointSize(20)
self.tbar.setFont(fnt)
self.ax_ft.set_xlabel('Distance R, $\AA$')
self.ax_ft.set_ylabel('Fourier transform, $\AA^{-3}$')
self.fig.tight_layout()
# self.fig.canvas.mpl_connect('pick_event', self.onpick3)
self.ax_ft.axhline(y=0, linewidth=1, color = 'k')
lfig = QtGui.QVBoxLayout()
lfig.addWidget(self.tbar)
lfig.addWidget(self.canv)
#Frame for xas figures
self.frameXasFig = QtGui.QFrame()
self.frameXasFig.setFrameShape(QtGui.QFrame.Panel)
self.frameXasFig.setFrameShadow(QtGui.QFrame.Sunken)
self.frameXasFig.setLayout(lfig)
self.frameXasFig.hide()
#XAS FIGURES END
### XES FIGURES
self.figXes = plt.figure(11)
self.ax_xes = plt.subplot2grid((2,2), (0,0))
#init lines
#self.abs_scatter = self.ax_abs.scatter([], [], s=1, picker=True)
self.lineXesOriginal, = self.ax_xes.plot([], [], 'o', picker=True)
self.lineXesOriginal.set_markersize(2)
self.lineXesBkgr, = self.ax_xes.plot([], [])
self.lineXesBkgr.set_color('g')
self.lineE0xes = self.ax_xes.axvline(0, color='g', linestyle='--', lw=1)
self.lineE1xes = self.ax_xes.axvline(0, color='g', linestyle='--', lw=1)
self.lineE2xes = self.ax_xes.axvline(0, color='g', linestyle='--', lw=1)
self.lineE3xes = self.ax_xes.axvline(0, color='g', linestyle='--', lw=1)
self.lineEminAnorm = self.ax_xes.axvline(0, color='r', linestyle='--', lw=1)
self.lineEmaxAnorm = self.ax_xes.axvline(0, color='r', linestyle='--', lw=1)
self.ax_xes.set_xlabel('Energy, eV')
self.ax_xes.set_ylabel('Emission intensity, a.u.')
# self.ax_xes.format_coord = format_coord
self.ax_xes_bc = plt.subplot2grid((2,2), (0,1))
self.lineXesBkgrCorr, = self.ax_xes_bc.plot([], []) #, label = "EXAFS")
self.lineXesBkgrCorr.set_color('k')
# self.exafssm_line, = self.ax_xes_bc.plot([], []) #, label = "zlc")
# self.exafssm_line.set_color('r')
# self.ax_exafs.legend(handles=[self.exafs_line, self.exafssm_line])
self.ax_xes_bc.axhline(y=0, linewidth=1, color = 'k')
self.ax_xes_norm = plt.subplot2grid((2,2), (1,0), colspan=2)
self.ax_xes_norm.axhline(y=0, linewidth=1, color = 'k')
self.lineXesNorm, = self.ax_xes_norm.plot([], []) #, label = "EXAFS zlc")
self.canvXes = FigureCanvas(self.figXes)
self.tbarXes = NavigationToolbar(self.canvXes, self)
fnt = self.tbarXes.font()
fnt.setPointSize(20)
self.tbarXes.setFont(fnt)
# self.ax_ft.set_xlabel('Distance R, $\AA$')
# self.ax_ft.set_ylabel('Fourier transform, $\AA^{-3}$')
self.figXes.tight_layout()
# self.figXes.canvas.mpl_connect('pick_event', self.onpick3)
# self.ax_ft.axhline(y=0, linewidth=1, color = 'k')
#
lfig = QtGui.QVBoxLayout()
lfig.addWidget(self.tbarXes)
lfig.addWidget(self.canvXes)
#Frame for XES figures
self.frameXesFig = QtGui.QFrame()
self.frameXesFig.setFrameShape(QtGui.QFrame.Panel)
self.frameXesFig.setFrameShadow(QtGui.QFrame.Sunken)
self.frameXesFig.setLayout(lfig)
# self.frameXesFig.hide()
#XES FIGURES END
###################### XES parameters
lblE0xes = QtGui.QLabel("E0")
lblE1xes = QtGui.QLabel("E1")
lblE2xes = QtGui.QLabel("E2")
lblE3xes = QtGui.QLabel("E3")
lblEMinANormxes = QtGui.QLabel("Emin for area norm")
lblEAMaxNormxes = QtGui.QLabel("Emax for area norm")
self.edtXesE0 = QtGui.QLineEdit()
self.edtXesE1 = QtGui.QLineEdit()
self.edtXesE2 = QtGui.QLineEdit()
self.edtXesE3 = QtGui.QLineEdit()
self.edtXesEANormMin = QtGui.QLineEdit()
self.edtXesEANormMax = QtGui.QLineEdit()
self.edtXesE0.returnPressed.connect(self.xesExtractRedo)
self.edtXesE1.returnPressed.connect(self.xesExtractRedo)
self.edtXesE2.returnPressed.connect(self.xesExtractRedo)
self.edtXesE3.returnPressed.connect(self.xesExtractRedo)
self.edtXesEANormMin.returnPressed.connect(self.xesExtractRedo)
self.edtXesEANormMax.returnPressed.connect(self.xesExtractRedo)
lparams = QtGui.QGridLayout()
lparams.addWidget(lblE0xes, 0, 0)
lparams.addWidget(lblE1xes, 1, 0)
lparams.addWidget(lblE2xes, 2, 0)
lparams.addWidget(lblE3xes, 3, 0)
lparams.addWidget(self.edtXesE0, 0, 1)
lparams.addWidget(self.edtXesE1, 1, 1)
lparams.addWidget(self.edtXesE2, 2, 1)
lparams.addWidget(self.edtXesE3, 3, 1)
lparams.addWidget(lblEMinANormxes, 0, 2)
lparams.addWidget(lblEAMaxNormxes, 1, 2)
lparams.addWidget(self.edtXesEANormMin, 0, 3)
lparams.addWidget(self.edtXesEANormMax, 1, 3)
self.frameXesParams = QtGui.QFrame()
self.frameXesParams.setFrameShape(QtGui.QFrame.Panel)
self.frameXesParams.setFrameShadow(QtGui.QFrame.Sunken)
self.frameXesParams.setLayout(lparams)
self.frameXesParams.hide()
###################### XES traansient parameters
lblEMinSmoothTrans = QtGui.QLabel("Emin for smoothing")
lblEMaxSmoothTrans = QtGui.QLabel("Emax for smoothing")
lblSmoothFactor = QtGui.QLabel("Smoothing factor")
self.edtEMinSmoothTrans = QtGui.QLineEdit()
self.edtEMaxSmoothTrans = QtGui.QLineEdit()
self.edtSmoothFactor = QtGui.QLineEdit()
lblInt1 = QtGui.QLabel("Transient integral")
lblInt2 = QtGui.QLabel("Smoothed transient integral")
lblError = QtGui.QLabel("Difference")
self.edtInt1Show = QtGui.QLineEdit("")
self.edtInt2Show = QtGui.QLineEdit("")
self.edtErrorShow = QtGui.QLineEdit("")
self.edtEMinSmoothTrans.returnPressed.connect(self.transChange)
self.edtEMaxSmoothTrans.returnPressed.connect(self.transChange)
self.edtSmoothFactor.returnPressed.connect(self.transChange)
lparams = QtGui.QGridLayout()
lparams.addWidget(lblEMinSmoothTrans, 0, 0)
lparams.addWidget(lblEMaxSmoothTrans, 1, 0)
lparams.addWidget(lblSmoothFactor, 2, 0)
lparams.addWidget(self.edtEMinSmoothTrans, 0, 1)
lparams.addWidget(self.edtEMaxSmoothTrans, 1, 1)
lparams.addWidget(self.edtSmoothFactor, 2, 1)
lparams.addWidget(lblInt1, 0, 2)
lparams.addWidget(lblInt2, 1, 2)
lparams.addWidget(lblError, 2, 2)
lparams.addWidget(self.edtInt1Show, 0, 3)
lparams.addWidget(self.edtInt2Show, 1, 3)
lparams.addWidget(self.edtErrorShow, 2, 3)
self.frameTransParams = QtGui.QFrame()
self.frameTransParams.setFrameShape(QtGui.QFrame.Panel)
self.frameTransParams.setFrameShadow(QtGui.QFrame.Sunken)
self.frameTransParams.setLayout(lparams)
self.frameTransParams.hide()
#XES parameters END
#Energy params
self.lblEs = QtGui.QLabel("Es")
self.lblE0 = QtGui.QLabel("E0")
self.lblE1 = QtGui.QLabel("E1")
self.lblE2 = QtGui.QLabel("E2")
self.lblE3 = QtGui.QLabel("E3")
self.chkExafsNormalization = QtGui.QCheckBox("Normalize by edge at energy")
self.chkReduceK = QtGui.QCheckBox("Reduce k points (averaging)")
self.chkReduceK.clicked.connect(self.extractParamsChange)
self.lblkpow = QtGui.QLabel("k^n")
self.lblEnergyShift = QtGui.QLabel("Energy scale shift")
self.lblsm = QtGui.QLabel("Zero-line correction (zlc)")
self.lblmju0poldegree = QtGui.QLabel("Mu0 polynomial")
self.lblBckgDegree = QtGui.QLabel("Backgr polynomial (-1 - Vectoreen)")
self.edtEs = modwid.QLineEditScroll()
self.edtE0 = modwid.QLineEditScroll()
self.edtE1 = modwid.QLineEditScroll()
self.edtE2 = modwid.QLineEditScroll()
self.edtE3 = modwid.QLineEditScroll()
self.edtExafsNormEnergy = QtGui.QLineEdit()
self.edtkpow = QtGui.QLineEdit("2")
self.edtEnergyShift = QtGui.QLineEdit("0")
self.edtEnergyShift.setEnabled(False)
self.edtsm = QtGui.QLineEdit("0")
self.edtmju0poldegree = QtGui.QLineEdit("4")
self.edtbckgdegree = QtGui.QLineEdit("-1")
self.btnDeglitching = QtGui.QPushButton('Remove glitches ...')
self.btnDeglitching.clicked.connect(self.removeglitches)
self.lblEs.setStyleSheet("color:#B22222;");
self.lblE0.setStyleSheet("color:#FF1493;");
self.lblE1.setStyleSheet("color:#808000;");
self.lblE2.setStyleSheet("color:#4682B4;");
self.lblE3.setStyleSheet("color:#800080;");
self.edtEs.setToolTip(ttt.xas_es)
self.edtE3.setToolTip(ttt.xas_e3)
lparams = QtGui.QGridLayout()
lparams1 = QtGui.QHBoxLayout()
lparams1.addWidget(self.lblEs)
lparams1.addWidget(self.edtEs)
lparams1.addWidget(self.lblE0)
lparams1.addWidget(self.edtE0)
lparams1.addWidget(self.lblE1)
lparams1.addWidget(self.edtE1)
lparams1.addWidget(self.lblE2)
lparams1.addWidget(self.edtE2)
lparams1.addWidget(self.lblE3)
lparams1.addWidget(self.edtE3)
lparams.addLayout(lparams1, 0,0,1,4)
lparams.addWidget(self.chkExafsNormalization, 1, 0)
lparams.addWidget(self.edtExafsNormEnergy, 1, 1)
lparams.addWidget(self.chkReduceK, 1, 2, 1, 2)
lparams2 = QtGui.QHBoxLayout()
lparams2.addWidget(self.lblsm)
lparams2.addWidget(self.edtsm)
lparams2.addWidget(self.lblkpow)
lparams2.addWidget(self.edtkpow)
lparams2.addWidget(self.lblEnergyShift)
lparams2.addWidget(self.edtEnergyShift)
lparams.addLayout(lparams2, 2,0,1,4)
lparams3 = QtGui.QHBoxLayout()
lparams3.addWidget(self.lblmju0poldegree)
lparams3.addWidget(self.edtmju0poldegree)
lparams3.addWidget(self.lblBckgDegree)
lparams3.addWidget(self.edtbckgdegree)
lparams3.addWidget(self.btnDeglitching)
lparams.addLayout(lparams3, 3,0,1,4)
self.edtEs.returnPressed.connect(self.extractParamsChange)
self.edtE0.returnPressed.connect(self.extractParamsChange)
self.edtE1.returnPressed.connect(self.extractParamsChange)
self.edtE2.returnPressed.connect(self.extractParamsChange)
self.edtE3.returnPressed.connect(self.extractParamsChange)
self.edtkpow.returnPressed.connect(self.kPowerChange)
self.edtsm.returnPressed.connect(self.extractParamsChange)
self.edtmju0poldegree.returnPressed.connect(self.extractParamsChange)
self.edtbckgdegree.returnPressed.connect(self.extractParamsChange)
self.edtExafsNormEnergy.returnPressed.connect(self.extractParamsChange)
#Frame for lparams
self.frameLParams = QtGui.QFrame()
self.frameLParams.setFrameShape(QtGui.QFrame.Panel)
self.frameLParams.setFrameShadow(QtGui.QFrame.Sunken)
self.frameLParams.setLayout(lparams)
self.lblkmin = QtGui.QLabel("K min")
self.lblkmax = QtGui.QLabel("K max")
self.lbldk = QtGui.QLabel("dK ")
self.lblrmin = QtGui.QLabel("R min")
self.lblrmax = QtGui.QLabel("R max")
self.lbldr = QtGui.QLabel("dR ")
self.edtkmin = QtGui.QLineEdit("0.5")
self.edtkmax = QtGui.QLineEdit("18")
self.edtdk = QtGui.QLineEdit("0.05")
self.edtrmin = QtGui.QLineEdit("0")
self.edtrmax = QtGui.QLineEdit("6")
self.edtdr = QtGui.QLineEdit("0.02")
self.edtkmin.returnPressed.connect(self.ftBftParamsChange)
self.edtkmax.returnPressed.connect(self.ftBftParamsChange)
self.edtdk.returnPressed.connect(self.ftBftParamsChange)
self.edtrmin.returnPressed.connect(self.ftBftParamsChange)
self.edtrmax.returnPressed.connect(self.ftBftParamsChange)
self.edtdr.returnPressed.connect(self.ftBftParamsChange)
lftparams = QtGui.QGridLayout()
lftparams.addWidget(self.lblkmin, 0, 0)
lftparams.addWidget(self.lblkmax, 0, 1)
lftparams.addWidget(self.lbldk, 0, 2)
lftparams.addWidget(self.edtkmin, 1, 0)
lftparams.addWidget(self.edtkmax, 1, 1)
lftparams.addWidget(self.edtdk, 1, 2)
lftparams.addWidget(self.lblrmin, 2, 0)
lftparams.addWidget(self.lblrmax, 2, 1)
lftparams.addWidget(self.lbldr, 2, 2)
lftparams.addWidget(self.edtrmin, 3, 0)
lftparams.addWidget(self.edtrmax, 3, 1)
lftparams.addWidget(self.edtdr, 3, 2)
#Frame for lftparams
self.frameLFTParams = QtGui.QFrame()
self.frameLFTParams.setFrameShape(QtGui.QFrame.Panel)
self.frameLFTParams.setFrameShadow(QtGui.QFrame.Sunken)
self.frameLFTParams.setLayout(lftparams)
self.lblrminbft = QtGui.QLabel("BFT R min")
self.lblrmaxbft = QtGui.QLabel("BFT R max")
self.lblbftwindowparam = QtGui.QLabel("BFT window param")
self.edtrminbft = QtGui.QLineEdit("0")
self.edtrmaxbft = QtGui.QLineEdit("6")
self.edtbftwindowparam = QtGui.QLineEdit("0.1")
self.edtrminbft.returnPressed.connect(self.bftParamsChange)
self.edtrmaxbft.returnPressed.connect(self.bftParamsChange)
self.edtbftwindowparam.returnPressed.connect(self.bftParamsChange)
self.btnFit = QtGui.QPushButton('Fit 1st sphere ...')
self.btnFit.clicked.connect(self.fit)
self.btnRdf = QtGui.QPushButton('Reconstruct RDF ...')
self.btnRdf.clicked.connect(self.rdf)
lbftparams = QtGui.QGridLayout()
lbftparams.addWidget(self.lblrminbft, 0,0)
lbftparams.addWidget(self.lblrmaxbft, 0,1)
lbftparams.addWidget(self.lblbftwindowparam, 0,2)
lbftparams.addWidget(self.edtrminbft, 1,0)
lbftparams.addWidget(self.edtrmaxbft, 1,1)
lbftparams.addWidget(self.edtbftwindowparam, 1,2)
lbftparams.addWidget(self.btnFit, 2,0, 1, 3)
lbftparams.addWidget(self.btnRdf, 3,0, 1, 3)
#Frame for lbftparams
self.frameLBFTParams = QtGui.QFrame()
self.frameLBFTParams.setFrameShape(QtGui.QFrame.Panel)
self.frameLBFTParams.setFrameShadow(QtGui.QFrame.Sunken)
self.frameLBFTParams.setLayout(lbftparams)
#compare buttons
self.mnuCompareXAS = QtGui.QMenu()
self.mnuCompareXAS.addAction('Compare mu...', self.comparemju)
self.mnuCompareXAS.addAction('Compare XANES...', self.comparexanes)
self.mnuCompareXAS.addAction('Compare EXAFS...', self.compareexafs)
self.mnuCompareXAS.addAction('Compare FT...', self.compareft)
self.mnuCompareXAS.addAction('Compare BFT...', self.comparebft)
self.mnuCompareXAS.addSeparator()
self.mnuCompareXAS.addAction('Compare i0', lambda: self.compare('i0'))
self.mnuCompareXAS.addAction('Compare i1', lambda: self.compare('i1'))
self.mnuCompareXAS.addAction('Compare i2', lambda: self.compare('i2'))
self.mnuCompareXAS.addAction('Compare i fluorescence', lambda: self.compare('ifluo'))
self.mnuCompareXAS.addAction('Compare mu ref', lambda: self.compare('muref'))
self.mnuCompareXAS.addSeparator()
self.mnuCompareXAS.addAction('Compare amplitude', lambda: self.compare('amp'))
self.mnuCompareXAS.addAction('Compare phase', lambda: self.compare('pha'))
self.mnuCompareXAS.addSeparator()
self.mnuCompareXAS.addAction('Compare mu rebin vs original', lambda: self.compare('mjuRebinVSoriginal'))
#
self.mnuCompareXES = QtGui.QMenu()
self.mnuCompareXES.addAction('Compare XES...', self.compareXes)
self.mnuCompareXES.addAction('Compare XES area normalized...', self.compareXesAnorm)
self.btnCompareXas = QtGui.QPushButton('Compare ...')
# self.btnCompareXas.setMenu(self.mnuCompareXAS)
#save buttons
self.mnuSaveXAS = QtGui.QMenu()
self.mnuSaveXAS.addAction('Save mu...', self.savemju)
self.mnuSaveXAS.addAction('Save XANES...', self.savexanes)
self.mnuSaveXAS.addAction('Save EXAFS...', self.saveexafs)
self.mnuSaveXAS.addAction('Save FT...', self.saveft)
self.mnuSaveXAS.addAction('Save BFT...', self.savebft)
self.mnuSaveXES = QtGui.QMenu()
self.mnuSaveXES.addAction('Save XES...', self.saveXes)
self.mnuSaveXES.addAction('Save XES area normalized...', self.saveXesAnorm)
self.btnSaveXas = QtGui.QPushButton('Save ...')
# self.btnSaveXas.setMenu(self.mnuSaveXAS)
lh = QtGui.QHBoxLayout()
lh.addWidget(self.btnCompareXas)
lh.addWidget(self.btnSaveXas)
l1.addLayout(lh)
self.chkSaveinOneFile = QtGui.QCheckBox("Save selected in single file")
self.chkSaveinOneFile.setChecked(False)
l1.addLayout(lh)
l1.addWidget(self.chkSaveinOneFile)
self.btnAverage = QtGui.QPushButton('Average / merge')
self.mnuAverageXAS = QtGui.QMenu()
self.mnuAverageXAS.addAction('Average mu direct', self.averageMjuDirect)
self.mnuAverageXAS.addAction('Average mu spline', self.averageMjuSpline)
self.mnuAverageXAS.addAction('Average EXAFS', self.averageExafs)
self.mnuAverageXAS.addAction('Merge mu', self.mergeMju)
self.mnuAverageXES = QtGui.QMenu()
self.mnuAverageXES.addAction('Average XES', self.averageXes)
self.btnRebin = QtGui.QPushButton('Rebin')
self.mnuRebinXAS = QtGui.QMenu()
self.mnuRebinXAS.addAction('Rebin mu', self.rebinMju)
self.mnuRebinXAS.addAction('Return to original mu', self.backToOriginalMju)
# self.mnuRebinXAS.addSeparator()
# self.mnuRebinXAS.addAction('Rebin EXAFS', self.rebinExafs)
self.mnuRebinXES = QtGui.QMenu()
self.mnuRebinXES.addAction('Rebin XES', self.rebinXes)
self.btnLinCombination = QtGui.QPushButton('Linear combination...')
self.btnLinCombination.clicked.connect(self.LinCombination)
self.btnPCA = QtGui.QPushButton('PCA analysis...')
self.btnPCA.clicked.connect(self.pcaAnalysis)
self.btnPCA.setEnabled(False)
# self.chkPicker = QtGui.QCheckBox("Allow to remove experimental points")
# self.chkPicker.stateChanged.connect(self.redraw_for_remove)
self.btnCopyParams = QtGui.QPushButton('Copy params')
self.btnCopyParams.clicked.connect(self.CopyParams)
self.btnApplytoSelected = QtGui.QPushButton('Apply params to selected')
self.btnApplytoSelected.clicked.connect(self.ApplytoSelected)
lh1 = QtGui.QHBoxLayout()
lh1.addWidget(self.btnCopyParams)
lh1.addWidget(self.btnApplytoSelected)
lbtn = QtGui.QGridLayout()
lbtn.addLayout(lh1, 0, 0, 1, 2)
lbtn.addWidget(self.btnAverage, 1, 0)
lbtn.addWidget(self.btnRebin, 1, 1)
lbtn.addWidget(self.btnLinCombination, 2, 0, 1, 2)
lbtn.addWidget(self.btnPCA, 3, 0, 1, 2)
layout = QtGui.QGridLayout()
layout.addLayout(l1, 0, 0)
layout.addWidget(self.frameXasFig, 0, 1, 1,3)
layout.addWidget(self.frameXesFig, 0, 1, 1,3)
layout.addLayout(lbtn, 1, 0)
layout.addWidget(self.frameLParams, 1, 1)
layout.addWidget(self.frameXesParams, 1, 1)
layout.addWidget(self.frameTransParams, 1, 1)
layout.addWidget(self.frameLFTParams, 1, 2)
layout.addWidget(self.frameLBFTParams, 1, 3)
layout.setColumnStretch(0,1)
layout.setColumnStretch(1,1)
layout.setColumnStretch(2,1)
layout.setColumnStretch(3,1)
lftparams.setAlignment(QtCore.Qt.AlignTop)
lbftparams.setAlignment(QtCore.Qt.AlignTop)
wid.setLayout(layout)
self.initialdir = ""
self.fig.tight_layout()
# self.fig.canvas.mpl_connect('pick_event', self.onpick)
self.canv.draw()
self.adaptOpeningParams()
self.leg_lines = self.ax_exafsm_legend.get_lines() + \
self.ax_ft_legend.get_lines() + self.ax_ft_legend.get_lines()
print(self.leg_lines)
# leg_lines.append(self.ax_exafs_legend.get_lines())
# leg_lines.append(self.ax_exafsm_legend.get_lines())
# leg_lines.append(self.ax_ft_legend.get_lines())
self.lines = [self.exafsd_line, self.bftexafs_line,
self.efr_line, self.efrsm_line, self.bftwinr_line,
self.efi_line, self.efism_line, self.bftwini_line]
print(self.lines)
# we will set up a dict mapping legend line to orig line, and enable
# picking on the legend line
self.linedXas = dict()
for leglineXas, origlineXas in zip(self.leg_lines, self.lines):
leglineXas.set_picker(5) # 5 pts tolerance
self.linedXas[leglineXas] = origlineXas
# if self.mode == 1:
# self.lined1 = dict()
# for legline, origline in zip(leg_lines, self.lines1):
## legline.set_picker(5) # 5 pts tolerance
# self.lined1[legline] = origline
self.show()
def openaddfiledialog_qtgui(self):
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.ExistingFiles)
dlg.setAcceptMode(0) # open dialog
dlg.setNameFilters(["All files (*.*)",
"XDI files (*.xdi)",
"FIO files (*.fio)",
"Text files (*.txt)",
"DAT files (*.dat)",
"XES files (*.xes)"])
# dlg.setDirectory(self.currentdir)
# filenames = QStringList()
if dlg.exec_():
filenames = dlg.selectedFiles()
return filenames
else:
return []
def savefiledialog_qtgui(self):
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.AnyFile)
dlg.setAcceptMode(1) # save dialog
dlg.setNameFilters(["All files (*.*)"])
# dlg.setDirectory(self.currentdir)
if dlg.exec_():
flist = dlg.selectedFiles()
return flist[0]
else:
return ""
def directoryfiledialog_qtgui(self):
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.Directory)
# dlg.setDirectory(self.currentdir)
dlg.setOption(QtGui.QFileDialog.ShowDirsOnly, True)
if dlg.exec_():
dlist = dlg.selectedFiles()
return dlist[0]
else:
return ""
def openfile(self):
# #apply file format settings
self.skiplines = int(self.edtSkipLines.text())
self.i0col = fromstring(self.edtI0Col.text(), dtype=int, sep=' ')
self.i1col = fromstring(self.edtICol.text(), dtype=int, sep=' ')
self.i2col = fromstring(self.edtI2Col.text(), dtype=int, sep=' ')
self.energycol = int(self.edtEnergyCol.text())
self.exafscol = int(self.edtExafsCol.text())
self.refcol = int(self.edtRefCol.text())
self.fluocol = fromstring(self.edtFluoCols.text(), dtype=int, sep=' ')
self.exafs_fluo = int(not self.chkTransOrFluo.isChecked())
self.calcmju = int(self.chkCalcMju.isChecked())
#
self.fn = self.openaddfiledialog_qtgui()
if self.fn == []:
self.lblStatus.setText("No files opened")
return
self.fn.sort()
fn1 = []
for i in range(0, len(self.fn)):
head, tail = path.split(str(self.fn[i]))
fn1.append(tail)
self.currentdir = head
if self.chkDataTypeExafs.isChecked(): #only exafs
msgBox = QtGui.QMessageBox()
msgBox.setText('Select k power used?')
msgBox.addButton(QtGui.QPushButton('0'), QtGui.QMessageBox.AcceptRole)
msgBox.addButton(QtGui.QPushButton('1'), QtGui.QMessageBox.AcceptRole)
msgBox.addButton(QtGui.QPushButton('2'), QtGui.QMessageBox.AcceptRole)
msgBox.addButton(QtGui.QPushButton('3'), QtGui.QMessageBox.AcceptRole)
kpower = msgBox.exec_()
startTime = timer()
for i in range(0, len(self.fn)):
#test code for automatic determination of the file structure
try:
hl, fl, n_hashtag, ncol, npoints = self.openaddfile_asciistructure(self.fn[i])
#check open settings
except:
pass
self.lstSpectra.addItem(fn1[i])
### XES #########################################
if self.chkDataTypeXes.isChecked(): #XES data
self.dataClasses.append(xaesa_xes_class())
self.dataClasses[-1].name = fn1[i]
try:
self.dataClasses[-1].energy, self.dataClasses[-1].xes = genfromtxt(str(self.fn[i]),
comments = "#",
skip_header = self.skiplines,
usecols=(self.energycol, self.exafscol),
unpack=True)
except:
self.openaddexception_cleaner(self.fn[i])
return
self.dataClasses[-1].E0 = self.dataClasses[-1].energy[0]
self.dataClasses[-1].E1 = self.dataClasses[-1].energy[int(len(self.dataClasses[-1].energy)/5)]
self.dataClasses[-1].E2 = self.dataClasses[-1].energy[int(4*len(self.dataClasses[-1].energy)/5)]
self.dataClasses[-1].E3 = self.dataClasses[-1].energy[len(self.dataClasses[-1].energy)-1]
self.dataClasses[-1].eAreaNormMin = self.dataClasses[-1].energy[0]
self.dataClasses[-1].eAreaNormMax = self.dataClasses[-1].energy[len(self.dataClasses[-1].energy)-1]
#process opened file
self.dataClasses[-1].removeBackground(polPower=polPowerXES)
self.dataClasses[-1].areaNormalize()
#try to get incident energy from filename
try:
udsc_pos = len(self.fn[i]) - [pos for pos, char in enumerate(self.fn[i]) if char == '_'][-1]-1
print(udsc_pos)
E = self.fn[i][-udsc_pos:-4]
self.dataClasses[-1].incidentEnergy = float(E)
except:
self.dataClasses[-1].incidentEnergy = 0
print(E)
sel_item = self.lstSpectra.item(self.lstSpectra.count()-1)
sel_item.setForeground(QtCore.Qt.darkMagenta)
### EXAFS ###############################################
if self.chkDataTypeExafs.isChecked(): #only exafs
self.dataClasses.append(xaesa_exafs_class(3))
self.dataClasses[-1].name = fn1[i]
try:
self.dataClasses[-1].k, self.dataClasses[-1].exafs = genfromtxt(str(self.fn[i]),
comments = "#",
skip_header = self.skiplines,
usecols=(self.energycol, self.exafscol),
unpack=True)
except:
self.openaddexception_cleaner(self.fn[i])
return
self.dataClasses[-1].Es = 0
self.dataClasses[-1].E0 = 0
self.dataClasses[-1].E1 = 0
self.dataClasses[-1].E2 = 0
self.dataClasses[-1].E3 = 0
self.dataClasses[-1].kPower = kpower
self.dataClasses[-1].processExpData()
sel_item = self.lstSpectra.item(self.lstSpectra.count()-1)
sel_item.setForeground(QtCore.Qt.blue)
### Calculate Mju #########
if self.chkDataTypeMju.isChecked(): #mju
if self.chkCalcMju.isChecked():
if self.exafs_fluo == 0: # xas
self.dataClasses.append(xaesa_exafs_class(0))
self.dataClasses[-1].name = fn1[i]
try:
self.dataClasses[-1].energy = genfromtxt(str(self.fn[i]),
comments = "#",
skip_header = self.skiplines,
usecols=(self.energycol),
unpack=True)
self.dataClasses[-1].i0 = genfromtxt(str(self.fn[i]),
comments = "#",
skip_header = self.skiplines,
usecols=self.i0col,
unpack=True)
if len(self.i0col)>1:
self.dataClasses[-1].i0 = sum(self.dataClasses[-1].i0, axis=0)
self.dataClasses[-1].i1 = genfromtxt(str(self.fn[i]),
comments = "#",
skip_header = self.skiplines,
usecols=self.i1col,
unpack=True)
if len(self.i1col)>1:
self.dataClasses[-1].i1 = sum(self.dataClasses[-1].i1, axis=0)
if self.i2col != -1:
self.dataClasses[-1].i2 = genfromtxt(str(self.fn[i]),
comments="#",
skip_header=self.skiplines,
usecols=self.i2col,
unpack=True)
if len(self.i2col)>1:
self.dataClasses[-1].i2 = sum(self.dataClasses[-1].i2, axis=0)
if self.dataClasses[-1].energy[0] < 100: #if energy is in keV
self.dataClasses[-1].energy *= 1000
except:
print("error opening file")
try:
self.dataClasses[-1].processExpData()
except:
print("error processing data")
continue
sel_item = self.lstSpectra.item(self.lstSpectra.count()-1)
sel_item.setForeground(QtCore.Qt.darkGreen)
if self.exafs_fluo == 1: #fluo
self.dataClasses.append(xaesa_exafs_class(1))
self.dataClasses[-1].name = fn1[i]
self.dataClasses[-1].energy = genfromtxt(str(self.fn[i]),
comments = "#",
skip_header = self.skiplines,
usecols=(self.energycol),
unpack=True)
self.dataClasses[-1].i0 = genfromtxt(str(self.fn[i]),
comments = "#",
skip_header = self.skiplines,
usecols=self.i0col,
unpack=True)
if len(self.i0col)>1:
self.dataClasses[-1].i0 = sum(self.dataClasses[-1].i0, axis=0)
self.dataClasses[-1].ifluo = genfromtxt(str(self.fn[i]),
comments = "#",
skip_header = self.skiplines,
usecols=self.fluocol,
unpack=True)
if self.dataClasses[-1].ifluo.ndim == 1:
self.dataClasses[-1].ifluo = asarray([self.dataClasses[-1].ifluo])
if self.dataClasses[-1].energy[0] < 100: #if energy is in keV
self.dataClasses[-1].energy *= 1000
try:
self.dataClasses[-1].processExpData()
except:
print("error processing data")
continue
sel_item = self.lstSpectra.item(self.lstSpectra.count()-1)
sel_item.setForeground(QtCore.Qt.darkGreen)
### Mju from file ########
else:
self.dataClasses.append(xaesa_exafs_class(2)) # mju
self.dataClasses[-1].name = fn1[i]
try:
self.dataClasses[-1].energy, \
self.dataClasses[-1].mju = genfromtxt( str(self.fn[i]), comments = "#",
skip_header = self.skiplines,
usecols=(self.energycol, self.exafscol),
unpack=True)
if self.refcol != -1:
self.dataClasses[-1].mjuRef = genfromtxt(str(self.fn[i]), comments="#",
skip_header=self.skiplines,
usecols=(self.refcol),
unpack=True)
if self.dataClasses[-1].energy[0] < 100: #if energy is in keV
self.dataClasses[-1].energy *= 1000
# print(self.dataClasses[-1].energy)
# print(self.dataClasses[-1].mju)
except:
print("error opening mu")
pass
try:
self.dataClasses[-1].processExpData()
except:
print("error processing data")
continue
sel_item = self.lstSpectra.item(self.lstSpectra.count()-1)
sel_item.setForeground(QtCore.Qt.darkGreen)
endTime = timer()
self.lblStatus.setText("{:d} files opened in {:.4f} seconds".format(len(self.fn), endTime - startTime) )
# self.lblStatus.setText("Files opened.")
def openaddfile_asciistructure(self, filename):
#test code for automatic determination of the file structure
ncol = []
f = open(filename)
# data = f.read()
nlines = 0
n_hashtag = 0
for line in f:
cols = line.split()
ncol.append( len(cols))
nlines = nlines+1
if line[0] == '#':
n_hashtag = n_hashtag + 1
curr = ncol[0]
starti = [0]
leng = [1]
for j in range(1, len(ncol)):
if curr==ncol[j]:
leng[-1] = leng[-1]+1
else:
curr = ncol[j]
starti.append(j)
leng.append(1)
hl = starti[ argmax(leng) ]
fl = nlines - hl - leng[ argmax(leng) ]
print("File ", filename)
print("Header lines : ", hl)
print("Footer lines : ", fl)
print("Lines started with # : ", n_hashtag)
print("Number of columns : ", ncol[hl+1])
print("Number of data points : ", leng[ argmax(leng)] )
print("")
# print(starti)
# print(leng)
f.close()
return hl, fl, n_hashtag, ncol[hl+1], leng[ argmax(leng)]
def removefile(self):
selected_indexes = self.lstSpectra.selectedIndexes()
if len(selected_indexes) == 0:
return
selectedRows = [x.row() for x in selected_indexes]
selectedRows.sort(reverse=True)
print(selectedRows)
for row in selectedRows:
del self.dataClasses[row]
self.lstSpectra.takeItem(row)
self.lblStatus.setText("Files removed.")
def savemju(self):
if self.current < 0:
return
if self.chkSaveinOneFile.isChecked(): #save in one file
selected_items = self.lstSpectra.selectedItems()
selected_indexes = self.lstSpectra.selectedIndexes()
column_captions = ""
for i in range(len(list(selected_items))):
if self.dataClasses[selected_indexes[i].row()].mju != []:
column_captions = column_captions + str(selected_items[i].text()) + " "
column_captions = column_captions + str(selected_items[i].text()) + " "
l = 0
#find the longest array
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
if l<len(self.dataClasses[y].energy):
l = len(self.dataClasses[y].energy)
save_array = []
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
if self.dataClasses[y].mju != []:
if l>len(self.dataClasses[y].energy):
add_array = zeros(l-len(self.dataClasses[y].energy))
else:
add_array = []
save_array.append(concatenate((self.dataClasses[y].energy, add_array)))
save_array.append(concatenate((self.dataClasses[y].mju, add_array)))
fn = self.savefiledialog_qtgui()
if fn == "":
return
savetxt(fn, transpose(save_array), header=column_captions)
else: #save in separate files
directory = self.directoryfiledialog_qtgui()
if directory == "":
return
selected_items = self.lstSpectra.selectedItems()
selected_indexes = self.lstSpectra.selectedIndexes()
for i in range(len(list(selected_items))):
y= selected_indexes[i].row()
filename = directory +"/" + str(selected_items[i].text()) + ".mu"
save_array = []
save_array.append(self.dataClasses[y].energy)
save_array.append(self.dataClasses[y].mju)
savetxt(filename, transpose(save_array))
def savexanes(self):
if self.current < 0:
return
if self.chkSaveinOneFile.isChecked(): #save in one file
selected_items = self.lstSpectra.selectedItems()
selected_indexes = self.lstSpectra.selectedIndexes()
column_captions = ""
for i in range(len(list(selected_items))):
if self.mju[selected_indexes[i].row()] != []:
column_captions = column_captions + str(selected_items[i].text()) + " "
column_captions = column_captions + str(selected_items[i].text()) + " "
l = 0
#find the longest array
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
if l<len(self.dataClasses[y].energy):
l = len(self.dataClasses[y].energy)
save_array = []
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
if self.dataClasses[y].mju != []:
if l>len(self.dataClasses[y].energy):
add_array = zeros(l-len(self.dataClasses[y].energy))
else:
add_array = []
idx = argmin(abs(self.dataClasses[y].energy - self.dataClasses[y].normalizationEnergy))
save_array.append(concatenate((self.dataClasses[y].energy, add_array)))
save_array.append(concatenate(
(self.dataClasses[y].mjuMinusVictoreen / self.dataClasses[y].mju0[idx], add_array)))
fn = self.savefiledialog_qtgui()
if fn == "":
return
savetxt(fn, transpose(save_array), header=column_captions)
else: #save in separate files
directory = self.directoryfiledialog_qtgui()
if directory == "":
return
selected_items = self.lstSpectra.selectedItems()
selected_indexes = self.lstSpectra.selectedIndexes()
for i in range(len(list(selected_items))):
y= selected_indexes[i].row()
filename = directory +"/" + str(selected_items[i].text()) + ".xanes"
idx = argmin(abs(self.dataClasses[y].energy - self.dataClasses[y].normalizationEnergy))
save_array = []
save_array.append(self.dataClasses[y].energy)
save_array.append(self.dataClasses[y].mjuMinusVictoreen / self.dataClasses[y].mju0[idx])
savetxt(filename, transpose(save_array))
def saveexafs(self):
if self.current < 0:
return
if self.chkSaveinOneFile.isChecked(): #save in one file
selected_items = self.lstSpectra.selectedItems()
selected_indexes = self.lstSpectra.selectedIndexes()
column_captions = ""
for i in range(len(list(selected_items))):
column_captions = column_captions + str(selected_items[i].text()) + " "
column_captions = column_captions + str(selected_items[i].text()) + " "
l = 0
#find the longest array
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
if l<len(self.dataClasses[y].k):
l = len(self.dataClasses[y].k)
save_array = []
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
if l>len(self.dataClasses[y].k):
add_array = zeros(l-len(self.dataClasses[y].k))
else:
add_array = []
save_array.append(concatenate((self.dataClasses[y].k, add_array)))
save_array.append(concatenate((self.dataClasses[y].exafsZLC, add_array)))
fn = self.savefiledialog_qtgui()
if fn == "":
return
savetxt(fn, transpose(save_array), header=column_captions)
else: #save in separate files
directory = self.directoryfiledialog_qtgui()
if directory == "":
return
selected_items = self.lstSpectra.selectedItems()
selected_indexes = self.lstSpectra.selectedIndexes()
for i in range(len(list(selected_items))):
y= selected_indexes[i].row()
filename = directory +"/" + str(selected_items[i].text()) + ".exafs"
save_array = []
save_array.append(self.dataClasses[y].k)
save_array.append(self.dataClasses[y].exafsZLC)
savetxt(filename, transpose(save_array))
def saveft(self):
if self.current < 0:
return
if self.chkSaveinOneFile.isChecked(): #save in one file
selected_items = self.lstSpectra.selectedItems()
selected_indexes = self.lstSpectra.selectedIndexes()
column_captions = ""
for i in range(len(list(selected_items))):
column_captions = column_captions + str(selected_items[i].text()) + " "
column_captions = column_captions + str(selected_items[i].text()) + " "
column_captions = column_captions + str(selected_items[i].text()) + " "
l = 0
#find the longest array
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
if l<len(self.dataClasses[y].rZLC):
l = len(self.dataClasses[y].rZLC)
save_array = []
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
if l>len(self.dataClasses[y].rZLC):
add_array = zeros(l-len(self.dataClasses[y].rZLC))
else:
add_array = []
save_array.append(concatenate((self.dataClasses[y].rZLC, add_array)))
save_array.append(concatenate((self.dataClasses[y].efrZLC, add_array)))
save_array.append(concatenate((self.dataClasses[y].efiZLC, add_array)))
fn = self.savefiledialog_qtgui()
if fn == "":
return
savetxt(fn, transpose(save_array), header=column_captions)
else: #save in separate files
directory = self.directoryfiledialog_qtgui()
if directory == "":
return
selected_items = self.lstSpectra.selectedItems()
selected_indexes = self.lstSpectra.selectedIndexes()
for i in range(len(list(selected_items))):
y= selected_indexes[i].row()
filename = directory +"/" + str(selected_items[i].text()) + ".ft"
save_array = []
save_array.append(self.dataClasses[y].rZLC)
save_array.append(self.dataClasses[y].efrZLC)
save_array.append(self.dataClasses[y].efiZLC)
savetxt(filename, transpose(save_array))
def savebft(self):
if self.current < 0:
return
if self.chkSaveinOneFile.isChecked(): #save in one file
selected_items = self.lstSpectra.selectedItems()
selected_indexes = self.lstSpectra.selectedIndexes()
column_captions = ""
for i in range(len(list(selected_items))):
column_captions = column_captions + str(selected_items[i].text()) + " "
column_captions = column_captions + str(selected_items[i].text()) + " "
l = 0
#find the longest array
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
if l<len(self.dataClasses[y].bftk):
l = len(self.dataClasses[y].bftk)
save_array = []
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
if l>len(self.dataClasses[y].bftk):
add_array = zeros(l-len(self.dataClasses[y].bftk))
else:
add_array = []
save_array.append(concatenate((self.dataClasses[y].bftk, add_array)))
save_array.append(concatenate((self.dataClasses[y].bftEXAFS, add_array)))
fn = self.savefiledialog_qtgui()
if fn == "":
return
savetxt(fn, transpose(save_array), header=column_captions)
else: #save in separate files
directory = self.directoryfiledialog_qtgui()
if directory == "":
return
selected_items = self.lstSpectra.selectedItems()
selected_indexes = self.lstSpectra.selectedIndexes()
for i in range(len(list(selected_items))):
y= selected_indexes[i].row()
filename = directory +"/" + str(selected_items[i].text()) + ".bft"
save_array = []
save_array.append(self.dataClasses[y].bftk)
save_array.append(self.dataClasses[y].bftEXAFS)
savetxt(filename, transpose(save_array))
def saveXes(self):
if self.current < 0:
return
if self.chkSaveinOneFile.isChecked(): #save in one file
selected_items = self.lstSpectra.selectedItems()
selected_indexes = self.lstSpectra.selectedIndexes()
column_captions = ""
for i in range(len(list(selected_items))):
if self.mju[selected_indexes[i].row()] != []:
column_captions = column_captions + str(selected_items[i].text()) + " "
column_captions = column_captions + str(selected_items[i].text()) + " "
l = 0
#find the longest array
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
if l<len(self.dataClasses[y].energy):
l = len(self.dataClasses[y].energy)
save_array = []
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
if self.dataClasses[y].xes != []:
if l>len(self.dataClasses[y].energy):
add_array = zeros(l-len(self.dataClasses[y].energy))
else:
add_array = []
save_array.append(concatenate((self.dataClasses[y].energy, add_array)))
save_array.append(concatenate((self.dataClasses[y].xes, add_array)))
fn = self.savefiledialog_qtgui()
if fn == "":
return
savetxt(fn, transpose(save_array), header=column_captions)
else: #save in separate files
directory = self.directoryfiledialog_qtgui()
if directory == "":
return
selected_items = self.lstSpectra.selectedItems()
selected_indexes = self.lstSpectra.selectedIndexes()
for i in range(len(list(selected_items))):
y= selected_indexes[i].row()
filename = directory +"/" + str(selected_items[i].text()) + ".xes"
save_array = []
save_array.append(self.dataClasses[y].energy)
save_array.append(self.dataClasses[y].xes)
savetxt(filename, transpose(save_array))
def saveXesAnorm(self):
if self.current < 0:
return
if self.chkSaveinOneFile.isChecked(): #save in one file
selected_items = self.lstSpectra.selectedItems()
selected_indexes = self.lstSpectra.selectedIndexes()
column_captions = ""
for i in range(len(list(selected_items))):
column_captions = column_captions + str(selected_items[i].text()) + " "
column_captions = column_captions + str(selected_items[i].text()) + " "
l = 0
#find the longest array
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
if l<len(self.dataClasses[y].energy):
l = len(self.dataClasses[y].energy)
save_array = []
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
if l>len(self.dataClasses[y].energy):
add_array = zeros(l-len(self.dataClasses[y].energy))
else:
add_array = []
save_array.append(concatenate((self.dataClasses[y].energy, add_array)))
save_array.append(concatenate((self.dataClasses[y].xesAreaNorm, add_array)))
fn = self.savefiledialog_qtgui()
if fn == "":
return
savetxt(fn, transpose(save_array), header=column_captions)
else: #save in separate files-
directory = self.directoryfiledialog_qtgui()
if directory == "":
return
selected_items = self.lstSpectra.selectedItems()
selected_indexes = self.lstSpectra.selectedIndexes()
for i in range(len(list(selected_items))):
y= selected_indexes[i].row()
filename = directory +"/" + str(selected_items[i].text()) + ".xesan"
save_array = []
save_array.append(self.dataClasses[y].energy)
save_array.append(self.dataClasses[y].xesAreaNorm)
savetxt(filename, transpose(save_array))
def ampPhaSave(self):
if self.current < 0:
return
cnr = self.current
d = self.directoryfiledialog_qtgui()
if d == "":
return
savetxt(d + "/" + self.lstSpectra.item(cnr).text() + ".amp",
transpose([self.dataClasses[cnr].bftk, self.dataClasses[cnr].bftAmp*self.dataClasses[cnr].bftk / self.dataClasses[cnr].bftk**self.dataClasses[cnr].kPower ]))
savetxt(d + "/" + self.lstSpectra.item(cnr).text() + ".pha",
transpose([self.dataClasses[cnr].bftk, self.dataClasses[cnr].bftPha*self.dataClasses[cnr].bftk / self.dataClasses[cnr].bftk**self.dataClasses[cnr].kPower ]))
def lstSpectraItemClicked(self):
# startTime = timer()
self.current = self.lstSpectra.currentRow()
print("Selected element", self.current)
cnr = self.current
self.lblCurrentFile.setText(self.dataClasses[cnr].name)
if isinstance(self.dataClasses[cnr], xaesa_transient_class):
#setup interface
self.frameXasFig.hide()
self.frameXesFig.show()
self.frameTransParams.show()
self.frameXesParams.hide()
self.frameLParams.hide()
self.frameLFTParams.hide()
self.frameLBFTParams.hide()
self.edtEMinSmoothTrans.setText("{:.2f}".format(self.dataClasses[cnr].eSmoothMin))
self.edtEMaxSmoothTrans.setText("{:.2f}".format(self.dataClasses[cnr].eSmoothMax))
self.edtSmoothFactor.setText("{:.8f}".format(self.dataClasses[cnr].smoothFactor))
self.lineXesOriginal.set_xdata(self.dataClasses[cnr].energy)
self.lineXesOriginal.set_ydata(self.dataClasses[cnr].transient)
self.lineE0xes.set_xdata(self.dataClasses[cnr].energy[0])
self.lineE1xes.set_xdata(self.dataClasses[cnr].energy[0])
self.lineE2xes.set_xdata(self.dataClasses[cnr].energy[0])
self.lineE3xes.set_xdata(self.dataClasses[cnr].energy[0])
self.lineEminAnorm.set_xdata(self.dataClasses[cnr].eSmoothMin)
self.lineEmaxAnorm.set_xdata(self.dataClasses[cnr].eSmoothMax)
self.lineXesBkgrCorr.set_xdata(self.dataClasses[cnr].energySmooth)
self.lineXesBkgrCorr.set_ydata(self.dataClasses[cnr].transientSmooth)
self.lineXesNorm.set_xdata(self.dataClasses[cnr].energy)
self.lineXesNorm.set_ydata(self.dataClasses[cnr].transient)
self.ax_xes.relim()
self.ax_xes_bc.relim()
self.ax_xes_norm.relim()
self.ax_xes.autoscale()
self.ax_xes_bc.autoscale()
self.ax_xes_norm.autoscale()
self.figXes.tight_layout()
self.canvXes.draw()
#Show integral values
where3 = where( logical_and(self.dataClasses[cnr].energy > self.dataClasses[cnr].eSmoothMin, \
self.dataClasses[cnr].energy < self.dataClasses[cnr].eSmoothMax) )
self.edtInt1Show.setText( \
str( simps(absolute(self.dataClasses[cnr].transient[where3]))))
self.edtInt2Show.setText( \
str( simps(absolute(self.dataClasses[cnr].transientSmooth))))
self.edtErrorShow.setText( \
str(simps(absolute(self.dataClasses[cnr].transient[where3] - self.dataClasses[cnr].transientSmooth))))
if isinstance(self.dataClasses[cnr], xaesa_xes_class):
#setup interface
self.frameXasFig.hide()
self.frameXesFig.show()
self.frameXesParams.show()
self.frameTransParams.hide()
self.frameLParams.hide()
self.frameLFTParams.hide()
self.frameLBFTParams.hide()
self.btnCompareXas.setMenu(self.mnuCompareXES)
self.btnSaveXas.setMenu(self.mnuSaveXES)
self.btnAverage.setMenu(self.mnuAverageXES)
self.btnRebin.setMenu(self.mnuRebinXES)
#set params to edit boxes
self.edtXesE0.setText("{:.2f}".format(self.dataClasses[cnr].E0))
self.edtXesE1.setText("{:.2f}".format(self.dataClasses[cnr].E1))
self.edtXesE2.setText("{:.2f}".format(self.dataClasses[cnr].E2))
self.edtXesE3.setText("{:.2f}".format(self.dataClasses[cnr].E3))
self.edtXesEANormMin.setText("{:.2f}".format(self.dataClasses[cnr].eAreaNormMin))
self.edtXesEANormMax.setText("{:.2f}".format(self.dataClasses[cnr].eAreaNormMax))
#update graph data
self.lineXesOriginal.set_xdata(self.dataClasses[cnr].energy)
self.lineXesOriginal.set_ydata(self.dataClasses[cnr].xes)
self.lineXesBkgr.set_xdata(self.dataClasses[cnr].energy)
self.lineXesBkgr.set_ydata(self.dataClasses[cnr].xesBackground)
self.lineE0xes.set_xdata(self.dataClasses[cnr].E0)
self.lineE1xes.set_xdata(self.dataClasses[cnr].E1)
self.lineE2xes.set_xdata(self.dataClasses[cnr].E2)
self.lineE3xes.set_xdata(self.dataClasses[cnr].E3)
self.lineEminAnorm.set_xdata(self.dataClasses[cnr].eAreaNormMin)
self.lineEmaxAnorm.set_xdata(self.dataClasses[cnr].eAreaNormMax)
self.lineXesBkgrCorr.set_xdata(self.dataClasses[cnr].energy)
self.lineXesBkgrCorr.set_ydata(self.dataClasses[cnr].xesBkgrCorrected)
self.lineXesNorm.set_xdata(self.dataClasses[cnr].energy)
self.lineXesNorm.set_ydata(self.dataClasses[cnr].xesAreaNorm)
self.ax_xes.relim()
self.ax_xes_bc.relim()
self.ax_xes_norm.relim()
self.ax_xes.autoscale()
self.ax_xes_bc.autoscale()
self.ax_xes_norm.autoscale()
self.figXes.tight_layout()
self.canvXes.draw()
if isinstance(self.dataClasses[cnr], xaesa_exafs_class):
#setup interface
self.frameXasFig.show()
self.frameXesFig.hide()
self.frameXesParams.hide()
self.frameLParams.show()
self.frameLFTParams.show()
self.frameLBFTParams.show()
self.frameTransParams.hide()
self.btnCompareXas.setMenu(self.mnuCompareXAS)
self.btnSaveXas.setMenu(self.mnuSaveXAS)
self.btnAverage.setMenu(self.mnuAverageXAS)
self.btnRebin.setMenu(self.mnuRebinXAS)
self.edtEs.setText("{:.2f}".format(self.dataClasses[cnr].Es))
self.edtE0.setText("{:.2f}".format(self.dataClasses[cnr].E0))
self.edtE1.setText("{:.2f}".format(self.dataClasses[cnr].E1))
self.edtE2.setText("{:.2f}".format(self.dataClasses[cnr].E2))
self.edtE3.setText("{:.2f}".format(self.dataClasses[cnr].E3))
self.edtEnergyShift.setText("{:.2f}".format(self.dataClasses[cnr].energyShift))
self.edtkpow.setText(str(self.dataClasses[cnr].kPower))
self.edtsm.setText(str(self.dataClasses[cnr].zeroLineCorr))
self.edtmju0poldegree.setText("{:.0f}".format(self.dataClasses[cnr].mju0PolinomialDegree))
self.edtbckgdegree.setText("{:.0f}".format(self.dataClasses[cnr].bckgrPolinomialDegree))
self.edtkmin.setText(str(self.dataClasses[cnr].kMin))
self.edtkmax.setText("{:.2f}".format(self.dataClasses[cnr].kMax))
self.edtdk.setText(str(self.dataClasses[cnr].dk))
self.edtrmin.setText(str(self.dataClasses[cnr].rMin))
self.edtrmax.setText(str(self.dataClasses[cnr].rMax))
self.edtdr.setText(str(self.dataClasses[cnr].dr))
self.edtrminbft.setText(str(self.dataClasses[cnr].rMinBft))
self.edtrmaxbft.setText(str(self.dataClasses[cnr].rMaxBft))
self.edtbftwindowparam.setText(str(self.dataClasses[cnr].bftWindowParam))
self.edtExafsNormEnergy.setText(str(self.dataClasses[cnr].normalizationEnergy))
self.chkExafsNormalization.setChecked(self.dataClasses[cnr].normalizationMode)
self.chkReduceK.setChecked(self.dataClasses[cnr].reduceK)
self.abs_scatter.set_xdata(self.dataClasses[cnr].energy)
self.abs_scatter.set_ydata(self.dataClasses[cnr].mju)
self.mjub_line.set_xdata(self.dataClasses[cnr].energy)
self.mjub_line.set_ydata(self.dataClasses[cnr].victoreen)
whereE0E3 = where( logical_and(self.dataClasses[cnr].energy > self.dataClasses[cnr].E0,
self.dataClasses[cnr].energy < self.dataClasses[cnr].E3) )
if self.dataClasses[cnr].mju0PolinomialDegree >= 0:
mju0 = self.dataClasses[cnr].mju0[whereE0E3]
else:
mju0 = self.dataClasses[cnr].mju0
self.mju0_mjub_line.set_xdata(self.dataClasses[cnr].energy[whereE0E3])
self.mju0_mjub_line.set_ydata(mju0+self.dataClasses[cnr].victoreen[whereE0E3])
self.deriv_line.set_xdata(self.dataClasses[cnr].energy)
self.deriv_line.set_ydata(self.dataClasses[cnr].mjuDerivative)
self.lineEs.set_xdata(self.dataClasses[cnr].Es)
self.lineE0.set_xdata(self.dataClasses[cnr].E0)
self.lineE1.set_xdata(self.dataClasses[cnr].E1)
self.lineE2.set_xdata(self.dataClasses[cnr].E2)
self.lineE3.set_xdata(self.dataClasses[cnr].E3)
self.ax_abs.relim()
self.ax_abs.autoscale()
self.ax_abs2.relim()
self.ax_abs2.autoscale()
self.exafs_line.set_xdata(self.dataClasses[cnr].k)
self.exafs_line.set_ydata(self.dataClasses[cnr].exafs)
self.exafssm_line.set_xdata(self.dataClasses[cnr].k)
self.exafssm_line.set_ydata(self.dataClasses[cnr].exafsZeroLine)
self.ax_exafs.relim()
self.ax_exafs.autoscale()
self.efr_line.set_xdata(self.dataClasses[cnr].r)
self.efr_line.set_ydata(self.dataClasses[cnr].efr)
self.efi_line.set_xdata(self.dataClasses[cnr].r)
self.efi_line.set_ydata(self.dataClasses[cnr].efi)
self.efrsm_line.set_xdata(self.dataClasses[cnr].rZLC)
self.efrsm_line.set_ydata(self.dataClasses[cnr].efrZLC)
self.efism_line.set_xdata(self.dataClasses[cnr].rZLC)
self.efism_line.set_ydata(self.dataClasses[cnr].efiZLC)
self.bftwinr_line.set_xdata(self.dataClasses[cnr].rZLC)
self.bftwinr_line.set_ydata(self.dataClasses[cnr].bftefrWindow)
self.bftwini_line.set_xdata(self.dataClasses[cnr].rZLC)
self.bftwini_line.set_ydata(self.dataClasses[cnr].bftefiWindow)
self.ax_ft.relim()
self.ax_ft.autoscale()
self.exafsd_line.set_xdata(self.dataClasses[cnr].k)
self.exafsd_line.set_ydata(self.dataClasses[cnr].exafsZLC)
self.bftexafs_line.set_xdata(self.dataClasses[cnr].bftk)
self.bftexafs_line.set_ydata(self.dataClasses[cnr].bftEXAFS)
self.ax_exafssm.relim()
self.ax_exafssm.autoscale()
self.fig.tight_layout()
self.canv.draw()
# endTime = timer()
# self.lblStatus.setText("Replot time {:.4f} seconds".format(endTime - startTime) )
self.lblnpoints.setText("Number of experimental points : " + str(len(self.dataClasses[cnr].mju)))
def listItemRightClicked(self, QPos):
parentPosition = self.lstSpectra.mapToGlobal(QtCore.QPoint(0, 0))
self.lstSpectraMenu.move(parentPosition + QPos)
self.lstSpectraMenu.show()
def lstSpectraItemDoubleClicked(self):
item = self.lstSpectra.currentItem()
item.setFlags(item.flags() | QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEditable | QtCore.Qt.ItemIsEnabled)
self.lstSpectra.editItem(self.lstSpectra.currentItem())
def savehdf5(self):
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.AnyFile)
dlg.setAcceptMode(1) # save dialog
dlg.setNameFilters(["HDF5 files (*.hdf5)", "All files (*.*)"])
# dlg.setDirectory(self.currenthdf5)
# dlg.setDirectory(self.currentdir)
if dlg.exec_():
fnlist = dlg.selectedFiles()
else:
return
fn = fnlist[0]
head, tail = path.split(str(fn))
# self.currenthdf5 = head
self.currentdir = head
fhdf5 = h5py.File(fn, "w")
# anfn = []
# for i in range(0, self.lstSpectra.count()):
# anfn.append(str(self.lstSpectra.item(i).text()))
# asciiList = [n.encode("ascii", "ignore") for n in anfn]
for i in range(self.lstSpectra.count()):
if isinstance(self.dataClasses[i], xaesa_exafs_class): #save XAS data
grp = fhdf5.create_group("{0:06d}".format(i) + "&" + self.lstSpectra.item(i).text())
grp.create_dataset("classType", data = 0)
grp.create_dataset("raw_data_type", data = self.dataClasses[i].raw_data_type)
grp.create_dataset("name", data = self.dataClasses[i].name)
grp.create_dataset("energy", data = self.dataClasses[i].energy)
grp.create_dataset("energyRebined", data = self.dataClasses[i].energyRebined)
grp.create_dataset("energyOriginal", data = self.dataClasses[i].energyOriginal)
grp.create_dataset("i0", data = self.dataClasses[i].i0)
grp.create_dataset("i1", data = self.dataClasses[i].i1)
grp.create_dataset("i2", data = self.dataClasses[i].i2)
grp.create_dataset("ifluo", data = self.dataClasses[i].ifluo)
#Mju datasets
grp.create_dataset("mju", data = self.dataClasses[i].mju)
grp.create_dataset("mjuRef", data=self.dataClasses[i].mjuRef)
grp.create_dataset("mjuRebined", data = self.dataClasses[i].mjuRebined)
grp.create_dataset("mjuOriginal", data = self.dataClasses[i].mjuOriginal)
grp.create_dataset("mjuDerivative", data = self.dataClasses[i].mjuDerivative)
grp.create_dataset("victoreen", data = self.dataClasses[i].victoreen)
grp.create_dataset("mjuMinusVictoreen", data = self.dataClasses[i].mjuMinusVictoreen)
grp.create_dataset("mju0", data = self.dataClasses[i].mju0)
#EXAFS datasets
grp.create_dataset("k", data = self.dataClasses[i].k )
grp.create_dataset("exafs", data = self.dataClasses[i].exafs )
grp.create_dataset("exafsZeroLine", data = self.dataClasses[i].exafsZeroLine )
grp.create_dataset("exafsZLC", data = self.dataClasses[i].exafsZLC )
# FT datasets
grp.create_dataset("window", data = self.dataClasses[i].window )
grp.create_dataset("exafsTimesWindow", data = self.dataClasses[i].exafsTimesWindow )
grp.create_dataset("exafsZLCTimesWindow", data = self.dataClasses[i].exafsZLCTimesWindow )
grp.create_dataset("r", data = self.dataClasses[i].r )
grp.create_dataset("fr", data = self.dataClasses[i].fr )
grp.create_dataset("fi", data = self.dataClasses[i].fi )
grp.create_dataset("efr", data = self.dataClasses[i].efr )
grp.create_dataset("efi", data = self.dataClasses[i].efi )
grp.create_dataset("rZLC", data = self.dataClasses[i].rZLC )
grp.create_dataset("frZLC", data = self.dataClasses[i].frZLC )
grp.create_dataset("fiZLC", data = self.dataClasses[i].fiZLC )
grp.create_dataset("efrZLC", data = self.dataClasses[i].efrZLC )
grp.create_dataset("efiZLC", data = self.dataClasses[i].efiZLC )
# BFT datasets
grp.create_dataset("bftWindow", data = self.dataClasses[i].bftWindow )
grp.create_dataset("bftk", data = self.dataClasses[i].bftk )
grp.create_dataset("bftefr", data = self.dataClasses[i].bftefr )
grp.create_dataset("bftefi", data = self.dataClasses[i].bftefi )
grp.create_dataset("bftAmp", data = self.dataClasses[i].bftAmp )
grp.create_dataset("bftPha", data = self.dataClasses[i].bftPha )
grp.create_dataset("bftEXAFS", data = self.dataClasses[i].bftEXAFS )
grp.create_dataset("bftefrWindow", data = self.dataClasses[i].bftefrWindow )
grp.create_dataset("bftefiWindow", data = self.dataClasses[i].bftefiWindow )
#Rebin parameters
grp.create_dataset("dE1", data = self.dataClasses[i].dE1 )
grp.create_dataset("dE2", data = self.dataClasses[i].dE2 )
grp.create_dataset("dE3", data = self.dataClasses[i].dE3 )
#extraction params
grp.create_dataset("Es", data=self.dataClasses[i].Es)
grp.create_dataset("E0", data = self.dataClasses[i].E0 )
grp.create_dataset("E1", data = self.dataClasses[i].E1 )
grp.create_dataset("E2", data = self.dataClasses[i].E2 )
grp.create_dataset("E3", data = self.dataClasses[i].E3 )
grp.create_dataset("energyShift", data=self.dataClasses[i].energyShift)
grp.create_dataset("kPower", data = self.dataClasses[i].kPower)
grp.create_dataset("zeroLineCorr", data = self.dataClasses[i].zeroLineCorr )
grp.create_dataset("mju0PolinomialDegree", data = self.dataClasses[i].mju0PolinomialDegree )
grp.create_dataset("bckgrPolinomialDegree", data = self.dataClasses[i].bckgrPolinomialDegree )
grp.create_dataset("normalizationMode", data = self.dataClasses[i].normalizationMode ) #0 for mju0 normalization, 1 for value normalization at given energy
grp.create_dataset("normalizationEnergy", data = self.dataClasses[i].normalizationEnergy )
#FT params
grp.create_dataset("kMin", data = self.dataClasses[i].kMin )
grp.create_dataset("kMax", data = self.dataClasses[i].kMax )
grp.create_dataset("dk", data = self.dataClasses[i].dk )
grp.create_dataset("rMin", data = self.dataClasses[i].rMin )
grp.create_dataset("rMax", data = self.dataClasses[i].rMax )
grp.create_dataset("dr", data = self.dataClasses[i].dr )
#BFT params
grp.create_dataset("rMinBft", data = self.dataClasses[i].rMinBft )
grp.create_dataset("rMaxBft", data = self.dataClasses[i].rMaxBft )
grp.create_dataset("bftWindowParam", data = self.dataClasses[i].bftWindowParam )
# Deglitching params and result
#fit params and results
grp.create_dataset("fitKMin", data = self.dataClasses[i].fitKMin )
grp.create_dataset("fitKMax", data = self.dataClasses[i].fitKMax )
grp.create_dataset("fitdk", data = self.dataClasses[i].fitdk )
grp.create_dataset("fitNShels", data = self.dataClasses[i].fitNShels )
grp.create_dataset("fitParams", data = self.dataClasses[i].fitParams )
grp.create_dataset("fitAmps", data = self.dataClasses[i].fitAmps )
grp.create_dataset("fitPhas", data = self.dataClasses[i].fitPhas )
grp.create_dataset("fitK", data = self.dataClasses[i].fitK )
grp.create_dataset("fitExafs", data = self.dataClasses[i].fitExafs )
#rdf params and results
grp.create_dataset("isRdfed", data = self.dataClasses[i].isRdfed )
grp.create_dataset("rdfKMin", data = self.dataClasses[i].rdfKMin )
grp.create_dataset("rdfKMax", data = self.dataClasses[i].rdfKMax )
grp.create_dataset("rdfdk", data = self.dataClasses[i].rdfdk )
grp.create_dataset("rdfRMin", data = self.dataClasses[i].rdfRMin )
grp.create_dataset("rdfRMax", data = self.dataClasses[i].rdfRMax )
grp.create_dataset("rdfdr", data = self.dataClasses[i].rdfdr )
grp.create_dataset("rdfMaxIterations", data = self.dataClasses[i].rdfMaxIterations )
grp.create_dataset("rdfAmpK", data = self.dataClasses[i].rdfAmpK )
grp.create_dataset("rdfAmp", data = self.dataClasses[i].rdfAmp )
grp.create_dataset("rdfPhaK", data = self.dataClasses[i].rdfPhaK )
grp.create_dataset("rdfPha", data = self.dataClasses[i].rdfPha )
grp.create_dataset("rdfAmpFile", data = self.dataClasses[i].rdfAmpFile )
grp.create_dataset("rdfPhaFile", data = self.dataClasses[i].rdfPhaFile )
grp.create_dataset("rdfK", data = self.dataClasses[i].rdfK )
grp.create_dataset("rdfExafs", data = self.dataClasses[i].rdfExafs )
grp.create_dataset("rdfR", data = self.dataClasses[i].rdfR )
grp.create_dataset("rdf", data = self.dataClasses[i].rdf )
if isinstance(self.dataClasses[i], xaesa_xes_class): #save XES data
grp = fhdf5.create_group("{0:06d}".format(i) + "&" + self.lstSpectra.item(i).text())
grp.create_dataset("classType", data = 10)
grp.create_dataset("name", data = self.dataClasses[i].name)
grp.create_dataset("energy", data = self.dataClasses[i].energy)
grp.create_dataset("energyRebined", data = self.dataClasses[i].energyRebined)
grp.create_dataset("energyOriginal", data = self.dataClasses[i].energyOriginal)
grp.create_dataset("xes", data = self.dataClasses[i].xes)
grp.create_dataset("xesBackground", data = self.dataClasses[i].xesBackground)
grp.create_dataset("xesBkgrCorrected", data = self.dataClasses[i].xesBkgrCorrected)
grp.create_dataset("xesAreaNorm", data = self.dataClasses[i].xesAreaNorm)
grp.create_dataset("xesMaxNorm", data = self.dataClasses[i].xesMaxNorm)
grp.create_dataset("xesRebinned", data = self.dataClasses[i].xesRebinned)
grp.create_dataset("xesOriginal", data = self.dataClasses[i].xesOriginal)
grp.create_dataset("E0", data = self.dataClasses[i].E0)
grp.create_dataset("E1", data = self.dataClasses[i].E1)
grp.create_dataset("E2", data = self.dataClasses[i].E2)
grp.create_dataset("E3", data = self.dataClasses[i].E3)
grp.create_dataset("eAreaNormMin", data = self.dataClasses[i].eAreaNormMin)
grp.create_dataset("eAreaNormMax", data = self.dataClasses[i].eAreaNormMax)
grp.create_dataset("incidentEnergy", data = self.dataClasses[i].incidentEnergy)
if isinstance(self.dataClasses[i], xaesa_transient_class): #save XES data
grp = fhdf5.create_group("{0:06d}".format(i) + "&" + self.lstSpectra.item(i).text())
grp.create_dataset("classType", data = 20)
grp.create_dataset("name", data = self.dataClasses[i].name)
grp.create_dataset("energy", data = self.dataClasses[i].energy)
grp.create_dataset("transient", data = self.dataClasses[i].transient)
grp.create_dataset("energySmooth", data = self.dataClasses[i].energySmooth)
grp.create_dataset("transientSmooth", data = self.dataClasses[i].transientSmooth)
grp.create_dataset("eSmoothMin", data = self.dataClasses[i].eSmoothMin)
grp.create_dataset("eSmoothMax", data = self.dataClasses[i].eSmoothMax)
grp.create_dataset("smoothFactor", data = self.dataClasses[i].smoothFactor)
fhdf5.close()
self.setWindowTitle("XAESA - X-ray Absorption and Emission Analytics --- " + tail)
def openhdf5(self):
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.ExistingFile)
dlg.setAcceptMode(0) # open dialog
dlg.setNameFilters(["HDF5 files (*.hdf5)", "All files (*.*)"])
# dlg.setDirectory(self.currenthdf5)
dlg.setDirectory(self.currentdir)
if dlg.exec_():
fnlist = dlg.selectedFiles()
else:
return
fn = fnlist[0]
head, tail = path.split(str(fn))
# self.currenthdf5 = head
self.currentdir = head
f = h5py.File(fn, "r")
self.lstSpectra.clear()
self.dataClasses = []
mainKeyList = list(f.keys())
for i in range(0, len(mainKeyList)):
#remove numbering if existing
if '&' in mainKeyList[i]:
txt = mainKeyList[i].split('&', 1)[-1]
self.lstSpectra.addItem(txt)
else:
self.lstSpectra.addItem(mainKeyList[i])
grp = f.get(mainKeyList[i])
classType = grp.get("classType")[()]
# print("classType", classType[()])
### OPEN XAS
if classType == 0: #XAS
self.dataClasses.append(xaesa_exafs_class(grp.get("raw_data_type")[()]))
self.dataClasses[-1].raw_data_type = grp.get("raw_data_type")[()]
self.dataClasses[-1].name = grp.get("name")[()]
if type(self.dataClasses[-1].name) is bytes:
self.dataClasses[-1].name = self.dataClasses[-1].name.decode('utf-8')
self.dataClasses[-1].energy = grp.get("energy")[()]
self.dataClasses[-1].energyRebined = grp.get("energyRebined")[()]
self.dataClasses[-1].energyOriginal = grp.get("energyOriginal")[()]
self.dataClasses[-1].i0 = grp.get("i0")[()]
self.dataClasses[-1].i1 = grp.get("i1")[()]
self.dataClasses[-1].i2 = grp.get("i2")[()]
self.dataClasses[-1].ifluo = grp.get("ifluo")[()]
#Mju datasets
self.dataClasses[-1].mju = grp.get("mju")[()]
self.dataClasses[-1].mjuRebined = grp.get("mjuRebined")[()]
self.dataClasses[-1].mjuOriginal = grp.get("mjuOriginal")[()]
self.dataClasses[-1].mjuDerivative= grp.get("mjuDerivative")[()]
self.dataClasses[-1].victoreen = grp.get("victoreen")[()]
self.dataClasses[-1].mjuMinusVictoreen = grp.get("mjuMinusVictoreen")[()]
self.dataClasses[-1].mju0 = grp.get("mju0")[()]
try:
self.dataClasses[-1].mjuRef = grp.get("mjuRef")[()]
except:
pass
#EXAFS datasets
self.dataClasses[-1].k = grp.get("k")[()]
self.dataClasses[-1].exafs = grp.get("exafs")[()]
self.dataClasses[-1].exafsZeroLine = grp.get("exafsZeroLine")[()]
self.dataClasses[-1].exafsZLC = grp.get("exafsZLC")[()]
# FT datasets
self.dataClasses[-1].window = grp.get("window")[()]
self.dataClasses[-1].exafsTimesWindow = grp.get("exafsTimesWindow")[()]
self.dataClasses[-1].exafsZLCTimesWindow = grp.get("exafsZLCTimesWindow")[()]
self.dataClasses[-1].r = grp.get("r")[()]
self.dataClasses[-1].fr = grp.get("fr")[()]
self.dataClasses[-1].fi = grp.get("fi")[()]
self.dataClasses[-1].efr = grp.get("efr")[()]
self.dataClasses[-1].efi = grp.get("efi")[()]
self.dataClasses[-1].rZLC = grp.get("rZLC")[()]
self.dataClasses[-1].frZLC = grp.get("frZLC")[()]
self.dataClasses[-1].fiZLC = grp.get("fiZLC")[()]
self.dataClasses[-1].efrZLC = grp.get("efrZLC")[()]
self.dataClasses[-1].efiZLC = grp.get("efiZLC")[()]
# BFT datasets
self.dataClasses[-1].bftWindow = grp.get("bftWindow")[()]
self.dataClasses[-1].bftk = grp.get("bftk")[()]
self.dataClasses[-1].bftefr = grp.get("bftefr")[()]
self.dataClasses[-1].bftefi = grp.get("bftefi")[()]
self.dataClasses[-1].bftAmp = grp.get("bftAmp")[()]
self.dataClasses[-1].bftPha = grp.get("bftPha")[()]
self.dataClasses[-1].bftEXAFS = grp.get("bftEXAFS")[()]
self.dataClasses[-1].bftefrWindow = grp.get("bftefrWindow")[()]
self.dataClasses[-1].bftefiWindow = grp.get("bftefiWindow")[()]
#Rebin parameters
self.dataClasses[-1].dE1 = grp.get("dE1")[()]
self.dataClasses[-1].dE2 = grp.get("dE2")[()]
self.dataClasses[-1].dE3 = grp.get("dE3")[()]
#extraction params
self.dataClasses[-1].E0 = grp.get("E0")[()]
self.dataClasses[-1].E1 = grp.get("E1")[()]
self.dataClasses[-1].E2 = grp.get("E2")[()]
self.dataClasses[-1].E3 = grp.get("E3")[()]
try:
self.dataClasses[-1].Es = grp.get("Es")[()]
except:
self.dataClasses[-1].Es = self.dataClasses[-1].E1 - 100
try:
self.dataClasses[-1].energyShift = grp.get("energyShift")[()]
except:
pass
self.dataClasses[-1].kPower = grp.get("kPower")[()]
self.dataClasses[-1].zeroLineCorr = grp.get("zeroLineCorr")[()]
try:
self.dataClasses[-1].bckgrPolinomialDegree = grp.get("bckgrPolinomialDegree")[()]
except:
self.dataClasses[-1].bckgrPolinomialDegree = -1
self.dataClasses[-1].normalizationMode = grp.get("normalizationMode")[()] #0 for mju0 normalization, 1 for value normalization at given energy
self.dataClasses[-1].normalizationEnergy = grp.get("normalizationEnergy")[()]
#FT params
self.dataClasses[-1].kMin = grp.get("kMin")[()]
self.dataClasses[-1].kMax = grp.get("kMax")[()]
self.dataClasses[-1].dk = grp.get("dk")[()]
self.dataClasses[-1].rMin = grp.get("rMin")[()]
self.dataClasses[-1].rMax = grp.get("rMax")[()]
self.dataClasses[-1].dr = grp.get("dr")[()]
#BFT params
self.dataClasses[-1].rMinBft = grp.get("rMinBft")[()]
self.dataClasses[-1].rMaxBft = grp.get("rMaxBft")[()]
self.dataClasses[-1].bftWindowParam = grp.get("bftWindowParam")[()]
# Deglitching params and result
#fit params and results
self.dataClasses[-1].fitKMin = grp.get("fitKMin")[()]
self.dataClasses[-1].fitKMax = grp.get("fitKMax")[()]
self.dataClasses[-1].fitdk = grp.get("fitdk")[()]
self.dataClasses[-1].fitNShels = grp.get("fitNShels")[()]
self.dataClasses[-1].fitParams = grp.get("fitParams")[()]
self.dataClasses[-1].fitAmps = grp.get("fitAmps")[()]
self.dataClasses[-1].fitPhas = grp.get("fitPhas")[()]
self.dataClasses[-1].fitK = grp.get("fitK")[()]
self.dataClasses[-1].fitExafs = grp.get("fitExafs")[()]
#rdf params and results
self.dataClasses[-1].isRdfed = grp.get("isRdfed")[()]
self.dataClasses[-1].rdfKMin = grp.get("rdfKMin")[()]
self.dataClasses[-1].rdfKMax = grp.get("rdfKMax")[()]
self.dataClasses[-1].rdfdk = grp.get("rdfdk")[()]
self.dataClasses[-1].rdfRMin = grp.get("rdfRMin")[()]
self.dataClasses[-1].rdfRMax =grp.get("rdfRMax")[()]
self.dataClasses[-1].rdfdr = grp.get("rdfdr")[()]
self.dataClasses[-1].rdfMaxIterations = grp.get("rdfMaxIterations")[()]
self.dataClasses[-1].rdfAmpK = grp.get("rdfAmpK")[()]
self.dataClasses[-1].rdfAmp = grp.get("rdfAmp")[()]
self.dataClasses[-1].rdfPhaK = grp.get("rdfPhaK")[()]
self.dataClasses[-1].rdfPha = grp.get("rdfPha")[()]
self.dataClasses[-1].rdfAmpFile = grp.get("rdfAmpFile")[()]
self.dataClasses[-1].rdfPhaFile = grp.get("rdfPhaFile")[()]
self.dataClasses[-1].rdfK = grp.get("rdfK")[()]
self.dataClasses[-1].rdfExafs = grp.get("rdfExafs")[()]
self.dataClasses[-1].rdfR = grp.get("rdfR")[()]
self.dataClasses[-1].rdf = grp.get("rdf")[()]
sel_item = self.lstSpectra.item(self.lstSpectra.count()-1)
if grp.get("raw_data_type")[()] == 3:
sel_item.setForeground(QtCore.Qt.blue)
else:
sel_item.setForeground(QtCore.Qt.darkGreen)
##################### OPEN XES
if classType == 10: #XES
self.dataClasses.append(xaesa_xes_class())
self.dataClasses[-1].name = grp.get("name")[()]#.decode('utf-8')
if type(self.dataClasses[-1].name) is bytes:
self.dataClasses[-1].name = self.dataClasses[-1].name.decode('utf-8')
self.dataClasses[-1].energy = grp.get("energy")[()]
self.dataClasses[-1].energyRebined = grp.get("energyRebined")[()]
self.dataClasses[-1].energyOriginal = grp.get("energyOriginal")[()]
self.dataClasses[-1].xes = grp.get("xes")[()]
self.dataClasses[-1].xesBackground = grp.get("xesBackground")[()]
self.dataClasses[-1].xesBkgrCorrected = grp.get("xesBkgrCorrected")[()]
self.dataClasses[-1].xesAreaNorm = grp.get("xesAreaNorm")[()]
self.dataClasses[-1].xesMaxNorm = grp.get("xesMaxNorm")[()]
self.dataClasses[-1].xesRebinned = grp.get("xesRebinned")[()]
self.dataClasses[-1].xesOriginal = grp.get("xesOriginal")[()]
self.dataClasses[-1].E0 = grp.get("E0")[()]
self.dataClasses[-1].E1 = grp.get("E1")[()]
self.dataClasses[-1].E2 = grp.get("E2")[()]
self.dataClasses[-1].E3 = grp.get("E3")[()]
self.dataClasses[-1].eAreaNormMin = grp.get("eAreaNormMin")[()]
self.dataClasses[-1].eAreaNormMax = grp.get("eAreaNormMax")[()]
try:
self.dataClasses[-1].incidentEnergy = grp.get("incidentEnergy")[()]
except:
self.dataClasses[-1].incidentEnergy = 0
sel_item = self.lstSpectra.item(self.lstSpectra.count()-1)
sel_item.setForeground(QtCore.Qt.darkMagenta)
##################### OPEN TRANSIENT
if classType == 20: #TRANSIENT
self.dataClasses.append(xaesa_transient_class())
self.dataClasses[-1].name = grp.get("name")[()]#.decode('utf-8')
if type(self.dataClasses[-1].name) is bytes:
self.dataClasses[-1].name = self.dataClasses[-1].name.decode('utf-8')
self.dataClasses[-1].energy = grp.get("energy")[()]
self.dataClasses[-1].energySmooth = grp.get("energySmooth")[()]
self.dataClasses[-1].transient = grp.get("transient")[()]
self.dataClasses[-1].transientSmooth = grp.get("transientSmooth")[()]
self.dataClasses[-1].eSmoothMin = grp.get("eSmoothMin")[()]
self.dataClasses[-1].eSmoothMax = grp.get("eSmoothMax")[()]
self.dataClasses[-1].smoothFactor = grp.get("smoothFactor")[()]
sel_item = self.lstSpectra.item(self.lstSpectra.count()-1)
sel_item.setForeground(QtCore.Qt.black)
f.close()
self.setWindowTitle("XAESA - X-ray Absorption and Emission Analytics --- " + tail)
# self.current = 0
# self.lstSpectra.setCurrentRow(0)
# self.lstSpectraItemClicked()
def CopyParams(self):
cnr = self.current
if isinstance(self.dataClasses[cnr], xaesa_xes_class):
self.copiedparamsXES = [self.dataClasses[cnr].E0,
self.dataClasses[cnr].E1,
self.dataClasses[cnr].E2,
self.dataClasses[cnr].E3,
self.dataClasses[cnr].eAreaNormMin,
self.dataClasses[cnr].eAreaNormMax
]
print("XES params copied")
if isinstance(self.dataClasses[cnr], xaesa_exafs_class):
self.copiedparamsXAS = [
self.dataClasses[cnr].E0,
self.dataClasses[cnr].E1,
self.dataClasses[cnr].E2,
self.dataClasses[cnr].E3,
self.dataClasses[cnr].zeroLineCorr,
self.dataClasses[cnr].kPower,
self.dataClasses[cnr].mju0PolinomialDegree,
self.dataClasses[cnr].normalizationMode,
self.dataClasses[cnr].normalizationEnergy,
self.dataClasses[cnr].kMin,
self.dataClasses[cnr].kMax,
self.dataClasses[cnr].dk ,
self.dataClasses[cnr].rMin,
self.dataClasses[cnr].rMax,
self.dataClasses[cnr].dr,
self.dataClasses[cnr].rMinBft,
self.dataClasses[cnr].rMaxBft,
self.dataClasses[cnr].bftWindowParam,
self.dataClasses[cnr].Es,
self.dataClasses[cnr].bckgrPolinomialDegree,
]
print("XAS params copied")
def ApplytoSelected(self):
if len(self.copiedparamsXAS)==0 and len(self.copiedparamsXES)==0:
return
selected_indexes = self.lstSpectra.selectedIndexes()
startTime = timer()
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
print(y)
if isinstance(self.dataClasses[y], xaesa_xes_class):
self.dataClasses[y].E0 = self.copiedparamsXES[0]
self.dataClasses[y].E1 = self.copiedparamsXES[1]
self.dataClasses[y].E2 = self.copiedparamsXES[2]
self.dataClasses[y].E3 = self.copiedparamsXES[3]
self.dataClasses[y].eAreaNormMin = self.copiedparamsXES[4]
self.dataClasses[y].eAreaNormMax = self.copiedparamsXES[5]
self.dataClasses[y].removeBackground(polPower=polPowerXES)
self.dataClasses[y].areaNormalize()
print("XES params applied")
if isinstance(self.dataClasses[y], xaesa_exafs_class):
self.dataClasses[y].E0 = self.copiedparamsXAS[0]
self.dataClasses[y].E1 = self.copiedparamsXAS[1]
self.dataClasses[y].E2 = self.copiedparamsXAS[2]
self.dataClasses[y].E3 = self.copiedparamsXAS[3]
self.dataClasses[y].zeroLineCorr = self.copiedparamsXAS[4]
self.dataClasses[y].kPower = self.copiedparamsXAS[5]
self.dataClasses[y].mju0PolinomialDegree = self.copiedparamsXAS[6]
self.dataClasses[y].normalizationMode = self.copiedparamsXAS[7]
self.dataClasses[y].normalizationEnergy = self.copiedparamsXAS[8]
self.dataClasses[y].kMin = self.copiedparamsXAS[9]
self.dataClasses[y].kMax = self.copiedparamsXAS[10]
self.dataClasses[y].dk = self.copiedparamsXAS[11]
self.dataClasses[y].rMin = self.copiedparamsXAS[12]
self.dataClasses[y].rMax = self.copiedparamsXAS[13]
self.dataClasses[y].dr = self.copiedparamsXAS[14]
self.dataClasses[y].rMinBft = self.copiedparamsXAS[15]
self.dataClasses[y].rMaxBft = self.copiedparamsXAS[16]
self.dataClasses[y].bftWindowParam = self.copiedparamsXAS[17]
self.dataClasses[y].Es = self.copiedparamsXAS[18]
self.dataClasses[y].bckgrPolinomialDegree = self.copiedparamsXAS[19]
self.dataClasses[y].redoExtraction()
print("XAS params applied")
endTime = timer()
self.lblStatus.setText("Params applied to {:d} files in {:.4f} seconds".format(len(list(selected_indexes)), endTime - startTime) )
def removeglitches(self):
if self.current < 0:
return
cnr = self.current
self.w = DGWindow()
self.w.exafs = copy(self.dataClasses[cnr].exafsZLC)
self.w.exafsdg = copy(self.dataClasses[cnr].exafsZLC)
self.w.k = copy(self.dataClasses[cnr].k)
self.w.plot()
if self.w.exec_():
self.dataClasses[cnr].exafsZLCdeglitch = copy(self.w.exafsdg)
self.dataClasses[cnr].exafsZLC = copy(self.w.exafsdg)
self.dataClasses[cnr].redoFtBft()
# self.glitchesRemoved[cnr] = 1
# self.ees_ft()
# self.lstSpectraItemClicked()
def fit(self):
if self.current < 0:
return
cnr = self.current
fw = FitWindow()
fw.setWindowTitle("FIT "+self.lstSpectra.currentItem().text())
fw.bft = copy(self.dataClasses[cnr].bftEXAFS)
fw.k = copy(self.dataClasses[cnr].bftk)
fw.ksettings = [[0.5, self.dataClasses[cnr].bftk[-1], 0.05]]
if self.dataClasses[cnr].isFitted == 1:
fw.fit_result = copy(self.dataClasses[cnr].fitExafs)
fw.savedshellnr = self.dataClasses[cnr].fitNShels
fw.fit_amps = copy(self.dataClasses[cnr].fitAmps)
fw.fit_phases = copy(self.dataClasses[cnr].fitPhas)
fw.fit_params = copy(self.dataClasses[cnr].fitParams)
fw.costfunction = 0 #self.fit_costfunction[cnr]
fw.ksettings = [[self.dataClasses[cnr].fitKMin, self.dataClasses[cnr].fitKMax, self.dataClasses[cnr].fitdk]]
fw.isfitted = 1
fw.updateUI()
fw.bftft()
fw.plot()
if fw.exec_(): #copy results and params to arrays
self.dataClasses[cnr].isFitted = 1
self.dataClasses[cnr].fitExafs = copy(fw.fit_result)
self.dataClasses[cnr].fitNShels = fw.shellnr
self.dataClasses[cnr].fitAmps = copy(fw.fit_amps)
self.dataClasses[cnr].fitPhas = copy(fw.fit_phases)
self.dataClasses[cnr].fitParams = copy(fw.fit_params)
# self.dataClasses[cnr].fit_costfunction[cnr] = fw.costfunction
self.dataClasses[cnr].fitKMin = fw.ksettings[0][0]
self.dataClasses[cnr].fitKMax = fw.ksettings[0][1]
self.dataClasses[cnr].fitdk = fw.ksettings[0][2]
pass
def rdf(self):
if self.current < 0:
return
cnr = self.current
self.rdfw = RdfWindow()
self.rdfw.setWindowTitle("RDF "+self.lstSpectra.currentItem().text())
if self.dataClasses[cnr].isRdfed == 1 :
self.rdfw.rdf = copy(self.dataClasses[cnr].rdf)
self.rdfw.rdf_r = copy(self.dataClasses[cnr].rdfR)
self.rdfw.rdf_exafs_k = copy(self.dataClasses[cnr].rdfK)
self.rdfw.rdf_exafs = copy(self.dataClasses[cnr].rdfExafs)
self.rdfw.params = [self.dataClasses[cnr].rdfKMin,
self.dataClasses[cnr].rdfKMax,
self.dataClasses[cnr].rdfdk,
self.dataClasses[cnr].rdfRMin,
self.dataClasses[cnr].rdfRMax,
self.dataClasses[cnr].rdfdr,
self.dataClasses[cnr].rdfMaxIterations
]
self.rdfw.amp_orig[0] = copy(self.dataClasses[cnr].rdfAmpK)
self.rdfw.amp_orig[1] = copy(self.dataClasses[cnr].rdfAmp)
self.rdfw.pha_orig[0] = copy(self.dataClasses[cnr].rdfPhaK)
self.rdfw.pha_orig[1] = copy(self.dataClasses[cnr].rdfPha)
self.rdfw.bft = copy(self.dataClasses[cnr].bftEXAFS)
self.rdfw.k = copy(self.dataClasses[cnr].bftk)
self.rdfw.kpow = self.dataClasses[cnr].kPower
self.rdfw.bftft()
self.rdfw.plot()
myStream = MyStream()
myStream.message.connect(self.rdfw.on_myStream_message)
# sys.stdout = myStream
if self.rdfw.exec_():
self.dataClasses[cnr].isRdfed = 1
self.dataClasses[cnr].rdf = copy(self.rdfw.rdf)
self.dataClasses[cnr].rdfR = copy(self.rdfw.rdf_r)
self.dataClasses[cnr].rdfKMin = self.rdfw.params[0]
self.dataClasses[cnr].rdfKMax = self.rdfw.params[1]
self.dataClasses[cnr].rdfdk = self.rdfw.params[2]
self.dataClasses[cnr].rdfRMin = self.rdfw.params[3]
self.dataClasses[cnr].rdfRax = self.rdfw.params[4]
self.dataClasses[cnr].rdfdr = self.rdfw.params[5]
self.dataClasses[cnr].rdfMaxIterations = self.rdfw.params[6]
self.dataClasses[cnr].rdfK = copy(self.rdfw.rdf_exafs_k)
self.dataClasses[cnr].rdfExafs = copy(self.rdfw.rdf_exafs)
self.dataClasses[cnr].rdfAmpK = copy(self.rdfw.amp_orig[0])
self.dataClasses[cnr].rdfAmp = copy(self.rdfw.amp_orig[1])
self.dataClasses[cnr].rdfPhaK = copy(self.rdfw.pha_orig[0])
self.dataClasses[cnr].rdfPha = copy(self.rdfw.pha_orig[1])
pass
def compare(self, dataType):
viewerDialog = xaesaViewerWindow()
selected_indexes = self.lstSpectra.selectedIndexes()
selected_items = self.lstSpectra.selectedItems()
if len(selected_indexes) == 0:
return
if dataType == 'i0' or dataType == 'i1' or dataType == 'i2' or dataType == 'ifluo' or dataType=='muref':
viewerDialog.viewer.x_caption = 'Energy, eV'
viewerDialog.viewer.y_caption = 'Intensity'
if dataType == 'mju' or dataType == 'mjuRebinVSoriginal':
viewerDialog.viewer.x_caption = 'Energy, eV'
viewerDialog.viewer.y_caption = 'Absorption, a.u.'
for i in range(len(list(selected_items))):
y= selected_indexes[i].row()
if dataType == 'i0' or dataType == 'i1' or dataType == 'i2' or dataType == 'ifluo' or dataType=='muref':
if self.dataClasses[y].energyOriginal != []:
energy = self.dataClasses[y].energyOriginal
else:
energy = self.dataClasses[y].energy
viewerDialog.viewer.x_data.append(energy)
if dataType == 'i0': viewerDialog.viewer.y_data.append(self.dataClasses[y].i0)
if dataType == 'i1': viewerDialog.viewer.y_data.append(self.dataClasses[y].i1)
if dataType == 'i2': viewerDialog.viewer.y_data.append(self.dataClasses[y].i2)
if dataType == 'muref': viewerDialog.viewer.y_data.append(self.dataClasses[y].mjuRef)
if dataType == 'ifluo':
for fluo_data in self.dataClasses[y].ifluo:
viewerDialog.viewer.y_data.append(fluo_data)
viewerDialog.viewer.labels.append(str(selected_items[i].text()))
if dataType == 'mjuRebinVSoriginal':
viewerDialog.viewer.x_data.append(self.dataClasses[y].energyOriginal)
viewerDialog.viewer.y_data.append(self.dataClasses[y].mjuOriginal)
viewerDialog.viewer.labels.append(str(selected_items[i].text() + 'Original'))
viewerDialog.viewer.x_data.append(self.dataClasses[y].energy)
viewerDialog.viewer.y_data.append(self.dataClasses[y].mju)
viewerDialog.viewer.labels.append(str(selected_items[i].text() + 'Rebin'))
viewerDialog.viewer.plot()
viewerDialog.exec_()
def comparemju(self):
cw = CompareWindow()
#self.cw.exafs = np.copy(self.exafsd[cnr])
#self.cw.exafsdg = np.copy(self.exafsd[cnr])
cw.mode = 3 #compare mju
selected_indexes = self.lstSpectra.selectedIndexes()
selected_items = self.lstSpectra.selectedItems()
if len(selected_indexes) == 0:
return
for i in range(len(list(selected_items))):
cw.labels.append(str(selected_items[i].text()))
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
cw.energy.append(self.dataClasses[y].energy)
cw.mju.append(self.dataClasses[y].mju)
cw.plot()
cw.exec_()
def comparexanes(self):
if self.current < 0:
return
cw = CompareWindow()
#self.cw.exafs = np.copy(self.exafsd[cnr])
#self.cw.exafsdg = np.copy(self.exafsd[cnr])
cw.mode = 4 #compare xanes
selected_indexes = self.lstSpectra.selectedIndexes()
selected_items = self.lstSpectra.selectedItems()
for i in range(len(list(selected_items))):
cw.labels.append(str(selected_items[i].text()))
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
cw.E0 = self.dataClasses[y].E0
cw.energy.append(self.dataClasses[y].energy)
idx = argmin(abs(self.dataClasses[y].energy - self.dataClasses[y].normalizationEnergy))
# self.cw.mju.append(self.mju_bc[y] / self.mju_bc[y][idx])
cw.mju.append(self.dataClasses[y].mjuMinusVictoreen / self.dataClasses[y].mju0[idx])
cw.plot()
cw.exec_()
def compareexafs(self):
cw = CompareWindow()
#self.cw.exafs = np.copy(self.exafsd[cnr])
#self.cw.exafsdg = np.copy(self.exafsd[cnr])
cw.mode = 0 #compare exafs
selected_indexes = self.lstSpectra.selectedIndexes()
selected_items = self.lstSpectra.selectedItems()
if len(selected_indexes) == 0:
return
for i in range(len(list(selected_items))):
cw.labels.append(str(selected_items[i].text()))
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
cw.k.append(self.dataClasses[y].k)
cw.exafs.append(self.dataClasses[y].exafsZLC)
cw.plot()
cw.exec_()
def compareft(self):
cw = CompareWindow()
#self.cw.exafs = np.copy(self.exafsd[cnr])
#self.cw.exafsdg = np.copy(self.exafsd[cnr])
cw.mode = 1 #compare exafs
selected_indexes = self.lstSpectra.selectedIndexes()
selected_items = self.lstSpectra.selectedItems()
if len(selected_indexes) == 0:
return
for i in range(len(list(selected_items))):
cw.labels.append(str(selected_items[i].text()))
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
cw.r.append(self.dataClasses[y].rZLC)
cw.fr.append(self.dataClasses[y].efrZLC)
cw.fi.append(self.dataClasses[y].efiZLC)
cw.plot()
cw.exec_()
def comparebft(self):
cw = CompareWindow()
#self.cw.exafs = np.copy(self.exafsd[cnr])
#self.cw.exafsdg = np.copy(self.exafsd[cnr])
cw.mode = 2 #compare exafs
selected_indexes = self.lstSpectra.selectedIndexes()
selected_items = self.lstSpectra.selectedItems()
if len(selected_indexes) == 0:
return
for i in range(len(list(selected_items))):
cw.labels.append(str(selected_items[i].text()))
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
cw.bftk.append(self.dataClasses[y].bftk)
cw.bftexafs.append(self.dataClasses[y].bftEXAFS)
cw.plot()
cw.exec_()
def compareXes(self):
cw = CompareWindow()
cw.mode = 10 #compare XES original
selected_indexes = self.lstSpectra.selectedIndexes()
selected_items = self.lstSpectra.selectedItems()
if len(selected_indexes) == 0:
return
for i in range(len(list(selected_items))):
cw.labels.append(str(selected_items[i].text()))
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
cw.energy.append(self.dataClasses[y].energy)
cw.xes.append(self.dataClasses[y].xes)
cw.plot()
cw.exec_()
def compareXesAnorm(self):
cw = CompareWindow()
cw.mode = 10 #compare XES original
selected_indexes = self.lstSpectra.selectedIndexes()
selected_items = self.lstSpectra.selectedItems()
if len(selected_indexes) == 0:
return
for i in range(len(list(selected_items))):
cw.labels.append(str(selected_items[i].text()))
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
cw.energy.append(self.dataClasses[y].energy)
cw.xes.append(self.dataClasses[y].xesAreaNorm)
cw.plot()
cw.exec_()
def pick_a_line(self, event):
print('pick')
if event.artist in [self.lineEs,self.lineE0,self.lineE1,self.lineE2,self.lineE3]:
print("line selected ", event.artist)
self.line_to_drag = event.artist
self.follower = self.fig.canvas.mpl_connect("motion_notify_event", self.followmouse)
self.releaser = self.fig.canvas.mpl_connect("button_press_event", self.releaseonclick)
def followmouse(self, event):
self.line_to_drag.set_xdata([event.xdata, event.xdata])
self.fig.canvas.draw_idle()
def releaseonclick(self, event):
XorY = self.line_to_drag.get_xdata()[0]
self.fig.canvas.mpl_disconnect(self.releaser)
self.fig.canvas.mpl_disconnect(self.follower)
cnr = self.current
if self.line_to_drag==self.lineEs: self.dataClasses[cnr].Es=XorY
if self.line_to_drag==self.lineE0: self.dataClasses[cnr].E0=XorY
if self.line_to_drag==self.lineE1: self.dataClasses[cnr].E1=XorY
if self.line_to_drag==self.lineE2: self.dataClasses[cnr].E2=XorY
if self.line_to_drag==self.lineE3: self.dataClasses[cnr].E3=XorY
self.dataClasses[cnr].redoExtraction()
self.lstSpectraItemClicked()
def onpick3(self, event):
ind = event.ind
print(ind)
cnr = self.current
self.dataClasses[cnr].energy = delete(self.dataClasses[cnr].energy, ind[0])
self.dataClasses[cnr].mju = delete(self.dataClasses[cnr].mju, ind[0])
self.dataClasses[cnr].processExpData()
# self.ees_step1()
# self.lstSpectraItemClicked()
def redraw_for_remove(self, state):
cnr = self.current
self.ax_abs.clear()
self.ax_abs2.clear()
self.ax_abs.scatter(self.energy[cnr], self.mju[cnr], s=1, picker=state)
line2, line3 = self.ax_abs.plot(self.energy[cnr], self.mjub[cnr],
self.energy[cnr], self.mju0_mjub[cnr])
line2.set_color('r')
line3.set_color('r')
def averageMjuDirect(self):
selected_indexes = self.lstSpectra.selectedIndexes()
if len(selected_indexes) == 0:
return
selectedRows = [x.row() for x in selected_indexes]
#check if all datasets with the same length
elementsCount = asarray([len(self.dataClasses[x].mju) for x in selectedRows])
if sum( elementsCount - elementsCount[0] ) != 0: #not all arrays are the same length
msgBox = QtGui.QMessageBox()
msgBox.setText("Not all arrays are the same length. Can't average.")
# msgBox.setInformativeText("Do you want to save your changes?")
msgBox.setStandardButtons(QtGui.QMessageBox.Yes)
msgBox.exec_()
return
average = array(self.dataClasses[selectedRows[0]].mju)
name = "mju_average " + str(selectedRows[0])
for i in selectedRows[1:]:
name = name + " + " + str(i)
average = average + self.dataClasses[i].mju
average = average / len(list(selected_indexes))
self.lstSpectra.addItem(name)
self.dataClasses.append(xaesa_exafs_class(2)) # mju
self.dataClasses[-1].energy = self.dataClasses[selectedRows[0]].energy
self.dataClasses[-1].mju = average
self.dataClasses[-1].E0 = self.dataClasses[selectedRows[0]].E0
self.dataClasses[-1].E1 = self.dataClasses[selectedRows[0]].E1
self.dataClasses[-1].E2 = self.dataClasses[selectedRows[0]].E2
self.dataClasses[-1].E3 = self.dataClasses[selectedRows[0]].E3
self.dataClasses[-1].zeroLineCorr = self.dataClasses[selectedRows[0]].zeroLineCorr
self.dataClasses[-1].kMin = self.dataClasses[selectedRows[0]].kMin
self.dataClasses[-1].kMax = self.dataClasses[selectedRows[0]].kMax
self.dataClasses[-1].dk = self.dataClasses[selectedRows[0]].dk
self.dataClasses[-1].rMin = self.dataClasses[selectedRows[0]].rMin
self.dataClasses[-1].rMax = self.dataClasses[selectedRows[0]].rMax
self.dataClasses[-1].dr = self.dataClasses[selectedRows[0]].dr
self.dataClasses[-1].kPower = self.dataClasses[selectedRows[0]].kPower
self.dataClasses[-1].rMinBft = self.dataClasses[selectedRows[0]].rMinBft
self.dataClasses[-1].rMaxBft = self.dataClasses[selectedRows[0]].rMaxBft
self.dataClasses[-1].bftWindowParam = self.dataClasses[selectedRows[0]].bftWindowParam
self.dataClasses[-1].processExpData()
def averageMjuSpline(self):
selected_indexes = self.lstSpectra.selectedIndexes()
if len(selected_indexes) == 0:
return
selectedRows = [x.row() for x in selected_indexes]
#find range where all curves are defined
min_e_all = asarray([min(self.dataClasses[x].energy) for x in selectedRows])
max_e_all = asarray([max(self.dataClasses[x].energy) for x in selectedRows])
min_e = max(min_e_all)
max_e = min(max_e_all)
#find average delta energy
average_diff_all = [average(diff(self.dataClasses[x].energy)) for x in selectedRows]
average_diff = average(average_diff_all)
common_e = arange(min_e, max_e, average_diff)
spl = InterpolatedUnivariateSpline(self.dataClasses[selectedRows[0]].energy, self.dataClasses[selectedRows[0]].mju)
new_vals = spl(common_e)
av = array(new_vals)
name = "mu_average " + str(selectedRows[0])
for i in selectedRows[1:]:
name = name + " + " + str(i)
spl = InterpolatedUnivariateSpline(self.dataClasses[i].energy, self.dataClasses[i].mju)
new_vals = spl(common_e)
av = av + new_vals
av = av / len(list(selected_indexes))
self.lstSpectra.addItem(name)
self.dataClasses.append(xaesa_exafs_class(2)) # mju
self.dataClasses[-1].energy = common_e
self.dataClasses[-1].mju = av
self.dataClasses[-1].E0 = self.dataClasses[selectedRows[0]].E0
self.dataClasses[-1].E1 = self.dataClasses[selectedRows[0]].E1
self.dataClasses[-1].E2 = self.dataClasses[selectedRows[0]].E2
self.dataClasses[-1].E3 = self.dataClasses[selectedRows[0]].E3
self.dataClasses[-1].zeroLineCorr = self.dataClasses[selectedRows[0]].zeroLineCorr
self.dataClasses[-1].kMin = self.dataClasses[selectedRows[0]].kMin
self.dataClasses[-1].kMax = self.dataClasses[selectedRows[0]].kMax
self.dataClasses[-1].dk = self.dataClasses[selectedRows[0]].dk
self.dataClasses[-1].rMin = self.dataClasses[selectedRows[0]].rMin
self.dataClasses[-1].rMax = self.dataClasses[selectedRows[0]].rMax
self.dataClasses[-1].dr = self.dataClasses[selectedRows[0]].dr
self.dataClasses[-1].kPower = self.dataClasses[selectedRows[0]].kPower
self.dataClasses[-1].rMinBft = self.dataClasses[selectedRows[0]].rMinBft
self.dataClasses[-1].rMaxBft = self.dataClasses[selectedRows[0]].rMaxBft
self.dataClasses[-1].bftWindowParam = self.dataClasses[selectedRows[0]].bftWindowParam
self.dataClasses[-1].processExpData()
def mergeMju(self):
selected_indexes = self.lstSpectra.selectedIndexes()
if len(selected_indexes) == 0:
return
selectedRows = [x.row() for x in selected_indexes]
energy_merge = array(self.dataClasses[selectedRows[0]].energy)
merge = array(self.dataClasses[selectedRows[0]].mju)
name = "mu_merge " + str(selectedRows[0])
for i in selectedRows[1:]:
name = name + " + " + str(i)
energy_merge = concatenate( (energy_merge, self.dataClasses[i].energy) )
merge = concatenate( (merge, self.dataClasses[i].mju) )
sort = energy_merge.argsort()
energy_merge = energy_merge[sort]
merge = merge[sort]
self.lstSpectra.addItem(name)
self.dataClasses.append(xaesa_exafs_class(2)) # mju
self.dataClasses[-1].energy = energy_merge
self.dataClasses[-1].mju = merge
self.dataClasses[-1].E0 = self.dataClasses[selectedRows[0]].E0
self.dataClasses[-1].E1 = self.dataClasses[selectedRows[0]].E1
self.dataClasses[-1].E2 = self.dataClasses[selectedRows[0]].E2
self.dataClasses[-1].E3 = self.dataClasses[selectedRows[0]].E3
self.dataClasses[-1].zeroLineCorr = self.dataClasses[selectedRows[0]].zeroLineCorr
self.dataClasses[-1].kMin = self.dataClasses[selectedRows[0]].kMin
self.dataClasses[-1].kMax = self.dataClasses[selectedRows[0]].kMax
self.dataClasses[-1].dk = self.dataClasses[selectedRows[0]].dk
self.dataClasses[-1].rMin = self.dataClasses[selectedRows[0]].rMin
self.dataClasses[-1].rMax = self.dataClasses[selectedRows[0]].rMax
self.dataClasses[-1].dr = self.dataClasses[selectedRows[0]].dr
self.dataClasses[-1].kPower = self.dataClasses[selectedRows[0]].kPower
self.dataClasses[-1].rMinBft = self.dataClasses[selectedRows[0]].rMinBft
self.dataClasses[-1].rMaxBft = self.dataClasses[selectedRows[0]].rMaxBft
self.dataClasses[-1].bftWindowParam = self.dataClasses[selectedRows[0]].bftWindowParam
self.dataClasses[-1].processExpData()
def duplicate(self):
selected_indexes = self.lstSpectra.selectedIndexes()
selectedRows = [x.row() for x in selected_indexes]
if len(selected_indexes) == 0:
return
for i in selectedRows:
self.lstSpectra.addItem(self.dataClasses[i].name + '_copy')
self.dataClasses.append(c.deepcopy(self.dataClasses[i]))
def averageExafs(self):
selected_indexes = self.lstSpectra.selectedIndexes()
if len(selected_indexes) == 0:
return
selectedRows = [x.row() for x in selected_indexes]
#find range where all curves are defined
min_k_all = asarray([min(self.dataClasses[x].k) for x in selectedRows])
max_k_all = asarray([max(self.dataClasses[x].k) for x in selectedRows])
min_k = max(min_k_all)
max_k = min(max_k_all)
#find average delta energy
average_diff_all = [average(diff(self.dataClasses[x].k)) for x in selectedRows]
average_diff = average(average_diff_all)
common_k = arange(min_k, max_k, average_diff)
spl = InterpolatedUnivariateSpline(self.dataClasses[selectedRows[0]].k, self.dataClasses[selectedRows[0]].exafsZLC)
new_vals = spl(common_k)
av = array(new_vals)
name = "exafs_average " + str(selectedRows[0])
for i in selectedRows[1:]:
name = name + " + " + str(i)
spl = InterpolatedUnivariateSpline(self.dataClasses[i].k, self.dataClasses[i].exafsZLC)
new_vals = spl(common_k)
av = av + new_vals
av = av / len(list(selected_indexes))
self.lstSpectra.addItem(name)
self.dataClasses.append(xaesa_exafs_class(3)) # EXAFS
self.dataClasses[-1].k = common_k
self.dataClasses[-1].exafs = av
self.dataClasses[-1].E0 = 0
self.dataClasses[-1].E1 = 0
self.dataClasses[-1].E2 = 0
self.dataClasses[-1].E3 = 0
self.dataClasses[-1].zeroLineCorr = 0
self.dataClasses[-1].kMin = self.dataClasses[selectedRows[0]].kMin
self.dataClasses[-1].kMax = self.dataClasses[selectedRows[0]].kMax
self.dataClasses[-1].dk = self.dataClasses[selectedRows[0]].dk
self.dataClasses[-1].rMin = self.dataClasses[selectedRows[0]].rMin
self.dataClasses[-1].rMax = self.dataClasses[selectedRows[0]].rMax
self.dataClasses[-1].dr = self.dataClasses[selectedRows[0]].dr
self.dataClasses[-1].kPower = self.dataClasses[selectedRows[0]].kPower
self.dataClasses[-1].rMinBft = self.dataClasses[selectedRows[0]].rMinBft
self.dataClasses[-1].rMaxBft = self.dataClasses[selectedRows[0]].rMaxBft
self.dataClasses[-1].bftWindowParam = self.dataClasses[selectedRows[0]].bftWindowParam
self.dataClasses[-1].processExpData()
def averageXes(self):
selected_indexes = self.lstSpectra.selectedIndexes()
if len(selected_indexes) == 0:
return
selectedRows = [x.row() for x in selected_indexes]
#check if all datasets with the same length
elementsCount = asarray([len(self.dataClasses[x].xes) for x in selectedRows])
if sum( elementsCount - elementsCount[0] ) != 0: #not all arrays are the same length
msgBox = QtGui.QMessageBox()
msgBox.setText("Not all arrays are the same length. Can't average.")
# msgBox.setInformativeText("Do you want to save your changes?")
msgBox.setStandardButtons(QtGui.QMessageBox.Yes)
msgBox.exec_()
return
average = array(self.dataClasses[selectedRows[0]].xes)
name = self.lstSpectra.item(selectedRows[0]).text() + '_average_of_' + str(len(selectedRows))
for i in selectedRows[1:]:
average = average + self.dataClasses[i].xes
average = average / len(list(selected_indexes))
self.lstSpectra.addItem(name)
self.dataClasses.append(xaesa_xes_class())
self.dataClasses[-1].name = name
self.dataClasses[-1].energy = self.dataClasses[selectedRows[0]].energy
self.dataClasses[-1].xes = average
self.dataClasses[-1].E0 = self.dataClasses[selectedRows[0]].E0
self.dataClasses[-1].E1 = self.dataClasses[selectedRows[0]].E1
self.dataClasses[-1].E2 = self.dataClasses[selectedRows[0]].E2
self.dataClasses[-1].E3 = self.dataClasses[selectedRows[0]].E3
self.dataClasses[-1].eAreaNormMin = self.dataClasses[selectedRows[0]].eAreaNormMin
self.dataClasses[-1].eAreaNormMax = self.dataClasses[selectedRows[0]].eAreaNormMax
#process opened file
self.dataClasses[-1].removeBackground(polPower=polPowerXES)
self.dataClasses[-1].areaNormalize()
sel_item = self.lstSpectra.item(self.lstSpectra.count()-1)
sel_item.setForeground(QtCore.Qt.darkMagenta)
def kPowerChange(self):
cnr = self.current
newKPower = float(self.edtkpow.text())
self.dataClasses[cnr].changeKPower(newKPower)
self.lstSpectraItemClicked() #update graphs
def extractParamsChange(self):
startTime = timer()
cnr = self.current
self.dataClasses[cnr].Es = float(self.edtEs.text())
self.dataClasses[cnr].E0 = float(self.edtE0.text())
self.dataClasses[cnr].E1 = float(self.edtE1.text())
self.dataClasses[cnr].E2 = float(self.edtE2.text())
self.dataClasses[cnr].E3 = float(self.edtE3.text())
self.dataClasses[cnr].kPower = float(self.edtkpow.text())
self.dataClasses[cnr].zeroLineCorr = float(self.edtsm.text())
self.dataClasses[cnr].normalizationMode = int(self.chkExafsNormalization.isChecked())
self.dataClasses[cnr].normalizationEnergy = float(self.edtExafsNormEnergy.text())
self.dataClasses[cnr].reduceK = int(self.chkReduceK.isChecked())
self.dataClasses[cnr].kMin = float(self.edtkmin.text())
self.dataClasses[cnr].kMax = float(self.edtkmax.text())
self.dataClasses[cnr].dk = float(self.edtdk.text())
self.dataClasses[cnr].rMin = float(self.edtrmin.text())
self.dataClasses[cnr].rMax = float(self.edtrmax.text())
self.dataClasses[cnr].dr = float(self.edtdr.text())
self.dataClasses[cnr].mju0PolinomialDegree = int(self.edtmju0poldegree.text())
self.dataClasses[cnr].bckgrPolinomialDegree = int(self.edtbckgdegree.text())
self.dataClasses[cnr].rMinBft = float(self.edtrminbft.text())
self.dataClasses[cnr].rMaxBft = float(self.edtrmaxbft.text())
self.dataClasses[cnr].bftWindowParam = float(self.edtbftwindowparam.text())
self.dataClasses[cnr].redoExtraction()
endTime = timer()
self.lblStatus.setText("Extraction done in {:.4f} seconds".format(endTime - startTime) )
self.lstSpectraItemClicked() #update graphs
def ftBftParamsChange(self):
startTime = timer()
cnr = self.current
self.dataClasses[cnr].E0 = float(self.edtE0.text())
self.dataClasses[cnr].E1 = float(self.edtE1.text())
self.dataClasses[cnr].E2 = float(self.edtE2.text())
self.dataClasses[cnr].E3 = float(self.edtE3.text())
self.dataClasses[cnr].kPower = float(self.edtkpow.text())
self.dataClasses[cnr].zeroLineCorr = float(self.edtsm.text())
self.dataClasses[cnr].normalizationMode = int(self.chkExafsNormalization.isChecked())
self.dataClasses[cnr].normalizationEnergy = float(self.edtExafsNormEnergy.text())
self.dataClasses[cnr].kMin = float(self.edtkmin.text())
self.dataClasses[cnr].kMax = float(self.edtkmax.text())
self.dataClasses[cnr].dk = float(self.edtdk.text())
self.dataClasses[cnr].rMin = float(self.edtrmin.text())
self.dataClasses[cnr].rMax = float(self.edtrmax.text())
self.dataClasses[cnr].dr = float(self.edtdr.text())
self.dataClasses[cnr].mju0PolinomialDegree = int(self.edtmju0poldegree.text())
self.dataClasses[cnr].bckgrPolinomialDegree = int(self.edtbckgdegree.text())
self.dataClasses[cnr].rMinBft = float(self.edtrminbft.text())
self.dataClasses[cnr].rMaxBft = float(self.edtrmaxbft.text())
self.dataClasses[cnr].bftWindowParam = float(self.edtbftwindowparam.text())
self.dataClasses[cnr].redoFtBft()
endTime = timer()
self.lblStatus.setText("FT & BFT done in {:.4f} seconds".format(endTime - startTime) )
self.lstSpectraItemClicked() #update graphs
def bftParamsChange(self):
startTime = timer()
cnr = self.current
self.dataClasses[cnr].E0 = float(self.edtE0.text())
self.dataClasses[cnr].E1 = float(self.edtE1.text())
self.dataClasses[cnr].E2 = float(self.edtE2.text())
self.dataClasses[cnr].E3 = float(self.edtE3.text())
self.dataClasses[cnr].kPower = float(self.edtkpow.text())
self.dataClasses[cnr].zeroLineCorr = float(self.edtsm.text())
self.dataClasses[cnr].normalizationMode = int(self.chkExafsNormalization.isChecked())
self.dataClasses[cnr].normalizationEnergy = float(self.edtExafsNormEnergy.text())
self.dataClasses[cnr].kMin = float(self.edtkmin.text())
self.dataClasses[cnr].kMax = float(self.edtkmax.text())
self.dataClasses[cnr].dk = float(self.edtdk.text())
self.dataClasses[cnr].rMin = float(self.edtrmin.text())
self.dataClasses[cnr].rMax = float(self.edtrmax.text())
self.dataClasses[cnr].dr = float(self.edtdr.text())
self.dataClasses[cnr].mju0PolinomialDegree = int(self.edtmju0poldegree.text())
self.dataClasses[cnr].bckgrPolinomialDegree = int(self.edtbckgdegree.text())
self.dataClasses[cnr].rMinBft = float(self.edtrminbft.text())
self.dataClasses[cnr].rMaxBft = float(self.edtrmaxbft.text())
self.dataClasses[cnr].bftWindowParam = float(self.edtbftwindowparam.text())
self.dataClasses[cnr].redoBft()
endTime = timer()
self.lblStatus.setText("BFT done in {:.4f} seconds".format(endTime - startTime) )
self.lstSpectraItemClicked() #update graphs
def rebinMju(self):
if self.current < 0:
return
de1 = self.xaesaSettings.rebinE1
de2 = self.xaesaSettings.rebinE1E0
dk = self.xaesaSettings.rebinE0E3
msgBox = QtGui.QMessageBox()
msgBox.setText("Es, E1, E0+50, E3 energy values will be used for rebinning. \n\
Step size is defined as:\n %s eV for Es < E < E1\n %s eV for E1 < E < E2 \n dk=%s A-1 for E2 < E < E3 \n\
Proceed ?" %(de1, de2, dk))
# msgBox.setInformativeText("Do you want to save your changes?")
msgBox.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
result = msgBox.exec_()
if result == QtGui.QMessageBox.No:
return
selected_indexes = self.lstSpectra.selectedIndexes()
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
self.dataClasses[y].changeToRebinedMjuAveraging(rebinType = 'spline', dE1 = de1, dE2=de2, dK=dk, s = 0)
sel_item = self.lstSpectra.item(y)
sel_item.setText( sel_item.text() + "(rebin)")
def rebinMjuRbfSmooth(self):
if self.current < 0:
return
de1 = self.xaesaSettings.rebinE1
de2 = self.xaesaSettings.rebinE1E0
dk = self.xaesaSettings.rebinE0E3
msgBox = QtGui.QMessageBox()
msgBox.setText("E1, E0+50, E3 energy values will be used for rebinning. \n\
Step size is defined as:\n %s eV for Es < E < E1\n %s eV for E1 < E < E2 \n dk=%s A-1 for E2 < E < E3 \n\
Proceed ?" %(de1, de2, dk))
# msgBox.setInformativeText("Do you want to save your changes?")
msgBox.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
result = msgBox.exec_()
if result == QtGui.QMessageBox.No:
return
selected_indexes = self.lstSpectra.selectedIndexes()
sm = float(self.edtRbfSmooth.text())
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
self.dataClasses[y].changeToRebinedMjuAveraging(rebinType = 'rbf-smooth', dE1 = de1, dE2=de2, dK=dk, s = sm)
sel_item = self.lstSpectra.item(y)
sel_item.setText( sel_item.text() + "(rebin)")
def backToOriginalMju(self):
if self.current < 0:
return
selected_indexes = self.lstSpectra.selectedIndexes()
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
self.dataClasses[y].changeToOriginalMju()
sel_item = self.lstSpectra.item(y)
sel_item.setText( sel_item.text().replace('(rebin)', ''))
def rebinExafs(self):
if self.current < 0:
return
msgBox = QtGui.QMessageBox()
msgBox.setText("E1, E0+50, E3 energy values will be used for rebinning. \n\
Step size is defined as:\n 5.00 eV for E < E1\n 0.25 eV for E1 < E < E2 \n dk=0.02 A-1 for E2 < E < E3 \n\
Proceed ?")
# msgBox.setInformativeText("Do you want to save your changes?")
msgBox.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
result = msgBox.exec_()
if result == QtGui.QMessageBox.No:
return
selected_indexes = self.lstSpectra.selectedIndexes()
for i in range(len(list(selected_indexes))):
y= selected_indexes[i].row()
self.dataClasses[y].changeToRebinedMjuAveraging1()
sel_item = self.lstSpectra.item(y)
sel_item.setText( sel_item.text() + "(rebin1)")
def rebinXes(self):
selected_indexes = self.lstSpectra.selectedIndexes()
if len(selected_indexes) == 0:
return
selectedRows = [x.row() for x in selected_indexes]
text, ok = QtGui.QInputDialog.getText(self,
"Enter rebin parameters",
"Enter rebin parameters Emin Emax dE",
QtGui.QLineEdit.Normal, "7000 7100 0.01")
if ok:
rebinParams = text.split()
eMin = float(rebinParams[0])
eMax = float(rebinParams[1])
dE = float(rebinParams[2])
else:
return
print(rebinParams)
for row in selectedRows:
energy_scale = self.dataClasses[row].energy
vals = self.dataClasses[row].xes
#check if all points are increasing
b = diff(energy_scale) > 0
if not all(b):
msgBox = QtGui.QMessageBox()
msgBox.setText("Data points must be increasing, this condition is not satisfied.\n\
Remove decreasing data points automaticly ?")
msgBox.setStandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
result = msgBox.exec_()
if result == QtGui.QMessageBox.No:
continue
if result == QtGui.QMessageBox.Yes: #remove bad data points
b = append(b, False)
energy_scale = self.dataClasses[row].energy[b]
vals = self.dataClasses[row].xes[b]
# new_energy, rebined = rebin_mju(energy_scale, vals,
# rebinParams[0], rebinParams[1], rebinParams[2])
spl = InterpolatedUnivariateSpline(energy_scale, vals)
new_energy_scale = arange(eMin, eMax, dE)
new_vals = spl(new_energy_scale)
name = self.lstSpectra.item(row).text() + '_rebin'
self.lstSpectra.addItem(name)
self.dataClasses.append(xaesa_xes_class())
self.dataClasses[-1].name = name
self.dataClasses[-1].energy = new_energy_scale
self.dataClasses[-1].xes = new_vals
self.dataClasses[-1].E0 = self.dataClasses[row].E0
self.dataClasses[-1].E1 = self.dataClasses[row].E1
self.dataClasses[-1].E2 = self.dataClasses[row].E2
self.dataClasses[-1].E3 = self.dataClasses[row].E3
self.dataClasses[-1].eAreaNormMin = self.dataClasses[row].eAreaNormMin
self.dataClasses[-1].eAreaNormMax = self.dataClasses[row].eAreaNormMax
#process opened file
self.dataClasses[-1].removeBackground(polPower=polPowerXES)
self.dataClasses[-1].areaNormalize()
sel_item = self.lstSpectra.item(self.lstSpectra.count()-1)
sel_item.setForeground(QtCore.Qt.darkMagenta)
def dwcorrection(self):
cnr = self.current
# dwfactor = float(askstring("Enter DW factor", "Enter DW factor"))
num, ok = QtGui.QInputDialog.getDouble(self,
"Enter DW factor",
"Enter DW factor",
value = 0.01,
max = 1,
min = -1,
decimals = 4)
if ok:
dwfactor = num
else:
return
self.dataClasses[cnr].exafs = self.dataClasses[cnr].exafs * exp(-2*dwfactor*self.dataClasses[cnr].k**2)
# self.exafsd[cnr] = self.dataClasses[cnr].exafs
self.dataClasses[cnr].exafsZLC = self.dataClasses[cnr].exafs
self.dataClasses[cnr].redoFtBft()
self.lstSpectraItemClicked()
def shiftenergyscale(self):
cnr = self.current
# shift = float(askstring("Enter energy shift", "Enter energy shift"))
num, ok = QtGui.QInputDialog.getDouble(self,
"Energy shift",
"Enter energy shift",
value = 10,
max = 30000,
min = -30000,
decimals = 2)
if ok:
shift = num
else:
return
self.dataClasses[cnr].energy = self.dataClasses[cnr].energy + shift
if isinstance(self.dataClasses[cnr], xaesa_xes_class):
print("shifteing")
self.dataClasses[cnr].E0 = self.dataClasses[cnr].E0 + shift
self.dataClasses[cnr].E1 = self.dataClasses[cnr].E1 + shift
self.dataClasses[cnr].E2 = self.dataClasses[cnr].E2 + shift
self.dataClasses[cnr].E3 = self.dataClasses[cnr].E3 + shift
self.dataClasses[cnr].eAreaNormMin = self.dataClasses[cnr].eAreaNormMin + shift
self.dataClasses[cnr].eAreaNormMax = self.dataClasses[cnr].eAreaNormMax + shift
self.dataClasses[cnr].energyShift = self.dataClasses[cnr].energyShift +shift
self.lstSpectraItemClicked()
def LinCombination(self):
if self.current < 0:
return
lcw = LCWindow()
lcw.mainform = self
msgBox = QtGui.QMessageBox()
msgBox.setText('Choose mju or EXAFS?')
msgBox.addButton(QtGui.QPushButton('Mju'), QtGui.QMessageBox.AcceptRole)
msgBox.addButton(QtGui.QPushButton('EXAFS'), QtGui.QMessageBox.AcceptRole)
msgBox.addButton(QtGui.QPushButton('XES'), QtGui.QMessageBox.AcceptRole)
lcw.mju_exafs = msgBox.exec_()
lcw.initUI()
lcw.exec_()
def pcaAnalysis(self):
pcaw = PCAWindow()
pcaw.mainform = self
msgBox = QtGui.QMessageBox()
msgBox.setText('Choose mju or EXAFS?')
msgBox.addButton(QtGui.QPushButton('Mju'), QtGui.QMessageBox.AcceptRole)
msgBox.addButton(QtGui.QPushButton('EXAFS'), QtGui.QMessageBox.AcceptRole)
msgBox.addButton(QtGui.QPushButton('XANES'), QtGui.QMessageBox.AcceptRole)
msgBox.addButton(QtGui.QPushButton('XES'), QtGui.QMessageBox.AcceptRole)
pcaw.mju_exafs = msgBox.exec_()
pcaw.initUI()
pcaw.exec_()
def openNexus(self):
self.fn = self.openaddfiledialog_qtgui()
if self.fn == []:
self.lblStatus.setText("No files opened")
return
self.fn.sort()
fn1 = []
for i in range(0, len(self.fn)):
head, tail = path.split(str(self.fn[i]))
fn1.append(tail)
self.currentdir = head
#add all file names to the list
#and fill arrays with data
self.lstSpectra.clear()
# self.lstSpectra.addItems(fn1)
#arrays to store analysed data
self.init_arrays()
if self.chkMjuOrExafs.isChecked(): #only exafs
msgBox = QtGui.QMessageBox()
msgBox.setText('Select k power used?')
msgBox.addButton(QtGui.QPushButton('0'), QtGui.QMessageBox.AcceptRole)
msgBox.addButton(QtGui.QPushButton('1'), QtGui.QMessageBox.AcceptRole)
msgBox.addButton(QtGui.QPushButton('2'), QtGui.QMessageBox.AcceptRole)
msgBox.addButton(QtGui.QPushButton('3'), QtGui.QMessageBox.AcceptRole)
kpower = msgBox.exec_()
for i in range(0, len(self.fn)):
self.print_hdf5_file_structure(self.fn[i])
# h5file = h5py.File(self.fn[i], "r")
# print(list(h5file.keys()))
def print_hdf5_file_structure(self, file_name) :
# """Prints the HDF5 file structure"""
file = h5py.File(file_name, 'r') # open read-only
item = file #["/Configure:0000/Run:0000"]
self.print_hdf5_item_structure(item)
file.close()
def print_hdf5_item_structure(self, g, offset=' ') :
# """Prints the input file/group/dataset (g) name and begin iterations on its content"""
if isinstance(g,h5py.File) :
print(g.file, '(File)', g.name)
elif isinstance(g,h5py.Dataset) :
print('(Dataset)', g.name, ' len =', g.shape, g.dtype)
elif isinstance(g,h5py.Group) :
print('(Group)', g.name)
else :
print('WORNING: UNKNOWN ITEM IN HDF5 FILE', g.name)
sys.exit ( "EXECUTION IS TERMINATED" )
if isinstance(g, h5py.File) or isinstance(g, h5py.Group) :
# print(list(g.keys()))
for key in g.keys() :
subg = g[key]
print(offset, key ," ", subg.name)
self.print_hdf5_item_structure(subg, offset + ' ')
def spectradifference(self):
selected_indexes = self.lstSpectra.selectedIndexes()
if len(selected_indexes) == 0:
return
selectedRows = [x.row() for x in selected_indexes]
#check if all datasets with the same length
elementsCount = asarray([len(self.dataClasses[x].xes) for x in selectedRows])
if sum( elementsCount - elementsCount[0] ) != 0: #not all arrays are the same length
msgBox = QtGui.QMessageBox()
msgBox.setText("Not all arrays are the same length. Can't average.")
# msgBox.setInformativeText("Do you want to save your changes?")
msgBox.setStandardButtons(QtGui.QMessageBox.Yes)
msgBox.exec_()
return
difference = self.dataClasses[selectedRows[1]].xesAreaNorm - self.dataClasses[selectedRows[0]].xesAreaNorm
name = self.lstSpectra.item(selectedRows[1]).text() + ' - ' + self.lstSpectra.item(selectedRows[0]).text()
self.lstSpectra.addItem(name)
self.dataClasses.append(xaesa_transient_class())
self.dataClasses[-1].name = name
self.dataClasses[-1].energy = self.dataClasses[selectedRows[0]].energy
self.dataClasses[-1].transient = difference
self.dataClasses[-1].eSmoothMin = self.dataClasses[selectedRows[0]].eAreaNormMin
self.dataClasses[-1].eSmoothMax = self.dataClasses[selectedRows[0]].eAreaNormMax
t1 = timer()
self.dataClasses[-1].smoothTransient(smFactor = self.dataClasses[-1].smoothFactor)
t2=timer()
print("transient time=", t2-t1)
def xesExtractRedo(self):
cnr = self.current
self.current = self.lstSpectra.currentRow()
cnr = self.current
self.dataClasses[cnr].E0 = float(self.edtXesE0.text())
self.dataClasses[cnr].E1 = float(self.edtXesE1.text())
self.dataClasses[cnr].E2 = float(self.edtXesE2.text())
self.dataClasses[cnr].E3 = float(self.edtXesE3.text())
self.dataClasses[cnr].eAreaNormMin = float(self.edtXesEANormMin.text())
self.dataClasses[cnr].eAreaNormMax = float(self.edtXesEANormMax.text())
self.dataClasses[cnr].removeBackground(polPower=polPowerXES)
self.dataClasses[cnr].areaNormalize()
self.lstSpectraItemClicked()
def transChange(self):
cnr = self.current
self.current = self.lstSpectra.currentRow()
cnr = self.current
self.dataClasses[cnr].eSmoothMin = float(self.edtEMinSmoothTrans.text())
self.dataClasses[cnr].eSmoothMax = float(self.edtEMaxSmoothTrans.text())
self.dataClasses[cnr].smoothFactor = float(self.edtSmoothFactor.text())
self.dataClasses[cnr].smoothTransient(smFactor = self.dataClasses[cnr].smoothFactor)
self.lstSpectraItemClicked()
def eventFilter(self, sender, event):
# this is the function that processes internal drop in notesList
if event.type() == QtCore.QEvent.ChildRemoved: #drop event
self.dragStopSelectedRows = [x.row() for x in self.lstSpectra.selectedIndexes()]
self.dragStartSelectedRows.sort()
if self.dragStopSelectedRows == self.dragStartSelectedRows: #do nothing
return 0
# print("Before sorting", self.dragStartSelectedRows, self.dragStopSelectedRows)
tmpList = [self.dataClasses[i] for i in self.dragStartSelectedRows]
self.dragStartSelectedRows.sort(reverse=True)
# print("after sorting", self.dragStartSelectedRows, self.dragStopSelectedRows, tmpList)
for i in self.dragStartSelectedRows: #remove elements
self.dataClasses.pop(i)
self.dragStopSelectedRows.sort()
self.dataClasses[self.dragStopSelectedRows[0]:self.dragStopSelectedRows[0]] = tmpList
if event.type() == QtCore.QEvent.ChildAdded: #drag start event
self.dragStartSelectedRows = [x.row() for x in self.lstSpectra.selectedIndexes()]
return False # don't actually interrupt anything
def onpick(self, event):
# on the pick event, find the orig line corresponding to the
# legend proxy line, and toggle the visibility
legline = event.artist
indexes = [i for i, j in enumerate(self.leg_lines) if j == legline]
print(indexes)
for i in indexes:
origline = self.lines[i]
vis = not origline.get_visible()
origline.set_visible(vis)
# if self.mode == 1:
# origline = self.lined1[legline]
# origline.set_visible(vis)
# Change the alpha on the line in the legend so we can see what lines
# have been toggled
if vis:
legline.set_alpha(1.0)
else:
legline.set_alpha(0.2)
self.fig.canvas.draw()
def shiftEnergyRef(self):
selected_indexes = self.lstSpectra.selectedIndexes()
if len(list(selected_indexes))<2:
return
ref = selected_indexes[-1].row()
maxderiv_ref = argmax( gradient(self.dataClasses[ref].mjuRef))
print(ref, maxderiv_ref)
for i in range(len(list(selected_indexes))-1):
y = selected_indexes[i].row()
maxderiv_data = argmax( gradient(self.dataClasses[y].mjuRef))
e_shift = self.dataClasses[ref].energy[maxderiv_ref] - self.dataClasses[y].energy[maxderiv_data]
print(y, e_shift)
self.dataClasses[y].energy = self.dataClasses[y].energy + e_shift
self.dataClasses[y].energyShift = self.dataClasses[y].energyShift + e_shift
def makeRxesPlane(self, energyTransfer=False):
selected_indexes = self.lstSpectra.selectedIndexes()
if len(selected_indexes) == 0:
return
selectedRows = [x.row() for x in selected_indexes]
rxesDialog = xaesaRxesWindow()
rxesDialog.viewer.rxes = []
rxesDialog.viewer.fluoEnergy = []
rxesDialog.viewer.incidentEnergy = []
if energyTransfer:
for i in selectedRows:
rxesDialog.viewer.rxes.append(self.dataClasses[i].xes )
rxesDialog.viewer.fluoEnergy.append(self.dataClasses[i].energy * (-1) + self.dataClasses[i].incidentEnergy)
rxesDialog.viewer.incidentEnergy.append(zeros(len(self.dataClasses[i].xes)) + self.dataClasses[i].incidentEnergy)
rxesDialog.viewer.rxes = transpose(rxesDialog.viewer.rxes)
rxesDialog.viewer.fluoEnergy = transpose(rxesDialog.viewer.fluoEnergy)
rxesDialog.viewer.incidentEnergy = transpose(rxesDialog.viewer.incidentEnergy)
rxesDialog.viewer.energyTransfer = energyTransfer
else:
for i in selectedRows:
rxesDialog.viewer.rxes.append(self.dataClasses[i].xes )
rxesDialog.viewer.fluoEnergy.append(self.dataClasses[i].energy)
rxesDialog.viewer.incidentEnergy.append(zeros(len(self.dataClasses[i].xes)) + self.dataClasses[i].incidentEnergy)
rxesDialog.viewer.rxes = transpose(rxesDialog.viewer.rxes)
rxesDialog.viewer.fluoEnergy = transpose(rxesDialog.viewer.fluoEnergy)
rxesDialog.viewer.incidentEnergy = transpose(rxesDialog.viewer.incidentEnergy)
rxesDialog.viewer.energyTransfer = energyTransfer
rxesDialog.viewer.plot()
rxesDialog.exec_()
def adaptOpeningParams(self):
print('mu ', self.chkDataTypeMju.isChecked())
print('Xes ', self.chkDataTypeXes.isChecked())
print('Exafs ', self.chkDataTypeExafs.isChecked())
print('Transient ', self.chkDataTypeTrans.isChecked())
if self.chkDataTypeMju.isChecked():
self.lblDataX.setText("Energy")
self.lblDataY.setText("mu")
self.edtRefCol.show()
self.lblDataY1.show()
self.gb2.show()
if self.chkCalcMju.isChecked():
self.gb3.show()
self.lblI0Col.show()
self.lblI1Col.show()
self.lblI2Col.show()
self.edtI0Col.show()
self.edtICol.show()
self.edtI2Col.show()
if self.chkTransOrFluo.isChecked(): #transmission selected
self.lblI1Col.setText("I1")
self.edtFluoCols.hide()
self.edtICol.show()
else: #Fluorescence selected
self.edtFluoCols.show()
self.edtICol.hide()
self.lblI1Col.setText("I fluo")
else:
self.gb3.hide()
self.lblI0Col.hide()
self.lblI1Col.hide()
self.lblI2Col.hide()
self.edtI0Col.hide()
self.edtICol.hide()
self.edtI2Col.hide()
self.edtFluoCols.hide()
if self.chkDataTypeXes.isChecked():
self.lblDataX.setText("Energy")
self.lblDataY.setText("Emission")
self.gb2.hide()
self.gb3.hide()
self.lblI0Col.hide()
self.lblI1Col.hide()
self.lblI2Col.hide()
self.edtI0Col.hide()
self.edtICol.hide()
self.edtI2Col.hide()
self.edtFluoCols.hide()
self.edtRefCol.hide()
self.lblDataY1.hide()
if self.chkDataTypeExafs.isChecked():
self.lblDataX.setText("k")
self.lblDataY.setText("EXAFS")
self.gb2.hide()
self.gb3.hide()
self.lblI0Col.hide()
self.lblI1Col.hide()
self.lblI2Col.hide()
self.edtI0Col.hide()
self.edtICol.hide()
self.edtI2Col.hide()
self.edtFluoCols.hide()
self.edtRefCol.hide()
self.lblDataY1.hide()
if self.chkDataTypeTrans.isChecked():
self.lblDataX.setText("Energy")
self.lblDataY.setText("Transient")
self.gb2.hide()
self.gb3.hide()
self.lblI0Col.hide()
self.lblI1Col.hide()
self.lblI2Col.hide()
self.edtI0Col.hide()
self.edtICol.hide()
self.edtI2Col.hide()
self.edtFluoCols.hide()
self.edtRefCol.hide()
self.lblDataY1.hide()
def saveGUISettings(self):
settings = QtCore.QSettings('dev', GUI_SETTINGS_ID)
# settings.setValue('emin', self.edtEmin.text())
# settings.setValue('emax', self.edtEmax.text())
# settings.setValue('de', self.edtdE.text())
# settings.setValue('reflection', self.edtCrystalReflection.text())
# settings.setValue('crystal', str(self.cmbCrystal.currentIndex()))
def restoreGUISettings(self):
settings = QtCore.QSettings('dev', GUI_SETTINGS_ID)
# self.edtEmin.setText(str(settings.value('emin')))
# self.edtEmax.setText(str(settings.value('emax')))
# self.edtdE.setText(str(settings.value('de')))
# self.edtCrystalReflection.setText(str(settings.value('reflection')))
# try:
# self.cmbCrystal.setCurrentIndex(int(str(settings.value('crystal'))))
# except:
# self.cmbCrystal.setCurrentIndex(0)
if __name__ == '__main__':
app = QtGui.QApplication(argv)
window = MyWindow()
print(getpid())
exit(app.exec_())
| 178,553
| 43.16374
| 174
|
py
|
xaesa
|
xaesa-master/xaesa_settings.py
|
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 6 11:20:43 2018
@author: akali
"""
from init import QTVer
if QTVer == 4:
from PyQt4 import QtGui, QtCore
if QTVer == 5:
from PyQt5 import QtWidgets as QtGui
from PyQt5 import QtCore
class xaesa_settings(QtGui.QWidget):
def __init__(self, parent=None):
super(xaesa_settings, self).__init__()
# self.rebinSmoothing = 1
self.rebinE1 = 5
self.rebinE1E0 = 0.1
self.rebinE0E3 = 0.02
self.initUI()
def initUI(self):
################# Rebin group ###################################
grpRebin = QtGui.QGroupBox("Rebin parameters")
# self.lblRebinSmoothing = QtGui.QLabel("Rebin smoothing factor")
# self.edtRebinSmoothing = QtGui.QLineEdit(str(self.rebinSmoothing))
self.lblrebinE1 = QtGui.QLabel("Rebin dE (E < E1)")
self.edtrebinE1 = QtGui.QLineEdit(str(self.rebinE1))
self.lblrebinE1E0 = QtGui.QLabel("Rebin dE (E1 < E < E0+50)")
self.edtrebinE1E0 = QtGui.QLineEdit(str(self.rebinE1E0))
self.lblrebinE0E3 = QtGui.QLabel("Rebin dk (E0+50 < E < E3)")
self.edtrebinE0E3 = QtGui.QLineEdit(str(self.rebinE0E3))
loutRebin = QtGui.QGridLayout()
# loutRebin.addWidget(self.lblRebinSmoothing, 0, 0)
# loutRebin.addWidget(self.edtRebinSmoothing, 0, 1)
loutRebin.addWidget(self.lblrebinE1, 0, 0)
loutRebin.addWidget(self.edtrebinE1, 0, 1)
loutRebin.addWidget(self.lblrebinE1E0, 1, 0)
loutRebin.addWidget(self.edtrebinE1E0, 1, 1)
loutRebin.addWidget(self.lblrebinE0E3, 2, 0)
loutRebin.addWidget(self.edtrebinE0E3, 2, 1)
grpRebin.setLayout(loutRebin)
################ Apply button ###############
self.btnApply = QtGui.QPushButton("Apply")
self.btnApply.clicked.connect(self.apply)
#################Main Layout ###############
loutMain = QtGui.QGridLayout()
loutMain.addWidget(grpRebin, 0, 0)
loutMain.addWidget(self.btnApply, 1, 0)
self.setLayout(loutMain)
def apply(self):
# self.rebinSmoothing = float(self.edtRebinSmoothing.text())
self.rebinE1 = float(self.edtrebinE1.text())
self.rebinE1E0 = float(self.edtrebinE1E0.text())
self.rebinE0E3 = float(self.edtrebinE0E3.text())
#class TestWindow(QtGui.QMainWindow):
# def __init__(self, parent=None):
# super(TestWindow, self).__init__()
#
# self.wid = xaesa_settings(self)
# self.setCentralWidget(self.wid)
#
# self.show()
#
# def closeEvent(self, event):
# super(TestWindow, self).closeEvent(event)
# print('closed')
#
#if __name__ == '__main__':
# app = QtGui.QApplication(argv)
#
# main = TestWindow()
#
# exit(app.exec_())
| 2,976
| 32.449438
| 76
|
py
|
xaesa
|
xaesa-master/xaesa_lincombination.py
|
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 20 11:07:03 2016
@author: sasha
"""
import os
from .init import QTVer
if QTVer == 4:
from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
if QTVer == 5:
from PyQt5 import QtWidgets as QtGui
from PyQt5 import QtCore
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.widgets import SpanSelector
from scipy.interpolate import InterpolatedUnivariateSpline, UnivariateSpline
#from . import ft
#from . import xaslib
#from tkinter import messagebox
from scipy.optimize import least_squares
#from tkinter.filedialog import asksaveasfilename
#from tkinter import Tk
def lin_comb_func(x, basis, fit):
# print(basis * x[:,None])
# print('sum', (np.sum(basis * x[:,None], axis=0)))
return np.sum(basis * x[:,None], axis=0) - fit
class LCWindow(QtGui.QDialog):
def __init__(self):
super(LCWindow, self).__init__()
self.mainform = None
self.mju_exafs = 1 # 0 - mju, 1 - exafs, 2 - xes
# self.initUI()
def initUI(self):
self.fit_result = []
self.fit_basis = []
lblBasis = QtGui.QLabel("Select basis:")
lblFit = QtGui.QLabel("Select spectra to fit (multiple selection possible):")
lblResult = QtGui.QLabel("Fit coeficients:")
self.lstBasis = QtGui.QListWidget()
self.lstFit = QtGui.QListWidget()
self.lstBasis.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.lstFit.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.lstFit.itemClicked.connect(self.lstFitItemClicked)
self.lstFitResult = QtGui.QListWidget()
anfn = []
fit_res = []
for i in range(0, self.mainform.lstSpectra.count()):
anfn.append(str(self.mainform.lstSpectra.item(i).text()))
fit_res.append("")
self.fit_result.append([])
self.fit_basis.append([])
self.lstBasis.addItems(anfn)
self.lstFit.addItems(anfn)
self.lstFitResult.addItems(fit_res)
lout = QtGui.QGridLayout()
lout.addWidget(lblBasis, 0,0)
lout.addWidget(lblFit,0,1 )
lout.addWidget(lblResult,0,2)
lout.addWidget(self.lstBasis, 1, 0)
lout.addWidget(self.lstFit, 1, 1)
lout.addWidget(self.lstFitResult,1,2)
#Figures
self.fig = plt.figure(6, figsize=(12, 6))
self.ax_exafs = plt.subplot2grid((1,2), (0,1))
self.ax_fit = plt.subplot2grid((1,2), (0,0))
self.canv = FigureCanvas(self.fig)
self.tbar = NavigationToolbar(self.canv, self)
self.exafs_line, = self.ax_exafs.plot([], [])
# self.bftexafs_line, = self.ax_exafs.plot([], [])
self.difference_line, = self.ax_exafs.plot([], [], "o")
self.exafsdgcomp_line, = self.ax_exafs.plot([], [])
# self.fit_line, = self.ax_fit.plot([], [], "o")
# self.fit_line.set_markersize(2)
self.exafsdgcomp_line.set_color('r')
self.glitch_lines = []
self.minmaxlines = []
self.fig.tight_layout()
self.btnFit = QtGui.QPushButton('Fit')
self.btnFit.clicked.connect(self.fit)
self.btnApply = QtGui.QPushButton('Save fit results...')
self.btnApply.clicked.connect(self.save_fit)
self.btnCancel = QtGui.QPushButton('Exit')
self.btnCancel.clicked.connect(self.cancel)
lfig = QtGui.QVBoxLayout()
lfig.addWidget(self.tbar)
lfig.addWidget(self.canv)
lfig.addLayout(lout)
lfig.addWidget(self.btnFit)
lfig.addWidget(self.btnApply)
lfig.addWidget(self.btnCancel)
self.setLayout(lfig)
#wid.setLayout(lfig)
def onselect(self, xmin, xmax):
self.edtx1.setText(str(xmin))
self.edtx2.setText(str(xmax))
def onselect1(self, xmin, xmax):
self.edtx3.setText(str(xmin))
self.edtx4.setText(str(xmax))
def plot(self):
# self.ax_exafs.clear()
# # set useblit True on gtkagg for enhanced performance
# self.span = SpanSelector(self.ax_exafs, self.onselect, 'horizontal', useblit=True,
# rectprops=dict(alpha=0.5, facecolor='red'), button = 1, span_stays=True)
#
# self.span1= SpanSelector(self.ax_exafs, self.onselect1, 'horizontal', useblit=True,
# rectprops=dict(alpha=0.5, facecolor='green'), button = 3, span_stays=True)
# self.ax_exafsdg.clear()
# self.ax_exafs.plot(self.k, self.exafs)
# self.ax_exafsdg.plot(self.k, self.exafsdg)
# self.exafs_line.set_xdata(self.k)
# self.exafs_line.set_ydata(self.exafs)
# self.exafsdg_line.set_xdata(self.k)
# self.exafsdg_line.set_ydata(self.exafsdg)
# self.exafsdgcomp_line.set_xdata(self.k)
# self.exafsdgcomp_line.set_ydata(self.exafsdg)
# self.ax_exafs.relim()
# self.ax_exafs.autoscale()
# self.ax_exafsdg.relim()
# self.ax_exafsdg.autoscale()
self.canv.draw()
def save_fit(self):
header = "#"
sa = [[],[]]
fmt="%10s"
for i in range(self.lstFit.count()):
if self.fit_basis[i] != []:
sa[0].append([self.lstFit.item(i).text()])
sa[1].append(self.fit_result[i])
# for i in range(len(self.fit_basis[i])):
# fmt = fmt + " %10.3f"
# Tk().withdraw()
# fn = asksaveasfilename()
# if fn == "":
# return
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.AnyFile)
dlg.setAcceptMode(1) # save dialog
dlg.setNameFilters(["All files (*.*)"])
dlg.setDirectory(os.getcwd())
if dlg.exec_():
flist = dlg.selectedFiles()
fn = flist[0]
else:
return
print(sa)
print(fmt)
print(np.hstack((sa[0], sa[1])))
sa[0] = np.array(sa[0])
sa[1] = np.array(sa[1])
# sa[1] = reshape(1, len(sa[0])*len(self.fit_basis[0]))
np.savetxt(fn, np.hstack((sa[0], sa[1])), fmt='%s')
def cancel(self):
self.close()
def fit(self):
sel_basis = self.lstBasis.selectedItems()
sel_fit = self.lstFit.selectedItems()
sel_basisi = self.lstBasis.selectedIndexes()
sel_fiti = self.lstFit.selectedIndexes()
if len(sel_basis) < 1:
messagebox.showinfo("Select basis spectra", "Please select at least 1 spectra for basis")
return
if len(sel_fit) < 1:
messagebox.showinfo("Select fit spectra", "Please select at least 1 spectrum to fit")
return
basis = []
basisi = []
variables = []
varbounds = [[],[]]
for i in range(len(sel_basis)):
y= sel_basisi[i].row()
if self.mju_exafs == 2:
basis.append(self.mainform.dataClasses[y].xesAreaNorm)
if self.mju_exafs == 1:
basis.append(self.mainform.dataClasses[y].exafsZLC)
if self.mju_exafs == 0:
basis.append(self.mainform.dataClasses[y].mjuMinusVictoreen)
basisi.append(y)
variables.append(1)
varbounds[0].append(0)
varbounds[1].append(1E6)
self.ax_fit.clear()
for i in range(len(sel_fit)):
y= sel_fiti[i].row()
if self.mju_exafs == 2:
fit = self.mainform.dataClasses[y].xesAreaNorm
if self.mju_exafs == 1:
fit = self.mainform.dataClasses[y].exafsZLC
if self.mju_exafs == 0:
fit = self.mainform.dataClasses[y].mjuMinusVictoreen
# lin_comb_func(np.array([1,1]), np.array(basis), np.array(fit))
lsq_result = least_squares(lin_comb_func, np.array(variables), \
# method = 'dogbox',
ftol = 1e-12,
max_nfev = 1000,
bounds = varbounds,
# tr_solver = 'lsmr',
# jac = '3-point',
# loss='soft_l1',
# f_scale=0.1,
verbose = 2,
# x_scale = [1,1,0.001],
args=(basis, fit) )
print (lsq_result.x)
self.lstFitResult.item(y).setText(str(lsq_result.x))
func = lin_comb_func(lsq_result.x, np.array(basis), np.array(fit))
self.fit_basis[y] = basisi
self.fit_result[y] = lsq_result.x
if self.mju_exafs == 2:
k_energy = self.mainform.dataClasses[y].energy
if self.mju_exafs == 1:
k_energy = self.mainform.dataClasses[y].k
if self.mju_exafs == 0:
k_energy = self.mainform.dataClasses[y].energy
self.exafs_line.set_xdata(k_energy)
self.exafs_line.set_ydata(fit)
self.exafsdgcomp_line.set_xdata(k_energy)
self.exafsdgcomp_line.set_ydata(func+fit)
self.ax_exafs.relim()
self.ax_exafs.autoscale()
self.ax_fit.plot(np.zeros(len(lsq_result.x))+y, lsq_result.x, "o")
self.canv.draw()
def lstFitItemClicked(self):
current = self.lstFit.currentRow()
if self.fit_basis[current] != []:
for i in range(self.lstBasis.count()):
# self.lstBasis.setSelected(self.lstBasis.item(i), False)
self.lstBasis.item(i).setSelected(False)
for i in self.fit_basis[current]:
# self.lstBasis.setSelected(self.lstBasis.item(self.fit_basis[current][i]), True)
self.lstBasis.item(i).setSelected(True)
basis = []
basisi = []
for i in range(len(self.fit_basis[current])):
if self.mju_exafs == 2:
basis.append(self.mainform.dataClasses[self.fit_basis[current][i]].xesAreaNorm)
if self.mju_exafs == 1:
basis.append(self.mainform.dataClasses[self.fit_basis[current][i]].exafsZLC)
if self.mju_exafs == 0:
basis.append(self.mainform.dataClasses[self.fit_basis[current][i]].mjuMinusVictoreen)
basisi.append(current)
if self.mju_exafs == 2:
k_energy = self.mainform.dataClasses[current].energy
abs_exafs = self.mainform.dataClasses[current].xesAreaNorm
if self.mju_exafs == 1:
k_energy = self.mainform.dataClasses[current].k
abs_exafs = self.mainform.dataClasses[current].exafsZLC
if self.mju_exafs == 0:
k_energy = self.mainform.dataClasses[current].energy
abs_exafs = self.mainform.dataClasses[current].mjuMinusVictoreen
func = lin_comb_func(self.fit_result[current], np.array(basis), np.array(abs_exafs))
self.exafs_line.set_xdata(k_energy)
self.exafs_line.set_ydata(abs_exafs)
self.exafsdgcomp_line.set_xdata(k_energy)
self.exafsdgcomp_line.set_ydata(func+abs_exafs)
self.ax_exafs.relim()
self.ax_exafs.autoscale()
self.canv.draw()
else:
self.exafs_line.set_xdata([])
self.exafs_line.set_ydata([])
self.exafsdgcomp_line.set_xdata([])
self.exafsdgcomp_line.set_ydata([])
self.ax_exafs.relim()
self.ax_exafs.autoscale()
self.canv.draw()
| 12,547
| 34.148459
| 105
|
py
|
xaesa
|
xaesa-master/interpolation_k2.py
|
# -*- coding: utf-8 -*-
"""
Created on Fri Nov 4 07:20:37 2022
@author: A.Kuzmin
"""
import numpy as np
import matplotlib.pyplot as plt
from scipy import interpolate
from scipy.interpolate import make_lsq_spline
from scipy.interpolate import InterpolatedUnivariateSpline
#, BSpline
#from scipy.interpolate import make_interp_spline
##########################################################
#
# Zero line for atomic absorption by LSQ spline
#
##########################################################
#
# Absorption coefficient mu(E) from E0 to Emax
#
def LSQ_ZeroLine(x, y, k):
xk = np.zeros(shape=(x.size))
ysk = np.zeros(shape=(xk.size))
# B-spline degree. Default is cubic, k=3.
# k = 3
# Calculate number of intervals
nk = round(x[-1]/500.0)+1
if nk <= 3:
nk = 3
print(nk)
# Calculate k axis
xk = (2.0/7.62*x)**0.5
print(xk)
# Calculate knots
tk = np.empty(shape=(nk-1))
tk.fill(0)
for i in range(0, nk-1):
tk[i] = np.sqrt((2.0/7.62*(i+1)*x[-1]/(nk))) #**0.5
print(tk)
# p = np.linspace(1, nk, nk)
# tk = (2.0/7.62*p*x[-1]/(nk))**0.5
# print(tk)
tt = np.r_[(xk[0],)*(k+1), tk, (xk[-1],)*(k+1)]
# print(tt)
# Compute the (coefficients of) an LSQ B-spline.
splk3 = make_lsq_spline(xk, y*xk*xk*xk, tt, k)
# Compute zero line
ysk = splk3(xk)/xk/xk/xk
i = 0
while xk[i] < tk[1]:
i = i + 1
n = i
xk_ = np.empty(shape=(xk.size-n))
xk_.fill(0)
ysk_ = np.empty(shape=(xk.size-n))
ysk_.fill(0)
for j in range(n,xk.size):
ysk_[j-n] = ysk[j]
xk_[j-n] = xk[j]
return ysk_
def extend_zeroline(x, y, x_new):
# Spline order: 1 linear, 2 quadratic, 3 cubic ...
order = 3
# Do extrapolation from E0 to Emin
s = InterpolatedUnivariateSpline(x, y, k=order)
return s(x_new)
##########################################################
# if __name__ == '__main__':
# # Main code
# nf = 999
# x = np.empty(shape=(nf))
# x.fill(0)
# xk = np.empty(shape=(nf))
# xk.fill(0)
# y = np.empty(shape=(nf))
# y.fill(0)
# #ysk2 = np.empty(shape=(nf))
# #ysk2.fill(0)
# #yy = np.empty(shape=(nf))
# #yy.fill(0)
# #
# # Create "Experimental data"
# #
# for i in range (0,nf):
# xk[i] = 30.0*(i+1)/(nf+1) # k space
# x[i] = xk[i]*xk[i]*7.62/2.0 # E space
# y[i] = 6.0*np.sin(2.0*xk[i]*2.0)*np.exp(-2.0*0.01*0.01*xk[i]*xk[i])/(xk[i]*2.0*2.0)
# # y[i] = y[i] + 2*np.sin(0.15*xk[i])
# # y[i] = y[i] + 2*np.sin(0.1*xk[i])
# y[i] = y[i] + 2*np.sin(0.01*xk[i])
# #
# # Calculate zero line for absorption coefficient mu(E)=y(x) from E0 to Emax
# #
# yy = LSQ_ZeroLine(x, y, 3)
# plt.plot(x, y, 'r-', lw=1, ms=5)
# #plt.plot(x, ysk2,'b-', lw=3, label='LSQ spline k^2')
# plt.plot(x, yy,'k-', lw=3, label='LSQ spline k^2')
# plt.legend(loc='best')
# plt.show()
| 3,137
| 19.376623
| 94
|
py
|
xaesa
|
xaesa-master/xaesa_deglitch.py
|
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 20 11:07:03 2016
@author: sasha
"""
from .init import QTVer
if QTVer == 4:
from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
if QTVer == 5:
from PyQt5 import QtWidgets as QtGui
from PyQt5 import QtCore
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.widgets import SpanSelector
from scipy.interpolate import InterpolatedUnivariateSpline, UnivariateSpline
from . import xaesa_ft
from .xaesa_ft import FT, BFT, BFTWindow, GETPHASE
def Window_Gauss10(k, kmin, kmax):
window = np.zeros(len(k))
ka = (kmin+kmax)/2.0
kw = (kmax-kmin)*(kmax-kmin)/9.210340372
#for i in range(len(k)):
#window = np.append(window, np.exp(-(k[i]-ka)*(k[i]-ka)/kw))
knp = np.asarray(k, float)
wp = -(knp-ka)*(knp-ka)/kw
np.exp(wp, window)
return window
class DGWindow(QtGui.QDialog):
def __init__(self):
super(DGWindow, self).__init__()
self.exafs = []
self.k = []
self.exafsdg = [1,2,3]
self.initUI()
def initUI(self):
#3wid = QtGui.QWidget(self)
#self.setCentralWidget(wid)
self.lblx1 = QtGui.QLabel("X1")
self.lblx2 = QtGui.QLabel("X2")
self.lblx3 = QtGui.QLabel("x3")
self.lblx4 = QtGui.QLabel("X4")
self.edtx1 = QtGui.QLineEdit("")
self.edtx2 = QtGui.QLineEdit("")
self.edtx3 = QtGui.QLineEdit("")
self.edtx4 = QtGui.QLineEdit("")
lregions = QtGui.QGridLayout()
lregions.addWidget(self.lblx1, 0, 0)
lregions.addWidget(self.lblx2, 0, 1)
lregions.addWidget(self.lblx3, 0, 2)
lregions.addWidget(self.lblx4, 0, 3)
lregions.addWidget(self.edtx1, 1, 0)
lregions.addWidget(self.edtx2, 1, 1)
lregions.addWidget(self.edtx3, 1, 2)
lregions.addWidget(self.edtx4, 1, 3)
self.lblGlitchCriteria = QtGui.QLabel("Glitch criteria")
self.lblrmax = QtGui.QLabel("R max")
self.edtGlitchCriteria = QtGui.QLineEdit("0.05")
self.edtrmax = QtGui.QLineEdit("10")
self.lstGlitchList = QtGui.QListWidget()
self.lstGlitchList.itemClicked.connect(self.lstGlitchListItemClicked)
lregions.addWidget(self.lblGlitchCriteria, 2, 0)
lregions.addWidget(self.edtGlitchCriteria, 2, 1)
lregions.addWidget(self.lblrmax, 2, 2)
lregions.addWidget(self.edtrmax, 2, 3)
lregions.addWidget(self.lstGlitchList, 3, 0, 1, 4)
#Figures
self.fig = plt.figure(2, figsize=(12, 6))
self.ax_exafs = plt.subplot2grid((1,2), (0,1))
self.ax_exafsdg = plt.subplot2grid((1,2), (0,0))
self.ax_exafsdg.set_title('Left mouse button to select region before glitch\nRight mouse button to select region after glitch')
self.canv = FigureCanvas(self.fig)
self.tbar = NavigationToolbar(self.canv, self)
# set useblit True on gtkagg for enhanced performance
self.span = SpanSelector(self.ax_exafsdg, self.onselect, 'horizontal', useblit=True,
rectprops=dict(alpha=0.5, facecolor='red'), button = 1, span_stays=True)
self.span1= SpanSelector(self.ax_exafsdg, self.onselect1, 'horizontal', useblit=True,
rectprops=dict(alpha=0.5, facecolor='green'), button = 3, span_stays=True)
self.exafs_line, = self.ax_exafs.plot([], [])
# self.bftexafs_line, = self.ax_exafs.plot([], [])
self.difference_line, = self.ax_exafs.plot([], [], "o")
self.exafsdgcomp_line, = self.ax_exafs.plot([], [])
self.exafsdg_line, = self.ax_exafsdg.plot([], [])
self.difference_line.set_markersize(2)
self.exafsdgcomp_line.set_color('r')
self.glitch_lines = []
self.minmaxlines = []
self.fig.tight_layout()
self.btnGlitchFinder = QtGui.QPushButton('Glitch finder')
self.btnGlitchFinder.clicked.connect(self.GlitchFinder)
self.btnDG = QtGui.QPushButton('Deglitch')
self.btnDG.clicked.connect(self.DG)
self.btnApply = QtGui.QPushButton('Apply')
self.btnApply.clicked.connect(self.apply)
self.btnCancel = QtGui.QPushButton('Cancel')
self.btnCancel.clicked.connect(self.cancel)
lfig = QtGui.QVBoxLayout()
lfig.addWidget(self.tbar)
lfig.addWidget(self.canv)
lfig.addLayout(lregions)
lfig.addWidget(self.btnGlitchFinder)
lfig.addWidget(self.btnDG)
lfig.addWidget(self.btnApply)
lfig.addWidget(self.btnCancel)
self.setLayout(lfig)
#wid.setLayout(lfig)
def onselect(self, xmin, xmax):
self.edtx1.setText(str(xmin))
self.edtx2.setText(str(xmax))
def onselect1(self, xmin, xmax):
self.edtx3.setText(str(xmin))
self.edtx4.setText(str(xmax))
def plot(self):
# self.ax_exafs.clear()
# # set useblit True on gtkagg for enhanced performance
# self.span = SpanSelector(self.ax_exafs, self.onselect, 'horizontal', useblit=True,
# rectprops=dict(alpha=0.5, facecolor='red'), button = 1, span_stays=True)
#
# self.span1= SpanSelector(self.ax_exafs, self.onselect1, 'horizontal', useblit=True,
# rectprops=dict(alpha=0.5, facecolor='green'), button = 3, span_stays=True)
# self.ax_exafsdg.clear()
# self.ax_exafs.plot(self.k, self.exafs)
# self.ax_exafsdg.plot(self.k, self.exafsdg)
self.exafs_line.set_xdata(self.k)
self.exafs_line.set_ydata(self.exafs)
self.exafsdg_line.set_xdata(self.k)
self.exafsdg_line.set_ydata(self.exafsdg)
self.exafsdgcomp_line.set_xdata(self.k)
self.exafsdgcomp_line.set_ydata(self.exafsdg)
self.ax_exafs.relim()
self.ax_exafs.autoscale()
self.ax_exafsdg.relim()
self.ax_exafsdg.autoscale()
self.canv.draw()
def apply(self):
#do whatever you need with self.roiGroups
self.accept()
def cancel(self):
#do whatever you need with self.roiGroups
self.close()
def DG(self):
if self.edtx1.text() == "" or self.edtx2.text() == "" \
or self.edtx3.text() == "" or self.edtx4.text() == "" :
return
x1 = float(self.edtx1.text())
x2 = float(self.edtx2.text())
x3 = float(self.edtx3.text())
x4 = float(self.edtx4.text())
k_dg = np.array([])
exafs_dg = np.array([])
for i in range( len(self.k)):
if( (self.k[i] > x1 and self.k[i] < x2) or (self.k[i] > x3 and self.k[i] < x4) ) :
k_dg = np.append(k_dg, self.k[i])
exafs_dg = np.append(exafs_dg, self.exafs[i])
spl = UnivariateSpline(k_dg, exafs_dg)
for i in range( len(self.k)):
if (self.k[i] > x2 and self.k[i] < x3): #change glitch to spline values
self.exafsdg[i] = spl(self.k[i])
self.plot()
def GlitchFinder(self):
window = Window_Gauss10(self.k, self.k[0], self.k[len(self.k)-1])
wexafs = self.exafsdg * window
rmax = float(self.edtrmax.text())
r, fr, fi = FT(self.k, wexafs, 0, rmax, 0.02)
bftw = BFTWindow(r, 0, rmax, 0.1)
forbftim = fi * bftw
forbftre = fr * bftw
bftk, bftefr, bftefi = BFT(r, forbftre, forbftim, self.k[0], self.k[len(self.k)-1], 0.05)
wind = Window_Gauss10(bftk, self.k[0], self.k[len(self.k)-1])
bftamp = np.sqrt(bftefr*bftefr / (wind*wind) + bftefi*bftefi / (wind*wind))
bftpha = GETPHASE(bftefr, bftefi)
bftexafs = bftamp * np.sin(bftpha)
spl = InterpolatedUnivariateSpline(bftk, bftexafs)
bftexafs_k = spl(self.k)
difference = self.exafsdg - bftexafs_k
difference2 = difference * difference
difference = np.sqrt(difference2)
criteria = float(self.edtGlitchCriteria.text())
where_criteria = np.where(difference > criteria)
# k_criteria = self.k[where_criteria]
#k_criteria = np.delete(k_criteria, len(k_criteria)-1)
# self.ax_exafs.clear()
# self.span = SpanSelector(self.ax_exafs, self.onselect, 'horizontal', useblit=True,
# rectprops=dict(alpha=0.5, facecolor='red'), button = 1, span_stays=True)
#
# self.span1= SpanSelector(self.ax_exafs, self.onselect1, 'horizontal', useblit=True,
# rectprops=dict(alpha=0.5, facecolor='green'), button = 3, span_stays=True)
# plot1, = self.ax_exafs.plot(self.k, self.exafs)
glitch_pos = []
# for i in range(len(where_criteria[0])-2):
# if where_criteria[0][i+1] == where_criteria[0][i]+1:
# glitch_pos.append( (k_criteria[i]+k_criteria[i+1])/2)
# self.ax_exafs.axvline((k_criteria[i]+k_criteria[i+1])/2, color='r', linestyle='--', lw=1)
self.glitch_points = np.split(where_criteria[0], np.where(np.diff(where_criteria[0]) != 1)[0]+1)
# if glitch_points[len(glitch_points)-1] >= self.k(len(self.k)-1):
# glitch_points.delete(len(glitch_points)-1)
for i in range(len(self.glitch_lines)):
self.glitch_lines[i].remove()
self.glitch_lines = []
remove1st = False
removelast = False
for i in range(len(self.glitch_points)):
val = np.sum( self.k[self.glitch_points[i]]) / len(self.glitch_points[i])
if val+0.5 >= self.k[len(self.k)-1]:
removelast = True
continue
if val-0.5 <= self.k[0]:
remove1st = True
continue
glitch_pos.append( val )
line = self.ax_exafsdg.axvline(val, color='r', linestyle='--', lw=1)
self.glitch_lines.append(line)
if remove1st:
del self.glitch_points[0]
if removelast:
del self.glitch_points[len(self.glitch_points)-1]
self.lstGlitchList.clear()
self.lstGlitchList.addItems(list(map(str,glitch_pos)))
# deriv_exafs = np.gradient(self.exafsdg)
# self.bftexafs_line.set_xdata(self.k)
# self.bftexafs_line.set_ydata(bftexafs_k)
self.difference_line.set_xdata(self.k)
self.difference_line.set_ydata(difference)
self.ax_exafs.relim()
self.ax_exafs.autoscale()
self.ax_exafsdg.relim()
self.ax_exafsdg.autoscale()
self.canv.draw()
def lstGlitchListItemClicked(self):
current = self.lstGlitchList.currentRow()
xmax1 = self.k[self.glitch_points[current][0]]-0.05
xmin1 = xmax1 - 0.2
self.edtx1.setText(str(xmin1))
self.edtx2.setText(str(xmax1))
xmin2 = self.k[self.glitch_points[current][len(self.glitch_points[current])-1]]+0.05
xmax2 = xmin2 + 0.2
self.edtx3.setText(str(xmin2))
self.edtx4.setText(str(xmax2))
for i in range(len(self.minmaxlines)):
self.minmaxlines[i].remove()
self.minmaxlines = []
line = self.ax_exafsdg.axvline(xmin1, color='g', linestyle='--', lw=1)
self.minmaxlines.append(line)
line = self.ax_exafsdg.axvline(xmax1, color='g', linestyle='--', lw=1)
self.minmaxlines.append(line)
line = self.ax_exafsdg.axvline(xmin2, color='g', linestyle='--', lw=1)
self.minmaxlines.append(line)
line = self.ax_exafsdg.axvline(xmax2, color='g', linestyle='--', lw=1)
self.minmaxlines.append(line)
self.canv.draw()
| 12,510
| 34.242254
| 135
|
py
|
xaesa
|
xaesa-master/xaesa_exafs_class.py
|
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 13 11:55:12 2018
@author: akali
"""
import sys
import os
from numpy import arange, argmin, argmax, argsort, asarray, concatenate, copy, delete, \
gradient, log, logical_and, multiply, newaxis, pi, power, \
sin, cos, sqrt, sum, where, zeros, unique, ones, convolve, \
isnan, polyfit, polyval, r_
from scipy.optimize import curve_fit
from scipy.interpolate import Rbf, InterpolatedUnivariateSpline, UnivariateSpline
from scipy.signal import symiirorder1
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import PolynomialFeatures
from sklearn.linear_model import LinearRegression
from .xaesa_constants_formulas import victoreen, windowGauss10, \
me, hbar
from .xaesa_ft import FT, BFT, GETPHASE, BFTWindow
from interpolation_k2 import LSQ_ZeroLine, extend_zeroline
from scipy.interpolate import make_lsq_spline
#import xalglib
class xaesa_exafs_class():
def __init__(self, init_raw_data_type):
self.raw_data_type = init_raw_data_type #0 for transmission, 1 for fluorescence, 2 for Mju, 3 for EXAFS
self.name = "" #name
#raw data loaded from experimantal file
self.energy = [] #1D array
self.energyRebined = []
self.energyOriginal = []
self.i0 = [] #1D array
self.i1 = [] #1D array
self.i2 = [] #1D array
self.ifluo = [] #2D array
#Mju datasets
self.mju = []
self.mjuRebined = []
self.mjuOriginal = []
self.mjuDerivative= []
self.victoreen = []
self.mjuMinusVictoreen = []
self.mju0 = []
self.mjuRef = []
#EXAFS datasets
self.k = []
self.exafs = []
self.exafsZeroLine = []
self.exafsZLC = []
self.exafsZLCdeglitch = []
# FT datasets
self.window = []
self.exafsTimesWindow = []
self.exafsZLCTimesWindow = []
self.r = []
self.fr = []
self.fi = []
self.efr = []
self.efi = []
self.rZLC = []
self.frZLC = []
self.fiZLC = []
self.efrZLC = []
self.efiZLC = []
# BFT datasets
self.bftWindow = []
self.bftk = []
self.bftefr = []
self.bftefi = []
self.bftAmp = []
self.bftPha = []
self.bftEXAFS = []
self.bftefrWindow = []
self.bftefiWindow = []
#Rebin parameters
self.dE1 = 3
self.dE2 = 0.1
self.dE3 = 1
#extraction params
self.Es = 0
self.E0 = 0
self.E1 = 0
self.E2 = 0
self.E3 = 0
self.energyShift = 0
self.kPower = 2
self.zeroLineCorr = 0
self.mju0PolinomialDegree = 4
self.bckgrPolinomialDegree = -1
self.normalizationMode = 0 #0 for mju0 normalization, 1 for value normalization at given energy
self.normalizationEnergy = 0
self.reduceK = 0
self.c = 0
#FT params
self.kMin = 0.5
self.kMax = 18
self.dk = 0.05
self.rMin = 0
self.rMax = 6
self.dr = 0.02
#BFT params
self.rMinBft = 0
self.rMaxBft = 6
self.bftWindowParam = 0.1
# Deglitching params and result
self.deglitchIntervals = []
#fit params and results
self.isFitted = 0
self.fitKMin = 0.5
self.fitKMax = 15
self.fitdk = 0.05
self.fitNShels = 1
self.fitParams = []
self.fitAmps = []
self.fitPhas = []
self.fitK = []
self.fitExafs = []
#rdf params and results
self.isRdfed = 0
self.rdfKMin = 0.5
self.rdfKMax = 15
self.rdfdk = 0.05
self.rdfRMin = 0.5
self.rdfRMax = 2.8
self.rdfdr = 0.01
self.rdfMaxIterations = 20
self.rdfAmpK = []
self.rdfAmp = []
self.rdfPhaK = []
self.rdfPha = []
self.rdfAmpFile = ''
self.rdfPhaFile = ''
self.rdfK = []
self.rdfExafs = []
self.rdfR = []
self.rdf = []
def calculateMjuTransmission(self):
self.mju = log(self.i0 / self.i1)
try:
self.mjuRef = log(self.i1 / self.i2)
except:
pass
def calculateMjuFluorescence(self):
self.mju = self.ifluo.sum(axis=0) / self.i0
print(self.mju)
def estimateEnergyValues(self):
# try:
# spl = Rbf( self.energy, self.mju,
# function = 'multiquadric',
# epsilon = 3, #epsilon 3 woks fine
# smooth = 5 )
# except:
# print("spline error")
# self.mju = spl(self.energy)
#remove 10% of the range if other edges appears at the end of the spectrum
lastPoint = int(len(self.mju) - len(self.mju)*0.1)
self.mjuDerivative = gradient(self.mju)
maxderiv = argmax(self.mjuDerivative[0:lastPoint])
energyMaxDerivValue = self.energy[0:lastPoint][maxderiv]
print("max deriv at ", energyMaxDerivValue)
self.E0 = self.energy[maxderiv] + 0.001
self.E1 = self.energy[maxderiv] - (energyMaxDerivValue - self.energy[0])/5
self.E2 = self.energy[maxderiv] + (self.energy[-1] - energyMaxDerivValue )/5
self.E3 = self.energy[-1]
self.Es = self.energy[0]
self.kMax = sqrt( (2*me/hbar**2) * (self.E3-self.E0) * 1.602*10**-19 ) *10**-10 - 0.5
def removeBackground(self):
if self.Es == 0:
energyStart = self.energy[0]
else:
energyStart = self.Es
whereE1 = where( logical_and(self.energy > energyStart, self.energy < self.E1) )
Xb = self.energy[whereE1]
yb = self.mju[whereE1]
popt, pcov = curve_fit(victoreen, Xb, yb)
self.victoreen = victoreen(self.energy, popt[0], popt[1])
self.mjuMinusVictoreen = self.mju - self.victoreen
def removeBackgroundPoly(self):
if self.Es == 0:
energyStart = self.energy[0]
else:
energyStart = self.Es
whereE1 = where( logical_and(self.energy > energyStart, self.energy < self.E1) )
Xb = self.energy[whereE1]
yb = self.mju[whereE1]
p = polyfit(Xb, yb, self.bckgrPolinomialDegree)
self.victoreen = polyval(p,self.energy)
self.mjuMinusVictoreen = self.mju - self.victoreen
def findMju0(self):
whereE2E3 = where( logical_and(self.energy > self.E2, self.energy < self.E3) )
if self.mju0PolinomialDegree >= 0:
energyToFit = self.energy[whereE2E3]
mjuToFit = self.mjuMinusVictoreen[whereE2E3]
polynomial_features = PolynomialFeatures(self.mju0PolinomialDegree,
include_bias=True)
linear_regression = LinearRegression()
pipeline = Pipeline([("polynomial_features", polynomial_features),
("linear_regression", linear_regression)])
pipeline.fit(energyToFit[:, newaxis], mjuToFit)
self.mju0 = pipeline.predict(self.energy[:, newaxis])
else:
whereE0E3 = where( logical_and(self.energy > self.E0, self.energy < self.E3) )
energyToFit = self.energy[whereE2E3]
mjuToFit = self.mjuMinusVictoreen[whereE2E3]
l = len(energyToFit)
mid = int(l/2)
left = int(l/4)
right = int(l/4 *3)
t = [energyToFit[left], energyToFit[mid], energyToFit[right]]
k = abs(self.mju0PolinomialDegree)
t = r_[(energyToFit[0],)*(k+1),
t,
(energyToFit[-1],)*(k+1)]
w = power((energyToFit - energyToFit[0]) + 1, 3/2)
spl = make_lsq_spline(energyToFit, mjuToFit, t, k, w=w)
self.mju0 = spl(self.energy[whereE0E3])
def calculateEXAFS(self):
whereE0E3 = where( logical_and(self.energy > self.E0, self.energy < self.E3) )
energyE0E3 = self.energy[whereE0E3]
mjuE0E3 = self.mjuMinusVictoreen[whereE0E3]
if self.mju0PolinomialDegree >= 0: mju0E0E3 = self.mju0[whereE0E3]
if self.mju0PolinomialDegree < 0: mju0E0E3 = self.mju0
if self.normalizationMode==0: #mju0 normalization
# mju0E0E3 = mju0[whereE0E3]
# mju0E0E3_1 = self.mju0[whereE0E3]
mju0E0E3_1 = mju0E0E3
if self.normalizationMode==1:
idx = argmin(abs(self.energy - self.normalizationEnergy))
mju0E0E3_1 = zeros(len(energyE0E3)) + self.mju0[idx]
self.k = sqrt( (2*me/hbar**2) * (energyE0E3-self.E0) * 1.602*10**-19 ) *10**-10
self.exafs = (mjuE0E3 - mju0E0E3)/mju0E0E3_1 * power(self.k, self.kPower)
### test auto reduce points
if self.reduceK :
sys.path.append(os.path.join('.', 'lib'))
import xaslib as xl
self.k, self.exafs = xl.kPointsReduction(self.k, self.exafs)
def calculateEXAFSZLC(self):
if self.zeroLineCorr == 0:
self.exafsZeroLine = zeros( len(self.k))
if self.zeroLineCorr > 0:
### test code
# sys.path.append(os.path.join('.', 'lib'))
# import xaslib as xl
# nk, ne = xl.kPointsReduction(self.k, self.exafs)
# spl = Rbf( nk, ne,
# function = 'multiquadric',
# epsilon = 3, #epsilon 3 woks fine
# smooth = self.zeroLineCorr )
### end test code
spl = Rbf( self.k, self.exafs,
function = 'multiquadric',
epsilon = 3, #epsilon 3 woks fine
smooth = self.zeroLineCorr )
self.exafsZeroLine = spl(self.k)
self.exafsZLC = self.exafs - self.exafsZeroLine
def ftEXAFS(self):
self.window = windowGauss10(self.k, self.kMin, self.kMax)
self.exafsTimesWindow = self.exafs * self.window
self.r, self.fr, self.fi = FT(self.k, self.exafsTimesWindow, self.rMin, self.rMax, self.dr)
self.efr = zeros(len( self.r))
sqrt(self.fr*self.fr + self.fi*self.fi, self.efr)
self.efi = self.fi * (-1)
def ftEXAFSZLC(self):
self.window = windowGauss10(self.k, self.kMin, self.kMax)
self.exafsZLCTimesWindow = self.exafsZLC * self.window
self.rZLC, self.frZLC, self.fiZLC = FT(self.k, self.exafsZLCTimesWindow, self.rMin, self.rMax, self.dr)
self.efrZLC = zeros(len( self.r))
sqrt(self.frZLC*self.frZLC + self.fiZLC*self.fiZLC, self.efrZLC)
self.efiZLC = self.fiZLC * (-1)
def bftEXAFSZLC(self):
self.bftWindow = BFTWindow(self.rZLC, self.rMinBft, self.rMaxBft, self.bftWindowParam)
forbftim = self.fiZLC * self.bftWindow
forbftre = self.frZLC * self.bftWindow
self.bftefrWindow = self.efrZLC * self.bftWindow
self.bftefiWindow = self.efiZLC * self.bftWindow
self.bftk, self.bftefr, self.bftefi = BFT(self.rZLC, forbftre, forbftim, self.kMin, self.kMax, self.dk)
wind = windowGauss10(self.bftk, self.kMin, self.kMax)
self.bftAmp = sqrt( self.bftefr*self.bftefr / (wind**self.kPower) +
self.bftefi*self.bftefi / (wind**self.kPower) )
self.bftPha = GETPHASE(self.bftefr, self.bftefi)
self.bftEXAFS = self.bftAmp * sin(self.bftPha)
def changeToRebinedMjuAveraging(self, rebinType = 'spline', dE1 = 1, dE2 = 0.1, dK = 0.01, s = 0):
# rebinType possible values:
# 'spline'
# 'rbf-smooth'
self.energyOriginal = copy(self.energy)
self.mjuOriginal = copy(self.mju)
# sort array in there are decreasing points
sortIndexes = self.energy.argsort()
sortedEnergy = self.energy[sortIndexes]
sortedMju = self.mju[sortIndexes]
dE = dE1
newE = []
newMju = []
#take data before E1
E1Region = where( logical_and(sortedEnergy > self.Es ,sortedEnergy < self.E1) )
E1Energy = sortedEnergy[E1Region]
E1Mju = sortedMju[E1Region]
newE.append(E1Energy[0])
newMju.append(E1Mju[0])
eCenter = E1Energy[0] + dE / 2
while eCenter + dE/2 < self.E1:
reg = where( logical_and(sortedEnergy > eCenter-dE/2, sortedEnergy < eCenter+dE/2) )
valE = sortedEnergy[reg].sum() / len(sortedEnergy[reg])
val = sortedMju[reg].sum() / len(sortedMju[reg])
newE.append(valE)
newMju.append(val)
eCenter = eCenter + dE
dE = dE2
#take data before E0+50
E0Region = where( logical_and(sortedEnergy > self.E1, sortedEnergy < self.E0+50) )
E0Energy = sortedEnergy[E0Region]
E0Mju = sortedMju[E0Region]
newE.append(E0Energy[0])
newMju.append(E0Mju[0])
eCenter = E0Energy[0] + dE / 2
while eCenter + dE/2 < self.E0+50:
reg = where( logical_and(sortedEnergy > eCenter-dE/2, sortedEnergy < eCenter+dE/2) )
# print("reg", len(reg), reg)
# if reg==[]:
# eCenter = eCenter + dE
if len(reg[0])==1:
valE = sortedEnergy[reg][0]
val = sortedMju[reg][0]
newE.append(valE)
newMju.append(val)
if len(reg[0])>1:
valE = sortedEnergy[reg].sum() / len(sortedEnergy[reg])
val = sortedMju[reg].sum() / len(sortedMju[reg])
newE.append(valE)
newMju.append(val)
eCenter = eCenter + dE
dk = dK
#take data after E0
E3Region = where( logical_and(sortedEnergy > self.E0+50, sortedEnergy < self.E3) )
E3Energy = sortedEnergy[E3Region]
E3Mju = sortedMju[E3Region]
newE.append(E3Energy[0])
newMju.append(E3Mju[0])
# kExafsMin = sqrt( (2*me/hbar**2) * (self.E0+50-self.E0) * 1.602*10**-19 ) *10**-10
# kExafsMax = sqrt( (2*me/hbar**2) * (self.E3-self.E0) * 1.602*10**-19 ) *10**-10
kScale = sqrt( (2*me/hbar**2) * (E3Energy-self.E0) * 1.602*10**-19 ) *10**-10
# eScale = kScale**2 * 10**20 / (1.602*10**-19 * (2*me/hbar**2)) + self.E0
kCenter = kScale[0] + dk / 2
while kCenter + dk/2 < kScale[-1]:
reg = where( logical_and(kScale > kCenter-dk/2, kScale < kCenter+dk/2) )
# print("reg", len(reg), reg)
# if reg==[]:
# eCenter = eCenter + dE
if len(reg[0])==1:
valE = E3Energy[reg][0]
val = E3Mju[reg][0]
newE.append(valE)
newMju.append(val)
if len(reg[0])>1:
valE = E3Energy[reg].sum() / len(E3Energy[reg])
val = E3Mju[reg].sum() / len(E3Mju[reg])
newE.append(valE)
newMju.append(val)
kCenter = kCenter + dk
newE = asarray(newE)
newMju = asarray(newMju)
kExafsMin = sqrt( (2*me/hbar**2) * (self.E0+50-self.E0) * 1.602*10**-19 ) *10**-10
kExafsMax = sqrt( (2*me/hbar**2) * (self.E3-self.E0) * 1.602*10**-19 ) *10**-10
kScale = arange(kExafsMin, kExafsMax, dk, dtype='float64')
eScale = kScale**2 * 10**20 / (1.602*10**-19 * (2*me/hbar**2)) + self.E0
a1 = arange(self.Es, self.E1, dE1, dtype='float64')
a2 = arange(self.E1, self.E0+50, dE2, dtype='float64')
self.energyRebined = concatenate((a1, a2, eScale.astype('float64')))
if rebinType == 'spline':
uniqueEnergy, uniqueIndexes = unique(newE, return_index=True)
newE = newE[uniqueIndexes]
newMju = newMju[uniqueIndexes]
newE = newE[~isnan(newE)]
newMju = newMju[~isnan(newMju)]
spl = InterpolatedUnivariateSpline(newE, newMju, k=1)
if rebinType == 'rbf-smooth':
spl = Rbf( newE, newMju,
function = 'multiquadric',
epsilon = 3, #epsilon 3 woks fine
smooth = s )
self.mjuRebined = spl(self.energyRebined)
self.mjuRebined = self.mjuRebined[1:-2]
self.energyRebined = self.energyRebined[1:-2]
self.energy = copy(self.energyRebined)
self.mju = copy(self.mjuRebined)
self.mjuDerivative = gradient(self.mju)
self.redoExtraction()
def changeToRebinedMjuAveraging1(self):
self.energyOriginal = copy(self.energy)
self.mjuOriginal = copy(self.mju)
# sort array in there are decreasing points
sortIndexes = self.energy.argsort()
sortedEnergy = self.energy[sortIndexes]
sortedMju = self.mju[sortIndexes]
dE = 5
newE = []
newMju = []
#take data before E1
E1Region = where( sortedEnergy < self.E1 )
E1Energy = sortedEnergy[E1Region]
E1Mju = sortedMju[E1Region]
newE.append(E1Energy[0])
newMju.append(E1Mju[0])
eCenter = E1Energy[0] + dE / 2
while eCenter + dE/2 < self.E1:
reg = where( logical_and(sortedEnergy > eCenter-dE/2, sortedEnergy < eCenter+dE/2) )
valE = sortedEnergy[reg].sum() / len(sortedEnergy[reg])
val = sortedMju[reg].sum() / len(sortedMju[reg])
newE.append(valE)
newMju.append(val)
eCenter = eCenter + dE
dE = 0.1
#take data before E0+50
E0Region = where( logical_and(sortedEnergy > self.E1, sortedEnergy < self.E0+50) )
E0Energy = sortedEnergy[E0Region]
E0Mju = sortedMju[E0Region]
newE.append(E0Energy[0])
newMju.append(E0Mju[0])
eCenter = E0Energy[0] + dE / 2
while eCenter + dE/2 < self.E0+50:
reg = where( logical_and(sortedEnergy > eCenter-dE/2, sortedEnergy < eCenter+dE/2) )
# print("reg", len(reg), reg)
# if reg==[]:
# eCenter = eCenter + dE
if len(reg[0])==1:
valE = sortedEnergy[reg][0]
val = sortedMju[reg][0]
newE.append(valE)
newMju.append(val)
if len(reg[0])>1:
valE = sortedEnergy[reg].sum() / len(sortedEnergy[reg])
val = sortedMju[reg].sum() / len(sortedMju[reg])
newE.append(valE)
newMju.append(val)
eCenter = eCenter + dE
dk = 0.01
#take data after E0
E3Region = where( logical_and(sortedEnergy > self.E0+50, sortedEnergy < self.E3) )
E3Energy = sortedEnergy[E3Region]
E3Mju = sortedMju[E3Region]
newE.append(E3Energy[0])
newMju.append(E3Mju[0])
# kExafsMin = sqrt( (2*me/hbar**2) * (self.E0-self.E0) * 1.602*10**-19 ) *10**-10
# kExafsMax = sqrt( (2*me/hbar**2) * (self.E3-self.E0) * 1.602*10**-19 ) *10**-10
kScale = sqrt( (2*me/hbar**2) * (E3Energy-self.E0) * 1.602*10**-19 ) *10**-10
# eScale = kScale**2 * 10**20 / (1.602*10**-19 * (2*me/hbar**2)) + self.E0
kCenter = kScale[0] + dk / 2
while kCenter + dk/2 < kScale[-1]:
reg = where( logical_and(kScale > kCenter-dE/2, kScale < kCenter+dE/2) )
# print("reg", len(reg), reg)
# if reg==[]:
# eCenter = eCenter + dE
if len(reg[0])==1:
valE = E3Energy[reg][0]
val = E3Mju[reg][0]
newE.append(valE)
newMju.append(val)
if len(reg[0])>1:
valE = E3Energy[reg].sum() / len(E3Energy[reg])
val = E3Mju[reg].sum() / len(E3Mju[reg])
newE.append(valE)
newMju.append(val)
kCenter = kCenter + dk
self.energy = copy(asarray(newE))
self.mju = copy(asarray(newMju))
self.energyRebined = copy(asarray(newE))
self.mjuRebined = copy(asarray(newMju))
self.mjuDerivative = gradient(self.mju)
self.redoExtraction()
def changeToOriginalMju(self):
self.energy = copy(self.energyOriginal)
self.mju = copy(self.mjuOriginal)
self.mjuDerivative = gradient(self.mju)
self.energyRebined = []
self.mjuRebined = []
self.redoExtraction()
def processExpData(self):
if self.raw_data_type == 0: #0 for transmission,
self.calculateMjuTransmission()
self.estimateEnergyValues()
self.removeBackground()
self.findMju0()
self.calculateEXAFS()
self.calculateEXAFSZLC()
self.ftEXAFS()
self.ftEXAFSZLC()
self.bftEXAFSZLC()
if self.raw_data_type == 1: # 1 for fluorescence
self.calculateMjuFluorescence()
self.estimateEnergyValues()
self.removeBackground()
self.findMju0()
self.calculateEXAFS()
self.calculateEXAFSZLC()
self.ftEXAFS()
self.ftEXAFSZLC()
self.bftEXAFSZLC()
if self.raw_data_type == 2: # 2 for Mju
print("processing", self.raw_data_type)
self.estimateEnergyValues()
self.removeBackground()
self.findMju0()
self.calculateEXAFS()
self.calculateEXAFSZLC()
self.ftEXAFS()
self.ftEXAFSZLC()
self.bftEXAFSZLC()
if self.raw_data_type == 3: # 3 for EXAFS
self.calculateEXAFSZLC()
self.ftEXAFS()
self.ftEXAFSZLC()
self.bftEXAFSZLC()
def changeKPower(self, newKPower):
actual_k_pow = self.kPower
new_k_pow = newKPower
self.exafs = self.exafs / self.k ** (actual_k_pow)
self.exafs = self.exafs * self.k ** (new_k_pow)
self.calculateEXAFSZLC()
self.ftEXAFS()
self.ftEXAFSZLC()
self.bftEXAFSZLC()
self.kPower = newKPower
def redoExtraction(self):
if self.raw_data_type in [0,1,2]: # 2 for Mju
if self.bckgrPolinomialDegree == -1: #use vectoreen
self.removeBackground()
if self.bckgrPolinomialDegree >=0 and self.bckgrPolinomialDegree <9:
self.removeBackgroundPoly()
self.findMju0()
self.calculateEXAFS()
self.calculateEXAFSZLC()
self.ftEXAFS()
self.ftEXAFSZLC()
self.bftEXAFSZLC()
if self.raw_data_type == 3: # 3 for EXAFS
self.calculateEXAFSZLC()
self.ftEXAFS()
self.ftEXAFSZLC()
self.bftEXAFSZLC()
def redoFtBft(self):
self.ftEXAFS()
self.ftEXAFSZLC()
self.bftEXAFSZLC()
def redoBft(self):
self.bftEXAFSZLC()
| 24,396
| 32.93185
| 113
|
py
|
xaesa
|
xaesa-master/compare.py
|
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 20 11:07:03 2016
@author: sasha
"""
from .init import QTVer
if QTVer == 4:
from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
if QTVer == 5:
from PyQt5 import QtWidgets as QtGui
from PyQt5 import QtCore
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
import matplotlib.pyplot as plt
class CompareWindow(QtGui.QDialog):
def __init__(self):
super(CompareWindow, self).__init__()
self.exafs = []
self.k = []
self.r = []
self.fr = []
self.fi = []
self.bftk = []
self.bftexafs = []
self.labels = []
self.energy = []
self.mju = []
self.xes = []
self.E0 = 0
self.lines = []
self.lines1 = []
#mode
#0 - exafs
#1 - ft
#2 - bft
#3 - mju
#10 - Xes original
#11 - XES area Normalized
#12 - XES Max Normalized
self.mode = 0
self.initUI()
def initUI(self):
#Figures
self.fig = plt.figure(1, figsize=(15, 6))
# self.ax_exafs = self.fig.add_subplot(111)
self.canv = FigureCanvas(self.fig)
self.tbar = NavigationToolbar(self.canv, self)
fnt = self.tbar.font()
fnt.setPointSize(20)
self.tbar.setFont(fnt)
# plt.tight_layout()
self.btnCancel = QtGui.QPushButton('Exit')
self.btnCancel.clicked.connect(self.cancel)
lfig = QtGui.QVBoxLayout()
lfig.addWidget(self.tbar)
lfig.addWidget(self.canv)
lfig.addWidget(self.btnCancel)
self.setLayout(lfig)
self.canv.draw()
#wid.setLayout(lfig)
def plot(self):
# self.ax_exafs.clear()
plt.clf()
self.ax_exafs = self.fig.add_subplot(111)
if self.mode == 0: #compare exafs
for i in range(len(self.k)):
l, = self.ax_exafs.plot(self.k[i], self.exafs[i], label = self.labels[i], linewidth=1)
self.ax_exafs.set_xlabel('Wavevector k, $\AA^{-1}$')
self.ax_exafs.set_ylabel('EXAFS, $\AA^{-2}$')
self.lines.append(l)
if self.mode == 1: #compare ft
for i in range(len(self.r)):
line1, = self.ax_exafs.plot(self.r[i], self.fr[i], label = self.labels[i], linewidth=1)
line2, = self.ax_exafs.plot(self.r[i], self.fi[i], linewidth=1)
line2.set_color(line1.get_color())
line2.set_linestyle('dotted')
self.ax_exafs.set_xlabel('Distance R, $\AA$')
self.ax_exafs.set_ylabel('Fourier transform, $\AA^{-3}$')
self.lines.append(line1)
self.lines1.append(line2)
if self.mode == 2: #compare bft
for i in range(len(self.bftk)):
l, = self.ax_exafs.plot(self.bftk[i], self.bftexafs[i], label = self.labels[i], linewidth=1)
self.ax_exafs.set_xlabel('Wavevector k, $\AA^{-1}$')
self.ax_exafs.set_ylabel('EXAFS, $\AA^{-2}$')
self.lines.append(l)
if self.mode == 3: #compare mju
for i in range(len(self.energy)):
l, = self.ax_exafs.plot(self.energy[i], self.mju[i], label = self.labels[i], linewidth=1)
self.ax_exafs.set_xlabel('Energy, eV')
self.ax_exafs.set_ylabel('Absorption, a.u.')
self.lines.append(l)
if self.mode == 4: #compare xanes
for i in range(len(self.energy)):
l, = self.ax_exafs.plot(self.energy[i], self.mju[i], label = self.labels[i], linewidth=1)
self.ax_exafs.set_xlabel('Energy, eV')
self.ax_exafs.set_ylabel('Absorption, a.u.')
self.ax_exafs.axhline(y=1, linewidth=0.5, color = 'k', linestyle='--',)
self.ax_exafs.set_xlim([self.E0-75,self.E0+200])
self.lines.append(l)
if self.mode == 10: # XES original
for i in range(len(self.energy)):
l, = self.ax_exafs.plot(self.energy[i], self.xes[i], label = self.labels[i], linewidth=1)
self.ax_exafs.set_xlabel('Energy, eV')
self.ax_exafs.set_ylabel('Intensity, a.u.')
self.lines.append(l)
if self.mode == 11: # XES area normalized
for i in range(len(self.energy)):
l, = self.ax_exafs.plot(self.energy[i], self.xes[i], label = self.labels[i], linewidth=1)
self.ax_exafs.set_xlabel('Energy, eV')
self.ax_exafs.set_ylabel('Area normalized intensity')
self.lines.append(l)
self.fig.canvas.mpl_connect('pick_event', self.onpick)
self.fig.tight_layout()
box = self.ax_exafs.get_position()
self.ax_exafs.set_position([box.x0, box.y0, box.width * 0.7, box.height])
leg = self.ax_exafs.legend(loc='center left', bbox_to_anchor=(1, 0.5))
# we will set up a dict mapping legend line to orig line, and enable
# picking on the legend line
self.lined = dict()
for legline, origline in zip(leg.get_lines(), self.lines):
legline.set_picker(5) # 5 pts tolerance
self.lined[legline] = origline
if self.mode == 1:
self.lined1 = dict()
for legline, origline in zip(leg.get_lines(), self.lines1):
# legline.set_picker(5) # 5 pts tolerance
self.lined1[legline] = origline
self.canv.draw()
def cancel(self):
#do whatever you need with self.roiGroups
plt.close(1)
self.close()
def onpick(self, event):
# on the pick event, find the orig line corresponding to the
# legend proxy line, and toggle the visibility
legline = event.artist
origline = self.lined[legline]
vis = not origline.get_visible()
origline.set_visible(vis)
if self.mode == 1:
origline = self.lined1[legline]
origline.set_visible(vis)
# Change the alpha on the line in the legend so we can see what lines
# have been toggled
if vis:
legline.set_alpha(1.0)
else:
legline.set_alpha(0.2)
self.fig.canvas.draw()
| 7,064
| 32.966346
| 108
|
py
|
xaesa
|
xaesa-master/xaesa_pca.py
|
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 20 11:07:03 2016
@author: sasha
"""
import os
from .init import QTVer
if QTVer == 4:
from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
if QTVer == 5:
from PyQt5 import QtWidgets as QtGui
from PyQt5 import QtCore
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
import matplotlib.pyplot as plt
import numpy as np
from scipy import linalg as LA
from matplotlib.widgets import SpanSelector
from scipy.interpolate import InterpolatedUnivariateSpline, UnivariateSpline
#from . import ft
#from . import xaslib
#from tkinter import messagebox
from scipy.optimize import least_squares
from sklearn.decomposition import PCA
#from tkinter.filedialog import asksaveasfilename
#from tkinter import Tk
def lin_comb_func(x, basis, fit):
# print(basis * x[:,None])
# print(np.sum(basis * x[:,None], axis=0))
return np.sum(basis * x[:,None], axis=0) - fit
class PCAWindow(QtGui.QDialog):
def __init__(self):
super(PCAWindow, self).__init__()
self.mainform = None
self.mju_exafs = 1 # 0 - mju, 1 - exafs, 2 - xes
# self.initUI()
def initUI(self):
self.fit_result = []
self.fit_basis = []
lblBasis = QtGui.QLabel("Select basis:")
lblFit = QtGui.QLabel("Select spectra to fit (multiple selection possible):")
lblResult = QtGui.QLabel("Fit coeficients:")
lblNComponents = QtGui.QLabel("Max number of PCA components:")
self.edtNComponents = QtGui.QLineEdit("3")
self.lstBasis = QtGui.QListWidget()
self.lstFit = QtGui.QListWidget()
self.lstBasis.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.lstFit.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
self.lstFit.itemClicked.connect(self.lstFitItemClicked)
self.lstFitResult = QtGui.QListWidget()
anfn = []
fit_res = []
for i in range(0, self.mainform.lstSpectra.count()):
anfn.append(str(self.mainform.lstSpectra.item(i).text()))
fit_res.append("")
self.fit_result.append([])
self.fit_basis.append([])
self.lstBasis.addItems(anfn)
self.lstFit.addItems(anfn)
self.lstFitResult.addItems(fit_res)
lout = QtGui.QGridLayout()
lout.addWidget(lblBasis, 0,0)
lout.addWidget(lblFit,0,1 )
lout.addWidget(lblResult,0,2)
lout.addWidget(self.lstBasis, 1, 0)
lout.addWidget(self.lstFit, 1, 1)
lout.addWidget(self.lstFitResult,1,2)
lout.addWidget(lblNComponents, 2, 0)
lout.addWidget(self.edtNComponents, 2, 1)
#Figures
self.fig = plt.figure(6, figsize=(12, 6))
self.ax_exafs = plt.subplot2grid((1,2), (0,1))
self.ax_fit = plt.subplot2grid((1,2), (0,0))
self.canv = FigureCanvas(self.fig)
self.tbar = NavigationToolbar(self.canv, self)
self.exafs_line, = self.ax_exafs.plot([], [])
# self.bftexafs_line, = self.ax_exafs.plot([], [])
self.difference_line, = self.ax_exafs.plot([], [], "o")
self.exafsdgcomp_line, = self.ax_exafs.plot([], [])
# self.fit_line, = self.ax_fit.plot([], [], "o")
# self.fit_line.set_markersize(2)
self.exafsdgcomp_line.set_color('r')
self.glitch_lines = []
self.minmaxlines = []
self.fig.tight_layout()
self.btnFit = QtGui.QPushButton('Find PCA components')
self.btnFit.clicked.connect(self.findPcaComponents)
lout.addWidget(self.btnFit, 2, 2)
self.btnPCATransform = QtGui.QPushButton('PCA Transform')
self.btnPCATransform.clicked.connect(self.PCATransform)
self.btnApply = QtGui.QPushButton('Save fit results...')
self.btnApply.clicked.connect(self.save_fit)
self.btnCancel = QtGui.QPushButton('Exit')
self.btnCancel.clicked.connect(self.cancel)
lfig = QtGui.QVBoxLayout()
lfig.addWidget(self.tbar)
lfig.addWidget(self.canv)
lfig.addLayout(lout)
lfig.addWidget(self.btnPCATransform)
lfig.addWidget(self.btnApply)
lfig.addWidget(self.btnCancel)
self.setLayout(lfig)
#wid.setLayout(lfig)
def onselect(self, xmin, xmax):
self.edtx1.setText(str(xmin))
self.edtx2.setText(str(xmax))
def onselect1(self, xmin, xmax):
self.edtx3.setText(str(xmin))
self.edtx4.setText(str(xmax))
def plot(self):
# self.ax_exafs.clear()
# # set useblit True on gtkagg for enhanced performance
# self.span = SpanSelector(self.ax_exafs, self.onselect, 'horizontal', useblit=True,
# rectprops=dict(alpha=0.5, facecolor='red'), button = 1, span_stays=True)
#
# self.span1= SpanSelector(self.ax_exafs, self.onselect1, 'horizontal', useblit=True,
# rectprops=dict(alpha=0.5, facecolor='green'), button = 3, span_stays=True)
# self.ax_exafsdg.clear()
# self.ax_exafs.plot(self.k, self.exafs)
# self.ax_exafsdg.plot(self.k, self.exafsdg)
# self.exafs_line.set_xdata(self.k)
# self.exafs_line.set_ydata(self.exafs)
# self.exafsdg_line.set_xdata(self.k)
# self.exafsdg_line.set_ydata(self.exafsdg)
# self.exafsdgcomp_line.set_xdata(self.k)
# self.exafsdgcomp_line.set_ydata(self.exafsdg)
# self.ax_exafs.relim()
# self.ax_exafs.autoscale()
# self.ax_exafsdg.relim()
# self.ax_exafsdg.autoscale()
self.canv.draw()
def save_fit(self):
header = "#"
sa = [[],[]]
fmt="%10s"
for i in range(self.lstFit.count()):
if self.fit_basis[i] != []:
sa[0].append([self.lstFit.item(i).text()])
sa[1].append(self.fit_result[i])
# for i in range(len(self.fit_basis[i])):
# fmt = fmt + " %10.3f"
# Tk().withdraw()
# fn = asksaveasfilename()
# if fn == "":
# return
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.AnyFile)
dlg.setAcceptMode(1) # save dialog
dlg.setNameFilters(["All files (*.*)"])
dlg.setDirectory(os.getcwd())
if dlg.exec_():
flist = dlg.selectedFiles()
fn = flist[0]
else:
return
print(sa)
print(fmt)
print(np.hstack((sa[0], sa[1])))
sa[0] = np.array(sa[0])
sa[1] = np.array(sa[1])
# sa[1] = reshape(1, len(sa[0])*len(self.fit_basis[0]))
np.savetxt(fn, np.hstack((sa[0], sa[1])), fmt='%s')
def cancel(self):
self.close()
def findPcaComponents(self):
sel_basis = self.lstBasis.selectedItems()
sel_fit = self.lstFit.selectedItems()
sel_basisi = self.lstBasis.selectedIndexes()
sel_fiti = self.lstFit.selectedIndexes()
if len(sel_basis) < 1:
# messagebox.showinfo("Select basis spectra", "Please select at least 1 spectra for basis")
return
# if len(sel_fit) < 1:
## messagebox.showinfo("Select fit spectra", "Please select at least 1 spectrum to fit")
# return
basis = []
basisi = []
variables = []
varbounds = [[],[]]
for i in range(len(sel_basis)):
y= sel_basisi[i].row()
if self.mju_exafs == 3:
basis.append(self.mainform.dataClasses[y].xesAreaNorm)
if self.mju_exafs == 2:
idx = np.argmin(abs(self.mainform.dataClasses[y].energy - \
self.mainform.dataClasses[y].normalizationEnergy))
basis.append(self.mainform.dataClasses[y].mjuMinusVictoreen / self.mainform.dataClasses[y].mju0[idx])
if self.mju_exafs == 1:
basis.append(self.mainform.dataClasses[y].exafsZLC)
if self.mju_exafs == 0:
basis.append(self.mainform.dataClasses[y].mjuMinusVictoreen)
basisi.append(y)
variables.append(1)
varbounds[0].append(0)
varbounds[1].append(1E6)
# basis = np.transpose(basis)
ncomp = int(self.edtNComponents.text())
self.pca = PCA(n_components=ncomp)
self.pca.fit(basis)
pca_score = self.pca.explained_variance_ratio_
V = self.pca.components_
# print(V)
print("Component score", pca_score)
# tr = self.pca.transform([V[1]*pca_score[1]])
# print("transform", tr)
# ft = pca.transform([V[1] * pca_score[1]])
# print(ft)
#
# a = 3 * V.T
# print(a)
#PCA with numpy
# x = np.transpose(basis)
#
# #centering the data
# x -= np.mean(x, axis = 0)
#
# cov = np.cov(x, rowvar = False)
#
# evals , evecs = LA.eigh(cov)
#
# idx = np.argsort(evals)[::-1]
# evecs = evecs[:,idx]
# evals = evals[idx]
#
# print(evals)
# print(evecs)
# self.ax_fit.clear()
# for i in range(len(sel_fit)):
# y= sel_fiti[i].row()
# if self.mju_exafs == 2:
# fit = self.mainform.dataClasses[y].xesAreaNorm
# if self.mju_exafs == 1:
# fit = self.mainform.dataClasses[y].exafsZLC
# if self.mju_exafs == 0:
# fit = self.mainform.dataClasses[y].mjuMinusVictoreen
#
## lin_comb_func(np.array([1,1]), np.array(basis), np.array(fit))
# lsq_result = least_squares(lin_comb_func, np.array(variables), \
## method = 'dogbox',
# ftol = 1e-12,
# max_nfev = 1000,
# bounds = varbounds,
## tr_solver = 'lsmr',
## jac = '3-point',
## loss='soft_l1',
## f_scale=0.1,
# verbose = 2,
## x_scale = [1,1,0.001],
# args=(basis, fit) )
#
# print (lsq_result.x)
# self.lstFitResult.item(y).setText(str(lsq_result.x))
#
# func = lin_comb_func(lsq_result.x, np.array(basis), np.array(fit))
#
# self.fit_basis[y] = basisi
# self.fit_result[y] = lsq_result.x
#
# if self.mju_exafs == 2:
# k_energy = self.mainform.dataClasses[y].energy
# if self.mju_exafs == 1:
# k_energy = self.mainform.dataClasses[y].k
# if self.mju_exafs == 0:
# k_energy = self.mainform.dataClasses[y].energy
#
#
# self.exafs_line.set_xdata(k_energy)
# self.exafs_line.set_ydata(fit)
# self.exafsdgcomp_line.set_xdata(k_energy)
# self.exafsdgcomp_line.set_ydata(func+fit)
# self.ax_exafs.relim()
# self.ax_exafs.autoscale()
#
# self.ax_fit.plot(np.zeros(len(lsq_result.x))+y, lsq_result.x, "o")
if self.mju_exafs == 3:
k_energy = self.mainform.dataClasses[y].energy
if self.mju_exafs == 2:
k_energy = self.mainform.dataClasses[y].energy
if self.mju_exafs == 1:
k_energy = self.mainform.dataClasses[y].k
if self.mju_exafs == 0:
k_energy = self.mainform.dataClasses[y].energy
self.ax_exafs.clear()
# for i in range(2):
# self.ax_exafs.plot(k_energy, V[i]*pca_score[i])
# sp = self.pca.inverse_transform(tr)
# print(sp)
# for i in range(len(sp)):
# self.ax_exafs.plot(k_energy, sp[i])
for i in range(len(V)):
self.ax_exafs.plot(k_energy, V[i]*pca_score[i])
#
# self.ax_exafs.plot(k_energy, sp[0])
# self.ax_exafs.plot(k_energy, self.mainform.dataClasses[5].exafsZLC)
# self.ax_exafs.plot(k_energy, evecs[0])
self.ax_exafs.relim()
self.ax_exafs.autoscale()
self.canv.draw()
def PCATransform(self):
self.ax_fit.clear()
sel_fit = self.lstFit.selectedItems()
sel_fiti = self.lstFit.selectedIndexes()
for i in range(len(sel_fit)):
y= sel_fiti[i].row()
if self.mju_exafs == 3:
fit = self.mainform.dataClasses[y].xesAreaNorm
if self.mju_exafs == 2:
idx = np.argmin(abs(self.mainform.dataClasses[y].energy - \
self.mainform.dataClasses[y].normalizationEnergy))
fit = self.mainform.dataClasses[y].mjuMinusVictoreen / self.mainform.dataClasses[y].mju0[idx]
if self.mju_exafs == 1:
fit = self.mainform.dataClasses[y].exafsZLC
if self.mju_exafs == 0:
fit = self.mainform.dataClasses[y].mjuMinusVictoreen
pca_tr = self.pca.transform([fit])
pca_inv = self.pca.inverse_transform(pca_tr)
self.lstFitResult.item(y).setText(str(pca_tr[0]))
if self.mju_exafs == 3:
k_energy = self.mainform.dataClasses[y].energy
if self.mju_exafs == 2:
k_energy = self.mainform.dataClasses[y].energy
if self.mju_exafs == 1:
k_energy = self.mainform.dataClasses[y].k
if self.mju_exafs == 0:
k_energy = self.mainform.dataClasses[y].energy
# print(self.pca.score_samples([fit]))
self.ax_exafs.clear()
self.ax_exafs.plot(k_energy, fit)
self.ax_exafs.plot(k_energy, pca_inv[0])
self.ax_exafs.relim()
self.ax_exafs.autoscale()
self.canv.draw()
def lstFitItemClicked(self):
current = self.lstFit.currentRow()
if self.fit_basis[current] != []:
for i in range(self.lstBasis.count()):
# self.lstBasis.setSelected(self.lstBasis.item(i), False)
self.lstBasis.item(i).setSelected(False)
for i in self.fit_basis[current]:
# self.lstBasis.setSelected(self.lstBasis.item(self.fit_basis[current][i]), True)
self.lstBasis.item(i).setSelected(True)
basis = []
basisi = []
for i in range(len(self.fit_basis[current])):
if self.mju_exafs == 2:
basis.append(self.mainform.dataClasses[self.fit_basis[current][i]].xesAreaNorm)
if self.mju_exafs == 1:
basis.append(self.mainform.dataClasses[self.fit_basis[current][i]].exafsZLC)
if self.mju_exafs == 0:
basis.append(self.mainform.dataClasses[self.fit_basis[current][i]].mjuMinusVictoreen)
basisi.append(current)
if self.mju_exafs == 2:
k_energy = self.mainform.dataClasses[current].energy
abs_exafs = self.mainform.dataClasses[current].xesAreaNorm
if self.mju_exafs == 1:
k_energy = self.mainform.dataClasses[current].k
abs_exafs = self.mainform.dataClasses[current].exafsZLC
if self.mju_exafs == 0:
k_energy = self.mainform.dataClasses[current].energy
abs_exafs = self.mainform.dataClasses[current].mjuMinusVictoreen
func = lin_comb_func(self.fit_result[current], np.array(basis), np.array(abs_exafs))
self.exafs_line.set_xdata(k_energy)
self.exafs_line.set_ydata(abs_exafs)
self.exafsdgcomp_line.set_xdata(k_energy)
self.exafsdgcomp_line.set_ydata(func+abs_exafs)
self.ax_exafs.relim()
self.ax_exafs.autoscale()
self.canv.draw()
else:
self.exafs_line.set_xdata([])
self.exafs_line.set_ydata([])
self.exafsdgcomp_line.set_xdata([])
self.exafsdgcomp_line.set_ydata([])
self.ax_exafs.relim()
self.ax_exafs.autoscale()
self.canv.draw()
| 17,208
| 34.926931
| 117
|
py
|
xaesa
|
xaesa-master/xalglib.py
|
###########################################################################
# ALGLIB 3.13.0 (source code generated 2017-12-29)
# Copyright (c) Sergey Bochkanov (ALGLIB project).
#
# >>> SOURCE LICENSE >>>
# This software is a non-commercial edition of ALGLIB package, which is
# licensed under ALGLIB Personal and Academic Use License Agreement (PAULA).
#
# See paula-v1.0.pdf file in the archive root for full text of license
# agreement.
# >>> END OF LICENSE >>>
##########################################################################
import ctypes
import ctypes
import sys
import os
if ctypes.sizeof(ctypes.c_void_p)==4:
c_ptrint_t = ctypes.c_int32
else:
c_ptrint_t = ctypes.c_int64
DT_BOOL = 1
DT_INT = 2
DT_REAL = 3
DT_COMPLEX = 4
SIZE_BOOL = 1
SIZE_INT = ctypes.sizeof(ctypes.c_void_p)
SIZE_REAL = 8
SIZE_COMPLEX = 16
OWN_CALLER = 1
OWN_AE = 2
X_ASSERTION_FAILED = 5
X_SET = 1 # data are copied into x-vector/matrix; previous contents of x-structure is freed
X_CREATE = 2 # x-vector/matrix is created, its previous contents is ignored
X_REWRITE = 3 # data are copied into x-structure; size of Python structure must be equal to the x-structure size
class x_complex(ctypes.Structure):
_fields_ = [("x", ctypes.c_double), ("y", ctypes.c_double)]
class x_multiptr(ctypes.Union):
_fields_ = [("p_ptr", ctypes.c_void_p),
("p_char", ctypes.c_char_p),
("p_bool", ctypes.POINTER(ctypes.c_int8)),
("p_int", ctypes.POINTER(c_ptrint_t)),
("p_real", ctypes.POINTER(ctypes.c_double)),
("p_complex", ctypes.POINTER(x_complex))]
class x_int(ctypes.Union):
_fields_ = [("val", c_ptrint_t),
("longval", ctypes.c_uint64)]
class x_string(ctypes.Structure):
_fields_ = [("owner", ctypes.c_uint64),
("last_action", ctypes.c_uint64),
("ptr", x_multiptr)]
class x_vector(ctypes.Structure):
_pack_ = 8
_fields_ = [("cnt", ctypes.c_uint64),
("datatype", ctypes.c_uint64),
("owner", ctypes.c_uint64),
("last_action", ctypes.c_uint64),
("ptr", x_multiptr)]
class x_matrix(ctypes.Structure):
_pack_ = 8
_fields_ = [("rows", ctypes.c_uint64),
("cols", ctypes.c_uint64),
("stride", ctypes.c_uint64),
("datatype", ctypes.c_uint64),
("owner", ctypes.c_uint64),
("last_action", ctypes.c_uint64),
("ptr", x_multiptr)]
#
# Load ALGLIB shared library
#
_so_candidates = []
curdir = os.path.dirname(__file__)
if curdir=="":
curdir = "."
if sys.platform=="win32" or sys.platform=="cygwin":
_shared_lib_name = "alglib313_"+str(ctypes.sizeof(ctypes.c_void_p)*8)+"free"+".dll"
_so_candidates.append(os.path.join(curdir,_shared_lib_name))
_so_candidates.append(os.path.join(sys.prefix,_shared_lib_name))
else:
_shared_lib_name = "alglib313_"+str(ctypes.sizeof(ctypes.c_void_p)*8)+"free"+".so"
_so_candidates.append(os.path.join(curdir,_shared_lib_name))
_so_candidates.append(os.path.join(sys.prefix,_shared_lib_name))
_so_candidates.append(os.path.join(os.sep+"usr","local",_shared_lib_name))
for _candidate in _so_candidates:
if os.path.isfile(_candidate):
_lib_alglib = ctypes.cdll.LoadLibrary(_candidate)
break
if _lib_alglib is None:
raise RuntimeError("ALGLIB: unable to load shared library")
_lib_alglib.x_activate_core.argtypes = []
_lib_alglib.x_activate_core.restype = None
_lib_alglib.x_activate_core()
_lib_alglib.x_malloc.argtypes = [ctypes.c_void_p, ctypes.c_uint64]
_lib_alglib.x_malloc.restype = ctypes.c_int32
_lib_alglib.x_free.argtypes = [ctypes.c_void_p]
_lib_alglib.x_free.restype = ctypes.c_int32
_lib_alglib.x_setnworkers.argtypes = [ctypes.c_uint64]
_lib_alglib.x_setnworkers.restype = ctypes.c_uint8
_lib_alglib.x_alloc_counter.argtypes = []
_lib_alglib.x_alloc_counter.restype = ctypes.c_int64
_lib_alglib.x_is_symmetric_e_.argtypes = [ctypes.c_void_p]
_lib_alglib.x_is_symmetric_e_.restype = ctypes.c_uint8
_lib_alglib.x_is_hermitian_e_.argtypes = [ctypes.c_void_p]
_lib_alglib.x_is_hermitian_e_.restype = ctypes.c_uint8
_lib_alglib.x_force_symmetric_e_.argtypes = [ctypes.c_void_p]
_lib_alglib.x_force_symmetric_e_.restype = ctypes.c_uint8
_lib_alglib.x_force_hermitian_e_.argtypes = [ctypes.c_void_p]
_lib_alglib.x_force_hermitian_e_.restype = ctypes.c_uint8
def x_malloc(cnt):
__cnt = ctypes.c_uint64(cnt)
if __cnt.value!=cnt:
raise RuntimeError("malloc() argument is too large!")
__result = ctypes.c_void_p(0)
if _lib_alglib.x_malloc(ctypes.byref(__result), __cnt)!=0:
raise RuntimeError("Error while calling x_malloc()")
return __result.value
def x_free(ptr):
__ptr = ctypes.c_void_p(ptr)
_lib_alglib.x_free(__ptr)
return
def xsign(val):
if val<0.0:
return -1.0
if val>0.0:
return +1.0
return 0.0
def setnworkers(nworkers):
__nworkers = ctypes.c_uint64(nworkers)
_lib_alglib.x_setnworkers(__nworkers)
return
def x_alloc_counter():
return _lib_alglib.x_alloc_counter()
def x_is_symmetric(x):
return _lib_alglib.x_is_symmetric_e_(ctypes.byref(x))
def x_force_symmetric(x):
return _lib_alglib.x_force_symmetric_e_(ctypes.byref(x))
def x_is_hermitian(x):
return _lib_alglib.x_is_hermitian_e_(ctypes.byref(x))
def x_force_hermitian(x):
return _lib_alglib.x_force_hermitian_e_(ctypes.byref(x))
def x_vector_clear(x):
if x.owner==OWN_AE:
x_free(x.ptr.p_ptr)
x.cnt = 0
x.ptr.p_ptr = 0
return
def x_matrix_clear(x):
if x.owner==OWN_AE:
x_free(x.ptr.p_ptr)
x.cols = 0
x.rows = 0
x.ptr.p_ptr = 0
return
#
# safe vector length:
# * returns list length.
# * throws ValueError if 'v' is not list (it uses
# 'msg' parameter to generate error message
#
def safe_len(msg,v):
if type(v)!=list:
raise ValueError(msg)
return len(v)
#
# safe matrix size
# * returns number of columns
# * throws ValueError if 'v' is not rectangular matrix
# (list of lists of same size)
# it uses 'msg' parameter to generate error message
#
def safe_cols(msg,v):
if type(v)!=list:
raise ValueError(msg)
if len(v)==0:
return 0
if type(v[0])!=list:
raise ValueError(msg)
cols = len(v[0])
for x in v:
if type(x)!=list:
raise ValueError(msg)
if len(x)!=cols:
raise ValueError(msg)
return cols
#
# safe matrix size
# * returns number of rows
# * throws ValueError if 'v' is not rectangular matrix
# (list of lists of same size)
# it uses 'msg' parameter to generate error message
#
def safe_rows(msg,v):
if type(v)!=list:
raise ValueError(msg)
if len(v)==0:
return 0
if type(v[0])!=list:
raise ValueError(msg)
cols = len(v[0])
for x in v:
if type(x)!=list:
raise ValueError(msg)
if len(x)!=cols:
raise ValueError(msg)
return len(v)
def create_real_vector(cnt):
if cnt<=0:
return []
return [0]*cnt
def create_real_matrix(rows, cols):
if rows<=0 or cols<=0:
return [[]]
matrix = []
row = 0
while row<rows:
matrix += [[0]*cols]
row += 1
return matrix
def is_bool(v):
try:
tmp = bool(v)
except:
return False
return True
def is_int(v):
try:
tmp = int(v)
except:
return False
return True
def is_real(v):
try:
tmp = float(v)
except:
return False
return True
def is_complex(v):
try:
tmp = complex(v)
except:
return False
return True
def is_bool_vector(v):
if type(v)!=list:
return False
for x in v:
try:
tmp = bool(x)
except:
return False
return True
def is_bool_matrix(v):
if type(v)!=list:
return False
if len(v)==0:
return True
if type(v[0])!=list:
return False
rows = len(v)
cols = len(v[0])
for x in v:
if type(x)!=list:
return False
if len(x)!=cols:
return False
for y in x:
try:
tmp = bool(y)
except:
return False
return True
def is_int_vector(v):
if type(v)!=list:
return False
for x in v:
try:
tmp = int(x)
except:
return False
return True
def is_int_matrix(v):
if type(v)!=list:
return False
if len(v)==0:
return True
if type(v[0])!=list:
return False
rows = len(v)
cols = len(v[0])
for x in v:
if type(x)!=list:
return False
if len(x)!=cols:
return False
for y in x:
try:
tmp = int(y)
except:
return False
return True
def is_real_vector(v):
if type(v)!=list:
return False
for x in v:
try:
tmp = float(x)
except:
return False
return True
def is_real_matrix(v):
if type(v)!=list:
return False
if len(v)==0:
return True
if type(v[0])!=list:
return False
rows = len(v)
cols = len(v[0])
for x in v:
if type(x)!=list:
return False
if len(x)!=cols:
return False
for y in x:
try:
tmp = float(y)
except:
return False
return True
def is_complex_vector(v):
if type(v)!=list:
return False
for x in v:
try:
tmp = complex(x)
except:
return False
return True
def is_complex_matrix(v):
if type(v)!=list:
return False
if len(v)==0:
return True
if type(v[0])!=list:
return False
rows = len(v)
cols = len(v[0])
for x in v:
if type(x)!=list:
return False
if len(x)!=cols:
return False
for y in x:
try:
tmp = complex(y)
except:
return False
return True
#
# conversion from list to x-vector:
#
# x x-vector.
# v list
# dt datatype
# mode one of the modes:
# * X_CREATE - x is assumed to be uninitialized
# * X_SET - x is assumed to be initialized; old contents is freed
# * X_REWRITE - x is assumed to have same size as v, exception is thrown otherwise
# it is rewritten without reallocation of memory;
#
def x_from_list(x, v, dt, mode):
#
# check types
#
if dt==DT_BOOL:
if not is_bool_vector(v):
raise ValueError("can't cast to bool_vector")
elemsize = SIZE_BOOL
if dt==DT_INT:
if not is_int_vector(v):
raise ValueError("can't cast to int_vector")
elemsize = SIZE_INT
if dt==DT_REAL:
if not is_real_vector(v):
raise ValueError("can't cast to real_vector")
elemsize = SIZE_REAL
if dt==DT_COMPLEX:
if not is_complex_vector(v):
raise ValueError("can't cast to complex_vector")
elemsize = SIZE_COMPLEX
#
# allocation
#
if mode==X_CREATE:
x.datatype = dt
x.cnt = len(v)
x.owner = OWN_AE
x.ptr.p_ptr = x_malloc(elemsize*x.cnt)
x.last_action = 1
if mode==X_SET:
if x.owner==OWN_AE:
x_free(x.ptr.p_ptr)
x.datatype = dt
x.cnt = len(v)
x.owner = OWN_AE
x.ptr.p_ptr = x_malloc(elemsize*x.cnt)
x.last_action = 3
if mode==X_REWRITE:
if x.datatype!=dt:
raise RuntimeError("Trying to rewrite vector - types don't match")
if len(v)!=x.cnt:
raise RuntimeError("Trying to rewrite vector - sizes don't match")
x.last_action = 2
#
# copy
#
if dt==DT_BOOL:
cnt = x.cnt
i = 0
while i<cnt:
x.ptr.p_bool[i] = bool(v[i])
i += 1
if dt==DT_INT:
cnt = x.cnt
i = 0
while i<cnt:
x.ptr.p_int[i] = int(v[i])
i += 1
if dt==DT_REAL:
cnt = x.cnt
i = 0
while i<cnt:
x.ptr.p_real[i] = float(v[i])
i += 1
if dt==DT_COMPLEX:
cnt = x.cnt
i = 0
while i<cnt:
tmp = complex(v[i])
x.ptr.p_complex[i].x = tmp.real
x.ptr.p_complex[i].y = tmp.imag
i += 1
return
#
# conversion from list of lists to x-matrix:
#
# x x-matrix.
# v list
# dt datatype
# mode one of the modes:
# * X_CREATE - x is assumed to be uninitialized
# * X_SET - x is assumed to be initialized; old contents is freed
# * X_REWRITE - x is assumed to have same size as v, exception is thrown otherwise
# it is rewritten without reallocation of memory;
#
def x_from_listlist(x, v, dt, mode):
#
# check types
#
if dt==DT_BOOL:
if not is_bool_matrix(v):
raise ValueError("can't cast to bool_matrix")
elemsize = SIZE_BOOL
if dt==DT_INT:
if not is_int_matrix(v):
raise ValueError("can't cast to int_matrix")
elemsize = SIZE_INT
if dt==DT_REAL:
if not is_real_matrix(v):
raise ValueError("can't cast to real_matrix")
elemsize = SIZE_REAL
if dt==DT_COMPLEX:
if not is_complex_matrix(v):
raise ValueError("can't cast to complex_matrix")
elemsize = SIZE_COMPLEX
#
# determine size
#
rows = len(v)
if rows>0:
cols = len(v[0])
else:
cols = 0
if cols==0:
rows = 0
#
# allocation
#
if mode==X_CREATE:
x.datatype = dt
x.cols = cols
x.rows = rows
x.stride = cols
x.owner = OWN_AE
x.ptr.p_ptr = x_malloc(elemsize*x.stride*x.rows)
x.last_action = 1
if mode==X_SET:
if x.owner==OWN_AE:
x_free(x.ptr.p_ptr)
x.cols = cols
x.rows = rows
x.stride =cols
x.owner = OWN_AE
x.ptr.p_ptr = x_malloc(elemsize*x.stride*x.rows)
x.last_action = 3
if mode==X_REWRITE:
if x.datatype!=dt:
raise RuntimeError("Trying to rewrite matrix - types don't match")
if rows!=x.rows or cols!=x.cols:
raise RuntimeError("Trying to rewrite vector - sizes don't match")
x.last_action = 2
#
# copy
#
offs = 0
endoffs = x.stride-x.cols
for p in v:
for q in p:
if dt==DT_BOOL:
x.ptr.p_bool[offs] = bool(q)
if dt==DT_INT:
x.ptr.p_int[offs] = int(q)
if dt==DT_REAL:
x.ptr.p_real[offs] = float(q)
if dt==DT_COMPLEX:
tmp = complex(q)
x.ptr.p_complex[offs].x = tmp.real
x.ptr.p_complex[offs].y = tmp.imag
offs = offs+1
offs = offs+endoffs
return
#
# conversion from x-vector to Python vector
#
# Function takes only one parameter - x, x-vector,
# which is NOT freed after use.
#
def list_from_x(x):
if x.cnt==0:
return []
r = [0]*x.cnt
i = 0
if x.datatype==DT_BOOL:
while i<x.cnt:
r[i] = bool(x.ptr.p_bool[i])
i += 1
if x.datatype==DT_INT:
while i<x.cnt:
r[i] = x.ptr.p_int[i]
i += 1
if x.datatype==DT_REAL:
while i<x.cnt:
r[i] = x.ptr.p_real[i]
i += 1
if x.datatype==DT_COMPLEX:
while i<x.cnt:
r[i] = complex(x.ptr.p_complex[i].x, x.ptr.p_complex[i].y)
i += 1
return r
#
# conversion from x-matrix to Python matrix
#
# Function takes only one parameter - x, x-matrix,
# which is NOT freed after use.
#
def listlist_from_x(x):
if x.cols==0 or x.rows==0:
return [[]]
r = create_real_matrix(x.rows, x.cols)
offs = 0
endoffs = x.stride-x.cols
m = x.rows
n = x.cols
dt = x.datatype
i = 0
while i<m:
j = 0
while j<n:
if dt==DT_BOOL:
r[i][j] = bool(x.ptr.p_bool[offs])
if dt==DT_INT:
r[i][j] = x.ptr.p_int[offs]
if dt==DT_REAL:
r[i][j] = x.ptr.p_real[offs]
if dt==DT_COMPLEX:
r[i][j] = complex(x.ptr.p_complex[offs].x, x.ptr.p_complex[offs].y)
offs += 1
j += 1
offs += endoffs
i += 1
return r
#
# this function copies x-vector to previously allocated list
# which should be large enough to store x-vector.
#
# invalid access to list is generated if list is too small.
# x-vector is not freed after use.
#
def copy_x_to_list(x,r):
if x.cnt==0:
return
i = 0
if x.datatype==DT_BOOL:
while i<x.cnt:
r[i] = bool(x.ptr.p_bool[i])
i += 1
if x.datatype==DT_INT:
while i<x.cnt:
r[i] = x.ptr.p_int[i]
i += 1
if x.datatype==DT_REAL:
while i<x.cnt:
r[i] = x.ptr.p_real[i]
i += 1
if x.datatype==DT_COMPLEX:
while i<x.cnt:
r[i] = complex(x.ptr.p_complex[i].x, x.ptr.p_complex[i].y)
i += 1
return
_lib_alglib.x_obj_free_kdtreerequestbuffer.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_kdtreerequestbuffer.restype = None
class kdtreerequestbuffer(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_kdtreerequestbuffer(self.ptr)
_lib_alglib.x_obj_free_kdtree.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_kdtree.restype = None
class kdtree(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_kdtree(self.ptr)
_lib_alglib.alglib_kdtreeserialize.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreeserialize.restype = ctypes.c_int32
def kdtreeserialize(obj):
error_msg = ctypes.c_char_p(0)
_s_out = ctypes.c_char_p(0)
retval = _lib_alglib.alglib_kdtreeserialize(ctypes.byref(error_msg), ctypes.byref(obj.ptr), ctypes.byref(_s_out))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreeserialize'")
s_out = _s_out.value
_lib_alglib.x_free(_s_out)
return s_out
_lib_alglib.alglib_kdtreeunserialize.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreeunserialize.restype = ctypes.c_int32
def kdtreeunserialize(s_in):
error_msg = ctypes.c_char_p(0)
_s_in = ctypes.c_char_p(s_in)
_obj = ctypes.c_void_p(0)
retval = _lib_alglib.alglib_kdtreeunserialize(ctypes.byref(error_msg), ctypes.byref(_s_in), ctypes.byref(_obj), )
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreeserialize'")
return kdtree(_obj)
_lib_alglib.alglib_kdtreebuild.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreebuild.restype = ctypes.c_int32
def kdtreebuild(*functionargs):
if len(functionargs)==5:
__friendly_form = False
xy,n,nx,ny,normtype = functionargs
elif len(functionargs)==4:
__friendly_form = True
xy,nx,ny,normtype = functionargs
n = safe_rows("'kdtreebuild': incorrect parameters",xy)
else:
raise RuntimeError("Error while calling 'kdtreebuild': function must have 4 or 5 parameters")
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__nx = x_int()
__nx.val = int(nx)
if __nx.val!=nx:
raise ValueError("Error while converting 'nx' parameter to 'x_int'")
__ny = x_int()
__ny.val = int(ny)
if __ny.val!=ny:
raise ValueError("Error while converting 'ny' parameter to 'x_int'")
__normtype = x_int()
__normtype.val = int(normtype)
if __normtype.val!=normtype:
raise ValueError("Error while converting 'normtype' parameter to 'x_int'")
__kdt = ctypes.c_void_p(0)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreebuild(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__n), ctypes.byref(__nx), ctypes.byref(__ny), ctypes.byref(__normtype), ctypes.byref(__kdt))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreebuild'")
__r__kdt = kdtree(__kdt)
return __r__kdt
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_kdtreebuildtagged.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreebuildtagged.restype = ctypes.c_int32
def kdtreebuildtagged(*functionargs):
if len(functionargs)==6:
__friendly_form = False
xy,tags,n,nx,ny,normtype = functionargs
elif len(functionargs)==5:
__friendly_form = True
xy,tags,nx,ny,normtype = functionargs
if safe_rows("'kdtreebuildtagged': incorrect parameters",xy)!=safe_len("'kdtreebuildtagged': incorrect parameters",tags):
raise RuntimeError("Error while calling 'kdtreebuildtagged': looks like one of arguments has wrong size")
n = safe_rows("'kdtreebuildtagged': incorrect parameters",xy)
else:
raise RuntimeError("Error while calling 'kdtreebuildtagged': function must have 5 or 6 parameters")
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(tags):
raise ValueError("'tags' parameter can't be cast to int_vector")
__tags = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__nx = x_int()
__nx.val = int(nx)
if __nx.val!=nx:
raise ValueError("Error while converting 'nx' parameter to 'x_int'")
__ny = x_int()
__ny.val = int(ny)
if __ny.val!=ny:
raise ValueError("Error while converting 'ny' parameter to 'x_int'")
__normtype = x_int()
__normtype.val = int(normtype)
if __normtype.val!=normtype:
raise ValueError("Error while converting 'normtype' parameter to 'x_int'")
__kdt = ctypes.c_void_p(0)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__tags, tags, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreebuildtagged(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__tags), ctypes.byref(__n), ctypes.byref(__nx), ctypes.byref(__ny), ctypes.byref(__normtype), ctypes.byref(__kdt))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreebuildtagged'")
__r__kdt = kdtree(__kdt)
return __r__kdt
finally:
x_matrix_clear(__xy)
x_vector_clear(__tags)
_lib_alglib.alglib_kdtreecreaterequestbuffer.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreecreaterequestbuffer.restype = ctypes.c_int32
def kdtreecreaterequestbuffer(kdt):
pass
__kdt = kdt.ptr
__buf = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreecreaterequestbuffer(ctypes.byref(_error_msg), ctypes.byref(__kdt), ctypes.byref(__buf))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreecreaterequestbuffer'")
__r__buf = kdtreerequestbuffer(__buf)
return __r__buf
finally:
pass
_lib_alglib.alglib_kdtreequeryknn.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreequeryknn.restype = ctypes.c_int32
def kdtreequeryknn(*functionargs):
if len(functionargs)==4:
__friendly_form = False
kdt,x,k,selfmatch = functionargs
elif len(functionargs)==3:
__friendly_form = True
kdt,x,k = functionargs
selfmatch = True
else:
raise RuntimeError("Error while calling 'kdtreequeryknn': function must have 3 or 4 parameters")
__result = x_int()
__result.val = 0
__kdt = kdt.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__selfmatch = ctypes.c_uint8(selfmatch)
if __selfmatch.value!=0:
__selfmatch = ctypes.c_uint8(1)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreequeryknn(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__kdt), ctypes.byref(__x), ctypes.byref(__k), ctypes.byref(__selfmatch))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreequeryknn'")
__r__result = __result.val
return __r__result
finally:
x_vector_clear(__x)
_lib_alglib.alglib_kdtreetsqueryknn.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreetsqueryknn.restype = ctypes.c_int32
def kdtreetsqueryknn(*functionargs):
if len(functionargs)==5:
__friendly_form = False
kdt,buf,x,k,selfmatch = functionargs
elif len(functionargs)==4:
__friendly_form = True
kdt,buf,x,k = functionargs
selfmatch = True
else:
raise RuntimeError("Error while calling 'kdtreetsqueryknn': function must have 4 or 5 parameters")
__result = x_int()
__result.val = 0
__kdt = kdt.ptr
__buf = buf.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__selfmatch = ctypes.c_uint8(selfmatch)
if __selfmatch.value!=0:
__selfmatch = ctypes.c_uint8(1)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreetsqueryknn(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__kdt), ctypes.byref(__buf), ctypes.byref(__x), ctypes.byref(__k), ctypes.byref(__selfmatch))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreetsqueryknn'")
__r__result = __result.val
return __r__result
finally:
x_vector_clear(__x)
_lib_alglib.alglib_kdtreequeryrnn.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreequeryrnn.restype = ctypes.c_int32
def kdtreequeryrnn(*functionargs):
if len(functionargs)==4:
__friendly_form = False
kdt,x,r,selfmatch = functionargs
elif len(functionargs)==3:
__friendly_form = True
kdt,x,r = functionargs
selfmatch = True
else:
raise RuntimeError("Error while calling 'kdtreequeryrnn': function must have 3 or 4 parameters")
__result = x_int()
__result.val = 0
__kdt = kdt.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__r = ctypes.c_double(r)
__selfmatch = ctypes.c_uint8(selfmatch)
if __selfmatch.value!=0:
__selfmatch = ctypes.c_uint8(1)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreequeryrnn(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__kdt), ctypes.byref(__x), ctypes.byref(__r), ctypes.byref(__selfmatch))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreequeryrnn'")
__r__result = __result.val
return __r__result
finally:
x_vector_clear(__x)
_lib_alglib.alglib_kdtreetsqueryrnn.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreetsqueryrnn.restype = ctypes.c_int32
def kdtreetsqueryrnn(*functionargs):
if len(functionargs)==5:
__friendly_form = False
kdt,buf,x,r,selfmatch = functionargs
elif len(functionargs)==4:
__friendly_form = True
kdt,buf,x,r = functionargs
selfmatch = True
else:
raise RuntimeError("Error while calling 'kdtreetsqueryrnn': function must have 4 or 5 parameters")
__result = x_int()
__result.val = 0
__kdt = kdt.ptr
__buf = buf.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__r = ctypes.c_double(r)
__selfmatch = ctypes.c_uint8(selfmatch)
if __selfmatch.value!=0:
__selfmatch = ctypes.c_uint8(1)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreetsqueryrnn(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__kdt), ctypes.byref(__buf), ctypes.byref(__x), ctypes.byref(__r), ctypes.byref(__selfmatch))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreetsqueryrnn'")
__r__result = __result.val
return __r__result
finally:
x_vector_clear(__x)
_lib_alglib.alglib_kdtreequeryaknn.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreequeryaknn.restype = ctypes.c_int32
def kdtreequeryaknn(*functionargs):
if len(functionargs)==5:
__friendly_form = False
kdt,x,k,selfmatch,eps = functionargs
elif len(functionargs)==4:
__friendly_form = True
kdt,x,k,eps = functionargs
selfmatch = True
else:
raise RuntimeError("Error while calling 'kdtreequeryaknn': function must have 4 or 5 parameters")
__result = x_int()
__result.val = 0
__kdt = kdt.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__selfmatch = ctypes.c_uint8(selfmatch)
if __selfmatch.value!=0:
__selfmatch = ctypes.c_uint8(1)
__eps = ctypes.c_double(eps)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreequeryaknn(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__kdt), ctypes.byref(__x), ctypes.byref(__k), ctypes.byref(__selfmatch), ctypes.byref(__eps))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreequeryaknn'")
__r__result = __result.val
return __r__result
finally:
x_vector_clear(__x)
_lib_alglib.alglib_kdtreetsqueryaknn.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreetsqueryaknn.restype = ctypes.c_int32
def kdtreetsqueryaknn(*functionargs):
if len(functionargs)==6:
__friendly_form = False
kdt,buf,x,k,selfmatch,eps = functionargs
elif len(functionargs)==5:
__friendly_form = True
kdt,buf,x,k,eps = functionargs
selfmatch = True
else:
raise RuntimeError("Error while calling 'kdtreetsqueryaknn': function must have 5 or 6 parameters")
__result = x_int()
__result.val = 0
__kdt = kdt.ptr
__buf = buf.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__selfmatch = ctypes.c_uint8(selfmatch)
if __selfmatch.value!=0:
__selfmatch = ctypes.c_uint8(1)
__eps = ctypes.c_double(eps)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreetsqueryaknn(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__kdt), ctypes.byref(__buf), ctypes.byref(__x), ctypes.byref(__k), ctypes.byref(__selfmatch), ctypes.byref(__eps))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreetsqueryaknn'")
__r__result = __result.val
return __r__result
finally:
x_vector_clear(__x)
_lib_alglib.alglib_kdtreequerybox.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreequerybox.restype = ctypes.c_int32
def kdtreequerybox(kdt, boxmin, boxmax):
pass
__result = x_int()
__result.val = 0
__kdt = kdt.ptr
if not is_real_vector(boxmin):
raise ValueError("'boxmin' parameter can't be cast to real_vector")
__boxmin = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(boxmax):
raise ValueError("'boxmax' parameter can't be cast to real_vector")
__boxmax = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__boxmin, boxmin, DT_REAL, X_CREATE)
x_from_list(__boxmax, boxmax, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreequerybox(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__kdt), ctypes.byref(__boxmin), ctypes.byref(__boxmax))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreequerybox'")
__r__result = __result.val
return __r__result
finally:
x_vector_clear(__boxmin)
x_vector_clear(__boxmax)
_lib_alglib.alglib_kdtreetsquerybox.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreetsquerybox.restype = ctypes.c_int32
def kdtreetsquerybox(kdt, buf, boxmin, boxmax):
pass
__result = x_int()
__result.val = 0
__kdt = kdt.ptr
__buf = buf.ptr
if not is_real_vector(boxmin):
raise ValueError("'boxmin' parameter can't be cast to real_vector")
__boxmin = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(boxmax):
raise ValueError("'boxmax' parameter can't be cast to real_vector")
__boxmax = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__boxmin, boxmin, DT_REAL, X_CREATE)
x_from_list(__boxmax, boxmax, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreetsquerybox(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__kdt), ctypes.byref(__buf), ctypes.byref(__boxmin), ctypes.byref(__boxmax))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreetsquerybox'")
__r__result = __result.val
return __r__result
finally:
x_vector_clear(__boxmin)
x_vector_clear(__boxmax)
_lib_alglib.alglib_kdtreequeryresultsx.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreequeryresultsx.restype = ctypes.c_int32
def kdtreequeryresultsx(kdt, x):
pass
__kdt = kdt.ptr
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreequeryresultsx(ctypes.byref(_error_msg), ctypes.byref(__kdt), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreequeryresultsx'")
__r__x = listlist_from_x(__x)
return __r__x
finally:
x_matrix_clear(__x)
_lib_alglib.alglib_kdtreequeryresultsxy.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreequeryresultsxy.restype = ctypes.c_int32
def kdtreequeryresultsxy(kdt, xy):
pass
__kdt = kdt.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreequeryresultsxy(ctypes.byref(_error_msg), ctypes.byref(__kdt), ctypes.byref(__xy))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreequeryresultsxy'")
__r__xy = listlist_from_x(__xy)
return __r__xy
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_kdtreequeryresultstags.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreequeryresultstags.restype = ctypes.c_int32
def kdtreequeryresultstags(kdt, tags):
pass
__kdt = kdt.ptr
if not is_int_vector(tags):
raise ValueError("'tags' parameter can't be cast to int_vector")
__tags = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__tags, tags, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreequeryresultstags(ctypes.byref(_error_msg), ctypes.byref(__kdt), ctypes.byref(__tags))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreequeryresultstags'")
__r__tags = list_from_x(__tags)
return __r__tags
finally:
x_vector_clear(__tags)
_lib_alglib.alglib_kdtreequeryresultsdistances.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreequeryresultsdistances.restype = ctypes.c_int32
def kdtreequeryresultsdistances(kdt, r):
pass
__kdt = kdt.ptr
if not is_real_vector(r):
raise ValueError("'r' parameter can't be cast to real_vector")
__r = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__r, r, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreequeryresultsdistances(ctypes.byref(_error_msg), ctypes.byref(__kdt), ctypes.byref(__r))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreequeryresultsdistances'")
__r__r = list_from_x(__r)
return __r__r
finally:
x_vector_clear(__r)
_lib_alglib.alglib_kdtreetsqueryresultsx.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreetsqueryresultsx.restype = ctypes.c_int32
def kdtreetsqueryresultsx(kdt, buf, x):
pass
__kdt = kdt.ptr
__buf = buf.ptr
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreetsqueryresultsx(ctypes.byref(_error_msg), ctypes.byref(__kdt), ctypes.byref(__buf), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreetsqueryresultsx'")
__r__x = listlist_from_x(__x)
return __r__x
finally:
x_matrix_clear(__x)
_lib_alglib.alglib_kdtreetsqueryresultsxy.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreetsqueryresultsxy.restype = ctypes.c_int32
def kdtreetsqueryresultsxy(kdt, buf, xy):
pass
__kdt = kdt.ptr
__buf = buf.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreetsqueryresultsxy(ctypes.byref(_error_msg), ctypes.byref(__kdt), ctypes.byref(__buf), ctypes.byref(__xy))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreetsqueryresultsxy'")
__r__xy = listlist_from_x(__xy)
return __r__xy
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_kdtreetsqueryresultstags.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreetsqueryresultstags.restype = ctypes.c_int32
def kdtreetsqueryresultstags(kdt, buf, tags):
pass
__kdt = kdt.ptr
__buf = buf.ptr
if not is_int_vector(tags):
raise ValueError("'tags' parameter can't be cast to int_vector")
__tags = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__tags, tags, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreetsqueryresultstags(ctypes.byref(_error_msg), ctypes.byref(__kdt), ctypes.byref(__buf), ctypes.byref(__tags))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreetsqueryresultstags'")
__r__tags = list_from_x(__tags)
return __r__tags
finally:
x_vector_clear(__tags)
_lib_alglib.alglib_kdtreetsqueryresultsdistances.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreetsqueryresultsdistances.restype = ctypes.c_int32
def kdtreetsqueryresultsdistances(kdt, buf, r):
pass
__kdt = kdt.ptr
__buf = buf.ptr
if not is_real_vector(r):
raise ValueError("'r' parameter can't be cast to real_vector")
__r = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__r, r, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreetsqueryresultsdistances(ctypes.byref(_error_msg), ctypes.byref(__kdt), ctypes.byref(__buf), ctypes.byref(__r))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreetsqueryresultsdistances'")
__r__r = list_from_x(__r)
return __r__r
finally:
x_vector_clear(__r)
_lib_alglib.alglib_kdtreequeryresultsxi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreequeryresultsxi.restype = ctypes.c_int32
def kdtreequeryresultsxi(kdt):
pass
__kdt = kdt.ptr
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreequeryresultsxi(ctypes.byref(_error_msg), ctypes.byref(__kdt), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreequeryresultsxi'")
__r__x = listlist_from_x(__x)
return __r__x
finally:
x_matrix_clear(__x)
_lib_alglib.alglib_kdtreequeryresultsxyi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreequeryresultsxyi.restype = ctypes.c_int32
def kdtreequeryresultsxyi(kdt):
pass
__kdt = kdt.ptr
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreequeryresultsxyi(ctypes.byref(_error_msg), ctypes.byref(__kdt), ctypes.byref(__xy))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreequeryresultsxyi'")
__r__xy = listlist_from_x(__xy)
return __r__xy
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_kdtreequeryresultstagsi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreequeryresultstagsi.restype = ctypes.c_int32
def kdtreequeryresultstagsi(kdt):
pass
__kdt = kdt.ptr
__tags = x_vector(cnt=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreequeryresultstagsi(ctypes.byref(_error_msg), ctypes.byref(__kdt), ctypes.byref(__tags))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreequeryresultstagsi'")
__r__tags = list_from_x(__tags)
return __r__tags
finally:
x_vector_clear(__tags)
_lib_alglib.alglib_kdtreequeryresultsdistancesi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kdtreequeryresultsdistancesi.restype = ctypes.c_int32
def kdtreequeryresultsdistancesi(kdt):
pass
__kdt = kdt.ptr
__r = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kdtreequeryresultsdistancesi(ctypes.byref(_error_msg), ctypes.byref(__kdt), ctypes.byref(__r))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kdtreequeryresultsdistancesi'")
__r__r = list_from_x(__r)
return __r__r
finally:
x_vector_clear(__r)
_lib_alglib.x_obj_free_hqrndstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_hqrndstate.restype = None
class hqrndstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_hqrndstate(self.ptr)
_lib_alglib.alglib_hqrndrandomize.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hqrndrandomize.restype = ctypes.c_int32
def hqrndrandomize():
pass
__state = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hqrndrandomize(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hqrndrandomize'")
__r__state = hqrndstate(__state)
return __r__state
finally:
pass
_lib_alglib.alglib_hqrndseed.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hqrndseed.restype = ctypes.c_int32
def hqrndseed(s1, s2):
pass
__s1 = x_int()
__s1.val = int(s1)
if __s1.val!=s1:
raise ValueError("Error while converting 's1' parameter to 'x_int'")
__s2 = x_int()
__s2.val = int(s2)
if __s2.val!=s2:
raise ValueError("Error while converting 's2' parameter to 'x_int'")
__state = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hqrndseed(ctypes.byref(_error_msg), ctypes.byref(__s1), ctypes.byref(__s2), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hqrndseed'")
__r__state = hqrndstate(__state)
return __r__state
finally:
pass
_lib_alglib.alglib_hqrnduniformr.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hqrnduniformr.restype = ctypes.c_int32
def hqrnduniformr(state):
pass
__result = ctypes.c_double(0)
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hqrnduniformr(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hqrnduniformr'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_hqrnduniformi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hqrnduniformi.restype = ctypes.c_int32
def hqrnduniformi(state, n):
pass
__result = x_int()
__result.val = 0
__state = state.ptr
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hqrnduniformi(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__state), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hqrnduniformi'")
__r__result = __result.val
return __r__result
finally:
pass
_lib_alglib.alglib_hqrndnormal.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hqrndnormal.restype = ctypes.c_int32
def hqrndnormal(state):
pass
__result = ctypes.c_double(0)
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hqrndnormal(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hqrndnormal'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_hqrndunit2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hqrndunit2.restype = ctypes.c_int32
def hqrndunit2(state):
pass
__state = state.ptr
__x = ctypes.c_double(0)
__y = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hqrndunit2(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hqrndunit2'")
__r__x = __x.value
__r__y = __y.value
return (__r__x, __r__y)
finally:
pass
_lib_alglib.alglib_hqrndnormal2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hqrndnormal2.restype = ctypes.c_int32
def hqrndnormal2(state):
pass
__state = state.ptr
__x1 = ctypes.c_double(0)
__x2 = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hqrndnormal2(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x1), ctypes.byref(__x2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hqrndnormal2'")
__r__x1 = __x1.value
__r__x2 = __x2.value
return (__r__x1, __r__x2)
finally:
pass
_lib_alglib.alglib_hqrndexponential.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hqrndexponential.restype = ctypes.c_int32
def hqrndexponential(state, lambdav):
pass
__result = ctypes.c_double(0)
__state = state.ptr
__lambdav = ctypes.c_double(lambdav)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hqrndexponential(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__state), ctypes.byref(__lambdav))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hqrndexponential'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_hqrnddiscrete.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hqrnddiscrete.restype = ctypes.c_int32
def hqrnddiscrete(state, x, n):
pass
__result = ctypes.c_double(0)
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hqrnddiscrete(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hqrnddiscrete'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__x)
_lib_alglib.alglib_hqrndcontinuous.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hqrndcontinuous.restype = ctypes.c_int32
def hqrndcontinuous(state, x, n):
pass
__result = ctypes.c_double(0)
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hqrndcontinuous(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hqrndcontinuous'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__x)
class x_xdebugrecord1(ctypes.Structure):
_pack_ = 8
_fields_ = [
("i", x_int),
("c", x_complex),
("a", x_vector)
]
class xdebugrecord1(object):
def __init__(self):
self.i = 0
self.c = 0
self.a = []
def x_xdebugrecord1_zero_fields(x):
x.i.val = 0
x.c.x = 0
x.c.y = 0
x.a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
return
def x_xdebugrecord1_clear(x):
x_vector_clear(x.a)
x_xdebugrecord1_zero_fields(x)
return
def x_from_xdebugrecord1(x,v):
x.i.val = int(v.i)
tmp = complex(v.c)
x.c.x = tmp.real
x.c.y = tmp.imag
x_from_list(x.a, v.a, DT_REAL, X_CREATE)
return
def xdebugrecord1_from_x(x):
r = xdebugrecord1()
r.i = x.i.val
r.c = complex(x.c.x,x.c.y)
r.a = list_from_x(x.a)
return r
_lib_alglib.alglib_xdebuginitrecord1.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebuginitrecord1.restype = ctypes.c_int32
def xdebuginitrecord1():
pass
__rec1 = x_xdebugrecord1()
x_xdebugrecord1_zero_fields(__rec1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebuginitrecord1(ctypes.byref(_error_msg), ctypes.byref(__rec1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebuginitrecord1'")
__r__rec1 = xdebugrecord1_from_x(__rec1)
return __r__rec1
finally:
x_xdebugrecord1_clear(__rec1)
_lib_alglib.alglib_xdebugb1count.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugb1count.restype = ctypes.c_int32
def xdebugb1count(a):
pass
__result = x_int()
__result.val = 0
if not is_bool_vector(a):
raise ValueError("'a' parameter can't be cast to bool_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_BOOL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugb1count(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugb1count'")
__r__result = __result.val
return __r__result
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugb1not.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugb1not.restype = ctypes.c_int32
def xdebugb1not(a):
pass
if not is_bool_vector(a):
raise ValueError("'a' parameter can't be cast to bool_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_BOOL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugb1not(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugb1not'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugb1appendcopy.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugb1appendcopy.restype = ctypes.c_int32
def xdebugb1appendcopy(a):
pass
if not is_bool_vector(a):
raise ValueError("'a' parameter can't be cast to bool_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_BOOL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugb1appendcopy(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugb1appendcopy'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugb1outeven.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugb1outeven.restype = ctypes.c_int32
def xdebugb1outeven(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__a = x_vector(cnt=0,datatype=DT_BOOL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugb1outeven(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugb1outeven'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugi1sum.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugi1sum.restype = ctypes.c_int32
def xdebugi1sum(a):
pass
__result = x_int()
__result.val = 0
if not is_int_vector(a):
raise ValueError("'a' parameter can't be cast to int_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugi1sum(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugi1sum'")
__r__result = __result.val
return __r__result
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugi1neg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugi1neg.restype = ctypes.c_int32
def xdebugi1neg(a):
pass
if not is_int_vector(a):
raise ValueError("'a' parameter can't be cast to int_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugi1neg(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugi1neg'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugi1appendcopy.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugi1appendcopy.restype = ctypes.c_int32
def xdebugi1appendcopy(a):
pass
if not is_int_vector(a):
raise ValueError("'a' parameter can't be cast to int_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugi1appendcopy(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugi1appendcopy'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugi1outeven.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugi1outeven.restype = ctypes.c_int32
def xdebugi1outeven(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__a = x_vector(cnt=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugi1outeven(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugi1outeven'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugr1sum.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugr1sum.restype = ctypes.c_int32
def xdebugr1sum(a):
pass
__result = ctypes.c_double(0)
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugr1sum(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugr1sum'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugr1neg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugr1neg.restype = ctypes.c_int32
def xdebugr1neg(a):
pass
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugr1neg(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugr1neg'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugr1appendcopy.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugr1appendcopy.restype = ctypes.c_int32
def xdebugr1appendcopy(a):
pass
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugr1appendcopy(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugr1appendcopy'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugr1outeven.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugr1outeven.restype = ctypes.c_int32
def xdebugr1outeven(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__a = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugr1outeven(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugr1outeven'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugc1sum.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugc1sum.restype = ctypes.c_int32
def xdebugc1sum(a):
pass
__result = x_complex(x=0,y=0)
if not is_complex_vector(a):
raise ValueError("'a' parameter can't be cast to complex_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugc1sum(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugc1sum'")
__r__result = complex(__result.x,__result.y)
return __r__result
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugc1neg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugc1neg.restype = ctypes.c_int32
def xdebugc1neg(a):
pass
if not is_complex_vector(a):
raise ValueError("'a' parameter can't be cast to complex_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugc1neg(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugc1neg'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugc1appendcopy.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugc1appendcopy.restype = ctypes.c_int32
def xdebugc1appendcopy(a):
pass
if not is_complex_vector(a):
raise ValueError("'a' parameter can't be cast to complex_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugc1appendcopy(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugc1appendcopy'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugc1outeven.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugc1outeven.restype = ctypes.c_int32
def xdebugc1outeven(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__a = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugc1outeven(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugc1outeven'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_xdebugb2count.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugb2count.restype = ctypes.c_int32
def xdebugb2count(a):
pass
__result = x_int()
__result.val = 0
if not is_bool_matrix(a):
raise ValueError("'a' parameter can't be cast to bool_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_BOOL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugb2count(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugb2count'")
__r__result = __result.val
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugb2not.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugb2not.restype = ctypes.c_int32
def xdebugb2not(a):
pass
if not is_bool_matrix(a):
raise ValueError("'a' parameter can't be cast to bool_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_BOOL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugb2not(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugb2not'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugb2transpose.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugb2transpose.restype = ctypes.c_int32
def xdebugb2transpose(a):
pass
if not is_bool_matrix(a):
raise ValueError("'a' parameter can't be cast to bool_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_BOOL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugb2transpose(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugb2transpose'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugb2outsin.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugb2outsin.restype = ctypes.c_int32
def xdebugb2outsin(m, n):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=DT_BOOL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugb2outsin(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugb2outsin'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugi2sum.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugi2sum.restype = ctypes.c_int32
def xdebugi2sum(a):
pass
__result = x_int()
__result.val = 0
if not is_int_matrix(a):
raise ValueError("'a' parameter can't be cast to int_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugi2sum(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugi2sum'")
__r__result = __result.val
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugi2neg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugi2neg.restype = ctypes.c_int32
def xdebugi2neg(a):
pass
if not is_int_matrix(a):
raise ValueError("'a' parameter can't be cast to int_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugi2neg(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugi2neg'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugi2transpose.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugi2transpose.restype = ctypes.c_int32
def xdebugi2transpose(a):
pass
if not is_int_matrix(a):
raise ValueError("'a' parameter can't be cast to int_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugi2transpose(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugi2transpose'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugi2outsin.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugi2outsin.restype = ctypes.c_int32
def xdebugi2outsin(m, n):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugi2outsin(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugi2outsin'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugr2sum.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugr2sum.restype = ctypes.c_int32
def xdebugr2sum(a):
pass
__result = ctypes.c_double(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugr2sum(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugr2sum'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugr2neg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugr2neg.restype = ctypes.c_int32
def xdebugr2neg(a):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugr2neg(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugr2neg'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugr2transpose.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugr2transpose.restype = ctypes.c_int32
def xdebugr2transpose(a):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugr2transpose(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugr2transpose'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugr2outsin.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugr2outsin.restype = ctypes.c_int32
def xdebugr2outsin(m, n):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugr2outsin(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugr2outsin'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugc2sum.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugc2sum.restype = ctypes.c_int32
def xdebugc2sum(a):
pass
__result = x_complex(x=0,y=0)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugc2sum(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugc2sum'")
__r__result = complex(__result.x,__result.y)
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugc2neg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugc2neg.restype = ctypes.c_int32
def xdebugc2neg(a):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugc2neg(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugc2neg'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugc2transpose.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugc2transpose.restype = ctypes.c_int32
def xdebugc2transpose(a):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugc2transpose(ctypes.byref(_error_msg), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugc2transpose'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugc2outsincos.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugc2outsincos.restype = ctypes.c_int32
def xdebugc2outsincos(m, n):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugc2outsincos(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugc2outsincos'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_xdebugmaskedbiasedproductsum.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_xdebugmaskedbiasedproductsum.restype = ctypes.c_int32
def xdebugmaskedbiasedproductsum(m, n, a, b, c):
pass
__result = ctypes.c_double(0)
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_bool_matrix(c):
raise ValueError("'c' parameter can't be cast to bool_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
x_from_listlist(__c, c, DT_BOOL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_xdebugmaskedbiasedproductsum(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'xdebugmaskedbiasedproductsum'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_matrix_clear(__c)
_lib_alglib.x_obj_free_odesolverstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_odesolverstate.restype = None
_lib_alglib.x_odesolverstate_get_needdy.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_odesolverstate_get_needdy.restype = None
_lib_alglib.x_odesolverstate_set_needdy.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_odesolverstate_set_needdy.restype = None
_lib_alglib.x_odesolverstate_get_y.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_odesolverstate_get_y.restype = None
_lib_alglib.x_odesolverstate_get_dy.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_odesolverstate_get_dy.restype = None
_lib_alglib.x_odesolverstate_get_x.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_odesolverstate_get_x.restype = None
_lib_alglib.x_odesolverstate_set_x.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_odesolverstate_set_x.restype = None
class odesolverstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_odesolverstate(self.ptr)
class x_odesolverreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("nfev", x_int),
("terminationtype", x_int)
]
class odesolverreport(object):
def __init__(self):
self.nfev = 0
self.terminationtype = 0
def x_odesolverreport_zero_fields(x):
x.nfev.val = 0
x.terminationtype.val = 0
return
def x_odesolverreport_clear(x):
x_odesolverreport_zero_fields(x)
return
def x_from_odesolverreport(x,v):
x.nfev.val = int(v.nfev)
x.terminationtype.val = int(v.terminationtype)
return
def odesolverreport_from_x(x):
r = odesolverreport()
r.nfev = x.nfev.val
r.terminationtype = x.terminationtype.val
return r
_lib_alglib.alglib_odesolverrkck.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_odesolverrkck.restype = ctypes.c_int32
def odesolverrkck(*functionargs):
if len(functionargs)==6:
__friendly_form = False
y,n,x,m,eps,h = functionargs
elif len(functionargs)==4:
__friendly_form = True
y,x,eps,h = functionargs
n = safe_len("'odesolverrkck': incorrect parameters",y)
m = safe_len("'odesolverrkck': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'odesolverrkck': function must have 4 or 6 parameters")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__eps = ctypes.c_double(eps)
__h = ctypes.c_double(h)
__state = ctypes.c_void_p(0)
try:
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_odesolverrkck(ctypes.byref(_error_msg), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__m), ctypes.byref(__eps), ctypes.byref(__h), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'odesolverrkck'")
__r__state = odesolverstate(__state)
return __r__state
finally:
x_vector_clear(__y)
x_vector_clear(__x)
def odesolversolve(state, dy, param = None):
# initialize temporaries
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_flag = ctypes.c_uint8()
# initialize reverse communication variables
_xc_y = x_vector()
_lib_alglib.x_odesolverstate_get_y(state.ptr, ctypes.byref(_xc_y))
_py_y = create_real_vector(_xc_y.cnt)
_xc_x = ctypes.c_double()
_xc_dy = x_vector()
_lib_alglib.x_odesolverstate_get_dy(state.ptr, ctypes.byref(_xc_dy))
_py_dy = create_real_vector(_xc_dy.cnt)
# algorithm iterations
while True:
retval = _lib_alglib.alglib_odesolveriteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'odesolveriteration'")
if not _xc_result:
break
_lib_alglib.x_odesolverstate_get_needdy(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_y, _py_y)
_lib_alglib.x_odesolverstate_get_x(state.ptr, ctypes.byref(_xc_x))
dy(_py_y, _xc_x.value, _py_dy, param)
x_from_list(_xc_dy, _py_dy, DT_REAL, X_REWRITE)
continue
raise RuntimeError("ALGLIB: unexpected error in 'odesolversolve'")
return
_lib_alglib.alglib_odesolverresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_odesolverresults.restype = ctypes.c_int32
def odesolverresults(state):
pass
__state = state.ptr
__m = x_int()
__m.val = 0
__xtbl = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ytbl = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_odesolverreport()
x_odesolverreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_odesolverresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__m), ctypes.byref(__xtbl), ctypes.byref(__ytbl), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'odesolverresults'")
__r__m = __m.val
__r__xtbl = list_from_x(__xtbl)
__r__ytbl = listlist_from_x(__ytbl)
__r__rep = odesolverreport_from_x(__rep)
return (__r__m, __r__xtbl, __r__ytbl, __r__rep)
finally:
x_vector_clear(__xtbl)
x_matrix_clear(__ytbl)
x_odesolverreport_clear(__rep)
_lib_alglib.x_obj_free_sparsematrix.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_sparsematrix.restype = None
class sparsematrix(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_sparsematrix(self.ptr)
_lib_alglib.x_obj_free_sparsebuffers.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_sparsebuffers.restype = None
class sparsebuffers(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_sparsebuffers(self.ptr)
_lib_alglib.alglib_sparsecreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecreate.restype = ctypes.c_int32
def sparsecreate(*functionargs):
if len(functionargs)==3:
__friendly_form = False
m,n,k = functionargs
elif len(functionargs)==2:
__friendly_form = True
m,n = functionargs
k = 0
else:
raise RuntimeError("Error while calling 'sparsecreate': function must have 2 or 3 parameters")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__s = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecreate(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__k), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecreate'")
__r__s = sparsematrix(__s)
return __r__s
finally:
pass
_lib_alglib.alglib_sparsecreatebuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecreatebuf.restype = ctypes.c_int32
def sparsecreatebuf(*functionargs):
if len(functionargs)==4:
__friendly_form = False
m,n,k,s = functionargs
elif len(functionargs)==3:
__friendly_form = True
m,n,s = functionargs
k = 0
else:
raise RuntimeError("Error while calling 'sparsecreatebuf': function must have 3 or 4 parameters")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecreatebuf(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__k), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecreatebuf'")
return
finally:
pass
_lib_alglib.alglib_sparsecreatecrs.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecreatecrs.restype = ctypes.c_int32
def sparsecreatecrs(m, n, ner):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_int_vector(ner):
raise ValueError("'ner' parameter can't be cast to int_vector")
__ner = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__s = ctypes.c_void_p(0)
try:
x_from_list(__ner, ner, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecreatecrs(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__ner), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecreatecrs'")
__r__s = sparsematrix(__s)
return __r__s
finally:
x_vector_clear(__ner)
_lib_alglib.alglib_sparsecreatecrsbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecreatecrsbuf.restype = ctypes.c_int32
def sparsecreatecrsbuf(m, n, ner, s):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_int_vector(ner):
raise ValueError("'ner' parameter can't be cast to int_vector")
__ner = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__s = s.ptr
try:
x_from_list(__ner, ner, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecreatecrsbuf(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__ner), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecreatecrsbuf'")
return
finally:
x_vector_clear(__ner)
_lib_alglib.alglib_sparsecreatesks.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecreatesks.restype = ctypes.c_int32
def sparsecreatesks(m, n, d, u):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_int_vector(d):
raise ValueError("'d' parameter can't be cast to int_vector")
__d = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(u):
raise ValueError("'u' parameter can't be cast to int_vector")
__u = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__s = ctypes.c_void_p(0)
try:
x_from_list(__d, d, DT_INT, X_CREATE)
x_from_list(__u, u, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecreatesks(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__d), ctypes.byref(__u), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecreatesks'")
__r__s = sparsematrix(__s)
return __r__s
finally:
x_vector_clear(__d)
x_vector_clear(__u)
_lib_alglib.alglib_sparsecreatesksbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecreatesksbuf.restype = ctypes.c_int32
def sparsecreatesksbuf(m, n, d, u, s):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_int_vector(d):
raise ValueError("'d' parameter can't be cast to int_vector")
__d = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(u):
raise ValueError("'u' parameter can't be cast to int_vector")
__u = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__s = s.ptr
try:
x_from_list(__d, d, DT_INT, X_CREATE)
x_from_list(__u, u, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecreatesksbuf(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__d), ctypes.byref(__u), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecreatesksbuf'")
return
finally:
x_vector_clear(__d)
x_vector_clear(__u)
_lib_alglib.alglib_sparsecreatesksband.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecreatesksband.restype = ctypes.c_int32
def sparsecreatesksband(m, n, bw):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__bw = x_int()
__bw.val = int(bw)
if __bw.val!=bw:
raise ValueError("Error while converting 'bw' parameter to 'x_int'")
__s = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecreatesksband(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__bw), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecreatesksband'")
__r__s = sparsematrix(__s)
return __r__s
finally:
pass
_lib_alglib.alglib_sparsecreatesksbandbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecreatesksbandbuf.restype = ctypes.c_int32
def sparsecreatesksbandbuf(m, n, bw, s):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__bw = x_int()
__bw.val = int(bw)
if __bw.val!=bw:
raise ValueError("Error while converting 'bw' parameter to 'x_int'")
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecreatesksbandbuf(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__bw), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecreatesksbandbuf'")
return
finally:
pass
_lib_alglib.alglib_sparsecopy.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecopy.restype = ctypes.c_int32
def sparsecopy(s0):
pass
__s0 = s0.ptr
__s1 = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecopy(ctypes.byref(_error_msg), ctypes.byref(__s0), ctypes.byref(__s1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecopy'")
__r__s1 = sparsematrix(__s1)
return __r__s1
finally:
pass
_lib_alglib.alglib_sparsecopybuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecopybuf.restype = ctypes.c_int32
def sparsecopybuf(s0, s1):
pass
__s0 = s0.ptr
__s1 = s1.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecopybuf(ctypes.byref(_error_msg), ctypes.byref(__s0), ctypes.byref(__s1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecopybuf'")
return
finally:
pass
_lib_alglib.alglib_sparseswap.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparseswap.restype = ctypes.c_int32
def sparseswap(s0, s1):
pass
__s0 = s0.ptr
__s1 = s1.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparseswap(ctypes.byref(_error_msg), ctypes.byref(__s0), ctypes.byref(__s1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparseswap'")
return
finally:
pass
_lib_alglib.alglib_sparseadd.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparseadd.restype = ctypes.c_int32
def sparseadd(s, i, j, v):
pass
__s = s.ptr
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
__j = x_int()
__j.val = int(j)
if __j.val!=j:
raise ValueError("Error while converting 'j' parameter to 'x_int'")
__v = ctypes.c_double(v)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparseadd(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__i), ctypes.byref(__j), ctypes.byref(__v))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparseadd'")
return
finally:
pass
_lib_alglib.alglib_sparseset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparseset.restype = ctypes.c_int32
def sparseset(s, i, j, v):
pass
__s = s.ptr
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
__j = x_int()
__j.val = int(j)
if __j.val!=j:
raise ValueError("Error while converting 'j' parameter to 'x_int'")
__v = ctypes.c_double(v)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparseset(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__i), ctypes.byref(__j), ctypes.byref(__v))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparseset'")
return
finally:
pass
_lib_alglib.alglib_sparseget.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparseget.restype = ctypes.c_int32
def sparseget(s, i, j):
pass
__result = ctypes.c_double(0)
__s = s.ptr
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
__j = x_int()
__j.val = int(j)
if __j.val!=j:
raise ValueError("Error while converting 'j' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparseget(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s), ctypes.byref(__i), ctypes.byref(__j))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparseget'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_sparsegetdiagonal.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsegetdiagonal.restype = ctypes.c_int32
def sparsegetdiagonal(s, i):
pass
__result = ctypes.c_double(0)
__s = s.ptr
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsegetdiagonal(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s), ctypes.byref(__i))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsegetdiagonal'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_sparsemv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsemv.restype = ctypes.c_int32
def sparsemv(s, x, y):
pass
__s = s.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsemv(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsemv'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_sparsemtv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsemtv.restype = ctypes.c_int32
def sparsemtv(s, x, y):
pass
__s = s.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsemtv(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsemtv'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_sparsemv2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsemv2.restype = ctypes.c_int32
def sparsemv2(s, x, y0, y1):
pass
__s = s.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y0):
raise ValueError("'y0' parameter can't be cast to real_vector")
__y0 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y1):
raise ValueError("'y1' parameter can't be cast to real_vector")
__y1 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y0, y0, DT_REAL, X_CREATE)
x_from_list(__y1, y1, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsemv2(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x), ctypes.byref(__y0), ctypes.byref(__y1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsemv2'")
__r__y0 = list_from_x(__y0)
__r__y1 = list_from_x(__y1)
return (__r__y0, __r__y1)
finally:
x_vector_clear(__x)
x_vector_clear(__y0)
x_vector_clear(__y1)
_lib_alglib.alglib_sparsesmv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsesmv.restype = ctypes.c_int32
def sparsesmv(s, isupper, x, y):
pass
__s = s.ptr
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsesmv(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__isupper), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsesmv'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_sparsevsmv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsevsmv.restype = ctypes.c_int32
def sparsevsmv(s, isupper, x):
pass
__result = ctypes.c_double(0)
__s = s.ptr
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsevsmv(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s), ctypes.byref(__isupper), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsevsmv'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__x)
_lib_alglib.alglib_sparsemm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsemm.restype = ctypes.c_int32
def sparsemm(s, a, k, b):
pass
__s = s.ptr
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsemm(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__a), ctypes.byref(__k), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsemm'")
__r__b = listlist_from_x(__b)
return __r__b
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_sparsemtm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsemtm.restype = ctypes.c_int32
def sparsemtm(s, a, k, b):
pass
__s = s.ptr
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsemtm(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__a), ctypes.byref(__k), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsemtm'")
__r__b = listlist_from_x(__b)
return __r__b
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_sparsemm2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsemm2.restype = ctypes.c_int32
def sparsemm2(s, a, k, b0, b1):
pass
__s = s.ptr
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
if not is_real_matrix(b0):
raise ValueError("'b0' parameter can't be cast to real_matrix")
__b0 = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(b1):
raise ValueError("'b1' parameter can't be cast to real_matrix")
__b1 = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b0, b0, DT_REAL, X_CREATE)
x_from_listlist(__b1, b1, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsemm2(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__a), ctypes.byref(__k), ctypes.byref(__b0), ctypes.byref(__b1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsemm2'")
__r__b0 = listlist_from_x(__b0)
__r__b1 = listlist_from_x(__b1)
return (__r__b0, __r__b1)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b0)
x_matrix_clear(__b1)
_lib_alglib.alglib_sparsesmm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsesmm.restype = ctypes.c_int32
def sparsesmm(s, isupper, a, k, b):
pass
__s = s.ptr
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsesmm(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__isupper), ctypes.byref(__a), ctypes.byref(__k), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsesmm'")
__r__b = listlist_from_x(__b)
return __r__b
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_sparsetrmv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsetrmv.restype = ctypes.c_int32
def sparsetrmv(s, isupper, isunit, optype, x, y):
pass
__s = s.ptr
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__optype = x_int()
__optype.val = int(optype)
if __optype.val!=optype:
raise ValueError("Error while converting 'optype' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsetrmv(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__optype), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsetrmv'")
__r__x = list_from_x(__x)
__r__y = list_from_x(__y)
return (__r__x, __r__y)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_sparsetrsv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsetrsv.restype = ctypes.c_int32
def sparsetrsv(s, isupper, isunit, optype, x):
pass
__s = s.ptr
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__optype = x_int()
__optype.val = int(optype)
if __optype.val!=optype:
raise ValueError("Error while converting 'optype' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsetrsv(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__optype), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsetrsv'")
__r__x = list_from_x(__x)
return __r__x
finally:
x_vector_clear(__x)
_lib_alglib.alglib_sparseresizematrix.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparseresizematrix.restype = ctypes.c_int32
def sparseresizematrix(s):
pass
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparseresizematrix(ctypes.byref(_error_msg), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparseresizematrix'")
return
finally:
pass
_lib_alglib.alglib_sparseenumerate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparseenumerate.restype = ctypes.c_int32
def sparseenumerate(s, t0, t1):
pass
__result = ctypes.c_uint8(0)
__s = s.ptr
__t0 = x_int()
__t0.val = int(t0)
if __t0.val!=t0:
raise ValueError("Error while converting 't0' parameter to 'x_int'")
__t1 = x_int()
__t1.val = int(t1)
if __t1.val!=t1:
raise ValueError("Error while converting 't1' parameter to 'x_int'")
__i = x_int()
__i.val = 0
__j = x_int()
__j.val = 0
__v = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparseenumerate(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s), ctypes.byref(__t0), ctypes.byref(__t1), ctypes.byref(__i), ctypes.byref(__j), ctypes.byref(__v))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparseenumerate'")
__r__result = __result.value!=0
__r__t0 = __t0.val
__r__t1 = __t1.val
__r__i = __i.val
__r__j = __j.val
__r__v = __v.value
return (__r__result, __r__t0, __r__t1, __r__i, __r__j, __r__v)
finally:
pass
_lib_alglib.alglib_sparserewriteexisting.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparserewriteexisting.restype = ctypes.c_int32
def sparserewriteexisting(s, i, j, v):
pass
__result = ctypes.c_uint8(0)
__s = s.ptr
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
__j = x_int()
__j.val = int(j)
if __j.val!=j:
raise ValueError("Error while converting 'j' parameter to 'x_int'")
__v = ctypes.c_double(v)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparserewriteexisting(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s), ctypes.byref(__i), ctypes.byref(__j), ctypes.byref(__v))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparserewriteexisting'")
__r__result = __result.value!=0
return __r__result
finally:
pass
_lib_alglib.alglib_sparsegetrow.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsegetrow.restype = ctypes.c_int32
def sparsegetrow(s, i, irow):
pass
__s = s.ptr
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
if not is_real_vector(irow):
raise ValueError("'irow' parameter can't be cast to real_vector")
__irow = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__irow, irow, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsegetrow(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__i), ctypes.byref(__irow))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsegetrow'")
__r__irow = list_from_x(__irow)
return __r__irow
finally:
x_vector_clear(__irow)
_lib_alglib.alglib_sparsegetcompressedrow.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsegetcompressedrow.restype = ctypes.c_int32
def sparsegetcompressedrow(s, i, colidx, vals):
pass
__s = s.ptr
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
if not is_int_vector(colidx):
raise ValueError("'colidx' parameter can't be cast to int_vector")
__colidx = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(vals):
raise ValueError("'vals' parameter can't be cast to real_vector")
__vals = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nzcnt = x_int()
__nzcnt.val = 0
try:
x_from_list(__colidx, colidx, DT_INT, X_CREATE)
x_from_list(__vals, vals, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsegetcompressedrow(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__i), ctypes.byref(__colidx), ctypes.byref(__vals), ctypes.byref(__nzcnt))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsegetcompressedrow'")
__r__colidx = list_from_x(__colidx)
__r__vals = list_from_x(__vals)
__r__nzcnt = __nzcnt.val
return (__r__colidx, __r__vals, __r__nzcnt)
finally:
x_vector_clear(__colidx)
x_vector_clear(__vals)
_lib_alglib.alglib_sparsetransposesks.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsetransposesks.restype = ctypes.c_int32
def sparsetransposesks(s):
pass
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsetransposesks(ctypes.byref(_error_msg), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsetransposesks'")
return
finally:
pass
_lib_alglib.alglib_sparseconvertto.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparseconvertto.restype = ctypes.c_int32
def sparseconvertto(s0, fmt):
pass
__s0 = s0.ptr
__fmt = x_int()
__fmt.val = int(fmt)
if __fmt.val!=fmt:
raise ValueError("Error while converting 'fmt' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparseconvertto(ctypes.byref(_error_msg), ctypes.byref(__s0), ctypes.byref(__fmt))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparseconvertto'")
return
finally:
pass
_lib_alglib.alglib_sparsecopytobuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecopytobuf.restype = ctypes.c_int32
def sparsecopytobuf(s0, fmt, s1):
pass
__s0 = s0.ptr
__fmt = x_int()
__fmt.val = int(fmt)
if __fmt.val!=fmt:
raise ValueError("Error while converting 'fmt' parameter to 'x_int'")
__s1 = s1.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecopytobuf(ctypes.byref(_error_msg), ctypes.byref(__s0), ctypes.byref(__fmt), ctypes.byref(__s1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecopytobuf'")
return
finally:
pass
_lib_alglib.alglib_sparseconverttohash.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparseconverttohash.restype = ctypes.c_int32
def sparseconverttohash(s):
pass
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparseconverttohash(ctypes.byref(_error_msg), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparseconverttohash'")
return
finally:
pass
_lib_alglib.alglib_sparsecopytohash.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecopytohash.restype = ctypes.c_int32
def sparsecopytohash(s0):
pass
__s0 = s0.ptr
__s1 = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecopytohash(ctypes.byref(_error_msg), ctypes.byref(__s0), ctypes.byref(__s1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecopytohash'")
__r__s1 = sparsematrix(__s1)
return __r__s1
finally:
pass
_lib_alglib.alglib_sparsecopytohashbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecopytohashbuf.restype = ctypes.c_int32
def sparsecopytohashbuf(s0, s1):
pass
__s0 = s0.ptr
__s1 = s1.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecopytohashbuf(ctypes.byref(_error_msg), ctypes.byref(__s0), ctypes.byref(__s1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecopytohashbuf'")
return
finally:
pass
_lib_alglib.alglib_sparseconverttocrs.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparseconverttocrs.restype = ctypes.c_int32
def sparseconverttocrs(s):
pass
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparseconverttocrs(ctypes.byref(_error_msg), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparseconverttocrs'")
return
finally:
pass
_lib_alglib.alglib_sparsecopytocrs.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecopytocrs.restype = ctypes.c_int32
def sparsecopytocrs(s0):
pass
__s0 = s0.ptr
__s1 = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecopytocrs(ctypes.byref(_error_msg), ctypes.byref(__s0), ctypes.byref(__s1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecopytocrs'")
__r__s1 = sparsematrix(__s1)
return __r__s1
finally:
pass
_lib_alglib.alglib_sparsecopytocrsbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecopytocrsbuf.restype = ctypes.c_int32
def sparsecopytocrsbuf(s0, s1):
pass
__s0 = s0.ptr
__s1 = s1.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecopytocrsbuf(ctypes.byref(_error_msg), ctypes.byref(__s0), ctypes.byref(__s1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecopytocrsbuf'")
return
finally:
pass
_lib_alglib.alglib_sparseconverttosks.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparseconverttosks.restype = ctypes.c_int32
def sparseconverttosks(s):
pass
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparseconverttosks(ctypes.byref(_error_msg), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparseconverttosks'")
return
finally:
pass
_lib_alglib.alglib_sparsecopytosks.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecopytosks.restype = ctypes.c_int32
def sparsecopytosks(s0):
pass
__s0 = s0.ptr
__s1 = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecopytosks(ctypes.byref(_error_msg), ctypes.byref(__s0), ctypes.byref(__s1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecopytosks'")
__r__s1 = sparsematrix(__s1)
return __r__s1
finally:
pass
_lib_alglib.alglib_sparsecopytosksbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecopytosksbuf.restype = ctypes.c_int32
def sparsecopytosksbuf(s0, s1):
pass
__s0 = s0.ptr
__s1 = s1.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecopytosksbuf(ctypes.byref(_error_msg), ctypes.byref(__s0), ctypes.byref(__s1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecopytosksbuf'")
return
finally:
pass
_lib_alglib.alglib_sparsegetmatrixtype.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsegetmatrixtype.restype = ctypes.c_int32
def sparsegetmatrixtype(s):
pass
__result = x_int()
__result.val = 0
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsegetmatrixtype(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsegetmatrixtype'")
__r__result = __result.val
return __r__result
finally:
pass
_lib_alglib.alglib_sparseishash.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparseishash.restype = ctypes.c_int32
def sparseishash(s):
pass
__result = ctypes.c_uint8(0)
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparseishash(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparseishash'")
__r__result = __result.value!=0
return __r__result
finally:
pass
_lib_alglib.alglib_sparseiscrs.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparseiscrs.restype = ctypes.c_int32
def sparseiscrs(s):
pass
__result = ctypes.c_uint8(0)
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparseiscrs(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparseiscrs'")
__r__result = __result.value!=0
return __r__result
finally:
pass
_lib_alglib.alglib_sparseissks.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparseissks.restype = ctypes.c_int32
def sparseissks(s):
pass
__result = ctypes.c_uint8(0)
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparseissks(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparseissks'")
__r__result = __result.value!=0
return __r__result
finally:
pass
_lib_alglib.alglib_sparsefree.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsefree.restype = ctypes.c_int32
def sparsefree():
pass
__s = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsefree(ctypes.byref(_error_msg), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsefree'")
__r__s = sparsematrix(__s)
return __r__s
finally:
pass
_lib_alglib.alglib_sparsegetnrows.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsegetnrows.restype = ctypes.c_int32
def sparsegetnrows(s):
pass
__result = x_int()
__result.val = 0
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsegetnrows(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsegetnrows'")
__r__result = __result.val
return __r__result
finally:
pass
_lib_alglib.alglib_sparsegetncols.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsegetncols.restype = ctypes.c_int32
def sparsegetncols(s):
pass
__result = x_int()
__result.val = 0
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsegetncols(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsegetncols'")
__r__result = __result.val
return __r__result
finally:
pass
_lib_alglib.alglib_sparsegetuppercount.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsegetuppercount.restype = ctypes.c_int32
def sparsegetuppercount(s):
pass
__result = x_int()
__result.val = 0
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsegetuppercount(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsegetuppercount'")
__r__result = __result.val
return __r__result
finally:
pass
_lib_alglib.alglib_sparsegetlowercount.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsegetlowercount.restype = ctypes.c_int32
def sparsegetlowercount(s):
pass
__result = x_int()
__result.val = 0
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsegetlowercount(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsegetlowercount'")
__r__result = __result.val
return __r__result
finally:
pass
_lib_alglib.alglib_cmatrixtranspose.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixtranspose.restype = ctypes.c_int32
def cmatrixtranspose(m, n, a, ia, ja, b, ib, jb):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ib = x_int()
__ib.val = int(ib)
if __ib.val!=ib:
raise ValueError("Error while converting 'ib' parameter to 'x_int'")
__jb = x_int()
__jb.val = int(jb)
if __jb.val!=jb:
raise ValueError("Error while converting 'jb' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixtranspose(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__b), ctypes.byref(__ib), ctypes.byref(__jb))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixtranspose'")
__r__b = listlist_from_x(__b)
return __r__b
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_rmatrixtranspose.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixtranspose.restype = ctypes.c_int32
def rmatrixtranspose(m, n, a, ia, ja, b, ib, jb):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ib = x_int()
__ib.val = int(ib)
if __ib.val!=ib:
raise ValueError("Error while converting 'ib' parameter to 'x_int'")
__jb = x_int()
__jb.val = int(jb)
if __jb.val!=jb:
raise ValueError("Error while converting 'jb' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixtranspose(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__b), ctypes.byref(__ib), ctypes.byref(__jb))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixtranspose'")
__r__b = listlist_from_x(__b)
return __r__b
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_rmatrixenforcesymmetricity.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixenforcesymmetricity.restype = ctypes.c_int32
def rmatrixenforcesymmetricity(a, n, isupper):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixenforcesymmetricity(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixenforcesymmetricity'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_cmatrixcopy.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixcopy.restype = ctypes.c_int32
def cmatrixcopy(m, n, a, ia, ja, b, ib, jb):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ib = x_int()
__ib.val = int(ib)
if __ib.val!=ib:
raise ValueError("Error while converting 'ib' parameter to 'x_int'")
__jb = x_int()
__jb.val = int(jb)
if __jb.val!=jb:
raise ValueError("Error while converting 'jb' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixcopy(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__b), ctypes.byref(__ib), ctypes.byref(__jb))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixcopy'")
__r__b = listlist_from_x(__b)
return __r__b
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_rmatrixcopy.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixcopy.restype = ctypes.c_int32
def rmatrixcopy(m, n, a, ia, ja, b, ib, jb):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ib = x_int()
__ib.val = int(ib)
if __ib.val!=ib:
raise ValueError("Error while converting 'ib' parameter to 'x_int'")
__jb = x_int()
__jb.val = int(jb)
if __jb.val!=jb:
raise ValueError("Error while converting 'jb' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixcopy(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__b), ctypes.byref(__ib), ctypes.byref(__jb))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixcopy'")
__r__b = listlist_from_x(__b)
return __r__b
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_rmatrixger.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixger.restype = ctypes.c_int32
def rmatrixger(m, n, a, ia, ja, alpha, u, iu, v, iv):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
if not is_real_vector(u):
raise ValueError("'u' parameter can't be cast to real_vector")
__u = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__iu = x_int()
__iu.val = int(iu)
if __iu.val!=iu:
raise ValueError("Error while converting 'iu' parameter to 'x_int'")
if not is_real_vector(v):
raise ValueError("'v' parameter can't be cast to real_vector")
__v = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__iv = x_int()
__iv.val = int(iv)
if __iv.val!=iv:
raise ValueError("Error while converting 'iv' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__u, u, DT_REAL, X_CREATE)
x_from_list(__v, v, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixger(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__alpha), ctypes.byref(__u), ctypes.byref(__iu), ctypes.byref(__v), ctypes.byref(__iv))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixger'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
x_vector_clear(__u)
x_vector_clear(__v)
_lib_alglib.alglib_cmatrixrank1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixrank1.restype = ctypes.c_int32
def cmatrixrank1(m, n, a, ia, ja, u, iu, v, iv):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
if not is_complex_vector(u):
raise ValueError("'u' parameter can't be cast to complex_vector")
__u = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__iu = x_int()
__iu.val = int(iu)
if __iu.val!=iu:
raise ValueError("Error while converting 'iu' parameter to 'x_int'")
if not is_complex_vector(v):
raise ValueError("'v' parameter can't be cast to complex_vector")
__v = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__iv = x_int()
__iv.val = int(iv)
if __iv.val!=iv:
raise ValueError("Error while converting 'iv' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__u, u, DT_COMPLEX, X_CREATE)
x_from_list(__v, v, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixrank1(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__u), ctypes.byref(__iu), ctypes.byref(__v), ctypes.byref(__iv))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixrank1'")
__r__a = listlist_from_x(__a)
__r__u = list_from_x(__u)
__r__v = list_from_x(__v)
return (__r__a, __r__u, __r__v)
finally:
x_matrix_clear(__a)
x_vector_clear(__u)
x_vector_clear(__v)
_lib_alglib.alglib_rmatrixrank1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixrank1.restype = ctypes.c_int32
def rmatrixrank1(m, n, a, ia, ja, u, iu, v, iv):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
if not is_real_vector(u):
raise ValueError("'u' parameter can't be cast to real_vector")
__u = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__iu = x_int()
__iu.val = int(iu)
if __iu.val!=iu:
raise ValueError("Error while converting 'iu' parameter to 'x_int'")
if not is_real_vector(v):
raise ValueError("'v' parameter can't be cast to real_vector")
__v = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__iv = x_int()
__iv.val = int(iv)
if __iv.val!=iv:
raise ValueError("Error while converting 'iv' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__u, u, DT_REAL, X_CREATE)
x_from_list(__v, v, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixrank1(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__u), ctypes.byref(__iu), ctypes.byref(__v), ctypes.byref(__iv))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixrank1'")
__r__a = listlist_from_x(__a)
__r__u = list_from_x(__u)
__r__v = list_from_x(__v)
return (__r__a, __r__u, __r__v)
finally:
x_matrix_clear(__a)
x_vector_clear(__u)
x_vector_clear(__v)
_lib_alglib.alglib_rmatrixgemv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixgemv.restype = ctypes.c_int32
def rmatrixgemv(m, n, alpha, a, ia, ja, opa, x, ix, beta, y, iy):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__opa = x_int()
__opa.val = int(opa)
if __opa.val!=opa:
raise ValueError("Error while converting 'opa' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ix = x_int()
__ix.val = int(ix)
if __ix.val!=ix:
raise ValueError("Error while converting 'ix' parameter to 'x_int'")
__beta = ctypes.c_double(beta)
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__iy = x_int()
__iy.val = int(iy)
if __iy.val!=iy:
raise ValueError("Error while converting 'iy' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixgemv(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__alpha), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__opa), ctypes.byref(__x), ctypes.byref(__ix), ctypes.byref(__beta), ctypes.byref(__y), ctypes.byref(__iy))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixgemv'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_matrix_clear(__a)
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_cmatrixmv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixmv.restype = ctypes.c_int32
def cmatrixmv(m, n, a, ia, ja, opa, x, ix, y, iy):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__opa = x_int()
__opa.val = int(opa)
if __opa.val!=opa:
raise ValueError("Error while converting 'opa' parameter to 'x_int'")
if not is_complex_vector(x):
raise ValueError("'x' parameter can't be cast to complex_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ix = x_int()
__ix.val = int(ix)
if __ix.val!=ix:
raise ValueError("Error while converting 'ix' parameter to 'x_int'")
if not is_complex_vector(y):
raise ValueError("'y' parameter can't be cast to complex_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__iy = x_int()
__iy.val = int(iy)
if __iy.val!=iy:
raise ValueError("Error while converting 'iy' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__x, x, DT_COMPLEX, X_CREATE)
x_from_list(__y, y, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixmv(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__opa), ctypes.byref(__x), ctypes.byref(__ix), ctypes.byref(__y), ctypes.byref(__iy))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixmv'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_matrix_clear(__a)
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_rmatrixmv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixmv.restype = ctypes.c_int32
def rmatrixmv(m, n, a, ia, ja, opa, x, ix, y, iy):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__opa = x_int()
__opa.val = int(opa)
if __opa.val!=opa:
raise ValueError("Error while converting 'opa' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ix = x_int()
__ix.val = int(ix)
if __ix.val!=ix:
raise ValueError("Error while converting 'ix' parameter to 'x_int'")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__iy = x_int()
__iy.val = int(iy)
if __iy.val!=iy:
raise ValueError("Error while converting 'iy' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixmv(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__opa), ctypes.byref(__x), ctypes.byref(__ix), ctypes.byref(__y), ctypes.byref(__iy))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixmv'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_matrix_clear(__a)
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_rmatrixsymv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixsymv.restype = ctypes.c_int32
def rmatrixsymv(n, alpha, a, ia, ja, isupper, x, ix, beta, y, iy):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ix = x_int()
__ix.val = int(ix)
if __ix.val!=ix:
raise ValueError("Error while converting 'ix' parameter to 'x_int'")
__beta = ctypes.c_double(beta)
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__iy = x_int()
__iy.val = int(iy)
if __iy.val!=iy:
raise ValueError("Error while converting 'iy' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixsymv(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__alpha), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__isupper), ctypes.byref(__x), ctypes.byref(__ix), ctypes.byref(__beta), ctypes.byref(__y), ctypes.byref(__iy))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixsymv'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_matrix_clear(__a)
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_rmatrixsyvmv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixsyvmv.restype = ctypes.c_int32
def rmatrixsyvmv(n, a, ia, ja, isupper, x, ix, tmp):
pass
__result = ctypes.c_double(0)
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ix = x_int()
__ix.val = int(ix)
if __ix.val!=ix:
raise ValueError("Error while converting 'ix' parameter to 'x_int'")
if not is_real_vector(tmp):
raise ValueError("'tmp' parameter can't be cast to real_vector")
__tmp = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__tmp, tmp, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixsyvmv(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__isupper), ctypes.byref(__x), ctypes.byref(__ix), ctypes.byref(__tmp))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixsyvmv'")
__r__result = __result.value
__r__tmp = list_from_x(__tmp)
return (__r__result, __r__tmp)
finally:
x_matrix_clear(__a)
x_vector_clear(__x)
x_vector_clear(__tmp)
_lib_alglib.alglib_rmatrixtrsv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixtrsv.restype = ctypes.c_int32
def rmatrixtrsv(n, a, ia, ja, isupper, isunit, optype, x, ix):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__optype = x_int()
__optype.val = int(optype)
if __optype.val!=optype:
raise ValueError("Error while converting 'optype' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ix = x_int()
__ix.val = int(ix)
if __ix.val!=ix:
raise ValueError("Error while converting 'ix' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixtrsv(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__optype), ctypes.byref(__x), ctypes.byref(__ix))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixtrsv'")
__r__x = list_from_x(__x)
return __r__x
finally:
x_matrix_clear(__a)
x_vector_clear(__x)
_lib_alglib.alglib_cmatrixrighttrsm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixrighttrsm.restype = ctypes.c_int32
def cmatrixrighttrsm(m, n, a, i1, j1, isupper, isunit, optype, x, i2, j2):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i1 = x_int()
__i1.val = int(i1)
if __i1.val!=i1:
raise ValueError("Error while converting 'i1' parameter to 'x_int'")
__j1 = x_int()
__j1.val = int(j1)
if __j1.val!=j1:
raise ValueError("Error while converting 'j1' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__optype = x_int()
__optype.val = int(optype)
if __optype.val!=optype:
raise ValueError("Error while converting 'optype' parameter to 'x_int'")
if not is_complex_matrix(x):
raise ValueError("'x' parameter can't be cast to complex_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i2 = x_int()
__i2.val = int(i2)
if __i2.val!=i2:
raise ValueError("Error while converting 'i2' parameter to 'x_int'")
__j2 = x_int()
__j2.val = int(j2)
if __j2.val!=j2:
raise ValueError("Error while converting 'j2' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__x, x, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixrighttrsm(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__i1), ctypes.byref(__j1), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__optype), ctypes.byref(__x), ctypes.byref(__i2), ctypes.byref(__j2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixrighttrsm'")
__r__x = listlist_from_x(__x)
return __r__x
finally:
x_matrix_clear(__a)
x_matrix_clear(__x)
_lib_alglib.alglib_smp_cmatrixrighttrsm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixrighttrsm.restype = ctypes.c_int32
def smp_cmatrixrighttrsm(m, n, a, i1, j1, isupper, isunit, optype, x, i2, j2):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i1 = x_int()
__i1.val = int(i1)
if __i1.val!=i1:
raise ValueError("Error while converting 'i1' parameter to 'x_int'")
__j1 = x_int()
__j1.val = int(j1)
if __j1.val!=j1:
raise ValueError("Error while converting 'j1' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__optype = x_int()
__optype.val = int(optype)
if __optype.val!=optype:
raise ValueError("Error while converting 'optype' parameter to 'x_int'")
if not is_complex_matrix(x):
raise ValueError("'x' parameter can't be cast to complex_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i2 = x_int()
__i2.val = int(i2)
if __i2.val!=i2:
raise ValueError("Error while converting 'i2' parameter to 'x_int'")
__j2 = x_int()
__j2.val = int(j2)
if __j2.val!=j2:
raise ValueError("Error while converting 'j2' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__x, x, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixrighttrsm(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__i1), ctypes.byref(__j1), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__optype), ctypes.byref(__x), ctypes.byref(__i2), ctypes.byref(__j2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixrighttrsm'")
__r__x = listlist_from_x(__x)
return __r__x
finally:
x_matrix_clear(__a)
x_matrix_clear(__x)
_lib_alglib.alglib_cmatrixlefttrsm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixlefttrsm.restype = ctypes.c_int32
def cmatrixlefttrsm(m, n, a, i1, j1, isupper, isunit, optype, x, i2, j2):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i1 = x_int()
__i1.val = int(i1)
if __i1.val!=i1:
raise ValueError("Error while converting 'i1' parameter to 'x_int'")
__j1 = x_int()
__j1.val = int(j1)
if __j1.val!=j1:
raise ValueError("Error while converting 'j1' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__optype = x_int()
__optype.val = int(optype)
if __optype.val!=optype:
raise ValueError("Error while converting 'optype' parameter to 'x_int'")
if not is_complex_matrix(x):
raise ValueError("'x' parameter can't be cast to complex_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i2 = x_int()
__i2.val = int(i2)
if __i2.val!=i2:
raise ValueError("Error while converting 'i2' parameter to 'x_int'")
__j2 = x_int()
__j2.val = int(j2)
if __j2.val!=j2:
raise ValueError("Error while converting 'j2' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__x, x, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixlefttrsm(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__i1), ctypes.byref(__j1), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__optype), ctypes.byref(__x), ctypes.byref(__i2), ctypes.byref(__j2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixlefttrsm'")
__r__x = listlist_from_x(__x)
return __r__x
finally:
x_matrix_clear(__a)
x_matrix_clear(__x)
_lib_alglib.alglib_smp_cmatrixlefttrsm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixlefttrsm.restype = ctypes.c_int32
def smp_cmatrixlefttrsm(m, n, a, i1, j1, isupper, isunit, optype, x, i2, j2):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i1 = x_int()
__i1.val = int(i1)
if __i1.val!=i1:
raise ValueError("Error while converting 'i1' parameter to 'x_int'")
__j1 = x_int()
__j1.val = int(j1)
if __j1.val!=j1:
raise ValueError("Error while converting 'j1' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__optype = x_int()
__optype.val = int(optype)
if __optype.val!=optype:
raise ValueError("Error while converting 'optype' parameter to 'x_int'")
if not is_complex_matrix(x):
raise ValueError("'x' parameter can't be cast to complex_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i2 = x_int()
__i2.val = int(i2)
if __i2.val!=i2:
raise ValueError("Error while converting 'i2' parameter to 'x_int'")
__j2 = x_int()
__j2.val = int(j2)
if __j2.val!=j2:
raise ValueError("Error while converting 'j2' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__x, x, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixlefttrsm(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__i1), ctypes.byref(__j1), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__optype), ctypes.byref(__x), ctypes.byref(__i2), ctypes.byref(__j2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixlefttrsm'")
__r__x = listlist_from_x(__x)
return __r__x
finally:
x_matrix_clear(__a)
x_matrix_clear(__x)
_lib_alglib.alglib_rmatrixrighttrsm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixrighttrsm.restype = ctypes.c_int32
def rmatrixrighttrsm(m, n, a, i1, j1, isupper, isunit, optype, x, i2, j2):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i1 = x_int()
__i1.val = int(i1)
if __i1.val!=i1:
raise ValueError("Error while converting 'i1' parameter to 'x_int'")
__j1 = x_int()
__j1.val = int(j1)
if __j1.val!=j1:
raise ValueError("Error while converting 'j1' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__optype = x_int()
__optype.val = int(optype)
if __optype.val!=optype:
raise ValueError("Error while converting 'optype' parameter to 'x_int'")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i2 = x_int()
__i2.val = int(i2)
if __i2.val!=i2:
raise ValueError("Error while converting 'i2' parameter to 'x_int'")
__j2 = x_int()
__j2.val = int(j2)
if __j2.val!=j2:
raise ValueError("Error while converting 'j2' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixrighttrsm(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__i1), ctypes.byref(__j1), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__optype), ctypes.byref(__x), ctypes.byref(__i2), ctypes.byref(__j2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixrighttrsm'")
__r__x = listlist_from_x(__x)
return __r__x
finally:
x_matrix_clear(__a)
x_matrix_clear(__x)
_lib_alglib.alglib_smp_rmatrixrighttrsm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixrighttrsm.restype = ctypes.c_int32
def smp_rmatrixrighttrsm(m, n, a, i1, j1, isupper, isunit, optype, x, i2, j2):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i1 = x_int()
__i1.val = int(i1)
if __i1.val!=i1:
raise ValueError("Error while converting 'i1' parameter to 'x_int'")
__j1 = x_int()
__j1.val = int(j1)
if __j1.val!=j1:
raise ValueError("Error while converting 'j1' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__optype = x_int()
__optype.val = int(optype)
if __optype.val!=optype:
raise ValueError("Error while converting 'optype' parameter to 'x_int'")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i2 = x_int()
__i2.val = int(i2)
if __i2.val!=i2:
raise ValueError("Error while converting 'i2' parameter to 'x_int'")
__j2 = x_int()
__j2.val = int(j2)
if __j2.val!=j2:
raise ValueError("Error while converting 'j2' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixrighttrsm(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__i1), ctypes.byref(__j1), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__optype), ctypes.byref(__x), ctypes.byref(__i2), ctypes.byref(__j2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixrighttrsm'")
__r__x = listlist_from_x(__x)
return __r__x
finally:
x_matrix_clear(__a)
x_matrix_clear(__x)
_lib_alglib.alglib_rmatrixlefttrsm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixlefttrsm.restype = ctypes.c_int32
def rmatrixlefttrsm(m, n, a, i1, j1, isupper, isunit, optype, x, i2, j2):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i1 = x_int()
__i1.val = int(i1)
if __i1.val!=i1:
raise ValueError("Error while converting 'i1' parameter to 'x_int'")
__j1 = x_int()
__j1.val = int(j1)
if __j1.val!=j1:
raise ValueError("Error while converting 'j1' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__optype = x_int()
__optype.val = int(optype)
if __optype.val!=optype:
raise ValueError("Error while converting 'optype' parameter to 'x_int'")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i2 = x_int()
__i2.val = int(i2)
if __i2.val!=i2:
raise ValueError("Error while converting 'i2' parameter to 'x_int'")
__j2 = x_int()
__j2.val = int(j2)
if __j2.val!=j2:
raise ValueError("Error while converting 'j2' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixlefttrsm(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__i1), ctypes.byref(__j1), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__optype), ctypes.byref(__x), ctypes.byref(__i2), ctypes.byref(__j2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixlefttrsm'")
__r__x = listlist_from_x(__x)
return __r__x
finally:
x_matrix_clear(__a)
x_matrix_clear(__x)
_lib_alglib.alglib_smp_rmatrixlefttrsm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixlefttrsm.restype = ctypes.c_int32
def smp_rmatrixlefttrsm(m, n, a, i1, j1, isupper, isunit, optype, x, i2, j2):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i1 = x_int()
__i1.val = int(i1)
if __i1.val!=i1:
raise ValueError("Error while converting 'i1' parameter to 'x_int'")
__j1 = x_int()
__j1.val = int(j1)
if __j1.val!=j1:
raise ValueError("Error while converting 'j1' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__optype = x_int()
__optype.val = int(optype)
if __optype.val!=optype:
raise ValueError("Error while converting 'optype' parameter to 'x_int'")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__i2 = x_int()
__i2.val = int(i2)
if __i2.val!=i2:
raise ValueError("Error while converting 'i2' parameter to 'x_int'")
__j2 = x_int()
__j2.val = int(j2)
if __j2.val!=j2:
raise ValueError("Error while converting 'j2' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixlefttrsm(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__i1), ctypes.byref(__j1), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__optype), ctypes.byref(__x), ctypes.byref(__i2), ctypes.byref(__j2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixlefttrsm'")
__r__x = listlist_from_x(__x)
return __r__x
finally:
x_matrix_clear(__a)
x_matrix_clear(__x)
_lib_alglib.alglib_cmatrixherk.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixherk.restype = ctypes.c_int32
def cmatrixherk(n, k, alpha, a, ia, ja, optypea, beta, c, ic, jc, isupper):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__optypea = x_int()
__optypea.val = int(optypea)
if __optypea.val!=optypea:
raise ValueError("Error while converting 'optypea' parameter to 'x_int'")
__beta = ctypes.c_double(beta)
if not is_complex_matrix(c):
raise ValueError("'c' parameter can't be cast to complex_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ic = x_int()
__ic.val = int(ic)
if __ic.val!=ic:
raise ValueError("Error while converting 'ic' parameter to 'x_int'")
__jc = x_int()
__jc.val = int(jc)
if __jc.val!=jc:
raise ValueError("Error while converting 'jc' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__c, c, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixherk(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__k), ctypes.byref(__alpha), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__optypea), ctypes.byref(__beta), ctypes.byref(__c), ctypes.byref(__ic), ctypes.byref(__jc), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixherk'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__a)
x_matrix_clear(__c)
_lib_alglib.alglib_smp_cmatrixherk.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixherk.restype = ctypes.c_int32
def smp_cmatrixherk(n, k, alpha, a, ia, ja, optypea, beta, c, ic, jc, isupper):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__optypea = x_int()
__optypea.val = int(optypea)
if __optypea.val!=optypea:
raise ValueError("Error while converting 'optypea' parameter to 'x_int'")
__beta = ctypes.c_double(beta)
if not is_complex_matrix(c):
raise ValueError("'c' parameter can't be cast to complex_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ic = x_int()
__ic.val = int(ic)
if __ic.val!=ic:
raise ValueError("Error while converting 'ic' parameter to 'x_int'")
__jc = x_int()
__jc.val = int(jc)
if __jc.val!=jc:
raise ValueError("Error while converting 'jc' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__c, c, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixherk(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__k), ctypes.byref(__alpha), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__optypea), ctypes.byref(__beta), ctypes.byref(__c), ctypes.byref(__ic), ctypes.byref(__jc), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixherk'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__a)
x_matrix_clear(__c)
_lib_alglib.alglib_rmatrixsyrk.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixsyrk.restype = ctypes.c_int32
def rmatrixsyrk(n, k, alpha, a, ia, ja, optypea, beta, c, ic, jc, isupper):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__optypea = x_int()
__optypea.val = int(optypea)
if __optypea.val!=optypea:
raise ValueError("Error while converting 'optypea' parameter to 'x_int'")
__beta = ctypes.c_double(beta)
if not is_real_matrix(c):
raise ValueError("'c' parameter can't be cast to real_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ic = x_int()
__ic.val = int(ic)
if __ic.val!=ic:
raise ValueError("Error while converting 'ic' parameter to 'x_int'")
__jc = x_int()
__jc.val = int(jc)
if __jc.val!=jc:
raise ValueError("Error while converting 'jc' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__c, c, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixsyrk(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__k), ctypes.byref(__alpha), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__optypea), ctypes.byref(__beta), ctypes.byref(__c), ctypes.byref(__ic), ctypes.byref(__jc), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixsyrk'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__a)
x_matrix_clear(__c)
_lib_alglib.alglib_smp_rmatrixsyrk.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixsyrk.restype = ctypes.c_int32
def smp_rmatrixsyrk(n, k, alpha, a, ia, ja, optypea, beta, c, ic, jc, isupper):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__optypea = x_int()
__optypea.val = int(optypea)
if __optypea.val!=optypea:
raise ValueError("Error while converting 'optypea' parameter to 'x_int'")
__beta = ctypes.c_double(beta)
if not is_real_matrix(c):
raise ValueError("'c' parameter can't be cast to real_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ic = x_int()
__ic.val = int(ic)
if __ic.val!=ic:
raise ValueError("Error while converting 'ic' parameter to 'x_int'")
__jc = x_int()
__jc.val = int(jc)
if __jc.val!=jc:
raise ValueError("Error while converting 'jc' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__c, c, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixsyrk(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__k), ctypes.byref(__alpha), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__optypea), ctypes.byref(__beta), ctypes.byref(__c), ctypes.byref(__ic), ctypes.byref(__jc), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixsyrk'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__a)
x_matrix_clear(__c)
_lib_alglib.alglib_cmatrixgemm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixgemm.restype = ctypes.c_int32
def cmatrixgemm(m, n, k, alpha, a, ia, ja, optypea, b, ib, jb, optypeb, beta, c, ic, jc):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__tmp__val = complex(alpha)
__alpha = x_complex(x=__tmp__val.real, y=__tmp__val.imag)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__optypea = x_int()
__optypea.val = int(optypea)
if __optypea.val!=optypea:
raise ValueError("Error while converting 'optypea' parameter to 'x_int'")
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ib = x_int()
__ib.val = int(ib)
if __ib.val!=ib:
raise ValueError("Error while converting 'ib' parameter to 'x_int'")
__jb = x_int()
__jb.val = int(jb)
if __jb.val!=jb:
raise ValueError("Error while converting 'jb' parameter to 'x_int'")
__optypeb = x_int()
__optypeb.val = int(optypeb)
if __optypeb.val!=optypeb:
raise ValueError("Error while converting 'optypeb' parameter to 'x_int'")
__tmp__val = complex(beta)
__beta = x_complex(x=__tmp__val.real, y=__tmp__val.imag)
if not is_complex_matrix(c):
raise ValueError("'c' parameter can't be cast to complex_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ic = x_int()
__ic.val = int(ic)
if __ic.val!=ic:
raise ValueError("Error while converting 'ic' parameter to 'x_int'")
__jc = x_int()
__jc.val = int(jc)
if __jc.val!=jc:
raise ValueError("Error while converting 'jc' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
x_from_listlist(__c, c, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixgemm(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__k), ctypes.byref(__alpha), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__optypea), ctypes.byref(__b), ctypes.byref(__ib), ctypes.byref(__jb), ctypes.byref(__optypeb), ctypes.byref(__beta), ctypes.byref(__c), ctypes.byref(__ic), ctypes.byref(__jc))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixgemm'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_matrix_clear(__c)
_lib_alglib.alglib_smp_cmatrixgemm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixgemm.restype = ctypes.c_int32
def smp_cmatrixgemm(m, n, k, alpha, a, ia, ja, optypea, b, ib, jb, optypeb, beta, c, ic, jc):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__tmp__val = complex(alpha)
__alpha = x_complex(x=__tmp__val.real, y=__tmp__val.imag)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__optypea = x_int()
__optypea.val = int(optypea)
if __optypea.val!=optypea:
raise ValueError("Error while converting 'optypea' parameter to 'x_int'")
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ib = x_int()
__ib.val = int(ib)
if __ib.val!=ib:
raise ValueError("Error while converting 'ib' parameter to 'x_int'")
__jb = x_int()
__jb.val = int(jb)
if __jb.val!=jb:
raise ValueError("Error while converting 'jb' parameter to 'x_int'")
__optypeb = x_int()
__optypeb.val = int(optypeb)
if __optypeb.val!=optypeb:
raise ValueError("Error while converting 'optypeb' parameter to 'x_int'")
__tmp__val = complex(beta)
__beta = x_complex(x=__tmp__val.real, y=__tmp__val.imag)
if not is_complex_matrix(c):
raise ValueError("'c' parameter can't be cast to complex_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ic = x_int()
__ic.val = int(ic)
if __ic.val!=ic:
raise ValueError("Error while converting 'ic' parameter to 'x_int'")
__jc = x_int()
__jc.val = int(jc)
if __jc.val!=jc:
raise ValueError("Error while converting 'jc' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
x_from_listlist(__c, c, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixgemm(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__k), ctypes.byref(__alpha), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__optypea), ctypes.byref(__b), ctypes.byref(__ib), ctypes.byref(__jb), ctypes.byref(__optypeb), ctypes.byref(__beta), ctypes.byref(__c), ctypes.byref(__ic), ctypes.byref(__jc))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixgemm'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_matrix_clear(__c)
_lib_alglib.alglib_rmatrixgemm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixgemm.restype = ctypes.c_int32
def rmatrixgemm(m, n, k, alpha, a, ia, ja, optypea, b, ib, jb, optypeb, beta, c, ic, jc):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__optypea = x_int()
__optypea.val = int(optypea)
if __optypea.val!=optypea:
raise ValueError("Error while converting 'optypea' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ib = x_int()
__ib.val = int(ib)
if __ib.val!=ib:
raise ValueError("Error while converting 'ib' parameter to 'x_int'")
__jb = x_int()
__jb.val = int(jb)
if __jb.val!=jb:
raise ValueError("Error while converting 'jb' parameter to 'x_int'")
__optypeb = x_int()
__optypeb.val = int(optypeb)
if __optypeb.val!=optypeb:
raise ValueError("Error while converting 'optypeb' parameter to 'x_int'")
__beta = ctypes.c_double(beta)
if not is_real_matrix(c):
raise ValueError("'c' parameter can't be cast to real_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ic = x_int()
__ic.val = int(ic)
if __ic.val!=ic:
raise ValueError("Error while converting 'ic' parameter to 'x_int'")
__jc = x_int()
__jc.val = int(jc)
if __jc.val!=jc:
raise ValueError("Error while converting 'jc' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
x_from_listlist(__c, c, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixgemm(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__k), ctypes.byref(__alpha), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__optypea), ctypes.byref(__b), ctypes.byref(__ib), ctypes.byref(__jb), ctypes.byref(__optypeb), ctypes.byref(__beta), ctypes.byref(__c), ctypes.byref(__ic), ctypes.byref(__jc))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixgemm'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_matrix_clear(__c)
_lib_alglib.alglib_smp_rmatrixgemm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixgemm.restype = ctypes.c_int32
def smp_rmatrixgemm(m, n, k, alpha, a, ia, ja, optypea, b, ib, jb, optypeb, beta, c, ic, jc):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__optypea = x_int()
__optypea.val = int(optypea)
if __optypea.val!=optypea:
raise ValueError("Error while converting 'optypea' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ib = x_int()
__ib.val = int(ib)
if __ib.val!=ib:
raise ValueError("Error while converting 'ib' parameter to 'x_int'")
__jb = x_int()
__jb.val = int(jb)
if __jb.val!=jb:
raise ValueError("Error while converting 'jb' parameter to 'x_int'")
__optypeb = x_int()
__optypeb.val = int(optypeb)
if __optypeb.val!=optypeb:
raise ValueError("Error while converting 'optypeb' parameter to 'x_int'")
__beta = ctypes.c_double(beta)
if not is_real_matrix(c):
raise ValueError("'c' parameter can't be cast to real_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ic = x_int()
__ic.val = int(ic)
if __ic.val!=ic:
raise ValueError("Error while converting 'ic' parameter to 'x_int'")
__jc = x_int()
__jc.val = int(jc)
if __jc.val!=jc:
raise ValueError("Error while converting 'jc' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
x_from_listlist(__c, c, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixgemm(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__k), ctypes.byref(__alpha), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__optypea), ctypes.byref(__b), ctypes.byref(__ib), ctypes.byref(__jb), ctypes.byref(__optypeb), ctypes.byref(__beta), ctypes.byref(__c), ctypes.byref(__ic), ctypes.byref(__jc))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixgemm'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_matrix_clear(__c)
_lib_alglib.alglib_cmatrixsyrk.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixsyrk.restype = ctypes.c_int32
def cmatrixsyrk(n, k, alpha, a, ia, ja, optypea, beta, c, ic, jc, isupper):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__optypea = x_int()
__optypea.val = int(optypea)
if __optypea.val!=optypea:
raise ValueError("Error while converting 'optypea' parameter to 'x_int'")
__beta = ctypes.c_double(beta)
if not is_complex_matrix(c):
raise ValueError("'c' parameter can't be cast to complex_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ic = x_int()
__ic.val = int(ic)
if __ic.val!=ic:
raise ValueError("Error while converting 'ic' parameter to 'x_int'")
__jc = x_int()
__jc.val = int(jc)
if __jc.val!=jc:
raise ValueError("Error while converting 'jc' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__c, c, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixsyrk(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__k), ctypes.byref(__alpha), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__optypea), ctypes.byref(__beta), ctypes.byref(__c), ctypes.byref(__ic), ctypes.byref(__jc), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixsyrk'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__a)
x_matrix_clear(__c)
_lib_alglib.alglib_smp_cmatrixsyrk.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixsyrk.restype = ctypes.c_int32
def smp_cmatrixsyrk(n, k, alpha, a, ia, ja, optypea, beta, c, ic, jc, isupper):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ia = x_int()
__ia.val = int(ia)
if __ia.val!=ia:
raise ValueError("Error while converting 'ia' parameter to 'x_int'")
__ja = x_int()
__ja.val = int(ja)
if __ja.val!=ja:
raise ValueError("Error while converting 'ja' parameter to 'x_int'")
__optypea = x_int()
__optypea.val = int(optypea)
if __optypea.val!=optypea:
raise ValueError("Error while converting 'optypea' parameter to 'x_int'")
__beta = ctypes.c_double(beta)
if not is_complex_matrix(c):
raise ValueError("'c' parameter can't be cast to complex_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ic = x_int()
__ic.val = int(ic)
if __ic.val!=ic:
raise ValueError("Error while converting 'ic' parameter to 'x_int'")
__jc = x_int()
__jc.val = int(jc)
if __jc.val!=jc:
raise ValueError("Error while converting 'jc' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__c, c, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixsyrk(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__k), ctypes.byref(__alpha), ctypes.byref(__a), ctypes.byref(__ia), ctypes.byref(__ja), ctypes.byref(__optypea), ctypes.byref(__beta), ctypes.byref(__c), ctypes.byref(__ic), ctypes.byref(__jc), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixsyrk'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__a)
x_matrix_clear(__c)
_lib_alglib.alglib_rmatrixrndorthogonal.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixrndorthogonal.restype = ctypes.c_int32
def rmatrixrndorthogonal(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixrndorthogonal(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixrndorthogonal'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_rmatrixrndcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixrndcond.restype = ctypes.c_int32
def rmatrixrndcond(n, c):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = ctypes.c_double(c)
__a = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixrndcond(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__c), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixrndcond'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_cmatrixrndorthogonal.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixrndorthogonal.restype = ctypes.c_int32
def cmatrixrndorthogonal(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixrndorthogonal(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixrndorthogonal'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_cmatrixrndcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixrndcond.restype = ctypes.c_int32
def cmatrixrndcond(n, c):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = ctypes.c_double(c)
__a = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixrndcond(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__c), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixrndcond'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_smatrixrndcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smatrixrndcond.restype = ctypes.c_int32
def smatrixrndcond(n, c):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = ctypes.c_double(c)
__a = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smatrixrndcond(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__c), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smatrixrndcond'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_spdmatrixrndcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixrndcond.restype = ctypes.c_int32
def spdmatrixrndcond(n, c):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = ctypes.c_double(c)
__a = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixrndcond(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__c), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixrndcond'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_hmatrixrndcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hmatrixrndcond.restype = ctypes.c_int32
def hmatrixrndcond(n, c):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = ctypes.c_double(c)
__a = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hmatrixrndcond(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__c), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hmatrixrndcond'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_hpdmatrixrndcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hpdmatrixrndcond.restype = ctypes.c_int32
def hpdmatrixrndcond(n, c):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = ctypes.c_double(c)
__a = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hpdmatrixrndcond(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__c), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hpdmatrixrndcond'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_rmatrixrndorthogonalfromtheright.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixrndorthogonalfromtheright.restype = ctypes.c_int32
def rmatrixrndorthogonalfromtheright(a, m, n):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixrndorthogonalfromtheright(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixrndorthogonalfromtheright'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_rmatrixrndorthogonalfromtheleft.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixrndorthogonalfromtheleft.restype = ctypes.c_int32
def rmatrixrndorthogonalfromtheleft(a, m, n):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixrndorthogonalfromtheleft(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixrndorthogonalfromtheleft'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_cmatrixrndorthogonalfromtheright.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixrndorthogonalfromtheright.restype = ctypes.c_int32
def cmatrixrndorthogonalfromtheright(a, m, n):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixrndorthogonalfromtheright(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixrndorthogonalfromtheright'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_cmatrixrndorthogonalfromtheleft.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixrndorthogonalfromtheleft.restype = ctypes.c_int32
def cmatrixrndorthogonalfromtheleft(a, m, n):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixrndorthogonalfromtheleft(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixrndorthogonalfromtheleft'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_smatrixrndmultiply.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smatrixrndmultiply.restype = ctypes.c_int32
def smatrixrndmultiply(a, n):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smatrixrndmultiply(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smatrixrndmultiply'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_hmatrixrndmultiply.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hmatrixrndmultiply.restype = ctypes.c_int32
def hmatrixrndmultiply(a, n):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hmatrixrndmultiply(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hmatrixrndmultiply'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_rmatrixlu.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixlu.restype = ctypes.c_int32
def rmatrixlu(a, m, n):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__pivots = x_vector(cnt=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixlu(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__pivots))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixlu'")
__r__a = listlist_from_x(__a)
__r__pivots = list_from_x(__pivots)
return (__r__a, __r__pivots)
finally:
x_matrix_clear(__a)
x_vector_clear(__pivots)
_lib_alglib.alglib_smp_rmatrixlu.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixlu.restype = ctypes.c_int32
def smp_rmatrixlu(a, m, n):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__pivots = x_vector(cnt=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixlu(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__pivots))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixlu'")
__r__a = listlist_from_x(__a)
__r__pivots = list_from_x(__pivots)
return (__r__a, __r__pivots)
finally:
x_matrix_clear(__a)
x_vector_clear(__pivots)
_lib_alglib.alglib_cmatrixlu.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixlu.restype = ctypes.c_int32
def cmatrixlu(a, m, n):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__pivots = x_vector(cnt=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixlu(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__pivots))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixlu'")
__r__a = listlist_from_x(__a)
__r__pivots = list_from_x(__pivots)
return (__r__a, __r__pivots)
finally:
x_matrix_clear(__a)
x_vector_clear(__pivots)
_lib_alglib.alglib_smp_cmatrixlu.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixlu.restype = ctypes.c_int32
def smp_cmatrixlu(a, m, n):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__pivots = x_vector(cnt=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixlu(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__pivots))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixlu'")
__r__a = listlist_from_x(__a)
__r__pivots = list_from_x(__pivots)
return (__r__a, __r__pivots)
finally:
x_matrix_clear(__a)
x_vector_clear(__pivots)
_lib_alglib.alglib_hpdmatrixcholesky.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hpdmatrixcholesky.restype = ctypes.c_int32
def hpdmatrixcholesky(a, n, isupper):
pass
__result = ctypes.c_uint8(0)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hpdmatrixcholesky(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hpdmatrixcholesky'")
__r__result = __result.value!=0
__r__a = listlist_from_x(__a)
return (__r__result, __r__a)
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_smp_hpdmatrixcholesky.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_hpdmatrixcholesky.restype = ctypes.c_int32
def smp_hpdmatrixcholesky(a, n, isupper):
pass
__result = ctypes.c_uint8(0)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_hpdmatrixcholesky(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_hpdmatrixcholesky'")
__r__result = __result.value!=0
__r__a = listlist_from_x(__a)
return (__r__result, __r__a)
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_spdmatrixcholesky.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixcholesky.restype = ctypes.c_int32
def spdmatrixcholesky(a, n, isupper):
pass
__result = ctypes.c_uint8(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixcholesky(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixcholesky'")
__r__result = __result.value!=0
__r__a = listlist_from_x(__a)
return (__r__result, __r__a)
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_smp_spdmatrixcholesky.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spdmatrixcholesky.restype = ctypes.c_int32
def smp_spdmatrixcholesky(a, n, isupper):
pass
__result = ctypes.c_uint8(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spdmatrixcholesky(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spdmatrixcholesky'")
__r__result = __result.value!=0
__r__a = listlist_from_x(__a)
return (__r__result, __r__a)
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_spdmatrixcholeskyupdateadd1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixcholeskyupdateadd1.restype = ctypes.c_int32
def spdmatrixcholeskyupdateadd1(a, n, isupper, u):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(u):
raise ValueError("'u' parameter can't be cast to real_vector")
__u = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__u, u, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixcholeskyupdateadd1(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__u))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixcholeskyupdateadd1'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
x_vector_clear(__u)
_lib_alglib.alglib_spdmatrixcholeskyupdatefix.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixcholeskyupdatefix.restype = ctypes.c_int32
def spdmatrixcholeskyupdatefix(a, n, isupper, fix):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_bool_vector(fix):
raise ValueError("'fix' parameter can't be cast to bool_vector")
__fix = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__fix, fix, DT_BOOL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixcholeskyupdatefix(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__fix))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixcholeskyupdatefix'")
__r__a = listlist_from_x(__a)
return __r__a
finally:
x_matrix_clear(__a)
x_vector_clear(__fix)
_lib_alglib.alglib_spdmatrixcholeskyupdateadd1buf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixcholeskyupdateadd1buf.restype = ctypes.c_int32
def spdmatrixcholeskyupdateadd1buf(a, n, isupper, u, bufr):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(u):
raise ValueError("'u' parameter can't be cast to real_vector")
__u = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(bufr):
raise ValueError("'bufr' parameter can't be cast to real_vector")
__bufr = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__u, u, DT_REAL, X_CREATE)
x_from_list(__bufr, bufr, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixcholeskyupdateadd1buf(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__u), ctypes.byref(__bufr))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixcholeskyupdateadd1buf'")
__r__a = listlist_from_x(__a)
__r__bufr = list_from_x(__bufr)
return (__r__a, __r__bufr)
finally:
x_matrix_clear(__a)
x_vector_clear(__u)
x_vector_clear(__bufr)
_lib_alglib.alglib_spdmatrixcholeskyupdatefixbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixcholeskyupdatefixbuf.restype = ctypes.c_int32
def spdmatrixcholeskyupdatefixbuf(a, n, isupper, fix, bufr):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_bool_vector(fix):
raise ValueError("'fix' parameter can't be cast to bool_vector")
__fix = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(bufr):
raise ValueError("'bufr' parameter can't be cast to real_vector")
__bufr = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__fix, fix, DT_BOOL, X_CREATE)
x_from_list(__bufr, bufr, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixcholeskyupdatefixbuf(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__fix), ctypes.byref(__bufr))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixcholeskyupdatefixbuf'")
__r__a = listlist_from_x(__a)
__r__bufr = list_from_x(__bufr)
return (__r__a, __r__bufr)
finally:
x_matrix_clear(__a)
x_vector_clear(__fix)
x_vector_clear(__bufr)
_lib_alglib.alglib_sparsecholeskyskyline.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecholeskyskyline.restype = ctypes.c_int32
def sparsecholeskyskyline(a, n, isupper):
pass
__result = ctypes.c_uint8(0)
__a = a.ptr
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecholeskyskyline(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecholeskyskyline'")
__r__result = __result.value!=0
return __r__result
finally:
pass
_lib_alglib.alglib_rmatrixrcond1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixrcond1.restype = ctypes.c_int32
def rmatrixrcond1(a, n):
pass
__result = ctypes.c_double(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixrcond1(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixrcond1'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_rmatrixrcondinf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixrcondinf.restype = ctypes.c_int32
def rmatrixrcondinf(a, n):
pass
__result = ctypes.c_double(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixrcondinf(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixrcondinf'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_spdmatrixrcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixrcond.restype = ctypes.c_int32
def spdmatrixrcond(a, n, isupper):
pass
__result = ctypes.c_double(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixrcond(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixrcond'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_rmatrixtrrcond1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixtrrcond1.restype = ctypes.c_int32
def rmatrixtrrcond1(a, n, isupper, isunit):
pass
__result = ctypes.c_double(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixtrrcond1(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__isunit))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixtrrcond1'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_rmatrixtrrcondinf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixtrrcondinf.restype = ctypes.c_int32
def rmatrixtrrcondinf(a, n, isupper, isunit):
pass
__result = ctypes.c_double(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixtrrcondinf(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__isunit))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixtrrcondinf'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_hpdmatrixrcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hpdmatrixrcond.restype = ctypes.c_int32
def hpdmatrixrcond(a, n, isupper):
pass
__result = ctypes.c_double(0)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hpdmatrixrcond(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hpdmatrixrcond'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_cmatrixrcond1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixrcond1.restype = ctypes.c_int32
def cmatrixrcond1(a, n):
pass
__result = ctypes.c_double(0)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixrcond1(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixrcond1'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_cmatrixrcondinf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixrcondinf.restype = ctypes.c_int32
def cmatrixrcondinf(a, n):
pass
__result = ctypes.c_double(0)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixrcondinf(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixrcondinf'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_rmatrixlurcond1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixlurcond1.restype = ctypes.c_int32
def rmatrixlurcond1(lua, n):
pass
__result = ctypes.c_double(0)
if not is_real_matrix(lua):
raise ValueError("'lua' parameter can't be cast to real_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__lua, lua, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixlurcond1(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__lua), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixlurcond1'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__lua)
_lib_alglib.alglib_rmatrixlurcondinf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixlurcondinf.restype = ctypes.c_int32
def rmatrixlurcondinf(lua, n):
pass
__result = ctypes.c_double(0)
if not is_real_matrix(lua):
raise ValueError("'lua' parameter can't be cast to real_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__lua, lua, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixlurcondinf(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__lua), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixlurcondinf'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__lua)
_lib_alglib.alglib_spdmatrixcholeskyrcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixcholeskyrcond.restype = ctypes.c_int32
def spdmatrixcholeskyrcond(a, n, isupper):
pass
__result = ctypes.c_double(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixcholeskyrcond(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixcholeskyrcond'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_hpdmatrixcholeskyrcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hpdmatrixcholeskyrcond.restype = ctypes.c_int32
def hpdmatrixcholeskyrcond(a, n, isupper):
pass
__result = ctypes.c_double(0)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hpdmatrixcholeskyrcond(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hpdmatrixcholeskyrcond'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_cmatrixlurcond1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixlurcond1.restype = ctypes.c_int32
def cmatrixlurcond1(lua, n):
pass
__result = ctypes.c_double(0)
if not is_complex_matrix(lua):
raise ValueError("'lua' parameter can't be cast to complex_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__lua, lua, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixlurcond1(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__lua), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixlurcond1'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__lua)
_lib_alglib.alglib_cmatrixlurcondinf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixlurcondinf.restype = ctypes.c_int32
def cmatrixlurcondinf(lua, n):
pass
__result = ctypes.c_double(0)
if not is_complex_matrix(lua):
raise ValueError("'lua' parameter can't be cast to complex_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__lua, lua, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixlurcondinf(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__lua), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixlurcondinf'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__lua)
_lib_alglib.alglib_cmatrixtrrcond1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixtrrcond1.restype = ctypes.c_int32
def cmatrixtrrcond1(a, n, isupper, isunit):
pass
__result = ctypes.c_double(0)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixtrrcond1(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__isunit))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixtrrcond1'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_cmatrixtrrcondinf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixtrrcondinf.restype = ctypes.c_int32
def cmatrixtrrcondinf(a, n, isupper, isunit):
pass
__result = ctypes.c_double(0)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixtrrcondinf(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__isunit))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixtrrcondinf'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
class x_matinvreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("r1", ctypes.c_double),
("rinf", ctypes.c_double)
]
class matinvreport(object):
def __init__(self):
self.r1 = 0
self.rinf = 0
def x_matinvreport_zero_fields(x):
x.r1 = 0
x.rinf = 0
return
def x_matinvreport_clear(x):
x_matinvreport_zero_fields(x)
return
def x_from_matinvreport(x,v):
x.r1 = float(v.r1)
x.rinf = float(v.rinf)
return
def matinvreport_from_x(x):
r = matinvreport()
r.r1 = x.r1
r.rinf = x.rinf
return r
_lib_alglib.alglib_rmatrixluinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixluinverse.restype = ctypes.c_int32
def rmatrixluinverse(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,pivots,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
a,pivots = functionargs
if safe_cols("'rmatrixluinverse': incorrect parameters",a)!=safe_rows("'rmatrixluinverse': incorrect parameters",a) or safe_cols("'rmatrixluinverse': incorrect parameters",a)!=safe_len("'rmatrixluinverse': incorrect parameters",pivots):
raise RuntimeError("Error while calling 'rmatrixluinverse': looks like one of arguments has wrong size")
n = safe_cols("'rmatrixluinverse': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'rmatrixluinverse': function must have 2 or 3 parameters")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(pivots):
raise ValueError("'pivots' parameter can't be cast to int_vector")
__pivots = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__pivots, pivots, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixluinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__pivots), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixluinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_vector_clear(__pivots)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_smp_rmatrixluinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixluinverse.restype = ctypes.c_int32
def smp_rmatrixluinverse(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,pivots,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
a,pivots = functionargs
if safe_cols("'smp_rmatrixluinverse': incorrect parameters",a)!=safe_rows("'smp_rmatrixluinverse': incorrect parameters",a) or safe_cols("'smp_rmatrixluinverse': incorrect parameters",a)!=safe_len("'smp_rmatrixluinverse': incorrect parameters",pivots):
raise RuntimeError("Error while calling 'smp_rmatrixluinverse': looks like one of arguments has wrong size")
n = safe_cols("'smp_rmatrixluinverse': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'smp_rmatrixluinverse': function must have 2 or 3 parameters")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(pivots):
raise ValueError("'pivots' parameter can't be cast to int_vector")
__pivots = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__pivots, pivots, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixluinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__pivots), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixluinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_vector_clear(__pivots)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_rmatrixinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixinverse.restype = ctypes.c_int32
def rmatrixinverse(*functionargs):
if len(functionargs)==2:
__friendly_form = False
a,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_cols("'rmatrixinverse': incorrect parameters",a)!=safe_rows("'rmatrixinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'rmatrixinverse': looks like one of arguments has wrong size")
n = safe_cols("'rmatrixinverse': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'rmatrixinverse': function must have 1 or 2 parameters")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_smp_rmatrixinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixinverse.restype = ctypes.c_int32
def smp_rmatrixinverse(*functionargs):
if len(functionargs)==2:
__friendly_form = False
a,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_cols("'smp_rmatrixinverse': incorrect parameters",a)!=safe_rows("'smp_rmatrixinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'smp_rmatrixinverse': looks like one of arguments has wrong size")
n = safe_cols("'smp_rmatrixinverse': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'smp_rmatrixinverse': function must have 1 or 2 parameters")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_cmatrixluinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixluinverse.restype = ctypes.c_int32
def cmatrixluinverse(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,pivots,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
a,pivots = functionargs
if safe_cols("'cmatrixluinverse': incorrect parameters",a)!=safe_rows("'cmatrixluinverse': incorrect parameters",a) or safe_cols("'cmatrixluinverse': incorrect parameters",a)!=safe_len("'cmatrixluinverse': incorrect parameters",pivots):
raise RuntimeError("Error while calling 'cmatrixluinverse': looks like one of arguments has wrong size")
n = safe_cols("'cmatrixluinverse': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'cmatrixluinverse': function must have 2 or 3 parameters")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(pivots):
raise ValueError("'pivots' parameter can't be cast to int_vector")
__pivots = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__pivots, pivots, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixluinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__pivots), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixluinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_vector_clear(__pivots)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_smp_cmatrixluinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixluinverse.restype = ctypes.c_int32
def smp_cmatrixluinverse(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,pivots,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
a,pivots = functionargs
if safe_cols("'smp_cmatrixluinverse': incorrect parameters",a)!=safe_rows("'smp_cmatrixluinverse': incorrect parameters",a) or safe_cols("'smp_cmatrixluinverse': incorrect parameters",a)!=safe_len("'smp_cmatrixluinverse': incorrect parameters",pivots):
raise RuntimeError("Error while calling 'smp_cmatrixluinverse': looks like one of arguments has wrong size")
n = safe_cols("'smp_cmatrixluinverse': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'smp_cmatrixluinverse': function must have 2 or 3 parameters")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(pivots):
raise ValueError("'pivots' parameter can't be cast to int_vector")
__pivots = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__pivots, pivots, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixluinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__pivots), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixluinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_vector_clear(__pivots)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_cmatrixinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixinverse.restype = ctypes.c_int32
def cmatrixinverse(*functionargs):
if len(functionargs)==2:
__friendly_form = False
a,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_cols("'cmatrixinverse': incorrect parameters",a)!=safe_rows("'cmatrixinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'cmatrixinverse': looks like one of arguments has wrong size")
n = safe_cols("'cmatrixinverse': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'cmatrixinverse': function must have 1 or 2 parameters")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_smp_cmatrixinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixinverse.restype = ctypes.c_int32
def smp_cmatrixinverse(*functionargs):
if len(functionargs)==2:
__friendly_form = False
a,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_cols("'smp_cmatrixinverse': incorrect parameters",a)!=safe_rows("'smp_cmatrixinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'smp_cmatrixinverse': looks like one of arguments has wrong size")
n = safe_cols("'smp_cmatrixinverse': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'smp_cmatrixinverse': function must have 1 or 2 parameters")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_spdmatrixcholeskyinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixcholeskyinverse.restype = ctypes.c_int32
def spdmatrixcholeskyinverse(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,n,isupper = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_cols("'spdmatrixcholeskyinverse': incorrect parameters",a)!=safe_rows("'spdmatrixcholeskyinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'spdmatrixcholeskyinverse': looks like one of arguments has wrong size")
n = safe_cols("'spdmatrixcholeskyinverse': incorrect parameters",a)
isupper = False
else:
raise RuntimeError("Error while calling 'spdmatrixcholeskyinverse': function must have 1 or 3 parameters")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixcholeskyinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixcholeskyinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_smp_spdmatrixcholeskyinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spdmatrixcholeskyinverse.restype = ctypes.c_int32
def smp_spdmatrixcholeskyinverse(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,n,isupper = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_cols("'smp_spdmatrixcholeskyinverse': incorrect parameters",a)!=safe_rows("'smp_spdmatrixcholeskyinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'smp_spdmatrixcholeskyinverse': looks like one of arguments has wrong size")
n = safe_cols("'smp_spdmatrixcholeskyinverse': incorrect parameters",a)
isupper = False
else:
raise RuntimeError("Error while calling 'smp_spdmatrixcholeskyinverse': function must have 1 or 3 parameters")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spdmatrixcholeskyinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spdmatrixcholeskyinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_spdmatrixinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixinverse.restype = ctypes.c_int32
def spdmatrixinverse(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,n,isupper = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_cols("'spdmatrixinverse': incorrect parameters",a)!=safe_rows("'spdmatrixinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'spdmatrixinverse': looks like one of arguments has wrong size")
n = safe_cols("'spdmatrixinverse': incorrect parameters",a)
isupper = False
else:
raise RuntimeError("Error while calling 'spdmatrixinverse': function must have 1 or 3 parameters")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to symmetric")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
if __friendly_form:
if not x_is_symmetric(__a):
raise ValueError("'a' parameter is not symmetric matrix")
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixinverse'")
if __friendly_form:
if not x_force_symmetric(__a):
raise RuntimeError("Internal error while forcing symmetricity of 'a' parameter")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_smp_spdmatrixinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spdmatrixinverse.restype = ctypes.c_int32
def smp_spdmatrixinverse(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,n,isupper = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_cols("'smp_spdmatrixinverse': incorrect parameters",a)!=safe_rows("'smp_spdmatrixinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'smp_spdmatrixinverse': looks like one of arguments has wrong size")
n = safe_cols("'smp_spdmatrixinverse': incorrect parameters",a)
isupper = False
else:
raise RuntimeError("Error while calling 'smp_spdmatrixinverse': function must have 1 or 3 parameters")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to symmetric")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
if __friendly_form:
if not x_is_symmetric(__a):
raise ValueError("'a' parameter is not symmetric matrix")
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spdmatrixinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spdmatrixinverse'")
if __friendly_form:
if not x_force_symmetric(__a):
raise RuntimeError("Internal error while forcing symmetricity of 'a' parameter")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_hpdmatrixcholeskyinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hpdmatrixcholeskyinverse.restype = ctypes.c_int32
def hpdmatrixcholeskyinverse(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,n,isupper = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_cols("'hpdmatrixcholeskyinverse': incorrect parameters",a)!=safe_rows("'hpdmatrixcholeskyinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'hpdmatrixcholeskyinverse': looks like one of arguments has wrong size")
n = safe_cols("'hpdmatrixcholeskyinverse': incorrect parameters",a)
isupper = False
else:
raise RuntimeError("Error while calling 'hpdmatrixcholeskyinverse': function must have 1 or 3 parameters")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hpdmatrixcholeskyinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hpdmatrixcholeskyinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_smp_hpdmatrixcholeskyinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_hpdmatrixcholeskyinverse.restype = ctypes.c_int32
def smp_hpdmatrixcholeskyinverse(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,n,isupper = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_cols("'smp_hpdmatrixcholeskyinverse': incorrect parameters",a)!=safe_rows("'smp_hpdmatrixcholeskyinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'smp_hpdmatrixcholeskyinverse': looks like one of arguments has wrong size")
n = safe_cols("'smp_hpdmatrixcholeskyinverse': incorrect parameters",a)
isupper = False
else:
raise RuntimeError("Error while calling 'smp_hpdmatrixcholeskyinverse': function must have 1 or 3 parameters")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_hpdmatrixcholeskyinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_hpdmatrixcholeskyinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_hpdmatrixinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hpdmatrixinverse.restype = ctypes.c_int32
def hpdmatrixinverse(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,n,isupper = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_cols("'hpdmatrixinverse': incorrect parameters",a)!=safe_rows("'hpdmatrixinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'hpdmatrixinverse': looks like one of arguments has wrong size")
n = safe_cols("'hpdmatrixinverse': incorrect parameters",a)
isupper = False
else:
raise RuntimeError("Error while calling 'hpdmatrixinverse': function must have 1 or 3 parameters")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to hermitian")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
if __friendly_form:
if not x_is_hermitian(__a):
raise ValueError("'a' parameter is not Hermitian matrix")
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hpdmatrixinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hpdmatrixinverse'")
if __friendly_form:
if not x_force_hermitian(__a):
raise RuntimeError("Internal error while forcing Hermitian properties of 'a' parameter")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_smp_hpdmatrixinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_hpdmatrixinverse.restype = ctypes.c_int32
def smp_hpdmatrixinverse(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,n,isupper = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_cols("'smp_hpdmatrixinverse': incorrect parameters",a)!=safe_rows("'smp_hpdmatrixinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'smp_hpdmatrixinverse': looks like one of arguments has wrong size")
n = safe_cols("'smp_hpdmatrixinverse': incorrect parameters",a)
isupper = False
else:
raise RuntimeError("Error while calling 'smp_hpdmatrixinverse': function must have 1 or 3 parameters")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to hermitian")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
if __friendly_form:
if not x_is_hermitian(__a):
raise ValueError("'a' parameter is not Hermitian matrix")
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_hpdmatrixinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_hpdmatrixinverse'")
if __friendly_form:
if not x_force_hermitian(__a):
raise RuntimeError("Internal error while forcing Hermitian properties of 'a' parameter")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_rmatrixtrinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixtrinverse.restype = ctypes.c_int32
def rmatrixtrinverse(*functionargs):
if len(functionargs)==4:
__friendly_form = False
a,n,isupper,isunit = functionargs
elif len(functionargs)==2:
__friendly_form = True
a,isupper = functionargs
if safe_cols("'rmatrixtrinverse': incorrect parameters",a)!=safe_rows("'rmatrixtrinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'rmatrixtrinverse': looks like one of arguments has wrong size")
n = safe_cols("'rmatrixtrinverse': incorrect parameters",a)
isunit = False
else:
raise RuntimeError("Error while calling 'rmatrixtrinverse': function must have 2 or 4 parameters")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixtrinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixtrinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_smp_rmatrixtrinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixtrinverse.restype = ctypes.c_int32
def smp_rmatrixtrinverse(*functionargs):
if len(functionargs)==4:
__friendly_form = False
a,n,isupper,isunit = functionargs
elif len(functionargs)==2:
__friendly_form = True
a,isupper = functionargs
if safe_cols("'smp_rmatrixtrinverse': incorrect parameters",a)!=safe_rows("'smp_rmatrixtrinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'smp_rmatrixtrinverse': looks like one of arguments has wrong size")
n = safe_cols("'smp_rmatrixtrinverse': incorrect parameters",a)
isunit = False
else:
raise RuntimeError("Error while calling 'smp_rmatrixtrinverse': function must have 2 or 4 parameters")
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixtrinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixtrinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_cmatrixtrinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixtrinverse.restype = ctypes.c_int32
def cmatrixtrinverse(*functionargs):
if len(functionargs)==4:
__friendly_form = False
a,n,isupper,isunit = functionargs
elif len(functionargs)==2:
__friendly_form = True
a,isupper = functionargs
if safe_cols("'cmatrixtrinverse': incorrect parameters",a)!=safe_rows("'cmatrixtrinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'cmatrixtrinverse': looks like one of arguments has wrong size")
n = safe_cols("'cmatrixtrinverse': incorrect parameters",a)
isunit = False
else:
raise RuntimeError("Error while calling 'cmatrixtrinverse': function must have 2 or 4 parameters")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixtrinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixtrinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_smp_cmatrixtrinverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixtrinverse.restype = ctypes.c_int32
def smp_cmatrixtrinverse(*functionargs):
if len(functionargs)==4:
__friendly_form = False
a,n,isupper,isunit = functionargs
elif len(functionargs)==2:
__friendly_form = True
a,isupper = functionargs
if safe_cols("'smp_cmatrixtrinverse': incorrect parameters",a)!=safe_rows("'smp_cmatrixtrinverse': incorrect parameters",a):
raise RuntimeError("Error while calling 'smp_cmatrixtrinverse': looks like one of arguments has wrong size")
n = safe_cols("'smp_cmatrixtrinverse': incorrect parameters",a)
isunit = False
else:
raise RuntimeError("Error while calling 'smp_cmatrixtrinverse': function must have 2 or 4 parameters")
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isunit = ctypes.c_uint8(isunit)
if __isunit.value!=0:
__isunit = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_matinvreport()
x_matinvreport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixtrinverse(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__isunit), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixtrinverse'")
__r__a = listlist_from_x(__a)
__r__info = __info.val
__r__rep = matinvreport_from_x(__rep)
return (__r__a, __r__info, __r__rep)
finally:
x_matrix_clear(__a)
x_matinvreport_clear(__rep)
_lib_alglib.alglib_rmatrixqr.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixqr.restype = ctypes.c_int32
def rmatrixqr(a, m, n):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__tau = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixqr(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixqr'")
__r__a = listlist_from_x(__a)
__r__tau = list_from_x(__tau)
return (__r__a, __r__tau)
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
_lib_alglib.alglib_smp_rmatrixqr.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixqr.restype = ctypes.c_int32
def smp_rmatrixqr(a, m, n):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__tau = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixqr(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixqr'")
__r__a = listlist_from_x(__a)
__r__tau = list_from_x(__tau)
return (__r__a, __r__tau)
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
_lib_alglib.alglib_rmatrixlq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixlq.restype = ctypes.c_int32
def rmatrixlq(a, m, n):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__tau = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixlq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixlq'")
__r__a = listlist_from_x(__a)
__r__tau = list_from_x(__tau)
return (__r__a, __r__tau)
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
_lib_alglib.alglib_smp_rmatrixlq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixlq.restype = ctypes.c_int32
def smp_rmatrixlq(a, m, n):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__tau = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixlq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixlq'")
__r__a = listlist_from_x(__a)
__r__tau = list_from_x(__tau)
return (__r__a, __r__tau)
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
_lib_alglib.alglib_cmatrixqr.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixqr.restype = ctypes.c_int32
def cmatrixqr(a, m, n):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__tau = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixqr(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixqr'")
__r__a = listlist_from_x(__a)
__r__tau = list_from_x(__tau)
return (__r__a, __r__tau)
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
_lib_alglib.alglib_smp_cmatrixqr.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixqr.restype = ctypes.c_int32
def smp_cmatrixqr(a, m, n):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__tau = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixqr(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixqr'")
__r__a = listlist_from_x(__a)
__r__tau = list_from_x(__tau)
return (__r__a, __r__tau)
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
_lib_alglib.alglib_cmatrixlq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixlq.restype = ctypes.c_int32
def cmatrixlq(a, m, n):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__tau = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixlq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixlq'")
__r__a = listlist_from_x(__a)
__r__tau = list_from_x(__tau)
return (__r__a, __r__tau)
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
_lib_alglib.alglib_smp_cmatrixlq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixlq.restype = ctypes.c_int32
def smp_cmatrixlq(a, m, n):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__tau = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixlq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixlq'")
__r__a = listlist_from_x(__a)
__r__tau = list_from_x(__tau)
return (__r__a, __r__tau)
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
_lib_alglib.alglib_rmatrixqrunpackq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixqrunpackq.restype = ctypes.c_int32
def rmatrixqrunpackq(a, m, n, tau, qcolumns):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(tau):
raise ValueError("'tau' parameter can't be cast to real_vector")
__tau = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__qcolumns = x_int()
__qcolumns.val = int(qcolumns)
if __qcolumns.val!=qcolumns:
raise ValueError("Error while converting 'qcolumns' parameter to 'x_int'")
__q = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__tau, tau, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixqrunpackq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau), ctypes.byref(__qcolumns), ctypes.byref(__q))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixqrunpackq'")
__r__q = listlist_from_x(__q)
return __r__q
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
x_matrix_clear(__q)
_lib_alglib.alglib_smp_rmatrixqrunpackq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixqrunpackq.restype = ctypes.c_int32
def smp_rmatrixqrunpackq(a, m, n, tau, qcolumns):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(tau):
raise ValueError("'tau' parameter can't be cast to real_vector")
__tau = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__qcolumns = x_int()
__qcolumns.val = int(qcolumns)
if __qcolumns.val!=qcolumns:
raise ValueError("Error while converting 'qcolumns' parameter to 'x_int'")
__q = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__tau, tau, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixqrunpackq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau), ctypes.byref(__qcolumns), ctypes.byref(__q))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixqrunpackq'")
__r__q = listlist_from_x(__q)
return __r__q
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
x_matrix_clear(__q)
_lib_alglib.alglib_rmatrixqrunpackr.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixqrunpackr.restype = ctypes.c_int32
def rmatrixqrunpackr(a, m, n):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__r = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixqrunpackr(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__r))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixqrunpackr'")
__r__r = listlist_from_x(__r)
return __r__r
finally:
x_matrix_clear(__a)
x_matrix_clear(__r)
_lib_alglib.alglib_rmatrixlqunpackq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixlqunpackq.restype = ctypes.c_int32
def rmatrixlqunpackq(a, m, n, tau, qrows):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(tau):
raise ValueError("'tau' parameter can't be cast to real_vector")
__tau = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__qrows = x_int()
__qrows.val = int(qrows)
if __qrows.val!=qrows:
raise ValueError("Error while converting 'qrows' parameter to 'x_int'")
__q = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__tau, tau, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixlqunpackq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau), ctypes.byref(__qrows), ctypes.byref(__q))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixlqunpackq'")
__r__q = listlist_from_x(__q)
return __r__q
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
x_matrix_clear(__q)
_lib_alglib.alglib_smp_rmatrixlqunpackq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixlqunpackq.restype = ctypes.c_int32
def smp_rmatrixlqunpackq(a, m, n, tau, qrows):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(tau):
raise ValueError("'tau' parameter can't be cast to real_vector")
__tau = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__qrows = x_int()
__qrows.val = int(qrows)
if __qrows.val!=qrows:
raise ValueError("Error while converting 'qrows' parameter to 'x_int'")
__q = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__tau, tau, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixlqunpackq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau), ctypes.byref(__qrows), ctypes.byref(__q))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixlqunpackq'")
__r__q = listlist_from_x(__q)
return __r__q
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
x_matrix_clear(__q)
_lib_alglib.alglib_rmatrixlqunpackl.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixlqunpackl.restype = ctypes.c_int32
def rmatrixlqunpackl(a, m, n):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__l = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixlqunpackl(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__l))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixlqunpackl'")
__r__l = listlist_from_x(__l)
return __r__l
finally:
x_matrix_clear(__a)
x_matrix_clear(__l)
_lib_alglib.alglib_cmatrixqrunpackq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixqrunpackq.restype = ctypes.c_int32
def cmatrixqrunpackq(a, m, n, tau, qcolumns):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_vector(tau):
raise ValueError("'tau' parameter can't be cast to complex_vector")
__tau = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__qcolumns = x_int()
__qcolumns.val = int(qcolumns)
if __qcolumns.val!=qcolumns:
raise ValueError("Error while converting 'qcolumns' parameter to 'x_int'")
__q = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__tau, tau, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixqrunpackq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau), ctypes.byref(__qcolumns), ctypes.byref(__q))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixqrunpackq'")
__r__q = listlist_from_x(__q)
return __r__q
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
x_matrix_clear(__q)
_lib_alglib.alglib_smp_cmatrixqrunpackq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixqrunpackq.restype = ctypes.c_int32
def smp_cmatrixqrunpackq(a, m, n, tau, qcolumns):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_vector(tau):
raise ValueError("'tau' parameter can't be cast to complex_vector")
__tau = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__qcolumns = x_int()
__qcolumns.val = int(qcolumns)
if __qcolumns.val!=qcolumns:
raise ValueError("Error while converting 'qcolumns' parameter to 'x_int'")
__q = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__tau, tau, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixqrunpackq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau), ctypes.byref(__qcolumns), ctypes.byref(__q))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixqrunpackq'")
__r__q = listlist_from_x(__q)
return __r__q
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
x_matrix_clear(__q)
_lib_alglib.alglib_cmatrixqrunpackr.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixqrunpackr.restype = ctypes.c_int32
def cmatrixqrunpackr(a, m, n):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__r = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixqrunpackr(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__r))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixqrunpackr'")
__r__r = listlist_from_x(__r)
return __r__r
finally:
x_matrix_clear(__a)
x_matrix_clear(__r)
_lib_alglib.alglib_cmatrixlqunpackq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixlqunpackq.restype = ctypes.c_int32
def cmatrixlqunpackq(a, m, n, tau, qrows):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_vector(tau):
raise ValueError("'tau' parameter can't be cast to complex_vector")
__tau = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__qrows = x_int()
__qrows.val = int(qrows)
if __qrows.val!=qrows:
raise ValueError("Error while converting 'qrows' parameter to 'x_int'")
__q = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__tau, tau, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixlqunpackq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau), ctypes.byref(__qrows), ctypes.byref(__q))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixlqunpackq'")
__r__q = listlist_from_x(__q)
return __r__q
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
x_matrix_clear(__q)
_lib_alglib.alglib_smp_cmatrixlqunpackq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixlqunpackq.restype = ctypes.c_int32
def smp_cmatrixlqunpackq(a, m, n, tau, qrows):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_vector(tau):
raise ValueError("'tau' parameter can't be cast to complex_vector")
__tau = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__qrows = x_int()
__qrows.val = int(qrows)
if __qrows.val!=qrows:
raise ValueError("Error while converting 'qrows' parameter to 'x_int'")
__q = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__tau, tau, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixlqunpackq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tau), ctypes.byref(__qrows), ctypes.byref(__q))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixlqunpackq'")
__r__q = listlist_from_x(__q)
return __r__q
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
x_matrix_clear(__q)
_lib_alglib.alglib_cmatrixlqunpackl.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixlqunpackl.restype = ctypes.c_int32
def cmatrixlqunpackl(a, m, n):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__l = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixlqunpackl(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__l))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixlqunpackl'")
__r__l = listlist_from_x(__l)
return __r__l
finally:
x_matrix_clear(__a)
x_matrix_clear(__l)
_lib_alglib.alglib_rmatrixbd.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixbd.restype = ctypes.c_int32
def rmatrixbd(a, m, n):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__tauq = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__taup = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixbd(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tauq), ctypes.byref(__taup))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixbd'")
__r__a = listlist_from_x(__a)
__r__tauq = list_from_x(__tauq)
__r__taup = list_from_x(__taup)
return (__r__a, __r__tauq, __r__taup)
finally:
x_matrix_clear(__a)
x_vector_clear(__tauq)
x_vector_clear(__taup)
_lib_alglib.alglib_rmatrixbdunpackq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixbdunpackq.restype = ctypes.c_int32
def rmatrixbdunpackq(qp, m, n, tauq, qcolumns):
pass
if not is_real_matrix(qp):
raise ValueError("'qp' parameter can't be cast to real_matrix")
__qp = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(tauq):
raise ValueError("'tauq' parameter can't be cast to real_vector")
__tauq = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__qcolumns = x_int()
__qcolumns.val = int(qcolumns)
if __qcolumns.val!=qcolumns:
raise ValueError("Error while converting 'qcolumns' parameter to 'x_int'")
__q = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__qp, qp, DT_REAL, X_CREATE)
x_from_list(__tauq, tauq, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixbdunpackq(ctypes.byref(_error_msg), ctypes.byref(__qp), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tauq), ctypes.byref(__qcolumns), ctypes.byref(__q))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixbdunpackq'")
__r__q = listlist_from_x(__q)
return __r__q
finally:
x_matrix_clear(__qp)
x_vector_clear(__tauq)
x_matrix_clear(__q)
_lib_alglib.alglib_rmatrixbdmultiplybyq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixbdmultiplybyq.restype = ctypes.c_int32
def rmatrixbdmultiplybyq(qp, m, n, tauq, z, zrows, zcolumns, fromtheright, dotranspose):
pass
if not is_real_matrix(qp):
raise ValueError("'qp' parameter can't be cast to real_matrix")
__qp = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(tauq):
raise ValueError("'tauq' parameter can't be cast to real_vector")
__tauq = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(z):
raise ValueError("'z' parameter can't be cast to real_matrix")
__z = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__zrows = x_int()
__zrows.val = int(zrows)
if __zrows.val!=zrows:
raise ValueError("Error while converting 'zrows' parameter to 'x_int'")
__zcolumns = x_int()
__zcolumns.val = int(zcolumns)
if __zcolumns.val!=zcolumns:
raise ValueError("Error while converting 'zcolumns' parameter to 'x_int'")
__fromtheright = ctypes.c_uint8(fromtheright)
if __fromtheright.value!=0:
__fromtheright = ctypes.c_uint8(1)
__dotranspose = ctypes.c_uint8(dotranspose)
if __dotranspose.value!=0:
__dotranspose = ctypes.c_uint8(1)
try:
x_from_listlist(__qp, qp, DT_REAL, X_CREATE)
x_from_list(__tauq, tauq, DT_REAL, X_CREATE)
x_from_listlist(__z, z, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixbdmultiplybyq(ctypes.byref(_error_msg), ctypes.byref(__qp), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tauq), ctypes.byref(__z), ctypes.byref(__zrows), ctypes.byref(__zcolumns), ctypes.byref(__fromtheright), ctypes.byref(__dotranspose))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixbdmultiplybyq'")
__r__z = listlist_from_x(__z)
return __r__z
finally:
x_matrix_clear(__qp)
x_vector_clear(__tauq)
x_matrix_clear(__z)
_lib_alglib.alglib_rmatrixbdunpackpt.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixbdunpackpt.restype = ctypes.c_int32
def rmatrixbdunpackpt(qp, m, n, taup, ptrows):
pass
if not is_real_matrix(qp):
raise ValueError("'qp' parameter can't be cast to real_matrix")
__qp = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(taup):
raise ValueError("'taup' parameter can't be cast to real_vector")
__taup = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ptrows = x_int()
__ptrows.val = int(ptrows)
if __ptrows.val!=ptrows:
raise ValueError("Error while converting 'ptrows' parameter to 'x_int'")
__pt = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__qp, qp, DT_REAL, X_CREATE)
x_from_list(__taup, taup, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixbdunpackpt(ctypes.byref(_error_msg), ctypes.byref(__qp), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__taup), ctypes.byref(__ptrows), ctypes.byref(__pt))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixbdunpackpt'")
__r__pt = listlist_from_x(__pt)
return __r__pt
finally:
x_matrix_clear(__qp)
x_vector_clear(__taup)
x_matrix_clear(__pt)
_lib_alglib.alglib_rmatrixbdmultiplybyp.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixbdmultiplybyp.restype = ctypes.c_int32
def rmatrixbdmultiplybyp(qp, m, n, taup, z, zrows, zcolumns, fromtheright, dotranspose):
pass
if not is_real_matrix(qp):
raise ValueError("'qp' parameter can't be cast to real_matrix")
__qp = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(taup):
raise ValueError("'taup' parameter can't be cast to real_vector")
__taup = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(z):
raise ValueError("'z' parameter can't be cast to real_matrix")
__z = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__zrows = x_int()
__zrows.val = int(zrows)
if __zrows.val!=zrows:
raise ValueError("Error while converting 'zrows' parameter to 'x_int'")
__zcolumns = x_int()
__zcolumns.val = int(zcolumns)
if __zcolumns.val!=zcolumns:
raise ValueError("Error while converting 'zcolumns' parameter to 'x_int'")
__fromtheright = ctypes.c_uint8(fromtheright)
if __fromtheright.value!=0:
__fromtheright = ctypes.c_uint8(1)
__dotranspose = ctypes.c_uint8(dotranspose)
if __dotranspose.value!=0:
__dotranspose = ctypes.c_uint8(1)
try:
x_from_listlist(__qp, qp, DT_REAL, X_CREATE)
x_from_list(__taup, taup, DT_REAL, X_CREATE)
x_from_listlist(__z, z, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixbdmultiplybyp(ctypes.byref(_error_msg), ctypes.byref(__qp), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__taup), ctypes.byref(__z), ctypes.byref(__zrows), ctypes.byref(__zcolumns), ctypes.byref(__fromtheright), ctypes.byref(__dotranspose))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixbdmultiplybyp'")
__r__z = listlist_from_x(__z)
return __r__z
finally:
x_matrix_clear(__qp)
x_vector_clear(__taup)
x_matrix_clear(__z)
_lib_alglib.alglib_rmatrixbdunpackdiagonals.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixbdunpackdiagonals.restype = ctypes.c_int32
def rmatrixbdunpackdiagonals(b, m, n):
pass
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(0)
__d = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__e = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixbdunpackdiagonals(ctypes.byref(_error_msg), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__d), ctypes.byref(__e))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixbdunpackdiagonals'")
__r__isupper = __isupper.value!=0
__r__d = list_from_x(__d)
__r__e = list_from_x(__e)
return (__r__isupper, __r__d, __r__e)
finally:
x_matrix_clear(__b)
x_vector_clear(__d)
x_vector_clear(__e)
_lib_alglib.alglib_rmatrixhessenberg.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixhessenberg.restype = ctypes.c_int32
def rmatrixhessenberg(a, n):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__tau = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixhessenberg(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__tau))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixhessenberg'")
__r__a = listlist_from_x(__a)
__r__tau = list_from_x(__tau)
return (__r__a, __r__tau)
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
_lib_alglib.alglib_rmatrixhessenbergunpackq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixhessenbergunpackq.restype = ctypes.c_int32
def rmatrixhessenbergunpackq(a, n, tau):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(tau):
raise ValueError("'tau' parameter can't be cast to real_vector")
__tau = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__q = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__tau, tau, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixhessenbergunpackq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__tau), ctypes.byref(__q))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixhessenbergunpackq'")
__r__q = listlist_from_x(__q)
return __r__q
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
x_matrix_clear(__q)
_lib_alglib.alglib_rmatrixhessenbergunpackh.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixhessenbergunpackh.restype = ctypes.c_int32
def rmatrixhessenbergunpackh(a, n):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__h = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixhessenbergunpackh(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__h))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixhessenbergunpackh'")
__r__h = listlist_from_x(__h)
return __r__h
finally:
x_matrix_clear(__a)
x_matrix_clear(__h)
_lib_alglib.alglib_smatrixtd.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smatrixtd.restype = ctypes.c_int32
def smatrixtd(a, n, isupper):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__tau = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__d = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__e = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smatrixtd(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__tau), ctypes.byref(__d), ctypes.byref(__e))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smatrixtd'")
__r__a = listlist_from_x(__a)
__r__tau = list_from_x(__tau)
__r__d = list_from_x(__d)
__r__e = list_from_x(__e)
return (__r__a, __r__tau, __r__d, __r__e)
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
x_vector_clear(__d)
x_vector_clear(__e)
_lib_alglib.alglib_smatrixtdunpackq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smatrixtdunpackq.restype = ctypes.c_int32
def smatrixtdunpackq(a, n, isupper, tau):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(tau):
raise ValueError("'tau' parameter can't be cast to real_vector")
__tau = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__q = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__tau, tau, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smatrixtdunpackq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__tau), ctypes.byref(__q))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smatrixtdunpackq'")
__r__q = listlist_from_x(__q)
return __r__q
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
x_matrix_clear(__q)
_lib_alglib.alglib_hmatrixtd.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hmatrixtd.restype = ctypes.c_int32
def hmatrixtd(a, n, isupper):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__tau = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__d = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__e = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hmatrixtd(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__tau), ctypes.byref(__d), ctypes.byref(__e))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hmatrixtd'")
__r__a = listlist_from_x(__a)
__r__tau = list_from_x(__tau)
__r__d = list_from_x(__d)
__r__e = list_from_x(__e)
return (__r__a, __r__tau, __r__d, __r__e)
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
x_vector_clear(__d)
x_vector_clear(__e)
_lib_alglib.alglib_hmatrixtdunpackq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hmatrixtdunpackq.restype = ctypes.c_int32
def hmatrixtdunpackq(a, n, isupper, tau):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_vector(tau):
raise ValueError("'tau' parameter can't be cast to complex_vector")
__tau = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__q = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__tau, tau, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hmatrixtdunpackq(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__tau), ctypes.byref(__q))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hmatrixtdunpackq'")
__r__q = listlist_from_x(__q)
return __r__q
finally:
x_matrix_clear(__a)
x_vector_clear(__tau)
x_matrix_clear(__q)
_lib_alglib.alglib_rmatrixbdsvd.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixbdsvd.restype = ctypes.c_int32
def rmatrixbdsvd(d, e, n, isupper, isfractionalaccuracyrequired, u, nru, c, ncc, vt, ncvt):
pass
__result = ctypes.c_uint8(0)
if not is_real_vector(d):
raise ValueError("'d' parameter can't be cast to real_vector")
__d = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(e):
raise ValueError("'e' parameter can't be cast to real_vector")
__e = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__isfractionalaccuracyrequired = ctypes.c_uint8(isfractionalaccuracyrequired)
if __isfractionalaccuracyrequired.value!=0:
__isfractionalaccuracyrequired = ctypes.c_uint8(1)
if not is_real_matrix(u):
raise ValueError("'u' parameter can't be cast to real_matrix")
__u = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nru = x_int()
__nru.val = int(nru)
if __nru.val!=nru:
raise ValueError("Error while converting 'nru' parameter to 'x_int'")
if not is_real_matrix(c):
raise ValueError("'c' parameter can't be cast to real_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ncc = x_int()
__ncc.val = int(ncc)
if __ncc.val!=ncc:
raise ValueError("Error while converting 'ncc' parameter to 'x_int'")
if not is_real_matrix(vt):
raise ValueError("'vt' parameter can't be cast to real_matrix")
__vt = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ncvt = x_int()
__ncvt.val = int(ncvt)
if __ncvt.val!=ncvt:
raise ValueError("Error while converting 'ncvt' parameter to 'x_int'")
try:
x_from_list(__d, d, DT_REAL, X_CREATE)
x_from_list(__e, e, DT_REAL, X_CREATE)
x_from_listlist(__u, u, DT_REAL, X_CREATE)
x_from_listlist(__c, c, DT_REAL, X_CREATE)
x_from_listlist(__vt, vt, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixbdsvd(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__d), ctypes.byref(__e), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__isfractionalaccuracyrequired), ctypes.byref(__u), ctypes.byref(__nru), ctypes.byref(__c), ctypes.byref(__ncc), ctypes.byref(__vt), ctypes.byref(__ncvt))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixbdsvd'")
__r__result = __result.value!=0
__r__d = list_from_x(__d)
__r__u = listlist_from_x(__u)
__r__c = listlist_from_x(__c)
__r__vt = listlist_from_x(__vt)
return (__r__result, __r__d, __r__u, __r__c, __r__vt)
finally:
x_vector_clear(__d)
x_vector_clear(__e)
x_matrix_clear(__u)
x_matrix_clear(__c)
x_matrix_clear(__vt)
_lib_alglib.alglib_rmatrixsvd.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixsvd.restype = ctypes.c_int32
def rmatrixsvd(a, m, n, uneeded, vtneeded, additionalmemory):
pass
__result = ctypes.c_uint8(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__uneeded = x_int()
__uneeded.val = int(uneeded)
if __uneeded.val!=uneeded:
raise ValueError("Error while converting 'uneeded' parameter to 'x_int'")
__vtneeded = x_int()
__vtneeded.val = int(vtneeded)
if __vtneeded.val!=vtneeded:
raise ValueError("Error while converting 'vtneeded' parameter to 'x_int'")
__additionalmemory = x_int()
__additionalmemory.val = int(additionalmemory)
if __additionalmemory.val!=additionalmemory:
raise ValueError("Error while converting 'additionalmemory' parameter to 'x_int'")
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__u = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__vt = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixsvd(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__uneeded), ctypes.byref(__vtneeded), ctypes.byref(__additionalmemory), ctypes.byref(__w), ctypes.byref(__u), ctypes.byref(__vt))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixsvd'")
__r__result = __result.value!=0
__r__w = list_from_x(__w)
__r__u = listlist_from_x(__u)
__r__vt = listlist_from_x(__vt)
return (__r__result, __r__w, __r__u, __r__vt)
finally:
x_matrix_clear(__a)
x_vector_clear(__w)
x_matrix_clear(__u)
x_matrix_clear(__vt)
_lib_alglib.alglib_smp_rmatrixsvd.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixsvd.restype = ctypes.c_int32
def smp_rmatrixsvd(a, m, n, uneeded, vtneeded, additionalmemory):
pass
__result = ctypes.c_uint8(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__uneeded = x_int()
__uneeded.val = int(uneeded)
if __uneeded.val!=uneeded:
raise ValueError("Error while converting 'uneeded' parameter to 'x_int'")
__vtneeded = x_int()
__vtneeded.val = int(vtneeded)
if __vtneeded.val!=vtneeded:
raise ValueError("Error while converting 'vtneeded' parameter to 'x_int'")
__additionalmemory = x_int()
__additionalmemory.val = int(additionalmemory)
if __additionalmemory.val!=additionalmemory:
raise ValueError("Error while converting 'additionalmemory' parameter to 'x_int'")
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__u = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__vt = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixsvd(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__uneeded), ctypes.byref(__vtneeded), ctypes.byref(__additionalmemory), ctypes.byref(__w), ctypes.byref(__u), ctypes.byref(__vt))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixsvd'")
__r__result = __result.value!=0
__r__w = list_from_x(__w)
__r__u = listlist_from_x(__u)
__r__vt = listlist_from_x(__vt)
return (__r__result, __r__w, __r__u, __r__vt)
finally:
x_matrix_clear(__a)
x_vector_clear(__w)
x_matrix_clear(__u)
x_matrix_clear(__vt)
_lib_alglib.x_obj_free_minlbfgsstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_minlbfgsstate.restype = None
_lib_alglib.x_minlbfgsstate_get_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlbfgsstate_get_needf.restype = None
_lib_alglib.x_minlbfgsstate_set_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlbfgsstate_set_needf.restype = None
_lib_alglib.x_minlbfgsstate_get_needfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlbfgsstate_get_needfg.restype = None
_lib_alglib.x_minlbfgsstate_set_needfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlbfgsstate_set_needfg.restype = None
_lib_alglib.x_minlbfgsstate_get_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlbfgsstate_get_xupdated.restype = None
_lib_alglib.x_minlbfgsstate_set_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlbfgsstate_set_xupdated.restype = None
_lib_alglib.x_minlbfgsstate_get_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlbfgsstate_get_f.restype = None
_lib_alglib.x_minlbfgsstate_set_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlbfgsstate_set_f.restype = None
_lib_alglib.x_minlbfgsstate_get_g.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlbfgsstate_get_g.restype = None
_lib_alglib.x_minlbfgsstate_get_x.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlbfgsstate_get_x.restype = None
class minlbfgsstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_minlbfgsstate(self.ptr)
class x_minlbfgsreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("iterationscount", x_int),
("nfev", x_int),
("varidx", x_int),
("terminationtype", x_int)
]
class minlbfgsreport(object):
def __init__(self):
self.iterationscount = 0
self.nfev = 0
self.varidx = 0
self.terminationtype = 0
def x_minlbfgsreport_zero_fields(x):
x.iterationscount.val = 0
x.nfev.val = 0
x.varidx.val = 0
x.terminationtype.val = 0
return
def x_minlbfgsreport_clear(x):
x_minlbfgsreport_zero_fields(x)
return
def x_from_minlbfgsreport(x,v):
x.iterationscount.val = int(v.iterationscount)
x.nfev.val = int(v.nfev)
x.varidx.val = int(v.varidx)
x.terminationtype.val = int(v.terminationtype)
return
def minlbfgsreport_from_x(x):
r = minlbfgsreport()
r.iterationscount = x.iterationscount.val
r.nfev = x.nfev.val
r.varidx = x.varidx.val
r.terminationtype = x.terminationtype.val
return r
_lib_alglib.alglib_minlbfgscreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgscreate.restype = ctypes.c_int32
def minlbfgscreate(*functionargs):
if len(functionargs)==3:
__friendly_form = False
n,m,x = functionargs
elif len(functionargs)==2:
__friendly_form = True
m,x = functionargs
n = safe_len("'minlbfgscreate': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minlbfgscreate': function must have 2 or 3 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgscreate(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__x), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgscreate'")
__r__state = minlbfgsstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minlbfgscreatef.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgscreatef.restype = ctypes.c_int32
def minlbfgscreatef(*functionargs):
if len(functionargs)==4:
__friendly_form = False
n,m,x,diffstep = functionargs
elif len(functionargs)==3:
__friendly_form = True
m,x,diffstep = functionargs
n = safe_len("'minlbfgscreatef': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minlbfgscreatef': function must have 3 or 4 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__diffstep = ctypes.c_double(diffstep)
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgscreatef(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__x), ctypes.byref(__diffstep), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgscreatef'")
__r__state = minlbfgsstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minlbfgssetcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgssetcond.restype = ctypes.c_int32
def minlbfgssetcond(state, epsg, epsf, epsx, maxits):
pass
__state = state.ptr
__epsg = ctypes.c_double(epsg)
__epsf = ctypes.c_double(epsf)
__epsx = ctypes.c_double(epsx)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgssetcond(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsg), ctypes.byref(__epsf), ctypes.byref(__epsx), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgssetcond'")
return
finally:
pass
_lib_alglib.alglib_minlbfgssetxrep.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgssetxrep.restype = ctypes.c_int32
def minlbfgssetxrep(state, needxrep):
pass
__state = state.ptr
__needxrep = ctypes.c_uint8(needxrep)
if __needxrep.value!=0:
__needxrep = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgssetxrep(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__needxrep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgssetxrep'")
return
finally:
pass
_lib_alglib.alglib_minlbfgssetstpmax.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgssetstpmax.restype = ctypes.c_int32
def minlbfgssetstpmax(state, stpmax):
pass
__state = state.ptr
__stpmax = ctypes.c_double(stpmax)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgssetstpmax(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__stpmax))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgssetstpmax'")
return
finally:
pass
_lib_alglib.alglib_minlbfgssetscale.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgssetscale.restype = ctypes.c_int32
def minlbfgssetscale(state, s):
pass
__state = state.ptr
if not is_real_vector(s):
raise ValueError("'s' parameter can't be cast to real_vector")
__s = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__s, s, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgssetscale(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgssetscale'")
return
finally:
x_vector_clear(__s)
_lib_alglib.alglib_minlbfgssetprecdefault.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgssetprecdefault.restype = ctypes.c_int32
def minlbfgssetprecdefault(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgssetprecdefault(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgssetprecdefault'")
return
finally:
pass
_lib_alglib.alglib_minlbfgssetpreccholesky.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgssetpreccholesky.restype = ctypes.c_int32
def minlbfgssetpreccholesky(state, p, isupper):
pass
__state = state.ptr
if not is_real_matrix(p):
raise ValueError("'p' parameter can't be cast to real_matrix")
__p = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__p, p, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgssetpreccholesky(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__p), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgssetpreccholesky'")
return
finally:
x_matrix_clear(__p)
_lib_alglib.alglib_minlbfgssetprecdiag.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgssetprecdiag.restype = ctypes.c_int32
def minlbfgssetprecdiag(state, d):
pass
__state = state.ptr
if not is_real_vector(d):
raise ValueError("'d' parameter can't be cast to real_vector")
__d = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__d, d, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgssetprecdiag(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__d))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgssetprecdiag'")
return
finally:
x_vector_clear(__d)
_lib_alglib.alglib_minlbfgssetprecscale.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgssetprecscale.restype = ctypes.c_int32
def minlbfgssetprecscale(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgssetprecscale(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgssetprecscale'")
return
finally:
pass
def minlbfgsoptimize_f(state, func, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minlbfgsstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
while True:
retval = _lib_alglib.alglib_minlbfgsiteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgsiteration'")
if not _xc_result:
break
_lib_alglib.x_minlbfgsstate_get_needf(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = func(_py_x, param)
_lib_alglib.x_minlbfgsstate_set_f(state.ptr, ctypes.byref(_xc_f))
continue
_lib_alglib.x_minlbfgsstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minlbfgsstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minlbfgsoptimize' (some derivatives were not provided?)")
return
def minlbfgsoptimize_g(state, grad, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minlbfgsstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
_xc_g = x_vector()
_lib_alglib.x_minlbfgsstate_get_g(state.ptr, ctypes.byref(_xc_g))
_py_g = create_real_vector(_xc_g.cnt)
while True:
retval = _lib_alglib.alglib_minlbfgsiteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgsiteration'")
if not _xc_result:
break
_lib_alglib.x_minlbfgsstate_get_needfg(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = grad(_py_x, _py_g, param)
_lib_alglib.x_minlbfgsstate_set_f(state.ptr, ctypes.byref(_xc_f))
x_from_list(_xc_g, _py_g, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minlbfgsstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minlbfgsstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minlbfgsoptimize' (some derivatives were not provided?)")
return
_lib_alglib.alglib_minlbfgsresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgsresults.restype = ctypes.c_int32
def minlbfgsresults(state):
pass
__state = state.ptr
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minlbfgsreport()
x_minlbfgsreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgsresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgsresults'")
__r__x = list_from_x(__x)
__r__rep = minlbfgsreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minlbfgsreport_clear(__rep)
_lib_alglib.alglib_minlbfgsresultsbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgsresultsbuf.restype = ctypes.c_int32
def minlbfgsresultsbuf(state, x, rep):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minlbfgsreport()
x_minlbfgsreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_minlbfgsreport(__rep, rep)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgsresultsbuf(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgsresultsbuf'")
__r__x = list_from_x(__x)
__r__rep = minlbfgsreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minlbfgsreport_clear(__rep)
_lib_alglib.alglib_minlbfgsrestartfrom.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgsrestartfrom.restype = ctypes.c_int32
def minlbfgsrestartfrom(state, x):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgsrestartfrom(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgsrestartfrom'")
return
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minlbfgsrequesttermination.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgsrequesttermination.restype = ctypes.c_int32
def minlbfgsrequesttermination(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgsrequesttermination(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgsrequesttermination'")
return
finally:
pass
_lib_alglib.alglib_minlbfgssetgradientcheck.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgssetgradientcheck.restype = ctypes.c_int32
def minlbfgssetgradientcheck(state, teststep):
pass
__state = state.ptr
__teststep = ctypes.c_double(teststep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgssetgradientcheck(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__teststep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgssetgradientcheck'")
return
finally:
pass
class x_densesolverreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("r1", ctypes.c_double),
("rinf", ctypes.c_double)
]
class densesolverreport(object):
def __init__(self):
self.r1 = 0
self.rinf = 0
def x_densesolverreport_zero_fields(x):
x.r1 = 0
x.rinf = 0
return
def x_densesolverreport_clear(x):
x_densesolverreport_zero_fields(x)
return
def x_from_densesolverreport(x,v):
x.r1 = float(v.r1)
x.rinf = float(v.rinf)
return
def densesolverreport_from_x(x):
r = densesolverreport()
r.r1 = x.r1
r.rinf = x.rinf
return r
class x_densesolverlsreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("r2", ctypes.c_double),
("cx", x_matrix),
("n", x_int),
("k", x_int)
]
class densesolverlsreport(object):
def __init__(self):
self.r2 = 0
self.cx = [[]]
self.n = 0
self.k = 0
def x_densesolverlsreport_zero_fields(x):
x.r2 = 0
x.cx = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
x.n.val = 0
x.k.val = 0
return
def x_densesolverlsreport_clear(x):
x_matrix_clear(x.cx)
x_densesolverlsreport_zero_fields(x)
return
def x_from_densesolverlsreport(x,v):
x.r2 = float(v.r2)
x_from_listlist(x.cx, v.cx, DT_REAL, X_CREATE)
x.n.val = int(v.n)
x.k.val = int(v.k)
return
def densesolverlsreport_from_x(x):
r = densesolverlsreport()
r.r2 = x.r2
r.cx = listlist_from_x(x.cx)
r.n = x.n.val
r.k = x.k.val
return r
_lib_alglib.alglib_rmatrixsolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixsolve.restype = ctypes.c_int32
def rmatrixsolve(a, n, b):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixsolve(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixsolve'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
x_densesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_smp_rmatrixsolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixsolve.restype = ctypes.c_int32
def smp_rmatrixsolve(a, n, b):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixsolve(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixsolve'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
x_densesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_rmatrixsolvefast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixsolvefast.restype = ctypes.c_int32
def rmatrixsolvefast(a, n, b):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixsolvefast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixsolvefast'")
__r__b = list_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
_lib_alglib.alglib_smp_rmatrixsolvefast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixsolvefast.restype = ctypes.c_int32
def smp_rmatrixsolvefast(a, n, b):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixsolvefast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixsolvefast'")
__r__b = list_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
_lib_alglib.alglib_rmatrixsolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixsolvem.restype = ctypes.c_int32
def rmatrixsolvem(a, n, b, m, rfs):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__rfs = ctypes.c_uint8(rfs)
if __rfs.value!=0:
__rfs = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixsolvem(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__rfs), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixsolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_smp_rmatrixsolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixsolvem.restype = ctypes.c_int32
def smp_rmatrixsolvem(a, n, b, m, rfs):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__rfs = ctypes.c_uint8(rfs)
if __rfs.value!=0:
__rfs = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixsolvem(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__rfs), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixsolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_rmatrixsolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixsolvemfast.restype = ctypes.c_int32
def rmatrixsolvemfast(a, n, b, m):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixsolvemfast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixsolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_smp_rmatrixsolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixsolvemfast.restype = ctypes.c_int32
def smp_rmatrixsolvemfast(a, n, b, m):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixsolvemfast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixsolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_rmatrixlusolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixlusolve.restype = ctypes.c_int32
def rmatrixlusolve(lua, p, n, b):
pass
if not is_real_matrix(lua):
raise ValueError("'lua' parameter can't be cast to real_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__lua, lua, DT_REAL, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixlusolve(ctypes.byref(_error_msg), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixlusolve'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__lua)
x_vector_clear(__p)
x_vector_clear(__b)
x_densesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_rmatrixlusolvefast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixlusolvefast.restype = ctypes.c_int32
def rmatrixlusolvefast(lua, p, n, b):
pass
if not is_real_matrix(lua):
raise ValueError("'lua' parameter can't be cast to real_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
try:
x_from_listlist(__lua, lua, DT_REAL, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixlusolvefast(ctypes.byref(_error_msg), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixlusolvefast'")
__r__b = list_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__lua)
x_vector_clear(__p)
x_vector_clear(__b)
_lib_alglib.alglib_rmatrixlusolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixlusolvem.restype = ctypes.c_int32
def rmatrixlusolvem(lua, p, n, b, m):
pass
if not is_real_matrix(lua):
raise ValueError("'lua' parameter can't be cast to real_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__lua, lua, DT_REAL, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixlusolvem(ctypes.byref(_error_msg), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixlusolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__lua)
x_vector_clear(__p)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_smp_rmatrixlusolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixlusolvem.restype = ctypes.c_int32
def smp_rmatrixlusolvem(lua, p, n, b, m):
pass
if not is_real_matrix(lua):
raise ValueError("'lua' parameter can't be cast to real_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__lua, lua, DT_REAL, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixlusolvem(ctypes.byref(_error_msg), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixlusolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__lua)
x_vector_clear(__p)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_rmatrixlusolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixlusolvemfast.restype = ctypes.c_int32
def rmatrixlusolvemfast(lua, p, n, b, m):
pass
if not is_real_matrix(lua):
raise ValueError("'lua' parameter can't be cast to real_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__lua, lua, DT_REAL, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixlusolvemfast(ctypes.byref(_error_msg), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixlusolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__lua)
x_vector_clear(__p)
x_matrix_clear(__b)
_lib_alglib.alglib_smp_rmatrixlusolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixlusolvemfast.restype = ctypes.c_int32
def smp_rmatrixlusolvemfast(lua, p, n, b, m):
pass
if not is_real_matrix(lua):
raise ValueError("'lua' parameter can't be cast to real_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__lua, lua, DT_REAL, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixlusolvemfast(ctypes.byref(_error_msg), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixlusolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__lua)
x_vector_clear(__p)
x_matrix_clear(__b)
_lib_alglib.alglib_rmatrixmixedsolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixmixedsolve.restype = ctypes.c_int32
def rmatrixmixedsolve(a, lua, p, n, b):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(lua):
raise ValueError("'lua' parameter can't be cast to real_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__lua, lua, DT_REAL, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixmixedsolve(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixmixedsolve'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_matrix_clear(__lua)
x_vector_clear(__p)
x_vector_clear(__b)
x_densesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_rmatrixmixedsolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixmixedsolvem.restype = ctypes.c_int32
def rmatrixmixedsolvem(a, lua, p, n, b, m):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(lua):
raise ValueError("'lua' parameter can't be cast to real_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__lua, lua, DT_REAL, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixmixedsolvem(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixmixedsolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_matrix_clear(__lua)
x_vector_clear(__p)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_cmatrixsolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixsolvem.restype = ctypes.c_int32
def cmatrixsolvem(a, n, b, m, rfs):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__rfs = ctypes.c_uint8(rfs)
if __rfs.value!=0:
__rfs = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixsolvem(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__rfs), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixsolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_smp_cmatrixsolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixsolvem.restype = ctypes.c_int32
def smp_cmatrixsolvem(a, n, b, m, rfs):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__rfs = ctypes.c_uint8(rfs)
if __rfs.value!=0:
__rfs = ctypes.c_uint8(1)
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixsolvem(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__rfs), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixsolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_cmatrixsolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixsolvemfast.restype = ctypes.c_int32
def cmatrixsolvemfast(a, n, b, m):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixsolvemfast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixsolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_smp_cmatrixsolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixsolvemfast.restype = ctypes.c_int32
def smp_cmatrixsolvemfast(a, n, b, m):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixsolvemfast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixsolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_cmatrixsolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixsolve.restype = ctypes.c_int32
def cmatrixsolve(a, n, b):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixsolve(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixsolve'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
x_densesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_smp_cmatrixsolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixsolve.restype = ctypes.c_int32
def smp_cmatrixsolve(a, n, b):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixsolve(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixsolve'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
x_densesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_cmatrixsolvefast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixsolvefast.restype = ctypes.c_int32
def cmatrixsolvefast(a, n, b):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixsolvefast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixsolvefast'")
__r__b = list_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
_lib_alglib.alglib_smp_cmatrixsolvefast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixsolvefast.restype = ctypes.c_int32
def smp_cmatrixsolvefast(a, n, b):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixsolvefast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixsolvefast'")
__r__b = list_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
_lib_alglib.alglib_cmatrixlusolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixlusolvem.restype = ctypes.c_int32
def cmatrixlusolvem(lua, p, n, b, m):
pass
if not is_complex_matrix(lua):
raise ValueError("'lua' parameter can't be cast to complex_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__lua, lua, DT_COMPLEX, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixlusolvem(ctypes.byref(_error_msg), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixlusolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__lua)
x_vector_clear(__p)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_smp_cmatrixlusolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixlusolvem.restype = ctypes.c_int32
def smp_cmatrixlusolvem(lua, p, n, b, m):
pass
if not is_complex_matrix(lua):
raise ValueError("'lua' parameter can't be cast to complex_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__lua, lua, DT_COMPLEX, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixlusolvem(ctypes.byref(_error_msg), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixlusolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__lua)
x_vector_clear(__p)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_cmatrixlusolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixlusolvemfast.restype = ctypes.c_int32
def cmatrixlusolvemfast(lua, p, n, b, m):
pass
if not is_complex_matrix(lua):
raise ValueError("'lua' parameter can't be cast to complex_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__lua, lua, DT_COMPLEX, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixlusolvemfast(ctypes.byref(_error_msg), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixlusolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__lua)
x_vector_clear(__p)
x_matrix_clear(__b)
_lib_alglib.alglib_smp_cmatrixlusolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_cmatrixlusolvemfast.restype = ctypes.c_int32
def smp_cmatrixlusolvemfast(lua, p, n, b, m):
pass
if not is_complex_matrix(lua):
raise ValueError("'lua' parameter can't be cast to complex_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__lua, lua, DT_COMPLEX, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_cmatrixlusolvemfast(ctypes.byref(_error_msg), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_cmatrixlusolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__lua)
x_vector_clear(__p)
x_matrix_clear(__b)
_lib_alglib.alglib_cmatrixlusolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixlusolve.restype = ctypes.c_int32
def cmatrixlusolve(lua, p, n, b):
pass
if not is_complex_matrix(lua):
raise ValueError("'lua' parameter can't be cast to complex_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__lua, lua, DT_COMPLEX, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixlusolve(ctypes.byref(_error_msg), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixlusolve'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__lua)
x_vector_clear(__p)
x_vector_clear(__b)
x_densesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_cmatrixlusolvefast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixlusolvefast.restype = ctypes.c_int32
def cmatrixlusolvefast(lua, p, n, b):
pass
if not is_complex_matrix(lua):
raise ValueError("'lua' parameter can't be cast to complex_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
try:
x_from_listlist(__lua, lua, DT_COMPLEX, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixlusolvefast(ctypes.byref(_error_msg), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixlusolvefast'")
__r__b = list_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__lua)
x_vector_clear(__p)
x_vector_clear(__b)
_lib_alglib.alglib_cmatrixmixedsolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixmixedsolvem.restype = ctypes.c_int32
def cmatrixmixedsolvem(a, lua, p, n, b, m):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_complex_matrix(lua):
raise ValueError("'lua' parameter can't be cast to complex_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__lua, lua, DT_COMPLEX, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixmixedsolvem(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixmixedsolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_matrix_clear(__lua)
x_vector_clear(__p)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_cmatrixmixedsolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixmixedsolve.restype = ctypes.c_int32
def cmatrixmixedsolve(a, lua, p, n, b):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_complex_matrix(lua):
raise ValueError("'lua' parameter can't be cast to complex_matrix")
__lua = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(p):
raise ValueError("'p' parameter can't be cast to int_vector")
__p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__lua, lua, DT_COMPLEX, X_CREATE)
x_from_list(__p, p, DT_INT, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixmixedsolve(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__lua), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__b), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixmixedsolve'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_matrix_clear(__lua)
x_vector_clear(__p)
x_vector_clear(__b)
x_densesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_spdmatrixsolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixsolvem.restype = ctypes.c_int32
def spdmatrixsolvem(a, n, isupper, b, m):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixsolvem(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixsolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_smp_spdmatrixsolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spdmatrixsolvem.restype = ctypes.c_int32
def smp_spdmatrixsolvem(a, n, isupper, b, m):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spdmatrixsolvem(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spdmatrixsolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_spdmatrixsolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixsolvemfast.restype = ctypes.c_int32
def spdmatrixsolvemfast(a, n, isupper, b, m):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixsolvemfast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixsolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_smp_spdmatrixsolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spdmatrixsolvemfast.restype = ctypes.c_int32
def smp_spdmatrixsolvemfast(a, n, isupper, b, m):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spdmatrixsolvemfast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spdmatrixsolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_spdmatrixsolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixsolve.restype = ctypes.c_int32
def spdmatrixsolve(a, n, isupper, b):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixsolve(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixsolve'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
x_densesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_smp_spdmatrixsolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spdmatrixsolve.restype = ctypes.c_int32
def smp_spdmatrixsolve(a, n, isupper, b):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spdmatrixsolve(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spdmatrixsolve'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
x_densesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_spdmatrixsolvefast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixsolvefast.restype = ctypes.c_int32
def spdmatrixsolvefast(a, n, isupper, b):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixsolvefast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixsolvefast'")
__r__b = list_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
_lib_alglib.alglib_smp_spdmatrixsolvefast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spdmatrixsolvefast.restype = ctypes.c_int32
def smp_spdmatrixsolvefast(a, n, isupper, b):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spdmatrixsolvefast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spdmatrixsolvefast'")
__r__b = list_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
_lib_alglib.alglib_spdmatrixcholeskysolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixcholeskysolvem.restype = ctypes.c_int32
def spdmatrixcholeskysolvem(cha, n, isupper, b, m):
pass
if not is_real_matrix(cha):
raise ValueError("'cha' parameter can't be cast to real_matrix")
__cha = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__cha, cha, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixcholeskysolvem(ctypes.byref(_error_msg), ctypes.byref(__cha), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixcholeskysolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__cha)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_smp_spdmatrixcholeskysolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spdmatrixcholeskysolvem.restype = ctypes.c_int32
def smp_spdmatrixcholeskysolvem(cha, n, isupper, b, m):
pass
if not is_real_matrix(cha):
raise ValueError("'cha' parameter can't be cast to real_matrix")
__cha = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__cha, cha, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spdmatrixcholeskysolvem(ctypes.byref(_error_msg), ctypes.byref(__cha), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spdmatrixcholeskysolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__cha)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_spdmatrixcholeskysolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixcholeskysolvemfast.restype = ctypes.c_int32
def spdmatrixcholeskysolvemfast(cha, n, isupper, b, m):
pass
if not is_real_matrix(cha):
raise ValueError("'cha' parameter can't be cast to real_matrix")
__cha = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__cha, cha, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixcholeskysolvemfast(ctypes.byref(_error_msg), ctypes.byref(__cha), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixcholeskysolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__cha)
x_matrix_clear(__b)
_lib_alglib.alglib_smp_spdmatrixcholeskysolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spdmatrixcholeskysolvemfast.restype = ctypes.c_int32
def smp_spdmatrixcholeskysolvemfast(cha, n, isupper, b, m):
pass
if not is_real_matrix(cha):
raise ValueError("'cha' parameter can't be cast to real_matrix")
__cha = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__cha, cha, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spdmatrixcholeskysolvemfast(ctypes.byref(_error_msg), ctypes.byref(__cha), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spdmatrixcholeskysolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__cha)
x_matrix_clear(__b)
_lib_alglib.alglib_spdmatrixcholeskysolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixcholeskysolve.restype = ctypes.c_int32
def spdmatrixcholeskysolve(cha, n, isupper, b):
pass
if not is_real_matrix(cha):
raise ValueError("'cha' parameter can't be cast to real_matrix")
__cha = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__cha, cha, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixcholeskysolve(ctypes.byref(_error_msg), ctypes.byref(__cha), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixcholeskysolve'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__cha)
x_vector_clear(__b)
x_densesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_spdmatrixcholeskysolvefast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixcholeskysolvefast.restype = ctypes.c_int32
def spdmatrixcholeskysolvefast(cha, n, isupper, b):
pass
if not is_real_matrix(cha):
raise ValueError("'cha' parameter can't be cast to real_matrix")
__cha = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
try:
x_from_listlist(__cha, cha, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixcholeskysolvefast(ctypes.byref(_error_msg), ctypes.byref(__cha), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixcholeskysolvefast'")
__r__b = list_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__cha)
x_vector_clear(__b)
_lib_alglib.alglib_hpdmatrixsolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hpdmatrixsolvem.restype = ctypes.c_int32
def hpdmatrixsolvem(a, n, isupper, b, m):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hpdmatrixsolvem(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hpdmatrixsolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_smp_hpdmatrixsolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_hpdmatrixsolvem.restype = ctypes.c_int32
def smp_hpdmatrixsolvem(a, n, isupper, b, m):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_hpdmatrixsolvem(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_hpdmatrixsolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_hpdmatrixsolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hpdmatrixsolvemfast.restype = ctypes.c_int32
def hpdmatrixsolvemfast(a, n, isupper, b, m):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hpdmatrixsolvemfast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hpdmatrixsolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_smp_hpdmatrixsolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_hpdmatrixsolvemfast.restype = ctypes.c_int32
def smp_hpdmatrixsolvemfast(a, n, isupper, b, m):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_hpdmatrixsolvemfast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_hpdmatrixsolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_hpdmatrixsolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hpdmatrixsolve.restype = ctypes.c_int32
def hpdmatrixsolve(a, n, isupper, b):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hpdmatrixsolve(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hpdmatrixsolve'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
x_densesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_smp_hpdmatrixsolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_hpdmatrixsolve.restype = ctypes.c_int32
def smp_hpdmatrixsolve(a, n, isupper, b):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_hpdmatrixsolve(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_hpdmatrixsolve'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
x_densesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_hpdmatrixsolvefast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hpdmatrixsolvefast.restype = ctypes.c_int32
def hpdmatrixsolvefast(a, n, isupper, b):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hpdmatrixsolvefast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hpdmatrixsolvefast'")
__r__b = list_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
_lib_alglib.alglib_smp_hpdmatrixsolvefast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_hpdmatrixsolvefast.restype = ctypes.c_int32
def smp_hpdmatrixsolvefast(a, n, isupper, b):
pass
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_hpdmatrixsolvefast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_hpdmatrixsolvefast'")
__r__b = list_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
_lib_alglib.alglib_hpdmatrixcholeskysolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hpdmatrixcholeskysolvem.restype = ctypes.c_int32
def hpdmatrixcholeskysolvem(cha, n, isupper, b, m):
pass
if not is_complex_matrix(cha):
raise ValueError("'cha' parameter can't be cast to complex_matrix")
__cha = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__cha, cha, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hpdmatrixcholeskysolvem(ctypes.byref(_error_msg), ctypes.byref(__cha), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hpdmatrixcholeskysolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__cha)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_smp_hpdmatrixcholeskysolvem.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_hpdmatrixcholeskysolvem.restype = ctypes.c_int32
def smp_hpdmatrixcholeskysolvem(cha, n, isupper, b, m):
pass
if not is_complex_matrix(cha):
raise ValueError("'cha' parameter can't be cast to complex_matrix")
__cha = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__cha, cha, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_hpdmatrixcholeskysolvem(ctypes.byref(_error_msg), ctypes.byref(__cha), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_hpdmatrixcholeskysolvem'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = listlist_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__cha)
x_matrix_clear(__b)
x_densesolverreport_clear(__rep)
x_matrix_clear(__x)
_lib_alglib.alglib_hpdmatrixcholeskysolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hpdmatrixcholeskysolvemfast.restype = ctypes.c_int32
def hpdmatrixcholeskysolvemfast(cha, n, isupper, b, m):
pass
if not is_complex_matrix(cha):
raise ValueError("'cha' parameter can't be cast to complex_matrix")
__cha = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__cha, cha, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hpdmatrixcholeskysolvemfast(ctypes.byref(_error_msg), ctypes.byref(__cha), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hpdmatrixcholeskysolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__cha)
x_matrix_clear(__b)
_lib_alglib.alglib_smp_hpdmatrixcholeskysolvemfast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_hpdmatrixcholeskysolvemfast.restype = ctypes.c_int32
def smp_hpdmatrixcholeskysolvemfast(cha, n, isupper, b, m):
pass
if not is_complex_matrix(cha):
raise ValueError("'cha' parameter can't be cast to complex_matrix")
__cha = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_matrix(b):
raise ValueError("'b' parameter can't be cast to complex_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
try:
x_from_listlist(__cha, cha, DT_COMPLEX, X_CREATE)
x_from_listlist(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_hpdmatrixcholeskysolvemfast(ctypes.byref(_error_msg), ctypes.byref(__cha), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_hpdmatrixcholeskysolvemfast'")
__r__b = listlist_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__cha)
x_matrix_clear(__b)
_lib_alglib.alglib_hpdmatrixcholeskysolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hpdmatrixcholeskysolve.restype = ctypes.c_int32
def hpdmatrixcholeskysolve(cha, n, isupper, b):
pass
if not is_complex_matrix(cha):
raise ValueError("'cha' parameter can't be cast to complex_matrix")
__cha = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
__rep = x_densesolverreport()
x_densesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__cha, cha, DT_COMPLEX, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hpdmatrixcholeskysolve(ctypes.byref(_error_msg), ctypes.byref(__cha), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hpdmatrixcholeskysolve'")
__r__info = __info.val
__r__rep = densesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__cha)
x_vector_clear(__b)
x_densesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_hpdmatrixcholeskysolvefast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hpdmatrixcholeskysolvefast.restype = ctypes.c_int32
def hpdmatrixcholeskysolvefast(cha, n, isupper, b):
pass
if not is_complex_matrix(cha):
raise ValueError("'cha' parameter can't be cast to complex_matrix")
__cha = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__info = x_int()
__info.val = 0
try:
x_from_listlist(__cha, cha, DT_COMPLEX, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hpdmatrixcholeskysolvefast(ctypes.byref(_error_msg), ctypes.byref(__cha), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__info))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hpdmatrixcholeskysolvefast'")
__r__b = list_from_x(__b)
__r__info = __info.val
return (__r__b, __r__info)
finally:
x_matrix_clear(__cha)
x_vector_clear(__b)
_lib_alglib.alglib_rmatrixsolvels.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixsolvels.restype = ctypes.c_int32
def rmatrixsolvels(a, nrows, ncols, b, threshold):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nrows = x_int()
__nrows.val = int(nrows)
if __nrows.val!=nrows:
raise ValueError("Error while converting 'nrows' parameter to 'x_int'")
__ncols = x_int()
__ncols.val = int(ncols)
if __ncols.val!=ncols:
raise ValueError("Error while converting 'ncols' parameter to 'x_int'")
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__threshold = ctypes.c_double(threshold)
__info = x_int()
__info.val = 0
__rep = x_densesolverlsreport()
x_densesolverlsreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixsolvels(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__nrows), ctypes.byref(__ncols), ctypes.byref(__b), ctypes.byref(__threshold), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixsolvels'")
__r__info = __info.val
__r__rep = densesolverlsreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
x_densesolverlsreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_smp_rmatrixsolvels.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rmatrixsolvels.restype = ctypes.c_int32
def smp_rmatrixsolvels(a, nrows, ncols, b, threshold):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nrows = x_int()
__nrows.val = int(nrows)
if __nrows.val!=nrows:
raise ValueError("Error while converting 'nrows' parameter to 'x_int'")
__ncols = x_int()
__ncols.val = int(ncols)
if __ncols.val!=ncols:
raise ValueError("Error while converting 'ncols' parameter to 'x_int'")
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__threshold = ctypes.c_double(threshold)
__info = x_int()
__info.val = 0
__rep = x_densesolverlsreport()
x_densesolverlsreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rmatrixsolvels(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__nrows), ctypes.byref(__ncols), ctypes.byref(__b), ctypes.byref(__threshold), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rmatrixsolvels'")
__r__info = __info.val
__r__rep = densesolverlsreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__info, __r__rep, __r__x)
finally:
x_matrix_clear(__a)
x_vector_clear(__b)
x_densesolverlsreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.x_obj_free_normestimatorstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_normestimatorstate.restype = None
class normestimatorstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_normestimatorstate(self.ptr)
_lib_alglib.alglib_normestimatorcreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_normestimatorcreate.restype = ctypes.c_int32
def normestimatorcreate(m, n, nstart, nits):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__nstart = x_int()
__nstart.val = int(nstart)
if __nstart.val!=nstart:
raise ValueError("Error while converting 'nstart' parameter to 'x_int'")
__nits = x_int()
__nits.val = int(nits)
if __nits.val!=nits:
raise ValueError("Error while converting 'nits' parameter to 'x_int'")
__state = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_normestimatorcreate(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__nstart), ctypes.byref(__nits), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'normestimatorcreate'")
__r__state = normestimatorstate(__state)
return __r__state
finally:
pass
_lib_alglib.alglib_normestimatorsetseed.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_normestimatorsetseed.restype = ctypes.c_int32
def normestimatorsetseed(state, seedval):
pass
__state = state.ptr
__seedval = x_int()
__seedval.val = int(seedval)
if __seedval.val!=seedval:
raise ValueError("Error while converting 'seedval' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_normestimatorsetseed(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__seedval))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'normestimatorsetseed'")
return
finally:
pass
_lib_alglib.alglib_normestimatorestimatesparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_normestimatorestimatesparse.restype = ctypes.c_int32
def normestimatorestimatesparse(state, a):
pass
__state = state.ptr
__a = a.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_normestimatorestimatesparse(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'normestimatorestimatesparse'")
return
finally:
pass
_lib_alglib.alglib_normestimatorresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_normestimatorresults.restype = ctypes.c_int32
def normestimatorresults(state):
pass
__state = state.ptr
__nrm = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_normestimatorresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__nrm))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'normestimatorresults'")
__r__nrm = __nrm.value
return __r__nrm
finally:
pass
_lib_alglib.x_obj_free_linlsqrstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_linlsqrstate.restype = None
class linlsqrstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_linlsqrstate(self.ptr)
class x_linlsqrreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("iterationscount", x_int),
("nmv", x_int),
("terminationtype", x_int)
]
class linlsqrreport(object):
def __init__(self):
self.iterationscount = 0
self.nmv = 0
self.terminationtype = 0
def x_linlsqrreport_zero_fields(x):
x.iterationscount.val = 0
x.nmv.val = 0
x.terminationtype.val = 0
return
def x_linlsqrreport_clear(x):
x_linlsqrreport_zero_fields(x)
return
def x_from_linlsqrreport(x,v):
x.iterationscount.val = int(v.iterationscount)
x.nmv.val = int(v.nmv)
x.terminationtype.val = int(v.terminationtype)
return
def linlsqrreport_from_x(x):
r = linlsqrreport()
r.iterationscount = x.iterationscount.val
r.nmv = x.nmv.val
r.terminationtype = x.terminationtype.val
return r
_lib_alglib.alglib_linlsqrcreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_linlsqrcreate.restype = ctypes.c_int32
def linlsqrcreate(m, n):
pass
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__state = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_linlsqrcreate(ctypes.byref(_error_msg), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'linlsqrcreate'")
__r__state = linlsqrstate(__state)
return __r__state
finally:
pass
_lib_alglib.alglib_linlsqrsetprecunit.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_linlsqrsetprecunit.restype = ctypes.c_int32
def linlsqrsetprecunit(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_linlsqrsetprecunit(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'linlsqrsetprecunit'")
return
finally:
pass
_lib_alglib.alglib_linlsqrsetprecdiag.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_linlsqrsetprecdiag.restype = ctypes.c_int32
def linlsqrsetprecdiag(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_linlsqrsetprecdiag(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'linlsqrsetprecdiag'")
return
finally:
pass
_lib_alglib.alglib_linlsqrsetlambdai.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_linlsqrsetlambdai.restype = ctypes.c_int32
def linlsqrsetlambdai(state, lambdai):
pass
__state = state.ptr
__lambdai = ctypes.c_double(lambdai)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_linlsqrsetlambdai(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__lambdai))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'linlsqrsetlambdai'")
return
finally:
pass
_lib_alglib.alglib_linlsqrsolvesparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_linlsqrsolvesparse.restype = ctypes.c_int32
def linlsqrsolvesparse(state, a, b):
pass
__state = state.ptr
__a = a.ptr
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_linlsqrsolvesparse(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__a), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'linlsqrsolvesparse'")
return
finally:
x_vector_clear(__b)
_lib_alglib.alglib_linlsqrsetcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_linlsqrsetcond.restype = ctypes.c_int32
def linlsqrsetcond(state, epsa, epsb, maxits):
pass
__state = state.ptr
__epsa = ctypes.c_double(epsa)
__epsb = ctypes.c_double(epsb)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_linlsqrsetcond(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsa), ctypes.byref(__epsb), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'linlsqrsetcond'")
return
finally:
pass
_lib_alglib.alglib_linlsqrresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_linlsqrresults.restype = ctypes.c_int32
def linlsqrresults(state):
pass
__state = state.ptr
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_linlsqrreport()
x_linlsqrreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_linlsqrresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'linlsqrresults'")
__r__x = list_from_x(__x)
__r__rep = linlsqrreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_linlsqrreport_clear(__rep)
_lib_alglib.alglib_linlsqrsetxrep.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_linlsqrsetxrep.restype = ctypes.c_int32
def linlsqrsetxrep(state, needxrep):
pass
__state = state.ptr
__needxrep = ctypes.c_uint8(needxrep)
if __needxrep.value!=0:
__needxrep = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_linlsqrsetxrep(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__needxrep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'linlsqrsetxrep'")
return
finally:
pass
_lib_alglib.x_obj_free_mincgstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_mincgstate.restype = None
_lib_alglib.x_mincgstate_get_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_mincgstate_get_needf.restype = None
_lib_alglib.x_mincgstate_set_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_mincgstate_set_needf.restype = None
_lib_alglib.x_mincgstate_get_needfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_mincgstate_get_needfg.restype = None
_lib_alglib.x_mincgstate_set_needfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_mincgstate_set_needfg.restype = None
_lib_alglib.x_mincgstate_get_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_mincgstate_get_xupdated.restype = None
_lib_alglib.x_mincgstate_set_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_mincgstate_set_xupdated.restype = None
_lib_alglib.x_mincgstate_get_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_mincgstate_get_f.restype = None
_lib_alglib.x_mincgstate_set_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_mincgstate_set_f.restype = None
_lib_alglib.x_mincgstate_get_g.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_mincgstate_get_g.restype = None
_lib_alglib.x_mincgstate_get_x.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_mincgstate_get_x.restype = None
class mincgstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_mincgstate(self.ptr)
class x_mincgreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("iterationscount", x_int),
("nfev", x_int),
("varidx", x_int),
("terminationtype", x_int)
]
class mincgreport(object):
def __init__(self):
self.iterationscount = 0
self.nfev = 0
self.varidx = 0
self.terminationtype = 0
def x_mincgreport_zero_fields(x):
x.iterationscount.val = 0
x.nfev.val = 0
x.varidx.val = 0
x.terminationtype.val = 0
return
def x_mincgreport_clear(x):
x_mincgreport_zero_fields(x)
return
def x_from_mincgreport(x,v):
x.iterationscount.val = int(v.iterationscount)
x.nfev.val = int(v.nfev)
x.varidx.val = int(v.varidx)
x.terminationtype.val = int(v.terminationtype)
return
def mincgreport_from_x(x):
r = mincgreport()
r.iterationscount = x.iterationscount.val
r.nfev = x.nfev.val
r.varidx = x.varidx.val
r.terminationtype = x.terminationtype.val
return r
_lib_alglib.alglib_mincgcreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgcreate.restype = ctypes.c_int32
def mincgcreate(*functionargs):
if len(functionargs)==2:
__friendly_form = False
n,x = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_len("'mincgcreate': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'mincgcreate': function must have 1 or 2 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgcreate(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgcreate'")
__r__state = mincgstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_mincgcreatef.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgcreatef.restype = ctypes.c_int32
def mincgcreatef(*functionargs):
if len(functionargs)==3:
__friendly_form = False
n,x,diffstep = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,diffstep = functionargs
n = safe_len("'mincgcreatef': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'mincgcreatef': function must have 2 or 3 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__diffstep = ctypes.c_double(diffstep)
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgcreatef(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__diffstep), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgcreatef'")
__r__state = mincgstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_mincgsetcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgsetcond.restype = ctypes.c_int32
def mincgsetcond(state, epsg, epsf, epsx, maxits):
pass
__state = state.ptr
__epsg = ctypes.c_double(epsg)
__epsf = ctypes.c_double(epsf)
__epsx = ctypes.c_double(epsx)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgsetcond(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsg), ctypes.byref(__epsf), ctypes.byref(__epsx), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgsetcond'")
return
finally:
pass
_lib_alglib.alglib_mincgsetscale.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgsetscale.restype = ctypes.c_int32
def mincgsetscale(state, s):
pass
__state = state.ptr
if not is_real_vector(s):
raise ValueError("'s' parameter can't be cast to real_vector")
__s = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__s, s, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgsetscale(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgsetscale'")
return
finally:
x_vector_clear(__s)
_lib_alglib.alglib_mincgsetxrep.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgsetxrep.restype = ctypes.c_int32
def mincgsetxrep(state, needxrep):
pass
__state = state.ptr
__needxrep = ctypes.c_uint8(needxrep)
if __needxrep.value!=0:
__needxrep = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgsetxrep(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__needxrep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgsetxrep'")
return
finally:
pass
_lib_alglib.alglib_mincgsetcgtype.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgsetcgtype.restype = ctypes.c_int32
def mincgsetcgtype(state, cgtype):
pass
__state = state.ptr
__cgtype = x_int()
__cgtype.val = int(cgtype)
if __cgtype.val!=cgtype:
raise ValueError("Error while converting 'cgtype' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgsetcgtype(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__cgtype))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgsetcgtype'")
return
finally:
pass
_lib_alglib.alglib_mincgsetstpmax.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgsetstpmax.restype = ctypes.c_int32
def mincgsetstpmax(state, stpmax):
pass
__state = state.ptr
__stpmax = ctypes.c_double(stpmax)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgsetstpmax(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__stpmax))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgsetstpmax'")
return
finally:
pass
_lib_alglib.alglib_mincgsuggeststep.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgsuggeststep.restype = ctypes.c_int32
def mincgsuggeststep(state, stp):
pass
__state = state.ptr
__stp = ctypes.c_double(stp)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgsuggeststep(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__stp))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgsuggeststep'")
return
finally:
pass
_lib_alglib.alglib_mincgsetprecdefault.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgsetprecdefault.restype = ctypes.c_int32
def mincgsetprecdefault(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgsetprecdefault(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgsetprecdefault'")
return
finally:
pass
_lib_alglib.alglib_mincgsetprecdiag.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgsetprecdiag.restype = ctypes.c_int32
def mincgsetprecdiag(state, d):
pass
__state = state.ptr
if not is_real_vector(d):
raise ValueError("'d' parameter can't be cast to real_vector")
__d = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__d, d, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgsetprecdiag(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__d))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgsetprecdiag'")
return
finally:
x_vector_clear(__d)
_lib_alglib.alglib_mincgsetprecscale.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgsetprecscale.restype = ctypes.c_int32
def mincgsetprecscale(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgsetprecscale(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgsetprecscale'")
return
finally:
pass
def mincgoptimize_f(state, func, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_mincgstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
while True:
retval = _lib_alglib.alglib_mincgiteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'mincgiteration'")
if not _xc_result:
break
_lib_alglib.x_mincgstate_get_needf(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = func(_py_x, param)
_lib_alglib.x_mincgstate_set_f(state.ptr, ctypes.byref(_xc_f))
continue
_lib_alglib.x_mincgstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_mincgstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'mincgoptimize' (some derivatives were not provided?)")
return
def mincgoptimize_g(state, grad, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_mincgstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
_xc_g = x_vector()
_lib_alglib.x_mincgstate_get_g(state.ptr, ctypes.byref(_xc_g))
_py_g = create_real_vector(_xc_g.cnt)
while True:
retval = _lib_alglib.alglib_mincgiteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'mincgiteration'")
if not _xc_result:
break
_lib_alglib.x_mincgstate_get_needfg(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = grad(_py_x, _py_g, param)
_lib_alglib.x_mincgstate_set_f(state.ptr, ctypes.byref(_xc_f))
x_from_list(_xc_g, _py_g, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_mincgstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_mincgstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'mincgoptimize' (some derivatives were not provided?)")
return
_lib_alglib.alglib_mincgresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgresults.restype = ctypes.c_int32
def mincgresults(state):
pass
__state = state.ptr
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_mincgreport()
x_mincgreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgresults'")
__r__x = list_from_x(__x)
__r__rep = mincgreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_mincgreport_clear(__rep)
_lib_alglib.alglib_mincgresultsbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgresultsbuf.restype = ctypes.c_int32
def mincgresultsbuf(state, x, rep):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_mincgreport()
x_mincgreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_mincgreport(__rep, rep)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgresultsbuf(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgresultsbuf'")
__r__x = list_from_x(__x)
__r__rep = mincgreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_mincgreport_clear(__rep)
_lib_alglib.alglib_mincgrestartfrom.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgrestartfrom.restype = ctypes.c_int32
def mincgrestartfrom(state, x):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgrestartfrom(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgrestartfrom'")
return
finally:
x_vector_clear(__x)
_lib_alglib.alglib_mincgrequesttermination.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgrequesttermination.restype = ctypes.c_int32
def mincgrequesttermination(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgrequesttermination(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgrequesttermination'")
return
finally:
pass
_lib_alglib.alglib_mincgsetgradientcheck.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mincgsetgradientcheck.restype = ctypes.c_int32
def mincgsetgradientcheck(state, teststep):
pass
__state = state.ptr
__teststep = ctypes.c_double(teststep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mincgsetgradientcheck(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__teststep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mincgsetgradientcheck'")
return
finally:
pass
_lib_alglib.x_obj_free_minbleicstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_minbleicstate.restype = None
_lib_alglib.x_minbleicstate_get_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbleicstate_get_needf.restype = None
_lib_alglib.x_minbleicstate_set_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbleicstate_set_needf.restype = None
_lib_alglib.x_minbleicstate_get_needfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbleicstate_get_needfg.restype = None
_lib_alglib.x_minbleicstate_set_needfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbleicstate_set_needfg.restype = None
_lib_alglib.x_minbleicstate_get_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbleicstate_get_xupdated.restype = None
_lib_alglib.x_minbleicstate_set_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbleicstate_set_xupdated.restype = None
_lib_alglib.x_minbleicstate_get_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbleicstate_get_f.restype = None
_lib_alglib.x_minbleicstate_set_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbleicstate_set_f.restype = None
_lib_alglib.x_minbleicstate_get_g.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbleicstate_get_g.restype = None
_lib_alglib.x_minbleicstate_get_x.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbleicstate_get_x.restype = None
class minbleicstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_minbleicstate(self.ptr)
class x_minbleicreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("iterationscount", x_int),
("nfev", x_int),
("varidx", x_int),
("terminationtype", x_int),
("debugeqerr", ctypes.c_double),
("debugfs", ctypes.c_double),
("debugff", ctypes.c_double),
("debugdx", ctypes.c_double),
("debugfeasqpits", x_int),
("debugfeasgpaits", x_int),
("inneriterationscount", x_int),
("outeriterationscount", x_int)
]
class minbleicreport(object):
def __init__(self):
self.iterationscount = 0
self.nfev = 0
self.varidx = 0
self.terminationtype = 0
self.debugeqerr = 0
self.debugfs = 0
self.debugff = 0
self.debugdx = 0
self.debugfeasqpits = 0
self.debugfeasgpaits = 0
self.inneriterationscount = 0
self.outeriterationscount = 0
def x_minbleicreport_zero_fields(x):
x.iterationscount.val = 0
x.nfev.val = 0
x.varidx.val = 0
x.terminationtype.val = 0
x.debugeqerr = 0
x.debugfs = 0
x.debugff = 0
x.debugdx = 0
x.debugfeasqpits.val = 0
x.debugfeasgpaits.val = 0
x.inneriterationscount.val = 0
x.outeriterationscount.val = 0
return
def x_minbleicreport_clear(x):
x_minbleicreport_zero_fields(x)
return
def x_from_minbleicreport(x,v):
x.iterationscount.val = int(v.iterationscount)
x.nfev.val = int(v.nfev)
x.varidx.val = int(v.varidx)
x.terminationtype.val = int(v.terminationtype)
x.debugeqerr = float(v.debugeqerr)
x.debugfs = float(v.debugfs)
x.debugff = float(v.debugff)
x.debugdx = float(v.debugdx)
x.debugfeasqpits.val = int(v.debugfeasqpits)
x.debugfeasgpaits.val = int(v.debugfeasgpaits)
x.inneriterationscount.val = int(v.inneriterationscount)
x.outeriterationscount.val = int(v.outeriterationscount)
return
def minbleicreport_from_x(x):
r = minbleicreport()
r.iterationscount = x.iterationscount.val
r.nfev = x.nfev.val
r.varidx = x.varidx.val
r.terminationtype = x.terminationtype.val
r.debugeqerr = x.debugeqerr
r.debugfs = x.debugfs
r.debugff = x.debugff
r.debugdx = x.debugdx
r.debugfeasqpits = x.debugfeasqpits.val
r.debugfeasgpaits = x.debugfeasgpaits.val
r.inneriterationscount = x.inneriterationscount.val
r.outeriterationscount = x.outeriterationscount.val
return r
_lib_alglib.alglib_minbleiccreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleiccreate.restype = ctypes.c_int32
def minbleiccreate(*functionargs):
if len(functionargs)==2:
__friendly_form = False
n,x = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_len("'minbleiccreate': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minbleiccreate': function must have 1 or 2 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleiccreate(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleiccreate'")
__r__state = minbleicstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minbleiccreatef.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleiccreatef.restype = ctypes.c_int32
def minbleiccreatef(*functionargs):
if len(functionargs)==3:
__friendly_form = False
n,x,diffstep = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,diffstep = functionargs
n = safe_len("'minbleiccreatef': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minbleiccreatef': function must have 2 or 3 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__diffstep = ctypes.c_double(diffstep)
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleiccreatef(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__diffstep), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleiccreatef'")
__r__state = minbleicstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minbleicsetbc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicsetbc.restype = ctypes.c_int32
def minbleicsetbc(state, bndl, bndu):
pass
__state = state.ptr
if not is_real_vector(bndl):
raise ValueError("'bndl' parameter can't be cast to real_vector")
__bndl = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(bndu):
raise ValueError("'bndu' parameter can't be cast to real_vector")
__bndu = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__bndl, bndl, DT_REAL, X_CREATE)
x_from_list(__bndu, bndu, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicsetbc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__bndl), ctypes.byref(__bndu))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicsetbc'")
return
finally:
x_vector_clear(__bndl)
x_vector_clear(__bndu)
_lib_alglib.alglib_minbleicsetlc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicsetlc.restype = ctypes.c_int32
def minbleicsetlc(*functionargs):
if len(functionargs)==4:
__friendly_form = False
state,c,ct,k = functionargs
elif len(functionargs)==3:
__friendly_form = True
state,c,ct = functionargs
if safe_rows("'minbleicsetlc': incorrect parameters",c)!=safe_len("'minbleicsetlc': incorrect parameters",ct):
raise RuntimeError("Error while calling 'minbleicsetlc': looks like one of arguments has wrong size")
k = safe_rows("'minbleicsetlc': incorrect parameters",c)
else:
raise RuntimeError("Error while calling 'minbleicsetlc': function must have 3 or 4 parameters")
__state = state.ptr
if not is_real_matrix(c):
raise ValueError("'c' parameter can't be cast to real_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(ct):
raise ValueError("'ct' parameter can't be cast to int_vector")
__ct = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
try:
x_from_listlist(__c, c, DT_REAL, X_CREATE)
x_from_list(__ct, ct, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicsetlc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__c), ctypes.byref(__ct), ctypes.byref(__k))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicsetlc'")
return
finally:
x_matrix_clear(__c)
x_vector_clear(__ct)
_lib_alglib.alglib_minbleicsetcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicsetcond.restype = ctypes.c_int32
def minbleicsetcond(state, epsg, epsf, epsx, maxits):
pass
__state = state.ptr
__epsg = ctypes.c_double(epsg)
__epsf = ctypes.c_double(epsf)
__epsx = ctypes.c_double(epsx)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicsetcond(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsg), ctypes.byref(__epsf), ctypes.byref(__epsx), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicsetcond'")
return
finally:
pass
_lib_alglib.alglib_minbleicsetscale.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicsetscale.restype = ctypes.c_int32
def minbleicsetscale(state, s):
pass
__state = state.ptr
if not is_real_vector(s):
raise ValueError("'s' parameter can't be cast to real_vector")
__s = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__s, s, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicsetscale(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicsetscale'")
return
finally:
x_vector_clear(__s)
_lib_alglib.alglib_minbleicsetprecdefault.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicsetprecdefault.restype = ctypes.c_int32
def minbleicsetprecdefault(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicsetprecdefault(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicsetprecdefault'")
return
finally:
pass
_lib_alglib.alglib_minbleicsetprecdiag.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicsetprecdiag.restype = ctypes.c_int32
def minbleicsetprecdiag(state, d):
pass
__state = state.ptr
if not is_real_vector(d):
raise ValueError("'d' parameter can't be cast to real_vector")
__d = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__d, d, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicsetprecdiag(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__d))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicsetprecdiag'")
return
finally:
x_vector_clear(__d)
_lib_alglib.alglib_minbleicsetprecscale.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicsetprecscale.restype = ctypes.c_int32
def minbleicsetprecscale(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicsetprecscale(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicsetprecscale'")
return
finally:
pass
_lib_alglib.alglib_minbleicsetxrep.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicsetxrep.restype = ctypes.c_int32
def minbleicsetxrep(state, needxrep):
pass
__state = state.ptr
__needxrep = ctypes.c_uint8(needxrep)
if __needxrep.value!=0:
__needxrep = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicsetxrep(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__needxrep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicsetxrep'")
return
finally:
pass
_lib_alglib.alglib_minbleicsetstpmax.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicsetstpmax.restype = ctypes.c_int32
def minbleicsetstpmax(state, stpmax):
pass
__state = state.ptr
__stpmax = ctypes.c_double(stpmax)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicsetstpmax(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__stpmax))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicsetstpmax'")
return
finally:
pass
def minbleicoptimize_f(state, func, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minbleicstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
while True:
retval = _lib_alglib.alglib_minbleiciteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minbleiciteration'")
if not _xc_result:
break
_lib_alglib.x_minbleicstate_get_needf(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = func(_py_x, param)
_lib_alglib.x_minbleicstate_set_f(state.ptr, ctypes.byref(_xc_f))
continue
_lib_alglib.x_minbleicstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minbleicstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minbleicoptimize' (some derivatives were not provided?)")
return
def minbleicoptimize_g(state, grad, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minbleicstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
_xc_g = x_vector()
_lib_alglib.x_minbleicstate_get_g(state.ptr, ctypes.byref(_xc_g))
_py_g = create_real_vector(_xc_g.cnt)
while True:
retval = _lib_alglib.alglib_minbleiciteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minbleiciteration'")
if not _xc_result:
break
_lib_alglib.x_minbleicstate_get_needfg(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = grad(_py_x, _py_g, param)
_lib_alglib.x_minbleicstate_set_f(state.ptr, ctypes.byref(_xc_f))
x_from_list(_xc_g, _py_g, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minbleicstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minbleicstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minbleicoptimize' (some derivatives were not provided?)")
return
_lib_alglib.alglib_minbleicresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicresults.restype = ctypes.c_int32
def minbleicresults(state):
pass
__state = state.ptr
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minbleicreport()
x_minbleicreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicresults'")
__r__x = list_from_x(__x)
__r__rep = minbleicreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minbleicreport_clear(__rep)
_lib_alglib.alglib_minbleicresultsbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicresultsbuf.restype = ctypes.c_int32
def minbleicresultsbuf(state, x, rep):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minbleicreport()
x_minbleicreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_minbleicreport(__rep, rep)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicresultsbuf(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicresultsbuf'")
__r__x = list_from_x(__x)
__r__rep = minbleicreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minbleicreport_clear(__rep)
_lib_alglib.alglib_minbleicrestartfrom.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicrestartfrom.restype = ctypes.c_int32
def minbleicrestartfrom(state, x):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicrestartfrom(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicrestartfrom'")
return
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minbleicrequesttermination.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicrequesttermination.restype = ctypes.c_int32
def minbleicrequesttermination(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicrequesttermination(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicrequesttermination'")
return
finally:
pass
_lib_alglib.alglib_minbleicsetgradientcheck.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicsetgradientcheck.restype = ctypes.c_int32
def minbleicsetgradientcheck(state, teststep):
pass
__state = state.ptr
__teststep = ctypes.c_double(teststep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicsetgradientcheck(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__teststep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicsetgradientcheck'")
return
finally:
pass
_lib_alglib.x_obj_free_minqpstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_minqpstate.restype = None
class minqpstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_minqpstate(self.ptr)
class x_minqpreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("inneriterationscount", x_int),
("outeriterationscount", x_int),
("nmv", x_int),
("ncholesky", x_int),
("terminationtype", x_int)
]
class minqpreport(object):
def __init__(self):
self.inneriterationscount = 0
self.outeriterationscount = 0
self.nmv = 0
self.ncholesky = 0
self.terminationtype = 0
def x_minqpreport_zero_fields(x):
x.inneriterationscount.val = 0
x.outeriterationscount.val = 0
x.nmv.val = 0
x.ncholesky.val = 0
x.terminationtype.val = 0
return
def x_minqpreport_clear(x):
x_minqpreport_zero_fields(x)
return
def x_from_minqpreport(x,v):
x.inneriterationscount.val = int(v.inneriterationscount)
x.outeriterationscount.val = int(v.outeriterationscount)
x.nmv.val = int(v.nmv)
x.ncholesky.val = int(v.ncholesky)
x.terminationtype.val = int(v.terminationtype)
return
def minqpreport_from_x(x):
r = minqpreport()
r.inneriterationscount = x.inneriterationscount.val
r.outeriterationscount = x.outeriterationscount.val
r.nmv = x.nmv.val
r.ncholesky = x.ncholesky.val
r.terminationtype = x.terminationtype.val
return r
_lib_alglib.alglib_minqpcreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpcreate.restype = ctypes.c_int32
def minqpcreate(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__state = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpcreate(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpcreate'")
__r__state = minqpstate(__state)
return __r__state
finally:
pass
_lib_alglib.alglib_minqpsetlinearterm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetlinearterm.restype = ctypes.c_int32
def minqpsetlinearterm(state, b):
pass
__state = state.ptr
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetlinearterm(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetlinearterm'")
return
finally:
x_vector_clear(__b)
_lib_alglib.alglib_minqpsetquadraticterm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetquadraticterm.restype = ctypes.c_int32
def minqpsetquadraticterm(*functionargs):
if len(functionargs)==3:
__friendly_form = False
state,a,isupper = functionargs
elif len(functionargs)==2:
__friendly_form = True
state,a = functionargs
isupper = False
else:
raise RuntimeError("Error while calling 'minqpsetquadraticterm': function must have 2 or 3 parameters")
__state = state.ptr
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to symmetric")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
if __friendly_form:
if not x_is_symmetric(__a):
raise ValueError("'a' parameter is not symmetric matrix")
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetquadraticterm(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__a), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetquadraticterm'")
return
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_minqpsetquadratictermsparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetquadratictermsparse.restype = ctypes.c_int32
def minqpsetquadratictermsparse(state, a, isupper):
pass
__state = state.ptr
__a = a.ptr
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetquadratictermsparse(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__a), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetquadratictermsparse'")
return
finally:
pass
_lib_alglib.alglib_minqpsetstartingpoint.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetstartingpoint.restype = ctypes.c_int32
def minqpsetstartingpoint(state, x):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetstartingpoint(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetstartingpoint'")
return
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minqpsetorigin.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetorigin.restype = ctypes.c_int32
def minqpsetorigin(state, xorigin):
pass
__state = state.ptr
if not is_real_vector(xorigin):
raise ValueError("'xorigin' parameter can't be cast to real_vector")
__xorigin = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__xorigin, xorigin, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetorigin(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__xorigin))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetorigin'")
return
finally:
x_vector_clear(__xorigin)
_lib_alglib.alglib_minqpsetscale.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetscale.restype = ctypes.c_int32
def minqpsetscale(state, s):
pass
__state = state.ptr
if not is_real_vector(s):
raise ValueError("'s' parameter can't be cast to real_vector")
__s = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__s, s, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetscale(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetscale'")
return
finally:
x_vector_clear(__s)
_lib_alglib.alglib_minqpsetscaleautodiag.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetscaleautodiag.restype = ctypes.c_int32
def minqpsetscaleautodiag(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetscaleautodiag(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetscaleautodiag'")
return
finally:
pass
_lib_alglib.alglib_minqpsetalgocholesky.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetalgocholesky.restype = ctypes.c_int32
def minqpsetalgocholesky(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetalgocholesky(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetalgocholesky'")
return
finally:
pass
_lib_alglib.alglib_minqpsetalgobleic.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetalgobleic.restype = ctypes.c_int32
def minqpsetalgobleic(state, epsg, epsf, epsx, maxits):
pass
__state = state.ptr
__epsg = ctypes.c_double(epsg)
__epsf = ctypes.c_double(epsf)
__epsx = ctypes.c_double(epsx)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetalgobleic(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsg), ctypes.byref(__epsf), ctypes.byref(__epsx), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetalgobleic'")
return
finally:
pass
_lib_alglib.alglib_minqpsetalgodenseaul.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetalgodenseaul.restype = ctypes.c_int32
def minqpsetalgodenseaul(state, epsx, rho, itscnt):
pass
__state = state.ptr
__epsx = ctypes.c_double(epsx)
__rho = ctypes.c_double(rho)
__itscnt = x_int()
__itscnt.val = int(itscnt)
if __itscnt.val!=itscnt:
raise ValueError("Error while converting 'itscnt' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetalgodenseaul(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsx), ctypes.byref(__rho), ctypes.byref(__itscnt))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetalgodenseaul'")
return
finally:
pass
_lib_alglib.alglib_minqpsetalgoquickqp.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetalgoquickqp.restype = ctypes.c_int32
def minqpsetalgoquickqp(state, epsg, epsf, epsx, maxouterits, usenewton):
pass
__state = state.ptr
__epsg = ctypes.c_double(epsg)
__epsf = ctypes.c_double(epsf)
__epsx = ctypes.c_double(epsx)
__maxouterits = x_int()
__maxouterits.val = int(maxouterits)
if __maxouterits.val!=maxouterits:
raise ValueError("Error while converting 'maxouterits' parameter to 'x_int'")
__usenewton = ctypes.c_uint8(usenewton)
if __usenewton.value!=0:
__usenewton = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetalgoquickqp(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsg), ctypes.byref(__epsf), ctypes.byref(__epsx), ctypes.byref(__maxouterits), ctypes.byref(__usenewton))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetalgoquickqp'")
return
finally:
pass
_lib_alglib.alglib_minqpsetbc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetbc.restype = ctypes.c_int32
def minqpsetbc(state, bndl, bndu):
pass
__state = state.ptr
if not is_real_vector(bndl):
raise ValueError("'bndl' parameter can't be cast to real_vector")
__bndl = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(bndu):
raise ValueError("'bndu' parameter can't be cast to real_vector")
__bndu = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__bndl, bndl, DT_REAL, X_CREATE)
x_from_list(__bndu, bndu, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetbc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__bndl), ctypes.byref(__bndu))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetbc'")
return
finally:
x_vector_clear(__bndl)
x_vector_clear(__bndu)
_lib_alglib.alglib_minqpsetlc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetlc.restype = ctypes.c_int32
def minqpsetlc(*functionargs):
if len(functionargs)==4:
__friendly_form = False
state,c,ct,k = functionargs
elif len(functionargs)==3:
__friendly_form = True
state,c,ct = functionargs
if safe_rows("'minqpsetlc': incorrect parameters",c)!=safe_len("'minqpsetlc': incorrect parameters",ct):
raise RuntimeError("Error while calling 'minqpsetlc': looks like one of arguments has wrong size")
k = safe_rows("'minqpsetlc': incorrect parameters",c)
else:
raise RuntimeError("Error while calling 'minqpsetlc': function must have 3 or 4 parameters")
__state = state.ptr
if not is_real_matrix(c):
raise ValueError("'c' parameter can't be cast to real_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(ct):
raise ValueError("'ct' parameter can't be cast to int_vector")
__ct = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
try:
x_from_listlist(__c, c, DT_REAL, X_CREATE)
x_from_list(__ct, ct, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetlc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__c), ctypes.byref(__ct), ctypes.byref(__k))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetlc'")
return
finally:
x_matrix_clear(__c)
x_vector_clear(__ct)
_lib_alglib.alglib_minqpsetlcsparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetlcsparse.restype = ctypes.c_int32
def minqpsetlcsparse(state, c, ct, k):
pass
__state = state.ptr
__c = c.ptr
if not is_int_vector(ct):
raise ValueError("'ct' parameter can't be cast to int_vector")
__ct = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
try:
x_from_list(__ct, ct, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetlcsparse(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__c), ctypes.byref(__ct), ctypes.byref(__k))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetlcsparse'")
return
finally:
x_vector_clear(__ct)
_lib_alglib.alglib_minqpsetlcmixed.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpsetlcmixed.restype = ctypes.c_int32
def minqpsetlcmixed(state, densec, densect, densek, sparsec, sparsect, sparsek):
pass
__state = state.ptr
if not is_real_matrix(densec):
raise ValueError("'densec' parameter can't be cast to real_matrix")
__densec = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(densect):
raise ValueError("'densect' parameter can't be cast to int_vector")
__densect = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__densek = x_int()
__densek.val = int(densek)
if __densek.val!=densek:
raise ValueError("Error while converting 'densek' parameter to 'x_int'")
__sparsec = sparsec.ptr
if not is_int_vector(sparsect):
raise ValueError("'sparsect' parameter can't be cast to int_vector")
__sparsect = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__sparsek = x_int()
__sparsek.val = int(sparsek)
if __sparsek.val!=sparsek:
raise ValueError("Error while converting 'sparsek' parameter to 'x_int'")
try:
x_from_listlist(__densec, densec, DT_REAL, X_CREATE)
x_from_list(__densect, densect, DT_INT, X_CREATE)
x_from_list(__sparsect, sparsect, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpsetlcmixed(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__densec), ctypes.byref(__densect), ctypes.byref(__densek), ctypes.byref(__sparsec), ctypes.byref(__sparsect), ctypes.byref(__sparsek))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpsetlcmixed'")
return
finally:
x_matrix_clear(__densec)
x_vector_clear(__densect)
x_vector_clear(__sparsect)
_lib_alglib.alglib_minqpoptimize.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpoptimize.restype = ctypes.c_int32
def minqpoptimize(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpoptimize(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpoptimize'")
return
finally:
pass
_lib_alglib.alglib_minqpresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpresults.restype = ctypes.c_int32
def minqpresults(state):
pass
__state = state.ptr
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minqpreport()
x_minqpreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpresults'")
__r__x = list_from_x(__x)
__r__rep = minqpreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minqpreport_clear(__rep)
_lib_alglib.alglib_minqpresultsbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minqpresultsbuf.restype = ctypes.c_int32
def minqpresultsbuf(state, x, rep):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minqpreport()
x_minqpreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_minqpreport(__rep, rep)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minqpresultsbuf(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minqpresultsbuf'")
__r__x = list_from_x(__x)
__r__rep = minqpreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minqpreport_clear(__rep)
_lib_alglib.x_obj_free_minnlcstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_minnlcstate.restype = None
_lib_alglib.x_minnlcstate_get_needfi.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnlcstate_get_needfi.restype = None
_lib_alglib.x_minnlcstate_set_needfi.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnlcstate_set_needfi.restype = None
_lib_alglib.x_minnlcstate_get_needfij.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnlcstate_get_needfij.restype = None
_lib_alglib.x_minnlcstate_set_needfij.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnlcstate_set_needfij.restype = None
_lib_alglib.x_minnlcstate_get_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnlcstate_get_xupdated.restype = None
_lib_alglib.x_minnlcstate_set_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnlcstate_set_xupdated.restype = None
_lib_alglib.x_minnlcstate_get_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnlcstate_get_f.restype = None
_lib_alglib.x_minnlcstate_set_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnlcstate_set_f.restype = None
_lib_alglib.x_minnlcstate_get_fi.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnlcstate_get_fi.restype = None
_lib_alglib.x_minnlcstate_get_j.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnlcstate_get_j.restype = None
_lib_alglib.x_minnlcstate_get_x.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnlcstate_get_x.restype = None
class minnlcstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_minnlcstate(self.ptr)
class x_minnlcreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("iterationscount", x_int),
("nfev", x_int),
("varidx", x_int),
("funcidx", x_int),
("terminationtype", x_int),
("dbgphase0its", x_int)
]
class minnlcreport(object):
def __init__(self):
self.iterationscount = 0
self.nfev = 0
self.varidx = 0
self.funcidx = 0
self.terminationtype = 0
self.dbgphase0its = 0
def x_minnlcreport_zero_fields(x):
x.iterationscount.val = 0
x.nfev.val = 0
x.varidx.val = 0
x.funcidx.val = 0
x.terminationtype.val = 0
x.dbgphase0its.val = 0
return
def x_minnlcreport_clear(x):
x_minnlcreport_zero_fields(x)
return
def x_from_minnlcreport(x,v):
x.iterationscount.val = int(v.iterationscount)
x.nfev.val = int(v.nfev)
x.varidx.val = int(v.varidx)
x.funcidx.val = int(v.funcidx)
x.terminationtype.val = int(v.terminationtype)
x.dbgphase0its.val = int(v.dbgphase0its)
return
def minnlcreport_from_x(x):
r = minnlcreport()
r.iterationscount = x.iterationscount.val
r.nfev = x.nfev.val
r.varidx = x.varidx.val
r.funcidx = x.funcidx.val
r.terminationtype = x.terminationtype.val
r.dbgphase0its = x.dbgphase0its.val
return r
_lib_alglib.alglib_minnlccreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlccreate.restype = ctypes.c_int32
def minnlccreate(*functionargs):
if len(functionargs)==2:
__friendly_form = False
n,x = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_len("'minnlccreate': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minnlccreate': function must have 1 or 2 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlccreate(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlccreate'")
__r__state = minnlcstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minnlccreatef.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlccreatef.restype = ctypes.c_int32
def minnlccreatef(*functionargs):
if len(functionargs)==3:
__friendly_form = False
n,x,diffstep = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,diffstep = functionargs
n = safe_len("'minnlccreatef': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minnlccreatef': function must have 2 or 3 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__diffstep = ctypes.c_double(diffstep)
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlccreatef(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__diffstep), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlccreatef'")
__r__state = minnlcstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minnlcsetbc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcsetbc.restype = ctypes.c_int32
def minnlcsetbc(state, bndl, bndu):
pass
__state = state.ptr
if not is_real_vector(bndl):
raise ValueError("'bndl' parameter can't be cast to real_vector")
__bndl = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(bndu):
raise ValueError("'bndu' parameter can't be cast to real_vector")
__bndu = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__bndl, bndl, DT_REAL, X_CREATE)
x_from_list(__bndu, bndu, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcsetbc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__bndl), ctypes.byref(__bndu))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcsetbc'")
return
finally:
x_vector_clear(__bndl)
x_vector_clear(__bndu)
_lib_alglib.alglib_minnlcsetlc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcsetlc.restype = ctypes.c_int32
def minnlcsetlc(*functionargs):
if len(functionargs)==4:
__friendly_form = False
state,c,ct,k = functionargs
elif len(functionargs)==3:
__friendly_form = True
state,c,ct = functionargs
if safe_rows("'minnlcsetlc': incorrect parameters",c)!=safe_len("'minnlcsetlc': incorrect parameters",ct):
raise RuntimeError("Error while calling 'minnlcsetlc': looks like one of arguments has wrong size")
k = safe_rows("'minnlcsetlc': incorrect parameters",c)
else:
raise RuntimeError("Error while calling 'minnlcsetlc': function must have 3 or 4 parameters")
__state = state.ptr
if not is_real_matrix(c):
raise ValueError("'c' parameter can't be cast to real_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(ct):
raise ValueError("'ct' parameter can't be cast to int_vector")
__ct = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
try:
x_from_listlist(__c, c, DT_REAL, X_CREATE)
x_from_list(__ct, ct, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcsetlc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__c), ctypes.byref(__ct), ctypes.byref(__k))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcsetlc'")
return
finally:
x_matrix_clear(__c)
x_vector_clear(__ct)
_lib_alglib.alglib_minnlcsetnlc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcsetnlc.restype = ctypes.c_int32
def minnlcsetnlc(state, nlec, nlic):
pass
__state = state.ptr
__nlec = x_int()
__nlec.val = int(nlec)
if __nlec.val!=nlec:
raise ValueError("Error while converting 'nlec' parameter to 'x_int'")
__nlic = x_int()
__nlic.val = int(nlic)
if __nlic.val!=nlic:
raise ValueError("Error while converting 'nlic' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcsetnlc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__nlec), ctypes.byref(__nlic))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcsetnlc'")
return
finally:
pass
_lib_alglib.alglib_minnlcsetcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcsetcond.restype = ctypes.c_int32
def minnlcsetcond(state, epsg, epsf, epsx, maxits):
pass
__state = state.ptr
__epsg = ctypes.c_double(epsg)
__epsf = ctypes.c_double(epsf)
__epsx = ctypes.c_double(epsx)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcsetcond(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsg), ctypes.byref(__epsf), ctypes.byref(__epsx), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcsetcond'")
return
finally:
pass
_lib_alglib.alglib_minnlcsetscale.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcsetscale.restype = ctypes.c_int32
def minnlcsetscale(state, s):
pass
__state = state.ptr
if not is_real_vector(s):
raise ValueError("'s' parameter can't be cast to real_vector")
__s = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__s, s, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcsetscale(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcsetscale'")
return
finally:
x_vector_clear(__s)
_lib_alglib.alglib_minnlcsetprecinexact.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcsetprecinexact.restype = ctypes.c_int32
def minnlcsetprecinexact(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcsetprecinexact(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcsetprecinexact'")
return
finally:
pass
_lib_alglib.alglib_minnlcsetprecexactlowrank.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcsetprecexactlowrank.restype = ctypes.c_int32
def minnlcsetprecexactlowrank(state, updatefreq):
pass
__state = state.ptr
__updatefreq = x_int()
__updatefreq.val = int(updatefreq)
if __updatefreq.val!=updatefreq:
raise ValueError("Error while converting 'updatefreq' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcsetprecexactlowrank(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__updatefreq))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcsetprecexactlowrank'")
return
finally:
pass
_lib_alglib.alglib_minnlcsetprecexactrobust.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcsetprecexactrobust.restype = ctypes.c_int32
def minnlcsetprecexactrobust(state, updatefreq):
pass
__state = state.ptr
__updatefreq = x_int()
__updatefreq.val = int(updatefreq)
if __updatefreq.val!=updatefreq:
raise ValueError("Error while converting 'updatefreq' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcsetprecexactrobust(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__updatefreq))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcsetprecexactrobust'")
return
finally:
pass
_lib_alglib.alglib_minnlcsetprecnone.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcsetprecnone.restype = ctypes.c_int32
def minnlcsetprecnone(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcsetprecnone(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcsetprecnone'")
return
finally:
pass
_lib_alglib.alglib_minnlcsetstpmax.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcsetstpmax.restype = ctypes.c_int32
def minnlcsetstpmax(state, stpmax):
pass
__state = state.ptr
__stpmax = ctypes.c_double(stpmax)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcsetstpmax(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__stpmax))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcsetstpmax'")
return
finally:
pass
_lib_alglib.alglib_minnlcsetalgoaul.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcsetalgoaul.restype = ctypes.c_int32
def minnlcsetalgoaul(state, rho, itscnt):
pass
__state = state.ptr
__rho = ctypes.c_double(rho)
__itscnt = x_int()
__itscnt.val = int(itscnt)
if __itscnt.val!=itscnt:
raise ValueError("Error while converting 'itscnt' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcsetalgoaul(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__rho), ctypes.byref(__itscnt))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcsetalgoaul'")
return
finally:
pass
_lib_alglib.alglib_minnlcsetxrep.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcsetxrep.restype = ctypes.c_int32
def minnlcsetxrep(state, needxrep):
pass
__state = state.ptr
__needxrep = ctypes.c_uint8(needxrep)
if __needxrep.value!=0:
__needxrep = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcsetxrep(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__needxrep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcsetxrep'")
return
finally:
pass
def minnlcoptimize_v(state, fvec, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minnlcstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_fi = x_vector()
_lib_alglib.x_minnlcstate_get_fi(state.ptr, ctypes.byref(_xc_fi))
_py_fi = create_real_vector(_xc_fi.cnt)
while True:
retval = _lib_alglib.alglib_minnlciteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minnlciteration'")
if not _xc_result:
break
_lib_alglib.x_minnlcstate_get_needfi(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
fvec(_py_x, _py_fi, param)
x_from_list(_xc_fi, _py_fi, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minnlcstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minnlcstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minnlcoptimize' (some derivatives were not provided?)")
return
def minnlcoptimize_j(state, jac, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minnlcstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_fi = x_vector()
_lib_alglib.x_minnlcstate_get_fi(state.ptr, ctypes.byref(_xc_fi))
_py_fi = create_real_vector(_xc_fi.cnt)
_xc_j = x_matrix()
_lib_alglib.x_minnlcstate_get_j(state.ptr, ctypes.byref(_xc_j))
_py_j = create_real_matrix(_xc_j.rows,_xc_j.cols)
while True:
retval = _lib_alglib.alglib_minnlciteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minnlciteration'")
if not _xc_result:
break
_lib_alglib.x_minnlcstate_get_needfij(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
jac(_py_x, _py_fi, _py_j, param)
x_from_list(_xc_fi, _py_fi, DT_REAL, X_REWRITE)
x_from_listlist(_xc_j, _py_j, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minnlcstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minnlcstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minnlcoptimize' (some derivatives were not provided?)")
return
_lib_alglib.alglib_minnlcresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcresults.restype = ctypes.c_int32
def minnlcresults(state):
pass
__state = state.ptr
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minnlcreport()
x_minnlcreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcresults'")
__r__x = list_from_x(__x)
__r__rep = minnlcreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minnlcreport_clear(__rep)
_lib_alglib.alglib_minnlcresultsbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcresultsbuf.restype = ctypes.c_int32
def minnlcresultsbuf(state, x, rep):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minnlcreport()
x_minnlcreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_minnlcreport(__rep, rep)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcresultsbuf(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcresultsbuf'")
__r__x = list_from_x(__x)
__r__rep = minnlcreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minnlcreport_clear(__rep)
_lib_alglib.alglib_minnlcrestartfrom.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcrestartfrom.restype = ctypes.c_int32
def minnlcrestartfrom(state, x):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcrestartfrom(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcrestartfrom'")
return
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minnlcsetgradientcheck.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnlcsetgradientcheck.restype = ctypes.c_int32
def minnlcsetgradientcheck(state, teststep):
pass
__state = state.ptr
__teststep = ctypes.c_double(teststep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnlcsetgradientcheck(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__teststep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnlcsetgradientcheck'")
return
finally:
pass
_lib_alglib.x_obj_free_minbcstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_minbcstate.restype = None
_lib_alglib.x_minbcstate_get_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbcstate_get_needf.restype = None
_lib_alglib.x_minbcstate_set_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbcstate_set_needf.restype = None
_lib_alglib.x_minbcstate_get_needfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbcstate_get_needfg.restype = None
_lib_alglib.x_minbcstate_set_needfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbcstate_set_needfg.restype = None
_lib_alglib.x_minbcstate_get_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbcstate_get_xupdated.restype = None
_lib_alglib.x_minbcstate_set_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbcstate_set_xupdated.restype = None
_lib_alglib.x_minbcstate_get_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbcstate_get_f.restype = None
_lib_alglib.x_minbcstate_set_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbcstate_set_f.restype = None
_lib_alglib.x_minbcstate_get_g.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbcstate_get_g.restype = None
_lib_alglib.x_minbcstate_get_x.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minbcstate_get_x.restype = None
class minbcstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_minbcstate(self.ptr)
class x_minbcreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("iterationscount", x_int),
("nfev", x_int),
("varidx", x_int),
("terminationtype", x_int)
]
class minbcreport(object):
def __init__(self):
self.iterationscount = 0
self.nfev = 0
self.varidx = 0
self.terminationtype = 0
def x_minbcreport_zero_fields(x):
x.iterationscount.val = 0
x.nfev.val = 0
x.varidx.val = 0
x.terminationtype.val = 0
return
def x_minbcreport_clear(x):
x_minbcreport_zero_fields(x)
return
def x_from_minbcreport(x,v):
x.iterationscount.val = int(v.iterationscount)
x.nfev.val = int(v.nfev)
x.varidx.val = int(v.varidx)
x.terminationtype.val = int(v.terminationtype)
return
def minbcreport_from_x(x):
r = minbcreport()
r.iterationscount = x.iterationscount.val
r.nfev = x.nfev.val
r.varidx = x.varidx.val
r.terminationtype = x.terminationtype.val
return r
_lib_alglib.alglib_minbccreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbccreate.restype = ctypes.c_int32
def minbccreate(*functionargs):
if len(functionargs)==2:
__friendly_form = False
n,x = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_len("'minbccreate': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minbccreate': function must have 1 or 2 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbccreate(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbccreate'")
__r__state = minbcstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minbccreatef.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbccreatef.restype = ctypes.c_int32
def minbccreatef(*functionargs):
if len(functionargs)==3:
__friendly_form = False
n,x,diffstep = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,diffstep = functionargs
n = safe_len("'minbccreatef': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minbccreatef': function must have 2 or 3 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__diffstep = ctypes.c_double(diffstep)
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbccreatef(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__diffstep), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbccreatef'")
__r__state = minbcstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minbcsetbc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbcsetbc.restype = ctypes.c_int32
def minbcsetbc(state, bndl, bndu):
pass
__state = state.ptr
if not is_real_vector(bndl):
raise ValueError("'bndl' parameter can't be cast to real_vector")
__bndl = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(bndu):
raise ValueError("'bndu' parameter can't be cast to real_vector")
__bndu = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__bndl, bndl, DT_REAL, X_CREATE)
x_from_list(__bndu, bndu, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbcsetbc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__bndl), ctypes.byref(__bndu))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbcsetbc'")
return
finally:
x_vector_clear(__bndl)
x_vector_clear(__bndu)
_lib_alglib.alglib_minbcsetcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbcsetcond.restype = ctypes.c_int32
def minbcsetcond(state, epsg, epsf, epsx, maxits):
pass
__state = state.ptr
__epsg = ctypes.c_double(epsg)
__epsf = ctypes.c_double(epsf)
__epsx = ctypes.c_double(epsx)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbcsetcond(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsg), ctypes.byref(__epsf), ctypes.byref(__epsx), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbcsetcond'")
return
finally:
pass
_lib_alglib.alglib_minbcsetscale.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbcsetscale.restype = ctypes.c_int32
def minbcsetscale(state, s):
pass
__state = state.ptr
if not is_real_vector(s):
raise ValueError("'s' parameter can't be cast to real_vector")
__s = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__s, s, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbcsetscale(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbcsetscale'")
return
finally:
x_vector_clear(__s)
_lib_alglib.alglib_minbcsetprecdefault.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbcsetprecdefault.restype = ctypes.c_int32
def minbcsetprecdefault(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbcsetprecdefault(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbcsetprecdefault'")
return
finally:
pass
_lib_alglib.alglib_minbcsetprecdiag.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbcsetprecdiag.restype = ctypes.c_int32
def minbcsetprecdiag(state, d):
pass
__state = state.ptr
if not is_real_vector(d):
raise ValueError("'d' parameter can't be cast to real_vector")
__d = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__d, d, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbcsetprecdiag(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__d))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbcsetprecdiag'")
return
finally:
x_vector_clear(__d)
_lib_alglib.alglib_minbcsetprecscale.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbcsetprecscale.restype = ctypes.c_int32
def minbcsetprecscale(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbcsetprecscale(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbcsetprecscale'")
return
finally:
pass
_lib_alglib.alglib_minbcsetxrep.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbcsetxrep.restype = ctypes.c_int32
def minbcsetxrep(state, needxrep):
pass
__state = state.ptr
__needxrep = ctypes.c_uint8(needxrep)
if __needxrep.value!=0:
__needxrep = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbcsetxrep(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__needxrep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbcsetxrep'")
return
finally:
pass
_lib_alglib.alglib_minbcsetstpmax.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbcsetstpmax.restype = ctypes.c_int32
def minbcsetstpmax(state, stpmax):
pass
__state = state.ptr
__stpmax = ctypes.c_double(stpmax)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbcsetstpmax(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__stpmax))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbcsetstpmax'")
return
finally:
pass
def minbcoptimize_f(state, func, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minbcstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
while True:
retval = _lib_alglib.alglib_minbciteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minbciteration'")
if not _xc_result:
break
_lib_alglib.x_minbcstate_get_needf(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = func(_py_x, param)
_lib_alglib.x_minbcstate_set_f(state.ptr, ctypes.byref(_xc_f))
continue
_lib_alglib.x_minbcstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minbcstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minbcoptimize' (some derivatives were not provided?)")
return
def minbcoptimize_g(state, grad, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minbcstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
_xc_g = x_vector()
_lib_alglib.x_minbcstate_get_g(state.ptr, ctypes.byref(_xc_g))
_py_g = create_real_vector(_xc_g.cnt)
while True:
retval = _lib_alglib.alglib_minbciteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minbciteration'")
if not _xc_result:
break
_lib_alglib.x_minbcstate_get_needfg(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = grad(_py_x, _py_g, param)
_lib_alglib.x_minbcstate_set_f(state.ptr, ctypes.byref(_xc_f))
x_from_list(_xc_g, _py_g, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minbcstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minbcstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minbcoptimize' (some derivatives were not provided?)")
return
_lib_alglib.alglib_minbcresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbcresults.restype = ctypes.c_int32
def minbcresults(state):
pass
__state = state.ptr
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minbcreport()
x_minbcreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbcresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbcresults'")
__r__x = list_from_x(__x)
__r__rep = minbcreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minbcreport_clear(__rep)
_lib_alglib.alglib_minbcresultsbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbcresultsbuf.restype = ctypes.c_int32
def minbcresultsbuf(state, x, rep):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minbcreport()
x_minbcreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_minbcreport(__rep, rep)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbcresultsbuf(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbcresultsbuf'")
__r__x = list_from_x(__x)
__r__rep = minbcreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minbcreport_clear(__rep)
_lib_alglib.alglib_minbcrestartfrom.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbcrestartfrom.restype = ctypes.c_int32
def minbcrestartfrom(state, x):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbcrestartfrom(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbcrestartfrom'")
return
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minbcrequesttermination.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbcrequesttermination.restype = ctypes.c_int32
def minbcrequesttermination(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbcrequesttermination(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbcrequesttermination'")
return
finally:
pass
_lib_alglib.alglib_minbcsetgradientcheck.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbcsetgradientcheck.restype = ctypes.c_int32
def minbcsetgradientcheck(state, teststep):
pass
__state = state.ptr
__teststep = ctypes.c_double(teststep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbcsetgradientcheck(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__teststep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbcsetgradientcheck'")
return
finally:
pass
_lib_alglib.x_obj_free_minnsstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_minnsstate.restype = None
_lib_alglib.x_minnsstate_get_needfi.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnsstate_get_needfi.restype = None
_lib_alglib.x_minnsstate_set_needfi.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnsstate_set_needfi.restype = None
_lib_alglib.x_minnsstate_get_needfij.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnsstate_get_needfij.restype = None
_lib_alglib.x_minnsstate_set_needfij.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnsstate_set_needfij.restype = None
_lib_alglib.x_minnsstate_get_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnsstate_get_xupdated.restype = None
_lib_alglib.x_minnsstate_set_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnsstate_set_xupdated.restype = None
_lib_alglib.x_minnsstate_get_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnsstate_get_f.restype = None
_lib_alglib.x_minnsstate_set_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnsstate_set_f.restype = None
_lib_alglib.x_minnsstate_get_fi.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnsstate_get_fi.restype = None
_lib_alglib.x_minnsstate_get_j.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnsstate_get_j.restype = None
_lib_alglib.x_minnsstate_get_x.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minnsstate_get_x.restype = None
class minnsstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_minnsstate(self.ptr)
class x_minnsreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("iterationscount", x_int),
("nfev", x_int),
("cerr", ctypes.c_double),
("lcerr", ctypes.c_double),
("nlcerr", ctypes.c_double),
("terminationtype", x_int),
("varidx", x_int),
("funcidx", x_int)
]
class minnsreport(object):
def __init__(self):
self.iterationscount = 0
self.nfev = 0
self.cerr = 0
self.lcerr = 0
self.nlcerr = 0
self.terminationtype = 0
self.varidx = 0
self.funcidx = 0
def x_minnsreport_zero_fields(x):
x.iterationscount.val = 0
x.nfev.val = 0
x.cerr = 0
x.lcerr = 0
x.nlcerr = 0
x.terminationtype.val = 0
x.varidx.val = 0
x.funcidx.val = 0
return
def x_minnsreport_clear(x):
x_minnsreport_zero_fields(x)
return
def x_from_minnsreport(x,v):
x.iterationscount.val = int(v.iterationscount)
x.nfev.val = int(v.nfev)
x.cerr = float(v.cerr)
x.lcerr = float(v.lcerr)
x.nlcerr = float(v.nlcerr)
x.terminationtype.val = int(v.terminationtype)
x.varidx.val = int(v.varidx)
x.funcidx.val = int(v.funcidx)
return
def minnsreport_from_x(x):
r = minnsreport()
r.iterationscount = x.iterationscount.val
r.nfev = x.nfev.val
r.cerr = x.cerr
r.lcerr = x.lcerr
r.nlcerr = x.nlcerr
r.terminationtype = x.terminationtype.val
r.varidx = x.varidx.val
r.funcidx = x.funcidx.val
return r
_lib_alglib.alglib_minnscreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnscreate.restype = ctypes.c_int32
def minnscreate(*functionargs):
if len(functionargs)==2:
__friendly_form = False
n,x = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_len("'minnscreate': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minnscreate': function must have 1 or 2 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnscreate(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnscreate'")
__r__state = minnsstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minnscreatef.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnscreatef.restype = ctypes.c_int32
def minnscreatef(*functionargs):
if len(functionargs)==3:
__friendly_form = False
n,x,diffstep = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,diffstep = functionargs
n = safe_len("'minnscreatef': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minnscreatef': function must have 2 or 3 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__diffstep = ctypes.c_double(diffstep)
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnscreatef(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__diffstep), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnscreatef'")
__r__state = minnsstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minnssetbc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnssetbc.restype = ctypes.c_int32
def minnssetbc(state, bndl, bndu):
pass
__state = state.ptr
if not is_real_vector(bndl):
raise ValueError("'bndl' parameter can't be cast to real_vector")
__bndl = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(bndu):
raise ValueError("'bndu' parameter can't be cast to real_vector")
__bndu = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__bndl, bndl, DT_REAL, X_CREATE)
x_from_list(__bndu, bndu, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnssetbc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__bndl), ctypes.byref(__bndu))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnssetbc'")
return
finally:
x_vector_clear(__bndl)
x_vector_clear(__bndu)
_lib_alglib.alglib_minnssetlc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnssetlc.restype = ctypes.c_int32
def minnssetlc(*functionargs):
if len(functionargs)==4:
__friendly_form = False
state,c,ct,k = functionargs
elif len(functionargs)==3:
__friendly_form = True
state,c,ct = functionargs
if safe_rows("'minnssetlc': incorrect parameters",c)!=safe_len("'minnssetlc': incorrect parameters",ct):
raise RuntimeError("Error while calling 'minnssetlc': looks like one of arguments has wrong size")
k = safe_rows("'minnssetlc': incorrect parameters",c)
else:
raise RuntimeError("Error while calling 'minnssetlc': function must have 3 or 4 parameters")
__state = state.ptr
if not is_real_matrix(c):
raise ValueError("'c' parameter can't be cast to real_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(ct):
raise ValueError("'ct' parameter can't be cast to int_vector")
__ct = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
try:
x_from_listlist(__c, c, DT_REAL, X_CREATE)
x_from_list(__ct, ct, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnssetlc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__c), ctypes.byref(__ct), ctypes.byref(__k))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnssetlc'")
return
finally:
x_matrix_clear(__c)
x_vector_clear(__ct)
_lib_alglib.alglib_minnssetnlc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnssetnlc.restype = ctypes.c_int32
def minnssetnlc(state, nlec, nlic):
pass
__state = state.ptr
__nlec = x_int()
__nlec.val = int(nlec)
if __nlec.val!=nlec:
raise ValueError("Error while converting 'nlec' parameter to 'x_int'")
__nlic = x_int()
__nlic.val = int(nlic)
if __nlic.val!=nlic:
raise ValueError("Error while converting 'nlic' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnssetnlc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__nlec), ctypes.byref(__nlic))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnssetnlc'")
return
finally:
pass
_lib_alglib.alglib_minnssetcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnssetcond.restype = ctypes.c_int32
def minnssetcond(state, epsx, maxits):
pass
__state = state.ptr
__epsx = ctypes.c_double(epsx)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnssetcond(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsx), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnssetcond'")
return
finally:
pass
_lib_alglib.alglib_minnssetscale.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnssetscale.restype = ctypes.c_int32
def minnssetscale(state, s):
pass
__state = state.ptr
if not is_real_vector(s):
raise ValueError("'s' parameter can't be cast to real_vector")
__s = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__s, s, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnssetscale(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnssetscale'")
return
finally:
x_vector_clear(__s)
_lib_alglib.alglib_minnssetalgoags.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnssetalgoags.restype = ctypes.c_int32
def minnssetalgoags(state, radius, penalty):
pass
__state = state.ptr
__radius = ctypes.c_double(radius)
__penalty = ctypes.c_double(penalty)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnssetalgoags(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__radius), ctypes.byref(__penalty))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnssetalgoags'")
return
finally:
pass
_lib_alglib.alglib_minnssetxrep.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnssetxrep.restype = ctypes.c_int32
def minnssetxrep(state, needxrep):
pass
__state = state.ptr
__needxrep = ctypes.c_uint8(needxrep)
if __needxrep.value!=0:
__needxrep = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnssetxrep(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__needxrep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnssetxrep'")
return
finally:
pass
_lib_alglib.alglib_minnsrequesttermination.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnsrequesttermination.restype = ctypes.c_int32
def minnsrequesttermination(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnsrequesttermination(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnsrequesttermination'")
return
finally:
pass
def minnsoptimize_v(state, fvec, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minnsstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_fi = x_vector()
_lib_alglib.x_minnsstate_get_fi(state.ptr, ctypes.byref(_xc_fi))
_py_fi = create_real_vector(_xc_fi.cnt)
while True:
retval = _lib_alglib.alglib_minnsiteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minnsiteration'")
if not _xc_result:
break
_lib_alglib.x_minnsstate_get_needfi(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
fvec(_py_x, _py_fi, param)
x_from_list(_xc_fi, _py_fi, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minnsstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minnsstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minnsoptimize' (some derivatives were not provided?)")
return
def minnsoptimize_j(state, jac, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minnsstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_fi = x_vector()
_lib_alglib.x_minnsstate_get_fi(state.ptr, ctypes.byref(_xc_fi))
_py_fi = create_real_vector(_xc_fi.cnt)
_xc_j = x_matrix()
_lib_alglib.x_minnsstate_get_j(state.ptr, ctypes.byref(_xc_j))
_py_j = create_real_matrix(_xc_j.rows,_xc_j.cols)
while True:
retval = _lib_alglib.alglib_minnsiteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minnsiteration'")
if not _xc_result:
break
_lib_alglib.x_minnsstate_get_needfij(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
jac(_py_x, _py_fi, _py_j, param)
x_from_list(_xc_fi, _py_fi, DT_REAL, X_REWRITE)
x_from_listlist(_xc_j, _py_j, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minnsstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minnsstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minnsoptimize' (some derivatives were not provided?)")
return
_lib_alglib.alglib_minnsresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnsresults.restype = ctypes.c_int32
def minnsresults(state):
pass
__state = state.ptr
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minnsreport()
x_minnsreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnsresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnsresults'")
__r__x = list_from_x(__x)
__r__rep = minnsreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minnsreport_clear(__rep)
_lib_alglib.alglib_minnsresultsbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnsresultsbuf.restype = ctypes.c_int32
def minnsresultsbuf(state, x, rep):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minnsreport()
x_minnsreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_minnsreport(__rep, rep)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnsresultsbuf(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnsresultsbuf'")
__r__x = list_from_x(__x)
__r__rep = minnsreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minnsreport_clear(__rep)
_lib_alglib.alglib_minnsrestartfrom.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minnsrestartfrom.restype = ctypes.c_int32
def minnsrestartfrom(state, x):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minnsrestartfrom(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minnsrestartfrom'")
return
finally:
x_vector_clear(__x)
_lib_alglib.x_obj_free_minasastate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_minasastate.restype = None
_lib_alglib.x_minasastate_get_needfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minasastate_get_needfg.restype = None
_lib_alglib.x_minasastate_set_needfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minasastate_set_needfg.restype = None
_lib_alglib.x_minasastate_get_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minasastate_get_xupdated.restype = None
_lib_alglib.x_minasastate_set_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minasastate_set_xupdated.restype = None
_lib_alglib.x_minasastate_get_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minasastate_get_f.restype = None
_lib_alglib.x_minasastate_set_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minasastate_set_f.restype = None
_lib_alglib.x_minasastate_get_g.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minasastate_get_g.restype = None
_lib_alglib.x_minasastate_get_x.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minasastate_get_x.restype = None
class minasastate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_minasastate(self.ptr)
class x_minasareport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("iterationscount", x_int),
("nfev", x_int),
("terminationtype", x_int),
("activeconstraints", x_int)
]
class minasareport(object):
def __init__(self):
self.iterationscount = 0
self.nfev = 0
self.terminationtype = 0
self.activeconstraints = 0
def x_minasareport_zero_fields(x):
x.iterationscount.val = 0
x.nfev.val = 0
x.terminationtype.val = 0
x.activeconstraints.val = 0
return
def x_minasareport_clear(x):
x_minasareport_zero_fields(x)
return
def x_from_minasareport(x,v):
x.iterationscount.val = int(v.iterationscount)
x.nfev.val = int(v.nfev)
x.terminationtype.val = int(v.terminationtype)
x.activeconstraints.val = int(v.activeconstraints)
return
def minasareport_from_x(x):
r = minasareport()
r.iterationscount = x.iterationscount.val
r.nfev = x.nfev.val
r.terminationtype = x.terminationtype.val
r.activeconstraints = x.activeconstraints.val
return r
_lib_alglib.alglib_minlbfgssetdefaultpreconditioner.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgssetdefaultpreconditioner.restype = ctypes.c_int32
def minlbfgssetdefaultpreconditioner(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgssetdefaultpreconditioner(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgssetdefaultpreconditioner'")
return
finally:
pass
_lib_alglib.alglib_minlbfgssetcholeskypreconditioner.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlbfgssetcholeskypreconditioner.restype = ctypes.c_int32
def minlbfgssetcholeskypreconditioner(state, p, isupper):
pass
__state = state.ptr
if not is_real_matrix(p):
raise ValueError("'p' parameter can't be cast to real_matrix")
__p = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__p, p, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlbfgssetcholeskypreconditioner(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__p), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlbfgssetcholeskypreconditioner'")
return
finally:
x_matrix_clear(__p)
_lib_alglib.alglib_minbleicsetbarrierwidth.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicsetbarrierwidth.restype = ctypes.c_int32
def minbleicsetbarrierwidth(state, mu):
pass
__state = state.ptr
__mu = ctypes.c_double(mu)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicsetbarrierwidth(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__mu))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicsetbarrierwidth'")
return
finally:
pass
_lib_alglib.alglib_minbleicsetbarrierdecay.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minbleicsetbarrierdecay.restype = ctypes.c_int32
def minbleicsetbarrierdecay(state, mudecay):
pass
__state = state.ptr
__mudecay = ctypes.c_double(mudecay)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minbleicsetbarrierdecay(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__mudecay))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minbleicsetbarrierdecay'")
return
finally:
pass
_lib_alglib.alglib_minasacreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minasacreate.restype = ctypes.c_int32
def minasacreate(*functionargs):
if len(functionargs)==4:
__friendly_form = False
n,x,bndl,bndu = functionargs
elif len(functionargs)==3:
__friendly_form = True
x,bndl,bndu = functionargs
if safe_len("'minasacreate': incorrect parameters",x)!=safe_len("'minasacreate': incorrect parameters",bndl) or safe_len("'minasacreate': incorrect parameters",x)!=safe_len("'minasacreate': incorrect parameters",bndu):
raise RuntimeError("Error while calling 'minasacreate': looks like one of arguments has wrong size")
n = safe_len("'minasacreate': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minasacreate': function must have 3 or 4 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(bndl):
raise ValueError("'bndl' parameter can't be cast to real_vector")
__bndl = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(bndu):
raise ValueError("'bndu' parameter can't be cast to real_vector")
__bndu = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__bndl, bndl, DT_REAL, X_CREATE)
x_from_list(__bndu, bndu, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minasacreate(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__bndl), ctypes.byref(__bndu), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minasacreate'")
__r__state = minasastate(__state)
return __r__state
finally:
x_vector_clear(__x)
x_vector_clear(__bndl)
x_vector_clear(__bndu)
_lib_alglib.alglib_minasasetcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minasasetcond.restype = ctypes.c_int32
def minasasetcond(state, epsg, epsf, epsx, maxits):
pass
__state = state.ptr
__epsg = ctypes.c_double(epsg)
__epsf = ctypes.c_double(epsf)
__epsx = ctypes.c_double(epsx)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minasasetcond(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsg), ctypes.byref(__epsf), ctypes.byref(__epsx), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minasasetcond'")
return
finally:
pass
_lib_alglib.alglib_minasasetxrep.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minasasetxrep.restype = ctypes.c_int32
def minasasetxrep(state, needxrep):
pass
__state = state.ptr
__needxrep = ctypes.c_uint8(needxrep)
if __needxrep.value!=0:
__needxrep = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minasasetxrep(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__needxrep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minasasetxrep'")
return
finally:
pass
_lib_alglib.alglib_minasasetalgorithm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minasasetalgorithm.restype = ctypes.c_int32
def minasasetalgorithm(state, algotype):
pass
__state = state.ptr
__algotype = x_int()
__algotype.val = int(algotype)
if __algotype.val!=algotype:
raise ValueError("Error while converting 'algotype' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minasasetalgorithm(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__algotype))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minasasetalgorithm'")
return
finally:
pass
_lib_alglib.alglib_minasasetstpmax.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minasasetstpmax.restype = ctypes.c_int32
def minasasetstpmax(state, stpmax):
pass
__state = state.ptr
__stpmax = ctypes.c_double(stpmax)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minasasetstpmax(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__stpmax))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minasasetstpmax'")
return
finally:
pass
def minasaoptimize_g(state, grad, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minasastate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
_xc_g = x_vector()
_lib_alglib.x_minasastate_get_g(state.ptr, ctypes.byref(_xc_g))
_py_g = create_real_vector(_xc_g.cnt)
while True:
retval = _lib_alglib.alglib_minasaiteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minasaiteration'")
if not _xc_result:
break
_lib_alglib.x_minasastate_get_needfg(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = grad(_py_x, _py_g, param)
_lib_alglib.x_minasastate_set_f(state.ptr, ctypes.byref(_xc_f))
x_from_list(_xc_g, _py_g, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minasastate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minasastate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minasaoptimize' (some derivatives were not provided?)")
return
_lib_alglib.alglib_minasaresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minasaresults.restype = ctypes.c_int32
def minasaresults(state):
pass
__state = state.ptr
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minasareport()
x_minasareport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minasaresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minasaresults'")
__r__x = list_from_x(__x)
__r__rep = minasareport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minasareport_clear(__rep)
_lib_alglib.alglib_minasaresultsbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minasaresultsbuf.restype = ctypes.c_int32
def minasaresultsbuf(state, x, rep):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minasareport()
x_minasareport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_minasareport(__rep, rep)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minasaresultsbuf(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minasaresultsbuf'")
__r__x = list_from_x(__x)
__r__rep = minasareport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minasareport_clear(__rep)
_lib_alglib.alglib_minasarestartfrom.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minasarestartfrom.restype = ctypes.c_int32
def minasarestartfrom(state, x, bndl, bndu):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(bndl):
raise ValueError("'bndl' parameter can't be cast to real_vector")
__bndl = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(bndu):
raise ValueError("'bndu' parameter can't be cast to real_vector")
__bndu = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__bndl, bndl, DT_REAL, X_CREATE)
x_from_list(__bndu, bndu, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minasarestartfrom(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__bndl), ctypes.byref(__bndu))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minasarestartfrom'")
return
finally:
x_vector_clear(__x)
x_vector_clear(__bndl)
x_vector_clear(__bndu)
_lib_alglib.x_obj_free_minlmstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_minlmstate.restype = None
_lib_alglib.x_minlmstate_get_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_get_needf.restype = None
_lib_alglib.x_minlmstate_set_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_set_needf.restype = None
_lib_alglib.x_minlmstate_get_needfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_get_needfg.restype = None
_lib_alglib.x_minlmstate_set_needfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_set_needfg.restype = None
_lib_alglib.x_minlmstate_get_needfgh.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_get_needfgh.restype = None
_lib_alglib.x_minlmstate_set_needfgh.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_set_needfgh.restype = None
_lib_alglib.x_minlmstate_get_needfi.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_get_needfi.restype = None
_lib_alglib.x_minlmstate_set_needfi.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_set_needfi.restype = None
_lib_alglib.x_minlmstate_get_needfij.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_get_needfij.restype = None
_lib_alglib.x_minlmstate_set_needfij.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_set_needfij.restype = None
_lib_alglib.x_minlmstate_get_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_get_xupdated.restype = None
_lib_alglib.x_minlmstate_set_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_set_xupdated.restype = None
_lib_alglib.x_minlmstate_get_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_get_f.restype = None
_lib_alglib.x_minlmstate_set_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_set_f.restype = None
_lib_alglib.x_minlmstate_get_fi.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_get_fi.restype = None
_lib_alglib.x_minlmstate_get_g.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_get_g.restype = None
_lib_alglib.x_minlmstate_get_h.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_get_h.restype = None
_lib_alglib.x_minlmstate_get_j.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_get_j.restype = None
_lib_alglib.x_minlmstate_get_x.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_minlmstate_get_x.restype = None
class minlmstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_minlmstate(self.ptr)
class x_minlmreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("iterationscount", x_int),
("terminationtype", x_int),
("funcidx", x_int),
("varidx", x_int),
("nfunc", x_int),
("njac", x_int),
("ngrad", x_int),
("nhess", x_int),
("ncholesky", x_int)
]
class minlmreport(object):
def __init__(self):
self.iterationscount = 0
self.terminationtype = 0
self.funcidx = 0
self.varidx = 0
self.nfunc = 0
self.njac = 0
self.ngrad = 0
self.nhess = 0
self.ncholesky = 0
def x_minlmreport_zero_fields(x):
x.iterationscount.val = 0
x.terminationtype.val = 0
x.funcidx.val = 0
x.varidx.val = 0
x.nfunc.val = 0
x.njac.val = 0
x.ngrad.val = 0
x.nhess.val = 0
x.ncholesky.val = 0
return
def x_minlmreport_clear(x):
x_minlmreport_zero_fields(x)
return
def x_from_minlmreport(x,v):
x.iterationscount.val = int(v.iterationscount)
x.terminationtype.val = int(v.terminationtype)
x.funcidx.val = int(v.funcidx)
x.varidx.val = int(v.varidx)
x.nfunc.val = int(v.nfunc)
x.njac.val = int(v.njac)
x.ngrad.val = int(v.ngrad)
x.nhess.val = int(v.nhess)
x.ncholesky.val = int(v.ncholesky)
return
def minlmreport_from_x(x):
r = minlmreport()
r.iterationscount = x.iterationscount.val
r.terminationtype = x.terminationtype.val
r.funcidx = x.funcidx.val
r.varidx = x.varidx.val
r.nfunc = x.nfunc.val
r.njac = x.njac.val
r.ngrad = x.ngrad.val
r.nhess = x.nhess.val
r.ncholesky = x.ncholesky.val
return r
_lib_alglib.alglib_minlmcreatevj.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmcreatevj.restype = ctypes.c_int32
def minlmcreatevj(*functionargs):
if len(functionargs)==3:
__friendly_form = False
n,m,x = functionargs
elif len(functionargs)==2:
__friendly_form = True
m,x = functionargs
n = safe_len("'minlmcreatevj': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minlmcreatevj': function must have 2 or 3 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmcreatevj(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__x), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmcreatevj'")
__r__state = minlmstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minlmcreatev.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmcreatev.restype = ctypes.c_int32
def minlmcreatev(*functionargs):
if len(functionargs)==4:
__friendly_form = False
n,m,x,diffstep = functionargs
elif len(functionargs)==3:
__friendly_form = True
m,x,diffstep = functionargs
n = safe_len("'minlmcreatev': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minlmcreatev': function must have 3 or 4 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__diffstep = ctypes.c_double(diffstep)
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmcreatev(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__x), ctypes.byref(__diffstep), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmcreatev'")
__r__state = minlmstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minlmcreatefgh.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmcreatefgh.restype = ctypes.c_int32
def minlmcreatefgh(*functionargs):
if len(functionargs)==2:
__friendly_form = False
n,x = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_len("'minlmcreatefgh': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minlmcreatefgh': function must have 1 or 2 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmcreatefgh(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmcreatefgh'")
__r__state = minlmstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minlmsetcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmsetcond.restype = ctypes.c_int32
def minlmsetcond(state, epsx, maxits):
pass
__state = state.ptr
__epsx = ctypes.c_double(epsx)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmsetcond(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsx), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmsetcond'")
return
finally:
pass
_lib_alglib.alglib_minlmsetxrep.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmsetxrep.restype = ctypes.c_int32
def minlmsetxrep(state, needxrep):
pass
__state = state.ptr
__needxrep = ctypes.c_uint8(needxrep)
if __needxrep.value!=0:
__needxrep = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmsetxrep(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__needxrep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmsetxrep'")
return
finally:
pass
_lib_alglib.alglib_minlmsetstpmax.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmsetstpmax.restype = ctypes.c_int32
def minlmsetstpmax(state, stpmax):
pass
__state = state.ptr
__stpmax = ctypes.c_double(stpmax)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmsetstpmax(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__stpmax))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmsetstpmax'")
return
finally:
pass
_lib_alglib.alglib_minlmsetscale.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmsetscale.restype = ctypes.c_int32
def minlmsetscale(state, s):
pass
__state = state.ptr
if not is_real_vector(s):
raise ValueError("'s' parameter can't be cast to real_vector")
__s = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__s, s, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmsetscale(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmsetscale'")
return
finally:
x_vector_clear(__s)
_lib_alglib.alglib_minlmsetbc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmsetbc.restype = ctypes.c_int32
def minlmsetbc(state, bndl, bndu):
pass
__state = state.ptr
if not is_real_vector(bndl):
raise ValueError("'bndl' parameter can't be cast to real_vector")
__bndl = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(bndu):
raise ValueError("'bndu' parameter can't be cast to real_vector")
__bndu = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__bndl, bndl, DT_REAL, X_CREATE)
x_from_list(__bndu, bndu, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmsetbc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__bndl), ctypes.byref(__bndu))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmsetbc'")
return
finally:
x_vector_clear(__bndl)
x_vector_clear(__bndu)
_lib_alglib.alglib_minlmsetlc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmsetlc.restype = ctypes.c_int32
def minlmsetlc(*functionargs):
if len(functionargs)==4:
__friendly_form = False
state,c,ct,k = functionargs
elif len(functionargs)==3:
__friendly_form = True
state,c,ct = functionargs
if safe_rows("'minlmsetlc': incorrect parameters",c)!=safe_len("'minlmsetlc': incorrect parameters",ct):
raise RuntimeError("Error while calling 'minlmsetlc': looks like one of arguments has wrong size")
k = safe_rows("'minlmsetlc': incorrect parameters",c)
else:
raise RuntimeError("Error while calling 'minlmsetlc': function must have 3 or 4 parameters")
__state = state.ptr
if not is_real_matrix(c):
raise ValueError("'c' parameter can't be cast to real_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(ct):
raise ValueError("'ct' parameter can't be cast to int_vector")
__ct = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
try:
x_from_listlist(__c, c, DT_REAL, X_CREATE)
x_from_list(__ct, ct, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmsetlc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__c), ctypes.byref(__ct), ctypes.byref(__k))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmsetlc'")
return
finally:
x_matrix_clear(__c)
x_vector_clear(__ct)
_lib_alglib.alglib_minlmsetacctype.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmsetacctype.restype = ctypes.c_int32
def minlmsetacctype(state, acctype):
pass
__state = state.ptr
__acctype = x_int()
__acctype.val = int(acctype)
if __acctype.val!=acctype:
raise ValueError("Error while converting 'acctype' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmsetacctype(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__acctype))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmsetacctype'")
return
finally:
pass
def minlmoptimize_v(state, fvec, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minlmstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_fi = x_vector()
_lib_alglib.x_minlmstate_get_fi(state.ptr, ctypes.byref(_xc_fi))
_py_fi = create_real_vector(_xc_fi.cnt)
while True:
retval = _lib_alglib.alglib_minlmiteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minlmiteration'")
if not _xc_result:
break
_lib_alglib.x_minlmstate_get_needfi(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
fvec(_py_x, _py_fi, param)
x_from_list(_xc_fi, _py_fi, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minlmstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minlmstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minlmoptimize' (some derivatives were not provided?)")
return
def minlmoptimize_vj(state, fvec, jac, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minlmstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_fi = x_vector()
_lib_alglib.x_minlmstate_get_fi(state.ptr, ctypes.byref(_xc_fi))
_py_fi = create_real_vector(_xc_fi.cnt)
_xc_j = x_matrix()
_lib_alglib.x_minlmstate_get_j(state.ptr, ctypes.byref(_xc_j))
_py_j = create_real_matrix(_xc_j.rows,_xc_j.cols)
while True:
retval = _lib_alglib.alglib_minlmiteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minlmiteration'")
if not _xc_result:
break
_lib_alglib.x_minlmstate_get_needfi(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
fvec(_py_x, _py_fi, param)
x_from_list(_xc_fi, _py_fi, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minlmstate_get_needfij(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
jac(_py_x, _py_fi, _py_j, param)
x_from_list(_xc_fi, _py_fi, DT_REAL, X_REWRITE)
x_from_listlist(_xc_j, _py_j, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minlmstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minlmstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minlmoptimize' (some derivatives were not provided?)")
return
def minlmoptimize_fgh(state, func, grad, hess, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minlmstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
_xc_g = x_vector()
_lib_alglib.x_minlmstate_get_g(state.ptr, ctypes.byref(_xc_g))
_py_g = create_real_vector(_xc_g.cnt)
_xc_h = x_matrix()
_lib_alglib.x_minlmstate_get_h(state.ptr, ctypes.byref(_xc_h))
_py_h = create_real_matrix(_xc_h.rows,_xc_h.cols)
while True:
retval = _lib_alglib.alglib_minlmiteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minlmiteration'")
if not _xc_result:
break
_lib_alglib.x_minlmstate_get_needf(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = func(_py_x, param)
_lib_alglib.x_minlmstate_set_f(state.ptr, ctypes.byref(_xc_f))
continue
_lib_alglib.x_minlmstate_get_needfg(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = grad(_py_x, _py_g, param)
_lib_alglib.x_minlmstate_set_f(state.ptr, ctypes.byref(_xc_f))
x_from_list(_xc_g, _py_g, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minlmstate_get_needfgh(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = hess(_py_x, _py_g, _py_h, param)
_lib_alglib.x_minlmstate_set_f(state.ptr, ctypes.byref(_xc_f))
x_from_list(_xc_g, _py_g, DT_REAL, X_REWRITE)
x_from_listlist(_xc_h, _py_h, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minlmstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minlmstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minlmoptimize' (some derivatives were not provided?)")
return
def minlmoptimize_fj(state, func, jac, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minlmstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
_xc_fi = x_vector()
_lib_alglib.x_minlmstate_get_fi(state.ptr, ctypes.byref(_xc_fi))
_py_fi = create_real_vector(_xc_fi.cnt)
_xc_j = x_matrix()
_lib_alglib.x_minlmstate_get_j(state.ptr, ctypes.byref(_xc_j))
_py_j = create_real_matrix(_xc_j.rows,_xc_j.cols)
while True:
retval = _lib_alglib.alglib_minlmiteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minlmiteration'")
if not _xc_result:
break
_lib_alglib.x_minlmstate_get_needf(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = func(_py_x, param)
_lib_alglib.x_minlmstate_set_f(state.ptr, ctypes.byref(_xc_f))
continue
_lib_alglib.x_minlmstate_get_needfij(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
jac(_py_x, _py_fi, _py_j, param)
x_from_list(_xc_fi, _py_fi, DT_REAL, X_REWRITE)
x_from_listlist(_xc_j, _py_j, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minlmstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minlmstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minlmoptimize' (some derivatives were not provided?)")
return
def minlmoptimize_fgj(state, func, grad, jac, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_minlmstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
_xc_g = x_vector()
_lib_alglib.x_minlmstate_get_g(state.ptr, ctypes.byref(_xc_g))
_py_g = create_real_vector(_xc_g.cnt)
_xc_fi = x_vector()
_lib_alglib.x_minlmstate_get_fi(state.ptr, ctypes.byref(_xc_fi))
_py_fi = create_real_vector(_xc_fi.cnt)
_xc_j = x_matrix()
_lib_alglib.x_minlmstate_get_j(state.ptr, ctypes.byref(_xc_j))
_py_j = create_real_matrix(_xc_j.rows,_xc_j.cols)
while True:
retval = _lib_alglib.alglib_minlmiteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'minlmiteration'")
if not _xc_result:
break
_lib_alglib.x_minlmstate_get_needf(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = func(_py_x, param)
_lib_alglib.x_minlmstate_set_f(state.ptr, ctypes.byref(_xc_f))
continue
_lib_alglib.x_minlmstate_get_needfg(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = grad(_py_x, _py_g, param)
_lib_alglib.x_minlmstate_set_f(state.ptr, ctypes.byref(_xc_f))
x_from_list(_xc_g, _py_g, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minlmstate_get_needfij(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
jac(_py_x, _py_fi, _py_j, param)
x_from_list(_xc_fi, _py_fi, DT_REAL, X_REWRITE)
x_from_listlist(_xc_j, _py_j, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_minlmstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_minlmstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'minlmoptimize' (some derivatives were not provided?)")
return
_lib_alglib.alglib_minlmresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmresults.restype = ctypes.c_int32
def minlmresults(state):
pass
__state = state.ptr
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minlmreport()
x_minlmreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmresults'")
__r__x = list_from_x(__x)
__r__rep = minlmreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minlmreport_clear(__rep)
_lib_alglib.alglib_minlmresultsbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmresultsbuf.restype = ctypes.c_int32
def minlmresultsbuf(state, x, rep):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_minlmreport()
x_minlmreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_minlmreport(__rep, rep)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmresultsbuf(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmresultsbuf'")
__r__x = list_from_x(__x)
__r__rep = minlmreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_minlmreport_clear(__rep)
_lib_alglib.alglib_minlmrestartfrom.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmrestartfrom.restype = ctypes.c_int32
def minlmrestartfrom(state, x):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmrestartfrom(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmrestartfrom'")
return
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minlmrequesttermination.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmrequesttermination.restype = ctypes.c_int32
def minlmrequesttermination(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmrequesttermination(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmrequesttermination'")
return
finally:
pass
_lib_alglib.alglib_minlmcreatevgj.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmcreatevgj.restype = ctypes.c_int32
def minlmcreatevgj(*functionargs):
if len(functionargs)==3:
__friendly_form = False
n,m,x = functionargs
elif len(functionargs)==2:
__friendly_form = True
m,x = functionargs
n = safe_len("'minlmcreatevgj': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minlmcreatevgj': function must have 2 or 3 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmcreatevgj(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__x), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmcreatevgj'")
__r__state = minlmstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minlmcreatefgj.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmcreatefgj.restype = ctypes.c_int32
def minlmcreatefgj(*functionargs):
if len(functionargs)==3:
__friendly_form = False
n,m,x = functionargs
elif len(functionargs)==2:
__friendly_form = True
m,x = functionargs
n = safe_len("'minlmcreatefgj': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minlmcreatefgj': function must have 2 or 3 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmcreatefgj(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__x), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmcreatefgj'")
__r__state = minlmstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minlmcreatefj.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmcreatefj.restype = ctypes.c_int32
def minlmcreatefj(*functionargs):
if len(functionargs)==3:
__friendly_form = False
n,m,x = functionargs
elif len(functionargs)==2:
__friendly_form = True
m,x = functionargs
n = safe_len("'minlmcreatefj': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'minlmcreatefj': function must have 2 or 3 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmcreatefj(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__x), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmcreatefj'")
__r__state = minlmstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_minlmsetgradientcheck.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_minlmsetgradientcheck.restype = ctypes.c_int32
def minlmsetgradientcheck(state, teststep):
pass
__state = state.ptr
__teststep = ctypes.c_double(teststep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_minlmsetgradientcheck(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__teststep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'minlmsetgradientcheck'")
return
finally:
pass
_lib_alglib.x_obj_free_eigsubspacestate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_eigsubspacestate.restype = None
class eigsubspacestate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_eigsubspacestate(self.ptr)
class x_eigsubspacereport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("iterationscount", x_int)
]
class eigsubspacereport(object):
def __init__(self):
self.iterationscount = 0
def x_eigsubspacereport_zero_fields(x):
x.iterationscount.val = 0
return
def x_eigsubspacereport_clear(x):
x_eigsubspacereport_zero_fields(x)
return
def x_from_eigsubspacereport(x,v):
x.iterationscount.val = int(v.iterationscount)
return
def eigsubspacereport_from_x(x):
r = eigsubspacereport()
r.iterationscount = x.iterationscount.val
return r
_lib_alglib.alglib_eigsubspacecreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_eigsubspacecreate.restype = ctypes.c_int32
def eigsubspacecreate(n, k):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__state = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_eigsubspacecreate(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__k), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'eigsubspacecreate'")
__r__state = eigsubspacestate(__state)
return __r__state
finally:
pass
_lib_alglib.alglib_eigsubspacecreatebuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_eigsubspacecreatebuf.restype = ctypes.c_int32
def eigsubspacecreatebuf(n, k, state):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_eigsubspacecreatebuf(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__k), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'eigsubspacecreatebuf'")
return
finally:
pass
_lib_alglib.alglib_eigsubspacesetcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_eigsubspacesetcond.restype = ctypes.c_int32
def eigsubspacesetcond(state, eps, maxits):
pass
__state = state.ptr
__eps = ctypes.c_double(eps)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_eigsubspacesetcond(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__eps), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'eigsubspacesetcond'")
return
finally:
pass
_lib_alglib.alglib_eigsubspacesetwarmstart.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_eigsubspacesetwarmstart.restype = ctypes.c_int32
def eigsubspacesetwarmstart(state, usewarmstart):
pass
__state = state.ptr
__usewarmstart = ctypes.c_uint8(usewarmstart)
if __usewarmstart.value!=0:
__usewarmstart = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_eigsubspacesetwarmstart(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__usewarmstart))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'eigsubspacesetwarmstart'")
return
finally:
pass
_lib_alglib.alglib_eigsubspaceoocstart.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_eigsubspaceoocstart.restype = ctypes.c_int32
def eigsubspaceoocstart(state, mtype):
pass
__state = state.ptr
__mtype = x_int()
__mtype.val = int(mtype)
if __mtype.val!=mtype:
raise ValueError("Error while converting 'mtype' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_eigsubspaceoocstart(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__mtype))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'eigsubspaceoocstart'")
return
finally:
pass
_lib_alglib.alglib_eigsubspaceooccontinue.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_eigsubspaceooccontinue.restype = ctypes.c_int32
def eigsubspaceooccontinue(state):
pass
__result = ctypes.c_uint8(0)
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_eigsubspaceooccontinue(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'eigsubspaceooccontinue'")
__r__result = __result.value!=0
return __r__result
finally:
pass
_lib_alglib.alglib_eigsubspaceoocgetrequestinfo.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_eigsubspaceoocgetrequestinfo.restype = ctypes.c_int32
def eigsubspaceoocgetrequestinfo(state):
pass
__state = state.ptr
__requesttype = x_int()
__requesttype.val = 0
__requestsize = x_int()
__requestsize.val = 0
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_eigsubspaceoocgetrequestinfo(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__requesttype), ctypes.byref(__requestsize))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'eigsubspaceoocgetrequestinfo'")
__r__requesttype = __requesttype.val
__r__requestsize = __requestsize.val
return (__r__requesttype, __r__requestsize)
finally:
pass
_lib_alglib.alglib_eigsubspaceoocgetrequestdata.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_eigsubspaceoocgetrequestdata.restype = ctypes.c_int32
def eigsubspaceoocgetrequestdata(state, x):
pass
__state = state.ptr
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_eigsubspaceoocgetrequestdata(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'eigsubspaceoocgetrequestdata'")
__r__x = listlist_from_x(__x)
return __r__x
finally:
x_matrix_clear(__x)
_lib_alglib.alglib_eigsubspaceoocsendresult.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_eigsubspaceoocsendresult.restype = ctypes.c_int32
def eigsubspaceoocsendresult(state, ax):
pass
__state = state.ptr
if not is_real_matrix(ax):
raise ValueError("'ax' parameter can't be cast to real_matrix")
__ax = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__ax, ax, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_eigsubspaceoocsendresult(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__ax))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'eigsubspaceoocsendresult'")
return
finally:
x_matrix_clear(__ax)
_lib_alglib.alglib_eigsubspaceoocstop.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_eigsubspaceoocstop.restype = ctypes.c_int32
def eigsubspaceoocstop(state):
pass
__state = state.ptr
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__z = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_eigsubspacereport()
x_eigsubspacereport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_eigsubspaceoocstop(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__w), ctypes.byref(__z), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'eigsubspaceoocstop'")
__r__w = list_from_x(__w)
__r__z = listlist_from_x(__z)
__r__rep = eigsubspacereport_from_x(__rep)
return (__r__w, __r__z, __r__rep)
finally:
x_vector_clear(__w)
x_matrix_clear(__z)
x_eigsubspacereport_clear(__rep)
_lib_alglib.alglib_eigsubspacesolvedenses.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_eigsubspacesolvedenses.restype = ctypes.c_int32
def eigsubspacesolvedenses(state, a, isupper):
pass
__state = state.ptr
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__z = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_eigsubspacereport()
x_eigsubspacereport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_eigsubspacesolvedenses(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__a), ctypes.byref(__isupper), ctypes.byref(__w), ctypes.byref(__z), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'eigsubspacesolvedenses'")
__r__w = list_from_x(__w)
__r__z = listlist_from_x(__z)
__r__rep = eigsubspacereport_from_x(__rep)
return (__r__w, __r__z, __r__rep)
finally:
x_matrix_clear(__a)
x_vector_clear(__w)
x_matrix_clear(__z)
x_eigsubspacereport_clear(__rep)
_lib_alglib.alglib_smp_eigsubspacesolvedenses.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_eigsubspacesolvedenses.restype = ctypes.c_int32
def smp_eigsubspacesolvedenses(state, a, isupper):
pass
__state = state.ptr
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__z = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_eigsubspacereport()
x_eigsubspacereport_zero_fields(__rep)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_eigsubspacesolvedenses(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__a), ctypes.byref(__isupper), ctypes.byref(__w), ctypes.byref(__z), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_eigsubspacesolvedenses'")
__r__w = list_from_x(__w)
__r__z = listlist_from_x(__z)
__r__rep = eigsubspacereport_from_x(__rep)
return (__r__w, __r__z, __r__rep)
finally:
x_matrix_clear(__a)
x_vector_clear(__w)
x_matrix_clear(__z)
x_eigsubspacereport_clear(__rep)
_lib_alglib.alglib_eigsubspacesolvesparses.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_eigsubspacesolvesparses.restype = ctypes.c_int32
def eigsubspacesolvesparses(state, a, isupper):
pass
__state = state.ptr
__a = a.ptr
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__z = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_eigsubspacereport()
x_eigsubspacereport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_eigsubspacesolvesparses(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__a), ctypes.byref(__isupper), ctypes.byref(__w), ctypes.byref(__z), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'eigsubspacesolvesparses'")
__r__w = list_from_x(__w)
__r__z = listlist_from_x(__z)
__r__rep = eigsubspacereport_from_x(__rep)
return (__r__w, __r__z, __r__rep)
finally:
x_vector_clear(__w)
x_matrix_clear(__z)
x_eigsubspacereport_clear(__rep)
_lib_alglib.alglib_smatrixevd.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smatrixevd.restype = ctypes.c_int32
def smatrixevd(a, n, zneeded, isupper):
pass
__result = ctypes.c_uint8(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__zneeded = x_int()
__zneeded.val = int(zneeded)
if __zneeded.val!=zneeded:
raise ValueError("Error while converting 'zneeded' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__d = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__z = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smatrixevd(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__zneeded), ctypes.byref(__isupper), ctypes.byref(__d), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smatrixevd'")
__r__result = __result.value!=0
__r__d = list_from_x(__d)
__r__z = listlist_from_x(__z)
return (__r__result, __r__d, __r__z)
finally:
x_matrix_clear(__a)
x_vector_clear(__d)
x_matrix_clear(__z)
_lib_alglib.alglib_smatrixevdr.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smatrixevdr.restype = ctypes.c_int32
def smatrixevdr(a, n, zneeded, isupper, b1, b2):
pass
__result = ctypes.c_uint8(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__zneeded = x_int()
__zneeded.val = int(zneeded)
if __zneeded.val!=zneeded:
raise ValueError("Error while converting 'zneeded' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__b1 = ctypes.c_double(b1)
__b2 = ctypes.c_double(b2)
__m = x_int()
__m.val = 0
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__z = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smatrixevdr(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__zneeded), ctypes.byref(__isupper), ctypes.byref(__b1), ctypes.byref(__b2), ctypes.byref(__m), ctypes.byref(__w), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smatrixevdr'")
__r__result = __result.value!=0
__r__m = __m.val
__r__w = list_from_x(__w)
__r__z = listlist_from_x(__z)
return (__r__result, __r__m, __r__w, __r__z)
finally:
x_matrix_clear(__a)
x_vector_clear(__w)
x_matrix_clear(__z)
_lib_alglib.alglib_smatrixevdi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smatrixevdi.restype = ctypes.c_int32
def smatrixevdi(a, n, zneeded, isupper, i1, i2):
pass
__result = ctypes.c_uint8(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__zneeded = x_int()
__zneeded.val = int(zneeded)
if __zneeded.val!=zneeded:
raise ValueError("Error while converting 'zneeded' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__i1 = x_int()
__i1.val = int(i1)
if __i1.val!=i1:
raise ValueError("Error while converting 'i1' parameter to 'x_int'")
__i2 = x_int()
__i2.val = int(i2)
if __i2.val!=i2:
raise ValueError("Error while converting 'i2' parameter to 'x_int'")
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__z = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smatrixevdi(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__zneeded), ctypes.byref(__isupper), ctypes.byref(__i1), ctypes.byref(__i2), ctypes.byref(__w), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smatrixevdi'")
__r__result = __result.value!=0
__r__w = list_from_x(__w)
__r__z = listlist_from_x(__z)
return (__r__result, __r__w, __r__z)
finally:
x_matrix_clear(__a)
x_vector_clear(__w)
x_matrix_clear(__z)
_lib_alglib.alglib_hmatrixevd.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hmatrixevd.restype = ctypes.c_int32
def hmatrixevd(a, n, zneeded, isupper):
pass
__result = ctypes.c_uint8(0)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__zneeded = x_int()
__zneeded.val = int(zneeded)
if __zneeded.val!=zneeded:
raise ValueError("Error while converting 'zneeded' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__d = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__z = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hmatrixevd(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__zneeded), ctypes.byref(__isupper), ctypes.byref(__d), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hmatrixevd'")
__r__result = __result.value!=0
__r__d = list_from_x(__d)
__r__z = listlist_from_x(__z)
return (__r__result, __r__d, __r__z)
finally:
x_matrix_clear(__a)
x_vector_clear(__d)
x_matrix_clear(__z)
_lib_alglib.alglib_hmatrixevdr.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hmatrixevdr.restype = ctypes.c_int32
def hmatrixevdr(a, n, zneeded, isupper, b1, b2):
pass
__result = ctypes.c_uint8(0)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__zneeded = x_int()
__zneeded.val = int(zneeded)
if __zneeded.val!=zneeded:
raise ValueError("Error while converting 'zneeded' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__b1 = ctypes.c_double(b1)
__b2 = ctypes.c_double(b2)
__m = x_int()
__m.val = 0
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__z = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hmatrixevdr(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__zneeded), ctypes.byref(__isupper), ctypes.byref(__b1), ctypes.byref(__b2), ctypes.byref(__m), ctypes.byref(__w), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hmatrixevdr'")
__r__result = __result.value!=0
__r__m = __m.val
__r__w = list_from_x(__w)
__r__z = listlist_from_x(__z)
return (__r__result, __r__m, __r__w, __r__z)
finally:
x_matrix_clear(__a)
x_vector_clear(__w)
x_matrix_clear(__z)
_lib_alglib.alglib_hmatrixevdi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hmatrixevdi.restype = ctypes.c_int32
def hmatrixevdi(a, n, zneeded, isupper, i1, i2):
pass
__result = ctypes.c_uint8(0)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__zneeded = x_int()
__zneeded.val = int(zneeded)
if __zneeded.val!=zneeded:
raise ValueError("Error while converting 'zneeded' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
__i1 = x_int()
__i1.val = int(i1)
if __i1.val!=i1:
raise ValueError("Error while converting 'i1' parameter to 'x_int'")
__i2 = x_int()
__i2.val = int(i2)
if __i2.val!=i2:
raise ValueError("Error while converting 'i2' parameter to 'x_int'")
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__z = x_matrix(rows=0,cols=0,stride=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hmatrixevdi(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__zneeded), ctypes.byref(__isupper), ctypes.byref(__i1), ctypes.byref(__i2), ctypes.byref(__w), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hmatrixevdi'")
__r__result = __result.value!=0
__r__w = list_from_x(__w)
__r__z = listlist_from_x(__z)
return (__r__result, __r__w, __r__z)
finally:
x_matrix_clear(__a)
x_vector_clear(__w)
x_matrix_clear(__z)
_lib_alglib.alglib_smatrixtdevd.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smatrixtdevd.restype = ctypes.c_int32
def smatrixtdevd(d, e, n, zneeded, z):
pass
__result = ctypes.c_uint8(0)
if not is_real_vector(d):
raise ValueError("'d' parameter can't be cast to real_vector")
__d = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(e):
raise ValueError("'e' parameter can't be cast to real_vector")
__e = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__zneeded = x_int()
__zneeded.val = int(zneeded)
if __zneeded.val!=zneeded:
raise ValueError("Error while converting 'zneeded' parameter to 'x_int'")
if not is_real_matrix(z):
raise ValueError("'z' parameter can't be cast to real_matrix")
__z = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__d, d, DT_REAL, X_CREATE)
x_from_list(__e, e, DT_REAL, X_CREATE)
x_from_listlist(__z, z, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smatrixtdevd(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__d), ctypes.byref(__e), ctypes.byref(__n), ctypes.byref(__zneeded), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smatrixtdevd'")
__r__result = __result.value!=0
__r__d = list_from_x(__d)
__r__z = listlist_from_x(__z)
return (__r__result, __r__d, __r__z)
finally:
x_vector_clear(__d)
x_vector_clear(__e)
x_matrix_clear(__z)
_lib_alglib.alglib_smatrixtdevdr.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smatrixtdevdr.restype = ctypes.c_int32
def smatrixtdevdr(d, e, n, zneeded, a, b, z):
pass
__result = ctypes.c_uint8(0)
if not is_real_vector(d):
raise ValueError("'d' parameter can't be cast to real_vector")
__d = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(e):
raise ValueError("'e' parameter can't be cast to real_vector")
__e = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__zneeded = x_int()
__zneeded.val = int(zneeded)
if __zneeded.val!=zneeded:
raise ValueError("Error while converting 'zneeded' parameter to 'x_int'")
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__m = x_int()
__m.val = 0
if not is_real_matrix(z):
raise ValueError("'z' parameter can't be cast to real_matrix")
__z = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__d, d, DT_REAL, X_CREATE)
x_from_list(__e, e, DT_REAL, X_CREATE)
x_from_listlist(__z, z, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smatrixtdevdr(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__d), ctypes.byref(__e), ctypes.byref(__n), ctypes.byref(__zneeded), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__m), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smatrixtdevdr'")
__r__result = __result.value!=0
__r__d = list_from_x(__d)
__r__m = __m.val
__r__z = listlist_from_x(__z)
return (__r__result, __r__d, __r__m, __r__z)
finally:
x_vector_clear(__d)
x_vector_clear(__e)
x_matrix_clear(__z)
_lib_alglib.alglib_smatrixtdevdi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smatrixtdevdi.restype = ctypes.c_int32
def smatrixtdevdi(d, e, n, zneeded, i1, i2, z):
pass
__result = ctypes.c_uint8(0)
if not is_real_vector(d):
raise ValueError("'d' parameter can't be cast to real_vector")
__d = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(e):
raise ValueError("'e' parameter can't be cast to real_vector")
__e = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__zneeded = x_int()
__zneeded.val = int(zneeded)
if __zneeded.val!=zneeded:
raise ValueError("Error while converting 'zneeded' parameter to 'x_int'")
__i1 = x_int()
__i1.val = int(i1)
if __i1.val!=i1:
raise ValueError("Error while converting 'i1' parameter to 'x_int'")
__i2 = x_int()
__i2.val = int(i2)
if __i2.val!=i2:
raise ValueError("Error while converting 'i2' parameter to 'x_int'")
if not is_real_matrix(z):
raise ValueError("'z' parameter can't be cast to real_matrix")
__z = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__d, d, DT_REAL, X_CREATE)
x_from_list(__e, e, DT_REAL, X_CREATE)
x_from_listlist(__z, z, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smatrixtdevdi(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__d), ctypes.byref(__e), ctypes.byref(__n), ctypes.byref(__zneeded), ctypes.byref(__i1), ctypes.byref(__i2), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smatrixtdevdi'")
__r__result = __result.value!=0
__r__d = list_from_x(__d)
__r__z = listlist_from_x(__z)
return (__r__result, __r__d, __r__z)
finally:
x_vector_clear(__d)
x_vector_clear(__e)
x_matrix_clear(__z)
_lib_alglib.alglib_rmatrixevd.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixevd.restype = ctypes.c_int32
def rmatrixevd(a, n, vneeded):
pass
__result = ctypes.c_uint8(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__vneeded = x_int()
__vneeded.val = int(vneeded)
if __vneeded.val!=vneeded:
raise ValueError("Error while converting 'vneeded' parameter to 'x_int'")
__wr = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__wi = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__vl = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__vr = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixevd(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__vneeded), ctypes.byref(__wr), ctypes.byref(__wi), ctypes.byref(__vl), ctypes.byref(__vr))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixevd'")
__r__result = __result.value!=0
__r__wr = list_from_x(__wr)
__r__wi = list_from_x(__wi)
__r__vl = listlist_from_x(__vl)
__r__vr = listlist_from_x(__vr)
return (__r__result, __r__wr, __r__wi, __r__vl, __r__vr)
finally:
x_matrix_clear(__a)
x_vector_clear(__wr)
x_vector_clear(__wi)
x_matrix_clear(__vl)
x_matrix_clear(__vr)
_lib_alglib.alglib_samplemoments.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_samplemoments.restype = ctypes.c_int32
def samplemoments(*functionargs):
if len(functionargs)==2:
__friendly_form = False
x,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_len("'samplemoments': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'samplemoments': function must have 1 or 2 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__mean = ctypes.c_double(0)
__variance = ctypes.c_double(0)
__skewness = ctypes.c_double(0)
__kurtosis = ctypes.c_double(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_samplemoments(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__mean), ctypes.byref(__variance), ctypes.byref(__skewness), ctypes.byref(__kurtosis))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'samplemoments'")
__r__mean = __mean.value
__r__variance = __variance.value
__r__skewness = __skewness.value
__r__kurtosis = __kurtosis.value
return (__r__mean, __r__variance, __r__skewness, __r__kurtosis)
finally:
x_vector_clear(__x)
_lib_alglib.alglib_samplemean.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_samplemean.restype = ctypes.c_int32
def samplemean(*functionargs):
if len(functionargs)==2:
__friendly_form = False
x,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_len("'samplemean': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'samplemean': function must have 1 or 2 parameters")
__result = ctypes.c_double(0)
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_samplemean(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'samplemean'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__x)
_lib_alglib.alglib_samplevariance.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_samplevariance.restype = ctypes.c_int32
def samplevariance(*functionargs):
if len(functionargs)==2:
__friendly_form = False
x,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_len("'samplevariance': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'samplevariance': function must have 1 or 2 parameters")
__result = ctypes.c_double(0)
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_samplevariance(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'samplevariance'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__x)
_lib_alglib.alglib_sampleskewness.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sampleskewness.restype = ctypes.c_int32
def sampleskewness(*functionargs):
if len(functionargs)==2:
__friendly_form = False
x,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_len("'sampleskewness': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'sampleskewness': function must have 1 or 2 parameters")
__result = ctypes.c_double(0)
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sampleskewness(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sampleskewness'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__x)
_lib_alglib.alglib_samplekurtosis.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_samplekurtosis.restype = ctypes.c_int32
def samplekurtosis(*functionargs):
if len(functionargs)==2:
__friendly_form = False
x,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_len("'samplekurtosis': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'samplekurtosis': function must have 1 or 2 parameters")
__result = ctypes.c_double(0)
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_samplekurtosis(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'samplekurtosis'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__x)
_lib_alglib.alglib_sampleadev.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sampleadev.restype = ctypes.c_int32
def sampleadev(*functionargs):
if len(functionargs)==2:
__friendly_form = False
x,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_len("'sampleadev': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'sampleadev': function must have 1 or 2 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__adev = ctypes.c_double(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sampleadev(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__adev))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sampleadev'")
__r__adev = __adev.value
return __r__adev
finally:
x_vector_clear(__x)
_lib_alglib.alglib_samplemedian.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_samplemedian.restype = ctypes.c_int32
def samplemedian(*functionargs):
if len(functionargs)==2:
__friendly_form = False
x,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_len("'samplemedian': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'samplemedian': function must have 1 or 2 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__median = ctypes.c_double(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_samplemedian(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__median))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'samplemedian'")
__r__median = __median.value
return __r__median
finally:
x_vector_clear(__x)
_lib_alglib.alglib_samplepercentile.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_samplepercentile.restype = ctypes.c_int32
def samplepercentile(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,n,p = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,p = functionargs
n = safe_len("'samplepercentile': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'samplepercentile': function must have 2 or 3 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__p = ctypes.c_double(p)
__v = ctypes.c_double(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_samplepercentile(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__p), ctypes.byref(__v))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'samplepercentile'")
__r__v = __v.value
return __r__v
finally:
x_vector_clear(__x)
_lib_alglib.alglib_cov2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cov2.restype = ctypes.c_int32
def cov2(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,y,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_len("'cov2': incorrect parameters",x)!=safe_len("'cov2': incorrect parameters",y):
raise RuntimeError("Error while calling 'cov2': looks like one of arguments has wrong size")
n = safe_len("'cov2': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'cov2': function must have 2 or 3 parameters")
__result = ctypes.c_double(0)
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cov2(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cov2'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_pearsoncorr2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pearsoncorr2.restype = ctypes.c_int32
def pearsoncorr2(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,y,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_len("'pearsoncorr2': incorrect parameters",x)!=safe_len("'pearsoncorr2': incorrect parameters",y):
raise RuntimeError("Error while calling 'pearsoncorr2': looks like one of arguments has wrong size")
n = safe_len("'pearsoncorr2': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'pearsoncorr2': function must have 2 or 3 parameters")
__result = ctypes.c_double(0)
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pearsoncorr2(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pearsoncorr2'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_spearmancorr2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spearmancorr2.restype = ctypes.c_int32
def spearmancorr2(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,y,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_len("'spearmancorr2': incorrect parameters",x)!=safe_len("'spearmancorr2': incorrect parameters",y):
raise RuntimeError("Error while calling 'spearmancorr2': looks like one of arguments has wrong size")
n = safe_len("'spearmancorr2': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'spearmancorr2': function must have 2 or 3 parameters")
__result = ctypes.c_double(0)
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spearmancorr2(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spearmancorr2'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_covm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_covm.restype = ctypes.c_int32
def covm(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,n,m = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_rows("'covm': incorrect parameters",x)
m = safe_cols("'covm': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'covm': function must have 1 or 3 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_covm(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'covm'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__x)
x_matrix_clear(__c)
_lib_alglib.alglib_smp_covm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_covm.restype = ctypes.c_int32
def smp_covm(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,n,m = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_rows("'smp_covm': incorrect parameters",x)
m = safe_cols("'smp_covm': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'smp_covm': function must have 1 or 3 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_covm(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_covm'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__x)
x_matrix_clear(__c)
_lib_alglib.alglib_pearsoncorrm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pearsoncorrm.restype = ctypes.c_int32
def pearsoncorrm(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,n,m = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_rows("'pearsoncorrm': incorrect parameters",x)
m = safe_cols("'pearsoncorrm': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'pearsoncorrm': function must have 1 or 3 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pearsoncorrm(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pearsoncorrm'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__x)
x_matrix_clear(__c)
_lib_alglib.alglib_smp_pearsoncorrm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_pearsoncorrm.restype = ctypes.c_int32
def smp_pearsoncorrm(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,n,m = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_rows("'smp_pearsoncorrm': incorrect parameters",x)
m = safe_cols("'smp_pearsoncorrm': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'smp_pearsoncorrm': function must have 1 or 3 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_pearsoncorrm(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_pearsoncorrm'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__x)
x_matrix_clear(__c)
_lib_alglib.alglib_spearmancorrm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spearmancorrm.restype = ctypes.c_int32
def spearmancorrm(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,n,m = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_rows("'spearmancorrm': incorrect parameters",x)
m = safe_cols("'spearmancorrm': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'spearmancorrm': function must have 1 or 3 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spearmancorrm(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spearmancorrm'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__x)
x_matrix_clear(__c)
_lib_alglib.alglib_smp_spearmancorrm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spearmancorrm.restype = ctypes.c_int32
def smp_spearmancorrm(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,n,m = functionargs
elif len(functionargs)==1:
__friendly_form = True
x, = functionargs
n = safe_rows("'smp_spearmancorrm': incorrect parameters",x)
m = safe_cols("'smp_spearmancorrm': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'smp_spearmancorrm': function must have 1 or 3 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spearmancorrm(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spearmancorrm'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__x)
x_matrix_clear(__c)
_lib_alglib.alglib_covm2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_covm2.restype = ctypes.c_int32
def covm2(*functionargs):
if len(functionargs)==5:
__friendly_form = False
x,y,n,m1,m2 = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_rows("'covm2': incorrect parameters",x)!=safe_rows("'covm2': incorrect parameters",y):
raise RuntimeError("Error while calling 'covm2': looks like one of arguments has wrong size")
n = safe_rows("'covm2': incorrect parameters",x)
m1 = safe_cols("'covm2': incorrect parameters",x)
m2 = safe_cols("'covm2': incorrect parameters",y)
else:
raise RuntimeError("Error while calling 'covm2': function must have 2 or 5 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(y):
raise ValueError("'y' parameter can't be cast to real_matrix")
__y = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m1 = x_int()
__m1.val = int(m1)
if __m1.val!=m1:
raise ValueError("Error while converting 'm1' parameter to 'x_int'")
__m2 = x_int()
__m2.val = int(m2)
if __m2.val!=m2:
raise ValueError("Error while converting 'm2' parameter to 'x_int'")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
x_from_listlist(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_covm2(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m1), ctypes.byref(__m2), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'covm2'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__x)
x_matrix_clear(__y)
x_matrix_clear(__c)
_lib_alglib.alglib_smp_covm2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_covm2.restype = ctypes.c_int32
def smp_covm2(*functionargs):
if len(functionargs)==5:
__friendly_form = False
x,y,n,m1,m2 = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_rows("'smp_covm2': incorrect parameters",x)!=safe_rows("'smp_covm2': incorrect parameters",y):
raise RuntimeError("Error while calling 'smp_covm2': looks like one of arguments has wrong size")
n = safe_rows("'smp_covm2': incorrect parameters",x)
m1 = safe_cols("'smp_covm2': incorrect parameters",x)
m2 = safe_cols("'smp_covm2': incorrect parameters",y)
else:
raise RuntimeError("Error while calling 'smp_covm2': function must have 2 or 5 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(y):
raise ValueError("'y' parameter can't be cast to real_matrix")
__y = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m1 = x_int()
__m1.val = int(m1)
if __m1.val!=m1:
raise ValueError("Error while converting 'm1' parameter to 'x_int'")
__m2 = x_int()
__m2.val = int(m2)
if __m2.val!=m2:
raise ValueError("Error while converting 'm2' parameter to 'x_int'")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
x_from_listlist(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_covm2(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m1), ctypes.byref(__m2), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_covm2'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__x)
x_matrix_clear(__y)
x_matrix_clear(__c)
_lib_alglib.alglib_pearsoncorrm2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pearsoncorrm2.restype = ctypes.c_int32
def pearsoncorrm2(*functionargs):
if len(functionargs)==5:
__friendly_form = False
x,y,n,m1,m2 = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_rows("'pearsoncorrm2': incorrect parameters",x)!=safe_rows("'pearsoncorrm2': incorrect parameters",y):
raise RuntimeError("Error while calling 'pearsoncorrm2': looks like one of arguments has wrong size")
n = safe_rows("'pearsoncorrm2': incorrect parameters",x)
m1 = safe_cols("'pearsoncorrm2': incorrect parameters",x)
m2 = safe_cols("'pearsoncorrm2': incorrect parameters",y)
else:
raise RuntimeError("Error while calling 'pearsoncorrm2': function must have 2 or 5 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(y):
raise ValueError("'y' parameter can't be cast to real_matrix")
__y = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m1 = x_int()
__m1.val = int(m1)
if __m1.val!=m1:
raise ValueError("Error while converting 'm1' parameter to 'x_int'")
__m2 = x_int()
__m2.val = int(m2)
if __m2.val!=m2:
raise ValueError("Error while converting 'm2' parameter to 'x_int'")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
x_from_listlist(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pearsoncorrm2(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m1), ctypes.byref(__m2), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pearsoncorrm2'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__x)
x_matrix_clear(__y)
x_matrix_clear(__c)
_lib_alglib.alglib_smp_pearsoncorrm2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_pearsoncorrm2.restype = ctypes.c_int32
def smp_pearsoncorrm2(*functionargs):
if len(functionargs)==5:
__friendly_form = False
x,y,n,m1,m2 = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_rows("'smp_pearsoncorrm2': incorrect parameters",x)!=safe_rows("'smp_pearsoncorrm2': incorrect parameters",y):
raise RuntimeError("Error while calling 'smp_pearsoncorrm2': looks like one of arguments has wrong size")
n = safe_rows("'smp_pearsoncorrm2': incorrect parameters",x)
m1 = safe_cols("'smp_pearsoncorrm2': incorrect parameters",x)
m2 = safe_cols("'smp_pearsoncorrm2': incorrect parameters",y)
else:
raise RuntimeError("Error while calling 'smp_pearsoncorrm2': function must have 2 or 5 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(y):
raise ValueError("'y' parameter can't be cast to real_matrix")
__y = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m1 = x_int()
__m1.val = int(m1)
if __m1.val!=m1:
raise ValueError("Error while converting 'm1' parameter to 'x_int'")
__m2 = x_int()
__m2.val = int(m2)
if __m2.val!=m2:
raise ValueError("Error while converting 'm2' parameter to 'x_int'")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
x_from_listlist(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_pearsoncorrm2(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m1), ctypes.byref(__m2), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_pearsoncorrm2'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__x)
x_matrix_clear(__y)
x_matrix_clear(__c)
_lib_alglib.alglib_spearmancorrm2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spearmancorrm2.restype = ctypes.c_int32
def spearmancorrm2(*functionargs):
if len(functionargs)==5:
__friendly_form = False
x,y,n,m1,m2 = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_rows("'spearmancorrm2': incorrect parameters",x)!=safe_rows("'spearmancorrm2': incorrect parameters",y):
raise RuntimeError("Error while calling 'spearmancorrm2': looks like one of arguments has wrong size")
n = safe_rows("'spearmancorrm2': incorrect parameters",x)
m1 = safe_cols("'spearmancorrm2': incorrect parameters",x)
m2 = safe_cols("'spearmancorrm2': incorrect parameters",y)
else:
raise RuntimeError("Error while calling 'spearmancorrm2': function must have 2 or 5 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(y):
raise ValueError("'y' parameter can't be cast to real_matrix")
__y = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m1 = x_int()
__m1.val = int(m1)
if __m1.val!=m1:
raise ValueError("Error while converting 'm1' parameter to 'x_int'")
__m2 = x_int()
__m2.val = int(m2)
if __m2.val!=m2:
raise ValueError("Error while converting 'm2' parameter to 'x_int'")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
x_from_listlist(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spearmancorrm2(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m1), ctypes.byref(__m2), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spearmancorrm2'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__x)
x_matrix_clear(__y)
x_matrix_clear(__c)
_lib_alglib.alglib_smp_spearmancorrm2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spearmancorrm2.restype = ctypes.c_int32
def smp_spearmancorrm2(*functionargs):
if len(functionargs)==5:
__friendly_form = False
x,y,n,m1,m2 = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_rows("'smp_spearmancorrm2': incorrect parameters",x)!=safe_rows("'smp_spearmancorrm2': incorrect parameters",y):
raise RuntimeError("Error while calling 'smp_spearmancorrm2': looks like one of arguments has wrong size")
n = safe_rows("'smp_spearmancorrm2': incorrect parameters",x)
m1 = safe_cols("'smp_spearmancorrm2': incorrect parameters",x)
m2 = safe_cols("'smp_spearmancorrm2': incorrect parameters",y)
else:
raise RuntimeError("Error while calling 'smp_spearmancorrm2': function must have 2 or 5 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(y):
raise ValueError("'y' parameter can't be cast to real_matrix")
__y = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m1 = x_int()
__m1.val = int(m1)
if __m1.val!=m1:
raise ValueError("Error while converting 'm1' parameter to 'x_int'")
__m2 = x_int()
__m2.val = int(m2)
if __m2.val!=m2:
raise ValueError("Error while converting 'm2' parameter to 'x_int'")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
x_from_listlist(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spearmancorrm2(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m1), ctypes.byref(__m2), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spearmancorrm2'")
__r__c = listlist_from_x(__c)
return __r__c
finally:
x_matrix_clear(__x)
x_matrix_clear(__y)
x_matrix_clear(__c)
_lib_alglib.alglib_rankdata.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rankdata.restype = ctypes.c_int32
def rankdata(*functionargs):
if len(functionargs)==3:
__friendly_form = False
xy,npoints,nfeatures = functionargs
elif len(functionargs)==1:
__friendly_form = True
xy, = functionargs
npoints = safe_rows("'rankdata': incorrect parameters",xy)
nfeatures = safe_cols("'rankdata': incorrect parameters",xy)
else:
raise RuntimeError("Error while calling 'rankdata': function must have 1 or 3 parameters")
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nfeatures = x_int()
__nfeatures.val = int(nfeatures)
if __nfeatures.val!=nfeatures:
raise ValueError("Error while converting 'nfeatures' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rankdata(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nfeatures))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rankdata'")
__r__xy = listlist_from_x(__xy)
return __r__xy
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_smp_rankdata.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rankdata.restype = ctypes.c_int32
def smp_rankdata(*functionargs):
if len(functionargs)==3:
__friendly_form = False
xy,npoints,nfeatures = functionargs
elif len(functionargs)==1:
__friendly_form = True
xy, = functionargs
npoints = safe_rows("'smp_rankdata': incorrect parameters",xy)
nfeatures = safe_cols("'smp_rankdata': incorrect parameters",xy)
else:
raise RuntimeError("Error while calling 'smp_rankdata': function must have 1 or 3 parameters")
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nfeatures = x_int()
__nfeatures.val = int(nfeatures)
if __nfeatures.val!=nfeatures:
raise ValueError("Error while converting 'nfeatures' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rankdata(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nfeatures))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rankdata'")
__r__xy = listlist_from_x(__xy)
return __r__xy
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_rankdatacentered.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rankdatacentered.restype = ctypes.c_int32
def rankdatacentered(*functionargs):
if len(functionargs)==3:
__friendly_form = False
xy,npoints,nfeatures = functionargs
elif len(functionargs)==1:
__friendly_form = True
xy, = functionargs
npoints = safe_rows("'rankdatacentered': incorrect parameters",xy)
nfeatures = safe_cols("'rankdatacentered': incorrect parameters",xy)
else:
raise RuntimeError("Error while calling 'rankdatacentered': function must have 1 or 3 parameters")
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nfeatures = x_int()
__nfeatures.val = int(nfeatures)
if __nfeatures.val!=nfeatures:
raise ValueError("Error while converting 'nfeatures' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rankdatacentered(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nfeatures))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rankdatacentered'")
__r__xy = listlist_from_x(__xy)
return __r__xy
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_smp_rankdatacentered.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rankdatacentered.restype = ctypes.c_int32
def smp_rankdatacentered(*functionargs):
if len(functionargs)==3:
__friendly_form = False
xy,npoints,nfeatures = functionargs
elif len(functionargs)==1:
__friendly_form = True
xy, = functionargs
npoints = safe_rows("'smp_rankdatacentered': incorrect parameters",xy)
nfeatures = safe_cols("'smp_rankdatacentered': incorrect parameters",xy)
else:
raise RuntimeError("Error while calling 'smp_rankdatacentered': function must have 1 or 3 parameters")
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nfeatures = x_int()
__nfeatures.val = int(nfeatures)
if __nfeatures.val!=nfeatures:
raise ValueError("Error while converting 'nfeatures' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rankdatacentered(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nfeatures))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rankdatacentered'")
__r__xy = listlist_from_x(__xy)
return __r__xy
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_pearsoncorrelation.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pearsoncorrelation.restype = ctypes.c_int32
def pearsoncorrelation(x, y, n):
pass
__result = ctypes.c_double(0)
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pearsoncorrelation(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pearsoncorrelation'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_spearmanrankcorrelation.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spearmanrankcorrelation.restype = ctypes.c_int32
def spearmanrankcorrelation(x, y, n):
pass
__result = ctypes.c_double(0)
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spearmanrankcorrelation(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spearmanrankcorrelation'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_pcabuildbasis.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pcabuildbasis.restype = ctypes.c_int32
def pcabuildbasis(x, npoints, nvars):
pass
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__s2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__v = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pcabuildbasis(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__info), ctypes.byref(__s2), ctypes.byref(__v))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pcabuildbasis'")
__r__info = __info.val
__r__s2 = list_from_x(__s2)
__r__v = listlist_from_x(__v)
return (__r__info, __r__s2, __r__v)
finally:
x_matrix_clear(__x)
x_vector_clear(__s2)
x_matrix_clear(__v)
_lib_alglib.alglib_smp_pcabuildbasis.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_pcabuildbasis.restype = ctypes.c_int32
def smp_pcabuildbasis(x, npoints, nvars):
pass
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__s2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__v = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_pcabuildbasis(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__info), ctypes.byref(__s2), ctypes.byref(__v))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_pcabuildbasis'")
__r__info = __info.val
__r__s2 = list_from_x(__s2)
__r__v = listlist_from_x(__v)
return (__r__info, __r__s2, __r__v)
finally:
x_matrix_clear(__x)
x_vector_clear(__s2)
x_matrix_clear(__v)
_lib_alglib.alglib_pcatruncatedsubspace.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pcatruncatedsubspace.restype = ctypes.c_int32
def pcatruncatedsubspace(x, npoints, nvars, nneeded, eps, maxits):
pass
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__nneeded = x_int()
__nneeded.val = int(nneeded)
if __nneeded.val!=nneeded:
raise ValueError("Error while converting 'nneeded' parameter to 'x_int'")
__eps = ctypes.c_double(eps)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
__s2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__v = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pcatruncatedsubspace(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__nneeded), ctypes.byref(__eps), ctypes.byref(__maxits), ctypes.byref(__s2), ctypes.byref(__v))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pcatruncatedsubspace'")
__r__s2 = list_from_x(__s2)
__r__v = listlist_from_x(__v)
return (__r__s2, __r__v)
finally:
x_matrix_clear(__x)
x_vector_clear(__s2)
x_matrix_clear(__v)
_lib_alglib.alglib_smp_pcatruncatedsubspace.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_pcatruncatedsubspace.restype = ctypes.c_int32
def smp_pcatruncatedsubspace(x, npoints, nvars, nneeded, eps, maxits):
pass
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__nneeded = x_int()
__nneeded.val = int(nneeded)
if __nneeded.val!=nneeded:
raise ValueError("Error while converting 'nneeded' parameter to 'x_int'")
__eps = ctypes.c_double(eps)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
__s2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__v = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_pcatruncatedsubspace(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__nneeded), ctypes.byref(__eps), ctypes.byref(__maxits), ctypes.byref(__s2), ctypes.byref(__v))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_pcatruncatedsubspace'")
__r__s2 = list_from_x(__s2)
__r__v = listlist_from_x(__v)
return (__r__s2, __r__v)
finally:
x_matrix_clear(__x)
x_vector_clear(__s2)
x_matrix_clear(__v)
_lib_alglib.alglib_dsoptimalsplit2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_dsoptimalsplit2.restype = ctypes.c_int32
def dsoptimalsplit2(a, c, n):
pass
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(c):
raise ValueError("'c' parameter can't be cast to int_vector")
__c = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__threshold = ctypes.c_double(0)
__pal = ctypes.c_double(0)
__pbl = ctypes.c_double(0)
__par = ctypes.c_double(0)
__pbr = ctypes.c_double(0)
__cve = ctypes.c_double(0)
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
x_from_list(__c, c, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_dsoptimalsplit2(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__c), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__threshold), ctypes.byref(__pal), ctypes.byref(__pbl), ctypes.byref(__par), ctypes.byref(__pbr), ctypes.byref(__cve))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'dsoptimalsplit2'")
__r__info = __info.val
__r__threshold = __threshold.value
__r__pal = __pal.value
__r__pbl = __pbl.value
__r__par = __par.value
__r__pbr = __pbr.value
__r__cve = __cve.value
return (__r__info, __r__threshold, __r__pal, __r__pbl, __r__par, __r__pbr, __r__cve)
finally:
x_vector_clear(__a)
x_vector_clear(__c)
_lib_alglib.alglib_dsoptimalsplit2fast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_dsoptimalsplit2fast.restype = ctypes.c_int32
def dsoptimalsplit2fast(a, c, tiesbuf, cntbuf, bufr, bufi, n, nc, alpha):
pass
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(c):
raise ValueError("'c' parameter can't be cast to int_vector")
__c = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(tiesbuf):
raise ValueError("'tiesbuf' parameter can't be cast to int_vector")
__tiesbuf = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(cntbuf):
raise ValueError("'cntbuf' parameter can't be cast to int_vector")
__cntbuf = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(bufr):
raise ValueError("'bufr' parameter can't be cast to real_vector")
__bufr = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(bufi):
raise ValueError("'bufi' parameter can't be cast to int_vector")
__bufi = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__nc = x_int()
__nc.val = int(nc)
if __nc.val!=nc:
raise ValueError("Error while converting 'nc' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
__info = x_int()
__info.val = 0
__threshold = ctypes.c_double(0)
__rms = ctypes.c_double(0)
__cvrms = ctypes.c_double(0)
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
x_from_list(__c, c, DT_INT, X_CREATE)
x_from_list(__tiesbuf, tiesbuf, DT_INT, X_CREATE)
x_from_list(__cntbuf, cntbuf, DT_INT, X_CREATE)
x_from_list(__bufr, bufr, DT_REAL, X_CREATE)
x_from_list(__bufi, bufi, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_dsoptimalsplit2fast(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__c), ctypes.byref(__tiesbuf), ctypes.byref(__cntbuf), ctypes.byref(__bufr), ctypes.byref(__bufi), ctypes.byref(__n), ctypes.byref(__nc), ctypes.byref(__alpha), ctypes.byref(__info), ctypes.byref(__threshold), ctypes.byref(__rms), ctypes.byref(__cvrms))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'dsoptimalsplit2fast'")
__r__a = list_from_x(__a)
__r__c = list_from_x(__c)
__r__tiesbuf = list_from_x(__tiesbuf)
__r__cntbuf = list_from_x(__cntbuf)
__r__bufr = list_from_x(__bufr)
__r__bufi = list_from_x(__bufi)
__r__info = __info.val
__r__threshold = __threshold.value
__r__rms = __rms.value
__r__cvrms = __cvrms.value
return (__r__a, __r__c, __r__tiesbuf, __r__cntbuf, __r__bufr, __r__bufi, __r__info, __r__threshold, __r__rms, __r__cvrms)
finally:
x_vector_clear(__a)
x_vector_clear(__c)
x_vector_clear(__tiesbuf)
x_vector_clear(__cntbuf)
x_vector_clear(__bufr)
x_vector_clear(__bufi)
class x_modelerrors(ctypes.Structure):
_pack_ = 8
_fields_ = [
("relclserror", ctypes.c_double),
("avgce", ctypes.c_double),
("rmserror", ctypes.c_double),
("avgerror", ctypes.c_double),
("avgrelerror", ctypes.c_double)
]
class modelerrors(object):
def __init__(self):
self.relclserror = 0
self.avgce = 0
self.rmserror = 0
self.avgerror = 0
self.avgrelerror = 0
def x_modelerrors_zero_fields(x):
x.relclserror = 0
x.avgce = 0
x.rmserror = 0
x.avgerror = 0
x.avgrelerror = 0
return
def x_modelerrors_clear(x):
x_modelerrors_zero_fields(x)
return
def x_from_modelerrors(x,v):
x.relclserror = float(v.relclserror)
x.avgce = float(v.avgce)
x.rmserror = float(v.rmserror)
x.avgerror = float(v.avgerror)
x.avgrelerror = float(v.avgrelerror)
return
def modelerrors_from_x(x):
r = modelerrors()
r.relclserror = x.relclserror
r.avgce = x.avgce
r.rmserror = x.rmserror
r.avgerror = x.avgerror
r.avgrelerror = x.avgrelerror
return r
_lib_alglib.x_obj_free_multilayerperceptron.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_multilayerperceptron.restype = None
class multilayerperceptron(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_multilayerperceptron(self.ptr)
_lib_alglib.alglib_mlpserialize.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpserialize.restype = ctypes.c_int32
def mlpserialize(obj):
error_msg = ctypes.c_char_p(0)
_s_out = ctypes.c_char_p(0)
retval = _lib_alglib.alglib_mlpserialize(ctypes.byref(error_msg), ctypes.byref(obj.ptr), ctypes.byref(_s_out))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpserialize'")
s_out = _s_out.value
_lib_alglib.x_free(_s_out)
return s_out
_lib_alglib.alglib_mlpunserialize.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpunserialize.restype = ctypes.c_int32
def mlpunserialize(s_in):
error_msg = ctypes.c_char_p(0)
_s_in = ctypes.c_char_p(s_in)
_obj = ctypes.c_void_p(0)
retval = _lib_alglib.alglib_mlpunserialize(ctypes.byref(error_msg), ctypes.byref(_s_in), ctypes.byref(_obj), )
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpserialize'")
return multilayerperceptron(_obj)
_lib_alglib.alglib_mlpcreate0.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcreate0.restype = ctypes.c_int32
def mlpcreate0(nin, nout):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__network = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcreate0(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nout), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcreate0'")
__r__network = multilayerperceptron(__network)
return __r__network
finally:
pass
_lib_alglib.alglib_mlpcreate1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcreate1.restype = ctypes.c_int32
def mlpcreate1(nin, nhid, nout):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid = x_int()
__nhid.val = int(nhid)
if __nhid.val!=nhid:
raise ValueError("Error while converting 'nhid' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__network = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcreate1(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid), ctypes.byref(__nout), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcreate1'")
__r__network = multilayerperceptron(__network)
return __r__network
finally:
pass
_lib_alglib.alglib_mlpcreate2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcreate2.restype = ctypes.c_int32
def mlpcreate2(nin, nhid1, nhid2, nout):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid1 = x_int()
__nhid1.val = int(nhid1)
if __nhid1.val!=nhid1:
raise ValueError("Error while converting 'nhid1' parameter to 'x_int'")
__nhid2 = x_int()
__nhid2.val = int(nhid2)
if __nhid2.val!=nhid2:
raise ValueError("Error while converting 'nhid2' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__network = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcreate2(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid1), ctypes.byref(__nhid2), ctypes.byref(__nout), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcreate2'")
__r__network = multilayerperceptron(__network)
return __r__network
finally:
pass
_lib_alglib.alglib_mlpcreateb0.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcreateb0.restype = ctypes.c_int32
def mlpcreateb0(nin, nout, b, d):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__b = ctypes.c_double(b)
__d = ctypes.c_double(d)
__network = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcreateb0(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nout), ctypes.byref(__b), ctypes.byref(__d), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcreateb0'")
__r__network = multilayerperceptron(__network)
return __r__network
finally:
pass
_lib_alglib.alglib_mlpcreateb1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcreateb1.restype = ctypes.c_int32
def mlpcreateb1(nin, nhid, nout, b, d):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid = x_int()
__nhid.val = int(nhid)
if __nhid.val!=nhid:
raise ValueError("Error while converting 'nhid' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__b = ctypes.c_double(b)
__d = ctypes.c_double(d)
__network = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcreateb1(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid), ctypes.byref(__nout), ctypes.byref(__b), ctypes.byref(__d), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcreateb1'")
__r__network = multilayerperceptron(__network)
return __r__network
finally:
pass
_lib_alglib.alglib_mlpcreateb2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcreateb2.restype = ctypes.c_int32
def mlpcreateb2(nin, nhid1, nhid2, nout, b, d):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid1 = x_int()
__nhid1.val = int(nhid1)
if __nhid1.val!=nhid1:
raise ValueError("Error while converting 'nhid1' parameter to 'x_int'")
__nhid2 = x_int()
__nhid2.val = int(nhid2)
if __nhid2.val!=nhid2:
raise ValueError("Error while converting 'nhid2' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__b = ctypes.c_double(b)
__d = ctypes.c_double(d)
__network = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcreateb2(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid1), ctypes.byref(__nhid2), ctypes.byref(__nout), ctypes.byref(__b), ctypes.byref(__d), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcreateb2'")
__r__network = multilayerperceptron(__network)
return __r__network
finally:
pass
_lib_alglib.alglib_mlpcreater0.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcreater0.restype = ctypes.c_int32
def mlpcreater0(nin, nout, a, b):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__network = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcreater0(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nout), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcreater0'")
__r__network = multilayerperceptron(__network)
return __r__network
finally:
pass
_lib_alglib.alglib_mlpcreater1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcreater1.restype = ctypes.c_int32
def mlpcreater1(nin, nhid, nout, a, b):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid = x_int()
__nhid.val = int(nhid)
if __nhid.val!=nhid:
raise ValueError("Error while converting 'nhid' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__network = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcreater1(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid), ctypes.byref(__nout), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcreater1'")
__r__network = multilayerperceptron(__network)
return __r__network
finally:
pass
_lib_alglib.alglib_mlpcreater2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcreater2.restype = ctypes.c_int32
def mlpcreater2(nin, nhid1, nhid2, nout, a, b):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid1 = x_int()
__nhid1.val = int(nhid1)
if __nhid1.val!=nhid1:
raise ValueError("Error while converting 'nhid1' parameter to 'x_int'")
__nhid2 = x_int()
__nhid2.val = int(nhid2)
if __nhid2.val!=nhid2:
raise ValueError("Error while converting 'nhid2' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__network = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcreater2(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid1), ctypes.byref(__nhid2), ctypes.byref(__nout), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcreater2'")
__r__network = multilayerperceptron(__network)
return __r__network
finally:
pass
_lib_alglib.alglib_mlpcreatec0.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcreatec0.restype = ctypes.c_int32
def mlpcreatec0(nin, nout):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__network = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcreatec0(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nout), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcreatec0'")
__r__network = multilayerperceptron(__network)
return __r__network
finally:
pass
_lib_alglib.alglib_mlpcreatec1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcreatec1.restype = ctypes.c_int32
def mlpcreatec1(nin, nhid, nout):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid = x_int()
__nhid.val = int(nhid)
if __nhid.val!=nhid:
raise ValueError("Error while converting 'nhid' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__network = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcreatec1(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid), ctypes.byref(__nout), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcreatec1'")
__r__network = multilayerperceptron(__network)
return __r__network
finally:
pass
_lib_alglib.alglib_mlpcreatec2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcreatec2.restype = ctypes.c_int32
def mlpcreatec2(nin, nhid1, nhid2, nout):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid1 = x_int()
__nhid1.val = int(nhid1)
if __nhid1.val!=nhid1:
raise ValueError("Error while converting 'nhid1' parameter to 'x_int'")
__nhid2 = x_int()
__nhid2.val = int(nhid2)
if __nhid2.val!=nhid2:
raise ValueError("Error while converting 'nhid2' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__network = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcreatec2(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid1), ctypes.byref(__nhid2), ctypes.byref(__nout), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcreatec2'")
__r__network = multilayerperceptron(__network)
return __r__network
finally:
pass
_lib_alglib.alglib_mlpcopy.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcopy.restype = ctypes.c_int32
def mlpcopy(network1):
pass
__network1 = network1.ptr
__network2 = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcopy(ctypes.byref(_error_msg), ctypes.byref(__network1), ctypes.byref(__network2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcopy'")
__r__network2 = multilayerperceptron(__network2)
return __r__network2
finally:
pass
_lib_alglib.alglib_mlpcopytunableparameters.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcopytunableparameters.restype = ctypes.c_int32
def mlpcopytunableparameters(network1, network2):
pass
__network1 = network1.ptr
__network2 = network2.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcopytunableparameters(ctypes.byref(_error_msg), ctypes.byref(__network1), ctypes.byref(__network2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcopytunableparameters'")
return
finally:
pass
_lib_alglib.alglib_mlprandomize.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlprandomize.restype = ctypes.c_int32
def mlprandomize(network):
pass
__network = network.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlprandomize(ctypes.byref(_error_msg), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlprandomize'")
return
finally:
pass
_lib_alglib.alglib_mlprandomizefull.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlprandomizefull.restype = ctypes.c_int32
def mlprandomizefull(network):
pass
__network = network.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlprandomizefull(ctypes.byref(_error_msg), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlprandomizefull'")
return
finally:
pass
_lib_alglib.alglib_mlpinitpreprocessor.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpinitpreprocessor.restype = ctypes.c_int32
def mlpinitpreprocessor(network, xy, ssize):
pass
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ssize = x_int()
__ssize.val = int(ssize)
if __ssize.val!=ssize:
raise ValueError("Error while converting 'ssize' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpinitpreprocessor(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__ssize))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpinitpreprocessor'")
return
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mlpproperties.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpproperties.restype = ctypes.c_int32
def mlpproperties(network):
pass
__network = network.ptr
__nin = x_int()
__nin.val = 0
__nout = x_int()
__nout.val = 0
__wcount = x_int()
__wcount.val = 0
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpproperties(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__nin), ctypes.byref(__nout), ctypes.byref(__wcount))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpproperties'")
__r__nin = __nin.val
__r__nout = __nout.val
__r__wcount = __wcount.val
return (__r__nin, __r__nout, __r__wcount)
finally:
pass
_lib_alglib.alglib_mlpgetinputscount.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgetinputscount.restype = ctypes.c_int32
def mlpgetinputscount(network):
pass
__result = x_int()
__result.val = 0
__network = network.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgetinputscount(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgetinputscount'")
__r__result = __result.val
return __r__result
finally:
pass
_lib_alglib.alglib_mlpgetoutputscount.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgetoutputscount.restype = ctypes.c_int32
def mlpgetoutputscount(network):
pass
__result = x_int()
__result.val = 0
__network = network.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgetoutputscount(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgetoutputscount'")
__r__result = __result.val
return __r__result
finally:
pass
_lib_alglib.alglib_mlpgetweightscount.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgetweightscount.restype = ctypes.c_int32
def mlpgetweightscount(network):
pass
__result = x_int()
__result.val = 0
__network = network.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgetweightscount(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgetweightscount'")
__r__result = __result.val
return __r__result
finally:
pass
_lib_alglib.alglib_mlpissoftmax.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpissoftmax.restype = ctypes.c_int32
def mlpissoftmax(network):
pass
__result = ctypes.c_uint8(0)
__network = network.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpissoftmax(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpissoftmax'")
__r__result = __result.value!=0
return __r__result
finally:
pass
_lib_alglib.alglib_mlpgetlayerscount.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgetlayerscount.restype = ctypes.c_int32
def mlpgetlayerscount(network):
pass
__result = x_int()
__result.val = 0
__network = network.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgetlayerscount(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgetlayerscount'")
__r__result = __result.val
return __r__result
finally:
pass
_lib_alglib.alglib_mlpgetlayersize.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgetlayersize.restype = ctypes.c_int32
def mlpgetlayersize(network, k):
pass
__result = x_int()
__result.val = 0
__network = network.ptr
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgetlayersize(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__k))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgetlayersize'")
__r__result = __result.val
return __r__result
finally:
pass
_lib_alglib.alglib_mlpgetinputscaling.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgetinputscaling.restype = ctypes.c_int32
def mlpgetinputscaling(network, i):
pass
__network = network.ptr
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
__mean = ctypes.c_double(0)
__sigma = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgetinputscaling(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__i), ctypes.byref(__mean), ctypes.byref(__sigma))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgetinputscaling'")
__r__mean = __mean.value
__r__sigma = __sigma.value
return (__r__mean, __r__sigma)
finally:
pass
_lib_alglib.alglib_mlpgetoutputscaling.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgetoutputscaling.restype = ctypes.c_int32
def mlpgetoutputscaling(network, i):
pass
__network = network.ptr
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
__mean = ctypes.c_double(0)
__sigma = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgetoutputscaling(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__i), ctypes.byref(__mean), ctypes.byref(__sigma))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgetoutputscaling'")
__r__mean = __mean.value
__r__sigma = __sigma.value
return (__r__mean, __r__sigma)
finally:
pass
_lib_alglib.alglib_mlpgetneuroninfo.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgetneuroninfo.restype = ctypes.c_int32
def mlpgetneuroninfo(network, k, i):
pass
__network = network.ptr
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
__fkind = x_int()
__fkind.val = 0
__threshold = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgetneuroninfo(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__k), ctypes.byref(__i), ctypes.byref(__fkind), ctypes.byref(__threshold))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgetneuroninfo'")
__r__fkind = __fkind.val
__r__threshold = __threshold.value
return (__r__fkind, __r__threshold)
finally:
pass
_lib_alglib.alglib_mlpgetweight.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgetweight.restype = ctypes.c_int32
def mlpgetweight(network, k0, i0, k1, i1):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__k0 = x_int()
__k0.val = int(k0)
if __k0.val!=k0:
raise ValueError("Error while converting 'k0' parameter to 'x_int'")
__i0 = x_int()
__i0.val = int(i0)
if __i0.val!=i0:
raise ValueError("Error while converting 'i0' parameter to 'x_int'")
__k1 = x_int()
__k1.val = int(k1)
if __k1.val!=k1:
raise ValueError("Error while converting 'k1' parameter to 'x_int'")
__i1 = x_int()
__i1.val = int(i1)
if __i1.val!=i1:
raise ValueError("Error while converting 'i1' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgetweight(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__k0), ctypes.byref(__i0), ctypes.byref(__k1), ctypes.byref(__i1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgetweight'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_mlpsetinputscaling.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpsetinputscaling.restype = ctypes.c_int32
def mlpsetinputscaling(network, i, mean, sigma):
pass
__network = network.ptr
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
__mean = ctypes.c_double(mean)
__sigma = ctypes.c_double(sigma)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpsetinputscaling(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__i), ctypes.byref(__mean), ctypes.byref(__sigma))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpsetinputscaling'")
return
finally:
pass
_lib_alglib.alglib_mlpsetoutputscaling.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpsetoutputscaling.restype = ctypes.c_int32
def mlpsetoutputscaling(network, i, mean, sigma):
pass
__network = network.ptr
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
__mean = ctypes.c_double(mean)
__sigma = ctypes.c_double(sigma)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpsetoutputscaling(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__i), ctypes.byref(__mean), ctypes.byref(__sigma))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpsetoutputscaling'")
return
finally:
pass
_lib_alglib.alglib_mlpsetneuroninfo.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpsetneuroninfo.restype = ctypes.c_int32
def mlpsetneuroninfo(network, k, i, fkind, threshold):
pass
__network = network.ptr
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
__fkind = x_int()
__fkind.val = int(fkind)
if __fkind.val!=fkind:
raise ValueError("Error while converting 'fkind' parameter to 'x_int'")
__threshold = ctypes.c_double(threshold)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpsetneuroninfo(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__k), ctypes.byref(__i), ctypes.byref(__fkind), ctypes.byref(__threshold))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpsetneuroninfo'")
return
finally:
pass
_lib_alglib.alglib_mlpsetweight.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpsetweight.restype = ctypes.c_int32
def mlpsetweight(network, k0, i0, k1, i1, w):
pass
__network = network.ptr
__k0 = x_int()
__k0.val = int(k0)
if __k0.val!=k0:
raise ValueError("Error while converting 'k0' parameter to 'x_int'")
__i0 = x_int()
__i0.val = int(i0)
if __i0.val!=i0:
raise ValueError("Error while converting 'i0' parameter to 'x_int'")
__k1 = x_int()
__k1.val = int(k1)
if __k1.val!=k1:
raise ValueError("Error while converting 'k1' parameter to 'x_int'")
__i1 = x_int()
__i1.val = int(i1)
if __i1.val!=i1:
raise ValueError("Error while converting 'i1' parameter to 'x_int'")
__w = ctypes.c_double(w)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpsetweight(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__k0), ctypes.byref(__i0), ctypes.byref(__k1), ctypes.byref(__i1), ctypes.byref(__w))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpsetweight'")
return
finally:
pass
_lib_alglib.alglib_mlpactivationfunction.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpactivationfunction.restype = ctypes.c_int32
def mlpactivationfunction(net, k):
pass
__net = ctypes.c_double(net)
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__f = ctypes.c_double(0)
__df = ctypes.c_double(0)
__d2f = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpactivationfunction(ctypes.byref(_error_msg), ctypes.byref(__net), ctypes.byref(__k), ctypes.byref(__f), ctypes.byref(__df), ctypes.byref(__d2f))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpactivationfunction'")
__r__f = __f.value
__r__df = __df.value
__r__d2f = __d2f.value
return (__r__f, __r__df, __r__d2f)
finally:
pass
_lib_alglib.alglib_mlpprocess.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpprocess.restype = ctypes.c_int32
def mlpprocess(network, x, y):
pass
__network = network.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpprocess(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpprocess'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_mlpprocessi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpprocessi.restype = ctypes.c_int32
def mlpprocessi(network, x):
pass
__network = network.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__y = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpprocessi(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpprocessi'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_mlperror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlperror.restype = ctypes.c_int32
def mlperror(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlperror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlperror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_smp_mlperror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlperror.restype = ctypes.c_int32
def smp_mlperror(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlperror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlperror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mlperrorsparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlperrorsparse.restype = ctypes.c_int32
def mlperrorsparse(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__xy = xy.ptr
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlperrorsparse(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlperrorsparse'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_smp_mlperrorsparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlperrorsparse.restype = ctypes.c_int32
def smp_mlperrorsparse(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__xy = xy.ptr
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlperrorsparse(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlperrorsparse'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_mlperrorn.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlperrorn.restype = ctypes.c_int32
def mlperrorn(network, xy, ssize):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ssize = x_int()
__ssize.val = int(ssize)
if __ssize.val!=ssize:
raise ValueError("Error while converting 'ssize' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlperrorn(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__ssize))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlperrorn'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mlpclserror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpclserror.restype = ctypes.c_int32
def mlpclserror(network, xy, npoints):
pass
__result = x_int()
__result.val = 0
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpclserror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpclserror'")
__r__result = __result.val
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_smp_mlpclserror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpclserror.restype = ctypes.c_int32
def smp_mlpclserror(network, xy, npoints):
pass
__result = x_int()
__result.val = 0
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpclserror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpclserror'")
__r__result = __result.val
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mlprelclserror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlprelclserror.restype = ctypes.c_int32
def mlprelclserror(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlprelclserror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlprelclserror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_smp_mlprelclserror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlprelclserror.restype = ctypes.c_int32
def smp_mlprelclserror(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlprelclserror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlprelclserror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mlprelclserrorsparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlprelclserrorsparse.restype = ctypes.c_int32
def mlprelclserrorsparse(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__xy = xy.ptr
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlprelclserrorsparse(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlprelclserrorsparse'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_smp_mlprelclserrorsparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlprelclserrorsparse.restype = ctypes.c_int32
def smp_mlprelclserrorsparse(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__xy = xy.ptr
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlprelclserrorsparse(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlprelclserrorsparse'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_mlpavgce.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpavgce.restype = ctypes.c_int32
def mlpavgce(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpavgce(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpavgce'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_smp_mlpavgce.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpavgce.restype = ctypes.c_int32
def smp_mlpavgce(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpavgce(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpavgce'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mlpavgcesparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpavgcesparse.restype = ctypes.c_int32
def mlpavgcesparse(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__xy = xy.ptr
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpavgcesparse(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpavgcesparse'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_smp_mlpavgcesparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpavgcesparse.restype = ctypes.c_int32
def smp_mlpavgcesparse(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__xy = xy.ptr
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpavgcesparse(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpavgcesparse'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_mlprmserror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlprmserror.restype = ctypes.c_int32
def mlprmserror(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlprmserror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlprmserror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_smp_mlprmserror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlprmserror.restype = ctypes.c_int32
def smp_mlprmserror(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlprmserror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlprmserror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mlprmserrorsparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlprmserrorsparse.restype = ctypes.c_int32
def mlprmserrorsparse(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__xy = xy.ptr
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlprmserrorsparse(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlprmserrorsparse'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_smp_mlprmserrorsparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlprmserrorsparse.restype = ctypes.c_int32
def smp_mlprmserrorsparse(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__xy = xy.ptr
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlprmserrorsparse(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlprmserrorsparse'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_mlpavgerror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpavgerror.restype = ctypes.c_int32
def mlpavgerror(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpavgerror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpavgerror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_smp_mlpavgerror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpavgerror.restype = ctypes.c_int32
def smp_mlpavgerror(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpavgerror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpavgerror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mlpavgerrorsparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpavgerrorsparse.restype = ctypes.c_int32
def mlpavgerrorsparse(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__xy = xy.ptr
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpavgerrorsparse(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpavgerrorsparse'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_smp_mlpavgerrorsparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpavgerrorsparse.restype = ctypes.c_int32
def smp_mlpavgerrorsparse(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__xy = xy.ptr
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpavgerrorsparse(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpavgerrorsparse'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_mlpavgrelerror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpavgrelerror.restype = ctypes.c_int32
def mlpavgrelerror(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpavgrelerror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpavgrelerror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_smp_mlpavgrelerror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpavgrelerror.restype = ctypes.c_int32
def smp_mlpavgrelerror(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpavgrelerror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpavgrelerror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mlpavgrelerrorsparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpavgrelerrorsparse.restype = ctypes.c_int32
def mlpavgrelerrorsparse(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__xy = xy.ptr
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpavgrelerrorsparse(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpavgrelerrorsparse'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_smp_mlpavgrelerrorsparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpavgrelerrorsparse.restype = ctypes.c_int32
def smp_mlpavgrelerrorsparse(network, xy, npoints):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__xy = xy.ptr
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpavgrelerrorsparse(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpavgrelerrorsparse'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_mlpgrad.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgrad.restype = ctypes.c_int32
def mlpgrad(network, x, desiredy, grad):
pass
__network = network.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(desiredy):
raise ValueError("'desiredy' parameter can't be cast to real_vector")
__desiredy = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__e = ctypes.c_double(0)
if not is_real_vector(grad):
raise ValueError("'grad' parameter can't be cast to real_vector")
__grad = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__desiredy, desiredy, DT_REAL, X_CREATE)
x_from_list(__grad, grad, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgrad(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__x), ctypes.byref(__desiredy), ctypes.byref(__e), ctypes.byref(__grad))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgrad'")
__r__e = __e.value
__r__grad = list_from_x(__grad)
return (__r__e, __r__grad)
finally:
x_vector_clear(__x)
x_vector_clear(__desiredy)
x_vector_clear(__grad)
_lib_alglib.alglib_mlpgradn.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgradn.restype = ctypes.c_int32
def mlpgradn(network, x, desiredy, grad):
pass
__network = network.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(desiredy):
raise ValueError("'desiredy' parameter can't be cast to real_vector")
__desiredy = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__e = ctypes.c_double(0)
if not is_real_vector(grad):
raise ValueError("'grad' parameter can't be cast to real_vector")
__grad = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__desiredy, desiredy, DT_REAL, X_CREATE)
x_from_list(__grad, grad, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgradn(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__x), ctypes.byref(__desiredy), ctypes.byref(__e), ctypes.byref(__grad))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgradn'")
__r__e = __e.value
__r__grad = list_from_x(__grad)
return (__r__e, __r__grad)
finally:
x_vector_clear(__x)
x_vector_clear(__desiredy)
x_vector_clear(__grad)
_lib_alglib.alglib_mlpgradbatch.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgradbatch.restype = ctypes.c_int32
def mlpgradbatch(network, xy, ssize, grad):
pass
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ssize = x_int()
__ssize.val = int(ssize)
if __ssize.val!=ssize:
raise ValueError("Error while converting 'ssize' parameter to 'x_int'")
__e = ctypes.c_double(0)
if not is_real_vector(grad):
raise ValueError("'grad' parameter can't be cast to real_vector")
__grad = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__grad, grad, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgradbatch(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__ssize), ctypes.byref(__e), ctypes.byref(__grad))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgradbatch'")
__r__e = __e.value
__r__grad = list_from_x(__grad)
return (__r__e, __r__grad)
finally:
x_matrix_clear(__xy)
x_vector_clear(__grad)
_lib_alglib.alglib_smp_mlpgradbatch.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpgradbatch.restype = ctypes.c_int32
def smp_mlpgradbatch(network, xy, ssize, grad):
pass
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ssize = x_int()
__ssize.val = int(ssize)
if __ssize.val!=ssize:
raise ValueError("Error while converting 'ssize' parameter to 'x_int'")
__e = ctypes.c_double(0)
if not is_real_vector(grad):
raise ValueError("'grad' parameter can't be cast to real_vector")
__grad = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__grad, grad, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpgradbatch(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__ssize), ctypes.byref(__e), ctypes.byref(__grad))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpgradbatch'")
__r__e = __e.value
__r__grad = list_from_x(__grad)
return (__r__e, __r__grad)
finally:
x_matrix_clear(__xy)
x_vector_clear(__grad)
_lib_alglib.alglib_mlpgradbatchsparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgradbatchsparse.restype = ctypes.c_int32
def mlpgradbatchsparse(network, xy, ssize, grad):
pass
__network = network.ptr
__xy = xy.ptr
__ssize = x_int()
__ssize.val = int(ssize)
if __ssize.val!=ssize:
raise ValueError("Error while converting 'ssize' parameter to 'x_int'")
__e = ctypes.c_double(0)
if not is_real_vector(grad):
raise ValueError("'grad' parameter can't be cast to real_vector")
__grad = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__grad, grad, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgradbatchsparse(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__ssize), ctypes.byref(__e), ctypes.byref(__grad))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgradbatchsparse'")
__r__e = __e.value
__r__grad = list_from_x(__grad)
return (__r__e, __r__grad)
finally:
x_vector_clear(__grad)
_lib_alglib.alglib_smp_mlpgradbatchsparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpgradbatchsparse.restype = ctypes.c_int32
def smp_mlpgradbatchsparse(network, xy, ssize, grad):
pass
__network = network.ptr
__xy = xy.ptr
__ssize = x_int()
__ssize.val = int(ssize)
if __ssize.val!=ssize:
raise ValueError("Error while converting 'ssize' parameter to 'x_int'")
__e = ctypes.c_double(0)
if not is_real_vector(grad):
raise ValueError("'grad' parameter can't be cast to real_vector")
__grad = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__grad, grad, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpgradbatchsparse(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__ssize), ctypes.byref(__e), ctypes.byref(__grad))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpgradbatchsparse'")
__r__e = __e.value
__r__grad = list_from_x(__grad)
return (__r__e, __r__grad)
finally:
x_vector_clear(__grad)
_lib_alglib.alglib_mlpgradbatchsubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgradbatchsubset.restype = ctypes.c_int32
def mlpgradbatchsubset(network, xy, setsize, idx, subsetsize, grad):
pass
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__setsize = x_int()
__setsize.val = int(setsize)
if __setsize.val!=setsize:
raise ValueError("Error while converting 'setsize' parameter to 'x_int'")
if not is_int_vector(idx):
raise ValueError("'idx' parameter can't be cast to int_vector")
__idx = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__subsetsize = x_int()
__subsetsize.val = int(subsetsize)
if __subsetsize.val!=subsetsize:
raise ValueError("Error while converting 'subsetsize' parameter to 'x_int'")
__e = ctypes.c_double(0)
if not is_real_vector(grad):
raise ValueError("'grad' parameter can't be cast to real_vector")
__grad = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__idx, idx, DT_INT, X_CREATE)
x_from_list(__grad, grad, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgradbatchsubset(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__setsize), ctypes.byref(__idx), ctypes.byref(__subsetsize), ctypes.byref(__e), ctypes.byref(__grad))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgradbatchsubset'")
__r__e = __e.value
__r__grad = list_from_x(__grad)
return (__r__e, __r__grad)
finally:
x_matrix_clear(__xy)
x_vector_clear(__idx)
x_vector_clear(__grad)
_lib_alglib.alglib_smp_mlpgradbatchsubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpgradbatchsubset.restype = ctypes.c_int32
def smp_mlpgradbatchsubset(network, xy, setsize, idx, subsetsize, grad):
pass
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__setsize = x_int()
__setsize.val = int(setsize)
if __setsize.val!=setsize:
raise ValueError("Error while converting 'setsize' parameter to 'x_int'")
if not is_int_vector(idx):
raise ValueError("'idx' parameter can't be cast to int_vector")
__idx = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__subsetsize = x_int()
__subsetsize.val = int(subsetsize)
if __subsetsize.val!=subsetsize:
raise ValueError("Error while converting 'subsetsize' parameter to 'x_int'")
__e = ctypes.c_double(0)
if not is_real_vector(grad):
raise ValueError("'grad' parameter can't be cast to real_vector")
__grad = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__idx, idx, DT_INT, X_CREATE)
x_from_list(__grad, grad, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpgradbatchsubset(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__setsize), ctypes.byref(__idx), ctypes.byref(__subsetsize), ctypes.byref(__e), ctypes.byref(__grad))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpgradbatchsubset'")
__r__e = __e.value
__r__grad = list_from_x(__grad)
return (__r__e, __r__grad)
finally:
x_matrix_clear(__xy)
x_vector_clear(__idx)
x_vector_clear(__grad)
_lib_alglib.alglib_mlpgradbatchsparsesubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgradbatchsparsesubset.restype = ctypes.c_int32
def mlpgradbatchsparsesubset(network, xy, setsize, idx, subsetsize, grad):
pass
__network = network.ptr
__xy = xy.ptr
__setsize = x_int()
__setsize.val = int(setsize)
if __setsize.val!=setsize:
raise ValueError("Error while converting 'setsize' parameter to 'x_int'")
if not is_int_vector(idx):
raise ValueError("'idx' parameter can't be cast to int_vector")
__idx = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__subsetsize = x_int()
__subsetsize.val = int(subsetsize)
if __subsetsize.val!=subsetsize:
raise ValueError("Error while converting 'subsetsize' parameter to 'x_int'")
__e = ctypes.c_double(0)
if not is_real_vector(grad):
raise ValueError("'grad' parameter can't be cast to real_vector")
__grad = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__idx, idx, DT_INT, X_CREATE)
x_from_list(__grad, grad, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgradbatchsparsesubset(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__setsize), ctypes.byref(__idx), ctypes.byref(__subsetsize), ctypes.byref(__e), ctypes.byref(__grad))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgradbatchsparsesubset'")
__r__e = __e.value
__r__grad = list_from_x(__grad)
return (__r__e, __r__grad)
finally:
x_vector_clear(__idx)
x_vector_clear(__grad)
_lib_alglib.alglib_smp_mlpgradbatchsparsesubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpgradbatchsparsesubset.restype = ctypes.c_int32
def smp_mlpgradbatchsparsesubset(network, xy, setsize, idx, subsetsize, grad):
pass
__network = network.ptr
__xy = xy.ptr
__setsize = x_int()
__setsize.val = int(setsize)
if __setsize.val!=setsize:
raise ValueError("Error while converting 'setsize' parameter to 'x_int'")
if not is_int_vector(idx):
raise ValueError("'idx' parameter can't be cast to int_vector")
__idx = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__subsetsize = x_int()
__subsetsize.val = int(subsetsize)
if __subsetsize.val!=subsetsize:
raise ValueError("Error while converting 'subsetsize' parameter to 'x_int'")
__e = ctypes.c_double(0)
if not is_real_vector(grad):
raise ValueError("'grad' parameter can't be cast to real_vector")
__grad = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__idx, idx, DT_INT, X_CREATE)
x_from_list(__grad, grad, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpgradbatchsparsesubset(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__setsize), ctypes.byref(__idx), ctypes.byref(__subsetsize), ctypes.byref(__e), ctypes.byref(__grad))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpgradbatchsparsesubset'")
__r__e = __e.value
__r__grad = list_from_x(__grad)
return (__r__e, __r__grad)
finally:
x_vector_clear(__idx)
x_vector_clear(__grad)
_lib_alglib.alglib_mlpgradnbatch.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpgradnbatch.restype = ctypes.c_int32
def mlpgradnbatch(network, xy, ssize, grad):
pass
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ssize = x_int()
__ssize.val = int(ssize)
if __ssize.val!=ssize:
raise ValueError("Error while converting 'ssize' parameter to 'x_int'")
__e = ctypes.c_double(0)
if not is_real_vector(grad):
raise ValueError("'grad' parameter can't be cast to real_vector")
__grad = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__grad, grad, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpgradnbatch(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__ssize), ctypes.byref(__e), ctypes.byref(__grad))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpgradnbatch'")
__r__e = __e.value
__r__grad = list_from_x(__grad)
return (__r__e, __r__grad)
finally:
x_matrix_clear(__xy)
x_vector_clear(__grad)
_lib_alglib.alglib_mlphessiannbatch.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlphessiannbatch.restype = ctypes.c_int32
def mlphessiannbatch(network, xy, ssize, grad, h):
pass
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ssize = x_int()
__ssize.val = int(ssize)
if __ssize.val!=ssize:
raise ValueError("Error while converting 'ssize' parameter to 'x_int'")
__e = ctypes.c_double(0)
if not is_real_vector(grad):
raise ValueError("'grad' parameter can't be cast to real_vector")
__grad = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(h):
raise ValueError("'h' parameter can't be cast to real_matrix")
__h = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__grad, grad, DT_REAL, X_CREATE)
x_from_listlist(__h, h, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlphessiannbatch(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__ssize), ctypes.byref(__e), ctypes.byref(__grad), ctypes.byref(__h))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlphessiannbatch'")
__r__e = __e.value
__r__grad = list_from_x(__grad)
__r__h = listlist_from_x(__h)
return (__r__e, __r__grad, __r__h)
finally:
x_matrix_clear(__xy)
x_vector_clear(__grad)
x_matrix_clear(__h)
_lib_alglib.alglib_mlphessianbatch.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlphessianbatch.restype = ctypes.c_int32
def mlphessianbatch(network, xy, ssize, grad, h):
pass
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ssize = x_int()
__ssize.val = int(ssize)
if __ssize.val!=ssize:
raise ValueError("Error while converting 'ssize' parameter to 'x_int'")
__e = ctypes.c_double(0)
if not is_real_vector(grad):
raise ValueError("'grad' parameter can't be cast to real_vector")
__grad = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(h):
raise ValueError("'h' parameter can't be cast to real_matrix")
__h = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__grad, grad, DT_REAL, X_CREATE)
x_from_listlist(__h, h, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlphessianbatch(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__ssize), ctypes.byref(__e), ctypes.byref(__grad), ctypes.byref(__h))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlphessianbatch'")
__r__e = __e.value
__r__grad = list_from_x(__grad)
__r__h = listlist_from_x(__h)
return (__r__e, __r__grad, __r__h)
finally:
x_matrix_clear(__xy)
x_vector_clear(__grad)
x_matrix_clear(__h)
_lib_alglib.alglib_mlpallerrorssubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpallerrorssubset.restype = ctypes.c_int32
def mlpallerrorssubset(network, xy, setsize, subset, subsetsize):
pass
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__setsize = x_int()
__setsize.val = int(setsize)
if __setsize.val!=setsize:
raise ValueError("Error while converting 'setsize' parameter to 'x_int'")
if not is_int_vector(subset):
raise ValueError("'subset' parameter can't be cast to int_vector")
__subset = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__subsetsize = x_int()
__subsetsize.val = int(subsetsize)
if __subsetsize.val!=subsetsize:
raise ValueError("Error while converting 'subsetsize' parameter to 'x_int'")
__rep = x_modelerrors()
x_modelerrors_zero_fields(__rep)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__subset, subset, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpallerrorssubset(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__setsize), ctypes.byref(__subset), ctypes.byref(__subsetsize), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpallerrorssubset'")
__r__rep = modelerrors_from_x(__rep)
return __r__rep
finally:
x_matrix_clear(__xy)
x_vector_clear(__subset)
x_modelerrors_clear(__rep)
_lib_alglib.alglib_smp_mlpallerrorssubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpallerrorssubset.restype = ctypes.c_int32
def smp_mlpallerrorssubset(network, xy, setsize, subset, subsetsize):
pass
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__setsize = x_int()
__setsize.val = int(setsize)
if __setsize.val!=setsize:
raise ValueError("Error while converting 'setsize' parameter to 'x_int'")
if not is_int_vector(subset):
raise ValueError("'subset' parameter can't be cast to int_vector")
__subset = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__subsetsize = x_int()
__subsetsize.val = int(subsetsize)
if __subsetsize.val!=subsetsize:
raise ValueError("Error while converting 'subsetsize' parameter to 'x_int'")
__rep = x_modelerrors()
x_modelerrors_zero_fields(__rep)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__subset, subset, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpallerrorssubset(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__setsize), ctypes.byref(__subset), ctypes.byref(__subsetsize), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpallerrorssubset'")
__r__rep = modelerrors_from_x(__rep)
return __r__rep
finally:
x_matrix_clear(__xy)
x_vector_clear(__subset)
x_modelerrors_clear(__rep)
_lib_alglib.alglib_mlpallerrorssparsesubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpallerrorssparsesubset.restype = ctypes.c_int32
def mlpallerrorssparsesubset(network, xy, setsize, subset, subsetsize):
pass
__network = network.ptr
__xy = xy.ptr
__setsize = x_int()
__setsize.val = int(setsize)
if __setsize.val!=setsize:
raise ValueError("Error while converting 'setsize' parameter to 'x_int'")
if not is_int_vector(subset):
raise ValueError("'subset' parameter can't be cast to int_vector")
__subset = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__subsetsize = x_int()
__subsetsize.val = int(subsetsize)
if __subsetsize.val!=subsetsize:
raise ValueError("Error while converting 'subsetsize' parameter to 'x_int'")
__rep = x_modelerrors()
x_modelerrors_zero_fields(__rep)
try:
x_from_list(__subset, subset, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpallerrorssparsesubset(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__setsize), ctypes.byref(__subset), ctypes.byref(__subsetsize), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpallerrorssparsesubset'")
__r__rep = modelerrors_from_x(__rep)
return __r__rep
finally:
x_vector_clear(__subset)
x_modelerrors_clear(__rep)
_lib_alglib.alglib_smp_mlpallerrorssparsesubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpallerrorssparsesubset.restype = ctypes.c_int32
def smp_mlpallerrorssparsesubset(network, xy, setsize, subset, subsetsize):
pass
__network = network.ptr
__xy = xy.ptr
__setsize = x_int()
__setsize.val = int(setsize)
if __setsize.val!=setsize:
raise ValueError("Error while converting 'setsize' parameter to 'x_int'")
if not is_int_vector(subset):
raise ValueError("'subset' parameter can't be cast to int_vector")
__subset = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__subsetsize = x_int()
__subsetsize.val = int(subsetsize)
if __subsetsize.val!=subsetsize:
raise ValueError("Error while converting 'subsetsize' parameter to 'x_int'")
__rep = x_modelerrors()
x_modelerrors_zero_fields(__rep)
try:
x_from_list(__subset, subset, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpallerrorssparsesubset(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__setsize), ctypes.byref(__subset), ctypes.byref(__subsetsize), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpallerrorssparsesubset'")
__r__rep = modelerrors_from_x(__rep)
return __r__rep
finally:
x_vector_clear(__subset)
x_modelerrors_clear(__rep)
_lib_alglib.alglib_mlperrorsubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlperrorsubset.restype = ctypes.c_int32
def mlperrorsubset(network, xy, setsize, subset, subsetsize):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__setsize = x_int()
__setsize.val = int(setsize)
if __setsize.val!=setsize:
raise ValueError("Error while converting 'setsize' parameter to 'x_int'")
if not is_int_vector(subset):
raise ValueError("'subset' parameter can't be cast to int_vector")
__subset = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__subsetsize = x_int()
__subsetsize.val = int(subsetsize)
if __subsetsize.val!=subsetsize:
raise ValueError("Error while converting 'subsetsize' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__subset, subset, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlperrorsubset(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__setsize), ctypes.byref(__subset), ctypes.byref(__subsetsize))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlperrorsubset'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
x_vector_clear(__subset)
_lib_alglib.alglib_smp_mlperrorsubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlperrorsubset.restype = ctypes.c_int32
def smp_mlperrorsubset(network, xy, setsize, subset, subsetsize):
pass
__result = ctypes.c_double(0)
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__setsize = x_int()
__setsize.val = int(setsize)
if __setsize.val!=setsize:
raise ValueError("Error while converting 'setsize' parameter to 'x_int'")
if not is_int_vector(subset):
raise ValueError("'subset' parameter can't be cast to int_vector")
__subset = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__subsetsize = x_int()
__subsetsize.val = int(subsetsize)
if __subsetsize.val!=subsetsize:
raise ValueError("Error while converting 'subsetsize' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__subset, subset, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlperrorsubset(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__setsize), ctypes.byref(__subset), ctypes.byref(__subsetsize))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlperrorsubset'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
x_vector_clear(__subset)
_lib_alglib.alglib_mlperrorsparsesubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlperrorsparsesubset.restype = ctypes.c_int32
def mlperrorsparsesubset(network, xy, setsize, subset, subsetsize):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__xy = xy.ptr
__setsize = x_int()
__setsize.val = int(setsize)
if __setsize.val!=setsize:
raise ValueError("Error while converting 'setsize' parameter to 'x_int'")
if not is_int_vector(subset):
raise ValueError("'subset' parameter can't be cast to int_vector")
__subset = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__subsetsize = x_int()
__subsetsize.val = int(subsetsize)
if __subsetsize.val!=subsetsize:
raise ValueError("Error while converting 'subsetsize' parameter to 'x_int'")
try:
x_from_list(__subset, subset, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlperrorsparsesubset(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__setsize), ctypes.byref(__subset), ctypes.byref(__subsetsize))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlperrorsparsesubset'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__subset)
_lib_alglib.alglib_smp_mlperrorsparsesubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlperrorsparsesubset.restype = ctypes.c_int32
def smp_mlperrorsparsesubset(network, xy, setsize, subset, subsetsize):
pass
__result = ctypes.c_double(0)
__network = network.ptr
__xy = xy.ptr
__setsize = x_int()
__setsize.val = int(setsize)
if __setsize.val!=setsize:
raise ValueError("Error while converting 'setsize' parameter to 'x_int'")
if not is_int_vector(subset):
raise ValueError("'subset' parameter can't be cast to int_vector")
__subset = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__subsetsize = x_int()
__subsetsize.val = int(subsetsize)
if __subsetsize.val!=subsetsize:
raise ValueError("Error while converting 'subsetsize' parameter to 'x_int'")
try:
x_from_list(__subset, subset, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlperrorsparsesubset(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__setsize), ctypes.byref(__subset), ctypes.byref(__subsetsize))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlperrorsparsesubset'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__subset)
_lib_alglib.alglib_fisherlda.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_fisherlda.restype = ctypes.c_int32
def fisherlda(xy, npoints, nvars, nclasses):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__nclasses = x_int()
__nclasses.val = int(nclasses)
if __nclasses.val!=nclasses:
raise ValueError("Error while converting 'nclasses' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_fisherlda(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__nclasses), ctypes.byref(__info), ctypes.byref(__w))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'fisherlda'")
__r__info = __info.val
__r__w = list_from_x(__w)
return (__r__info, __r__w)
finally:
x_matrix_clear(__xy)
x_vector_clear(__w)
_lib_alglib.alglib_fisherldan.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_fisherldan.restype = ctypes.c_int32
def fisherldan(xy, npoints, nvars, nclasses):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__nclasses = x_int()
__nclasses.val = int(nclasses)
if __nclasses.val!=nclasses:
raise ValueError("Error while converting 'nclasses' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__w = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_fisherldan(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__nclasses), ctypes.byref(__info), ctypes.byref(__w))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'fisherldan'")
__r__info = __info.val
__r__w = listlist_from_x(__w)
return (__r__info, __r__w)
finally:
x_matrix_clear(__xy)
x_matrix_clear(__w)
_lib_alglib.alglib_smp_fisherldan.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_fisherldan.restype = ctypes.c_int32
def smp_fisherldan(xy, npoints, nvars, nclasses):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__nclasses = x_int()
__nclasses.val = int(nclasses)
if __nclasses.val!=nclasses:
raise ValueError("Error while converting 'nclasses' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__w = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_fisherldan(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__nclasses), ctypes.byref(__info), ctypes.byref(__w))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_fisherldan'")
__r__info = __info.val
__r__w = listlist_from_x(__w)
return (__r__info, __r__w)
finally:
x_matrix_clear(__xy)
x_matrix_clear(__w)
_lib_alglib.x_obj_free_ssamodel.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_ssamodel.restype = None
class ssamodel(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_ssamodel(self.ptr)
_lib_alglib.alglib_ssacreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssacreate.restype = ctypes.c_int32
def ssacreate():
pass
__s = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssacreate(ctypes.byref(_error_msg), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssacreate'")
__r__s = ssamodel(__s)
return __r__s
finally:
pass
_lib_alglib.alglib_ssasetwindow.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssasetwindow.restype = ctypes.c_int32
def ssasetwindow(s, windowwidth):
pass
__s = s.ptr
__windowwidth = x_int()
__windowwidth.val = int(windowwidth)
if __windowwidth.val!=windowwidth:
raise ValueError("Error while converting 'windowwidth' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssasetwindow(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__windowwidth))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssasetwindow'")
return
finally:
pass
_lib_alglib.alglib_ssasetseed.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssasetseed.restype = ctypes.c_int32
def ssasetseed(s, seed):
pass
__s = s.ptr
__seed = x_int()
__seed.val = int(seed)
if __seed.val!=seed:
raise ValueError("Error while converting 'seed' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssasetseed(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__seed))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssasetseed'")
return
finally:
pass
_lib_alglib.alglib_ssasetpoweruplength.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssasetpoweruplength.restype = ctypes.c_int32
def ssasetpoweruplength(s, pwlen):
pass
__s = s.ptr
__pwlen = x_int()
__pwlen.val = int(pwlen)
if __pwlen.val!=pwlen:
raise ValueError("Error while converting 'pwlen' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssasetpoweruplength(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__pwlen))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssasetpoweruplength'")
return
finally:
pass
_lib_alglib.alglib_ssasetmemorylimit.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssasetmemorylimit.restype = ctypes.c_int32
def ssasetmemorylimit(s, memlimit):
pass
__s = s.ptr
__memlimit = x_int()
__memlimit.val = int(memlimit)
if __memlimit.val!=memlimit:
raise ValueError("Error while converting 'memlimit' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssasetmemorylimit(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__memlimit))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssasetmemorylimit'")
return
finally:
pass
_lib_alglib.alglib_ssaaddsequence.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssaaddsequence.restype = ctypes.c_int32
def ssaaddsequence(*functionargs):
if len(functionargs)==3:
__friendly_form = False
s,x,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
s,x = functionargs
n = safe_len("'ssaaddsequence': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'ssaaddsequence': function must have 2 or 3 parameters")
__s = s.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssaaddsequence(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssaaddsequence'")
return
finally:
x_vector_clear(__x)
_lib_alglib.alglib_ssaappendpointandupdate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssaappendpointandupdate.restype = ctypes.c_int32
def ssaappendpointandupdate(s, x, updateits):
pass
__s = s.ptr
__x = ctypes.c_double(x)
__updateits = ctypes.c_double(updateits)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssaappendpointandupdate(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x), ctypes.byref(__updateits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssaappendpointandupdate'")
return
finally:
pass
_lib_alglib.alglib_ssaappendsequenceandupdate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssaappendsequenceandupdate.restype = ctypes.c_int32
def ssaappendsequenceandupdate(*functionargs):
if len(functionargs)==4:
__friendly_form = False
s,x,nticks,updateits = functionargs
elif len(functionargs)==3:
__friendly_form = True
s,x,updateits = functionargs
nticks = safe_len("'ssaappendsequenceandupdate': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'ssaappendsequenceandupdate': function must have 3 or 4 parameters")
__s = s.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nticks = x_int()
__nticks.val = int(nticks)
if __nticks.val!=nticks:
raise ValueError("Error while converting 'nticks' parameter to 'x_int'")
__updateits = ctypes.c_double(updateits)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssaappendsequenceandupdate(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x), ctypes.byref(__nticks), ctypes.byref(__updateits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssaappendsequenceandupdate'")
return
finally:
x_vector_clear(__x)
_lib_alglib.alglib_ssasetalgoprecomputed.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssasetalgoprecomputed.restype = ctypes.c_int32
def ssasetalgoprecomputed(*functionargs):
if len(functionargs)==4:
__friendly_form = False
s,a,windowwidth,nbasis = functionargs
elif len(functionargs)==2:
__friendly_form = True
s,a = functionargs
windowwidth = safe_rows("'ssasetalgoprecomputed': incorrect parameters",a)
nbasis = safe_cols("'ssasetalgoprecomputed': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'ssasetalgoprecomputed': function must have 2 or 4 parameters")
__s = s.ptr
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__windowwidth = x_int()
__windowwidth.val = int(windowwidth)
if __windowwidth.val!=windowwidth:
raise ValueError("Error while converting 'windowwidth' parameter to 'x_int'")
__nbasis = x_int()
__nbasis.val = int(nbasis)
if __nbasis.val!=nbasis:
raise ValueError("Error while converting 'nbasis' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssasetalgoprecomputed(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__a), ctypes.byref(__windowwidth), ctypes.byref(__nbasis))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssasetalgoprecomputed'")
return
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_ssasetalgotopkdirect.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssasetalgotopkdirect.restype = ctypes.c_int32
def ssasetalgotopkdirect(s, topk):
pass
__s = s.ptr
__topk = x_int()
__topk.val = int(topk)
if __topk.val!=topk:
raise ValueError("Error while converting 'topk' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssasetalgotopkdirect(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__topk))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssasetalgotopkdirect'")
return
finally:
pass
_lib_alglib.alglib_ssasetalgotopkrealtime.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssasetalgotopkrealtime.restype = ctypes.c_int32
def ssasetalgotopkrealtime(s, topk):
pass
__s = s.ptr
__topk = x_int()
__topk.val = int(topk)
if __topk.val!=topk:
raise ValueError("Error while converting 'topk' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssasetalgotopkrealtime(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__topk))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssasetalgotopkrealtime'")
return
finally:
pass
_lib_alglib.alglib_ssacleardata.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssacleardata.restype = ctypes.c_int32
def ssacleardata(s):
pass
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssacleardata(ctypes.byref(_error_msg), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssacleardata'")
return
finally:
pass
_lib_alglib.alglib_ssagetbasis.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssagetbasis.restype = ctypes.c_int32
def ssagetbasis(s):
pass
__s = s.ptr
__a = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__sv = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__windowwidth = x_int()
__windowwidth.val = 0
__nbasis = x_int()
__nbasis.val = 0
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssagetbasis(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__a), ctypes.byref(__sv), ctypes.byref(__windowwidth), ctypes.byref(__nbasis))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssagetbasis'")
__r__a = listlist_from_x(__a)
__r__sv = list_from_x(__sv)
__r__windowwidth = __windowwidth.val
__r__nbasis = __nbasis.val
return (__r__a, __r__sv, __r__windowwidth, __r__nbasis)
finally:
x_matrix_clear(__a)
x_vector_clear(__sv)
_lib_alglib.alglib_ssagetlrr.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssagetlrr.restype = ctypes.c_int32
def ssagetlrr(s):
pass
__s = s.ptr
__a = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__windowwidth = x_int()
__windowwidth.val = 0
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssagetlrr(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__a), ctypes.byref(__windowwidth))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssagetlrr'")
__r__a = list_from_x(__a)
__r__windowwidth = __windowwidth.val
return (__r__a, __r__windowwidth)
finally:
x_vector_clear(__a)
_lib_alglib.alglib_ssaanalyzelastwindow.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssaanalyzelastwindow.restype = ctypes.c_int32
def ssaanalyzelastwindow(s):
pass
__s = s.ptr
__trend = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__noise = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nticks = x_int()
__nticks.val = 0
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssaanalyzelastwindow(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__trend), ctypes.byref(__noise), ctypes.byref(__nticks))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssaanalyzelastwindow'")
__r__trend = list_from_x(__trend)
__r__noise = list_from_x(__noise)
__r__nticks = __nticks.val
return (__r__trend, __r__noise, __r__nticks)
finally:
x_vector_clear(__trend)
x_vector_clear(__noise)
_lib_alglib.alglib_ssaanalyzelast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssaanalyzelast.restype = ctypes.c_int32
def ssaanalyzelast(s, nticks):
pass
__s = s.ptr
__nticks = x_int()
__nticks.val = int(nticks)
if __nticks.val!=nticks:
raise ValueError("Error while converting 'nticks' parameter to 'x_int'")
__trend = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__noise = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssaanalyzelast(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__nticks), ctypes.byref(__trend), ctypes.byref(__noise))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssaanalyzelast'")
__r__trend = list_from_x(__trend)
__r__noise = list_from_x(__noise)
return (__r__trend, __r__noise)
finally:
x_vector_clear(__trend)
x_vector_clear(__noise)
_lib_alglib.alglib_ssaanalyzesequence.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssaanalyzesequence.restype = ctypes.c_int32
def ssaanalyzesequence(*functionargs):
if len(functionargs)==3:
__friendly_form = False
s,data,nticks = functionargs
elif len(functionargs)==2:
__friendly_form = True
s,data = functionargs
nticks = safe_len("'ssaanalyzesequence': incorrect parameters",data)
else:
raise RuntimeError("Error while calling 'ssaanalyzesequence': function must have 2 or 3 parameters")
__s = s.ptr
if not is_real_vector(data):
raise ValueError("'data' parameter can't be cast to real_vector")
__data = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nticks = x_int()
__nticks.val = int(nticks)
if __nticks.val!=nticks:
raise ValueError("Error while converting 'nticks' parameter to 'x_int'")
__trend = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__noise = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__data, data, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssaanalyzesequence(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__data), ctypes.byref(__nticks), ctypes.byref(__trend), ctypes.byref(__noise))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssaanalyzesequence'")
__r__trend = list_from_x(__trend)
__r__noise = list_from_x(__noise)
return (__r__trend, __r__noise)
finally:
x_vector_clear(__data)
x_vector_clear(__trend)
x_vector_clear(__noise)
_lib_alglib.alglib_ssaforecastlast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssaforecastlast.restype = ctypes.c_int32
def ssaforecastlast(s, nticks):
pass
__s = s.ptr
__nticks = x_int()
__nticks.val = int(nticks)
if __nticks.val!=nticks:
raise ValueError("Error while converting 'nticks' parameter to 'x_int'")
__trend = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssaforecastlast(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__nticks), ctypes.byref(__trend))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssaforecastlast'")
__r__trend = list_from_x(__trend)
return __r__trend
finally:
x_vector_clear(__trend)
_lib_alglib.alglib_ssaforecastsequence.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssaforecastsequence.restype = ctypes.c_int32
def ssaforecastsequence(*functionargs):
if len(functionargs)==5:
__friendly_form = False
s,data,datalen,forecastlen,applysmoothing = functionargs
elif len(functionargs)==3:
__friendly_form = True
s,data,forecastlen = functionargs
datalen = safe_len("'ssaforecastsequence': incorrect parameters",data)
applysmoothing = True
else:
raise RuntimeError("Error while calling 'ssaforecastsequence': function must have 3 or 5 parameters")
__s = s.ptr
if not is_real_vector(data):
raise ValueError("'data' parameter can't be cast to real_vector")
__data = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__datalen = x_int()
__datalen.val = int(datalen)
if __datalen.val!=datalen:
raise ValueError("Error while converting 'datalen' parameter to 'x_int'")
__forecastlen = x_int()
__forecastlen.val = int(forecastlen)
if __forecastlen.val!=forecastlen:
raise ValueError("Error while converting 'forecastlen' parameter to 'x_int'")
__applysmoothing = ctypes.c_uint8(applysmoothing)
if __applysmoothing.value!=0:
__applysmoothing = ctypes.c_uint8(1)
__trend = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__data, data, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssaforecastsequence(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__data), ctypes.byref(__datalen), ctypes.byref(__forecastlen), ctypes.byref(__applysmoothing), ctypes.byref(__trend))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssaforecastsequence'")
__r__trend = list_from_x(__trend)
return __r__trend
finally:
x_vector_clear(__data)
x_vector_clear(__trend)
_lib_alglib.alglib_ssaforecastavglast.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssaforecastavglast.restype = ctypes.c_int32
def ssaforecastavglast(s, m, nticks):
pass
__s = s.ptr
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__nticks = x_int()
__nticks.val = int(nticks)
if __nticks.val!=nticks:
raise ValueError("Error while converting 'nticks' parameter to 'x_int'")
__trend = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssaforecastavglast(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__m), ctypes.byref(__nticks), ctypes.byref(__trend))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssaforecastavglast'")
__r__trend = list_from_x(__trend)
return __r__trend
finally:
x_vector_clear(__trend)
_lib_alglib.alglib_ssaforecastavgsequence.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ssaforecastavgsequence.restype = ctypes.c_int32
def ssaforecastavgsequence(*functionargs):
if len(functionargs)==6:
__friendly_form = False
s,data,datalen,m,forecastlen,applysmoothing = functionargs
elif len(functionargs)==4:
__friendly_form = True
s,data,m,forecastlen = functionargs
datalen = safe_len("'ssaforecastavgsequence': incorrect parameters",data)
applysmoothing = True
else:
raise RuntimeError("Error while calling 'ssaforecastavgsequence': function must have 4 or 6 parameters")
__s = s.ptr
if not is_real_vector(data):
raise ValueError("'data' parameter can't be cast to real_vector")
__data = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__datalen = x_int()
__datalen.val = int(datalen)
if __datalen.val!=datalen:
raise ValueError("Error while converting 'datalen' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__forecastlen = x_int()
__forecastlen.val = int(forecastlen)
if __forecastlen.val!=forecastlen:
raise ValueError("Error while converting 'forecastlen' parameter to 'x_int'")
__applysmoothing = ctypes.c_uint8(applysmoothing)
if __applysmoothing.value!=0:
__applysmoothing = ctypes.c_uint8(1)
__trend = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__data, data, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ssaforecastavgsequence(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__data), ctypes.byref(__datalen), ctypes.byref(__m), ctypes.byref(__forecastlen), ctypes.byref(__applysmoothing), ctypes.byref(__trend))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ssaforecastavgsequence'")
__r__trend = list_from_x(__trend)
return __r__trend
finally:
x_vector_clear(__data)
x_vector_clear(__trend)
_lib_alglib.alglib_gammafunction.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_gammafunction.restype = ctypes.c_int32
def gammafunction(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_gammafunction(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'gammafunction'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_lngamma.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lngamma.restype = ctypes.c_int32
def lngamma(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
__sgngam = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lngamma(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x), ctypes.byref(__sgngam))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lngamma'")
__r__result = __result.value
__r__sgngam = __sgngam.value
return (__r__result, __r__sgngam)
finally:
pass
_lib_alglib.alglib_errorfunction.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_errorfunction.restype = ctypes.c_int32
def errorfunction(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_errorfunction(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'errorfunction'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_errorfunctionc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_errorfunctionc.restype = ctypes.c_int32
def errorfunctionc(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_errorfunctionc(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'errorfunctionc'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_normaldistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_normaldistribution.restype = ctypes.c_int32
def normaldistribution(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_normaldistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'normaldistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_inverf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_inverf.restype = ctypes.c_int32
def inverf(e):
pass
__result = ctypes.c_double(0)
__e = ctypes.c_double(e)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_inverf(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__e))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'inverf'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_invnormaldistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_invnormaldistribution.restype = ctypes.c_int32
def invnormaldistribution(y0):
pass
__result = ctypes.c_double(0)
__y0 = ctypes.c_double(y0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_invnormaldistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__y0))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'invnormaldistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_incompletegamma.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_incompletegamma.restype = ctypes.c_int32
def incompletegamma(a, x):
pass
__result = ctypes.c_double(0)
__a = ctypes.c_double(a)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_incompletegamma(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'incompletegamma'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_incompletegammac.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_incompletegammac.restype = ctypes.c_int32
def incompletegammac(a, x):
pass
__result = ctypes.c_double(0)
__a = ctypes.c_double(a)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_incompletegammac(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'incompletegammac'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_invincompletegammac.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_invincompletegammac.restype = ctypes.c_int32
def invincompletegammac(a, y0):
pass
__result = ctypes.c_double(0)
__a = ctypes.c_double(a)
__y0 = ctypes.c_double(y0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_invincompletegammac(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__y0))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'invincompletegammac'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.x_obj_free_linearmodel.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_linearmodel.restype = None
class linearmodel(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_linearmodel(self.ptr)
class x_lrreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("c", x_matrix),
("rmserror", ctypes.c_double),
("avgerror", ctypes.c_double),
("avgrelerror", ctypes.c_double),
("cvrmserror", ctypes.c_double),
("cvavgerror", ctypes.c_double),
("cvavgrelerror", ctypes.c_double),
("ncvdefects", x_int),
("cvdefects", x_vector)
]
class lrreport(object):
def __init__(self):
self.c = [[]]
self.rmserror = 0
self.avgerror = 0
self.avgrelerror = 0
self.cvrmserror = 0
self.cvavgerror = 0
self.cvavgrelerror = 0
self.ncvdefects = 0
self.cvdefects = []
def x_lrreport_zero_fields(x):
x.c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
x.rmserror = 0
x.avgerror = 0
x.avgrelerror = 0
x.cvrmserror = 0
x.cvavgerror = 0
x.cvavgrelerror = 0
x.ncvdefects.val = 0
x.cvdefects = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
return
def x_lrreport_clear(x):
x_matrix_clear(x.c)
x_vector_clear(x.cvdefects)
x_lrreport_zero_fields(x)
return
def x_from_lrreport(x,v):
x_from_listlist(x.c, v.c, DT_REAL, X_CREATE)
x.rmserror = float(v.rmserror)
x.avgerror = float(v.avgerror)
x.avgrelerror = float(v.avgrelerror)
x.cvrmserror = float(v.cvrmserror)
x.cvavgerror = float(v.cvavgerror)
x.cvavgrelerror = float(v.cvavgrelerror)
x.ncvdefects.val = int(v.ncvdefects)
x_from_list(x.cvdefects, v.cvdefects, DT_INT, X_CREATE)
return
def lrreport_from_x(x):
r = lrreport()
r.c = listlist_from_x(x.c)
r.rmserror = x.rmserror
r.avgerror = x.avgerror
r.avgrelerror = x.avgrelerror
r.cvrmserror = x.cvrmserror
r.cvavgerror = x.cvavgerror
r.cvavgrelerror = x.cvavgrelerror
r.ncvdefects = x.ncvdefects.val
r.cvdefects = list_from_x(x.cvdefects)
return r
_lib_alglib.alglib_lrbuild.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lrbuild.restype = ctypes.c_int32
def lrbuild(xy, npoints, nvars):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__lm = ctypes.c_void_p(0)
__ar = x_lrreport()
x_lrreport_zero_fields(__ar)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lrbuild(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__info), ctypes.byref(__lm), ctypes.byref(__ar))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lrbuild'")
__r__info = __info.val
__r__lm = linearmodel(__lm)
__r__ar = lrreport_from_x(__ar)
return (__r__info, __r__lm, __r__ar)
finally:
x_matrix_clear(__xy)
x_lrreport_clear(__ar)
_lib_alglib.alglib_lrbuilds.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lrbuilds.restype = ctypes.c_int32
def lrbuilds(xy, s, npoints, nvars):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(s):
raise ValueError("'s' parameter can't be cast to real_vector")
__s = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__lm = ctypes.c_void_p(0)
__ar = x_lrreport()
x_lrreport_zero_fields(__ar)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__s, s, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lrbuilds(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__s), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__info), ctypes.byref(__lm), ctypes.byref(__ar))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lrbuilds'")
__r__info = __info.val
__r__lm = linearmodel(__lm)
__r__ar = lrreport_from_x(__ar)
return (__r__info, __r__lm, __r__ar)
finally:
x_matrix_clear(__xy)
x_vector_clear(__s)
x_lrreport_clear(__ar)
_lib_alglib.alglib_lrbuildzs.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lrbuildzs.restype = ctypes.c_int32
def lrbuildzs(xy, s, npoints, nvars):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(s):
raise ValueError("'s' parameter can't be cast to real_vector")
__s = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__lm = ctypes.c_void_p(0)
__ar = x_lrreport()
x_lrreport_zero_fields(__ar)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__s, s, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lrbuildzs(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__s), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__info), ctypes.byref(__lm), ctypes.byref(__ar))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lrbuildzs'")
__r__info = __info.val
__r__lm = linearmodel(__lm)
__r__ar = lrreport_from_x(__ar)
return (__r__info, __r__lm, __r__ar)
finally:
x_matrix_clear(__xy)
x_vector_clear(__s)
x_lrreport_clear(__ar)
_lib_alglib.alglib_lrbuildz.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lrbuildz.restype = ctypes.c_int32
def lrbuildz(xy, npoints, nvars):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__lm = ctypes.c_void_p(0)
__ar = x_lrreport()
x_lrreport_zero_fields(__ar)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lrbuildz(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__info), ctypes.byref(__lm), ctypes.byref(__ar))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lrbuildz'")
__r__info = __info.val
__r__lm = linearmodel(__lm)
__r__ar = lrreport_from_x(__ar)
return (__r__info, __r__lm, __r__ar)
finally:
x_matrix_clear(__xy)
x_lrreport_clear(__ar)
_lib_alglib.alglib_lrunpack.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lrunpack.restype = ctypes.c_int32
def lrunpack(lm):
pass
__lm = lm.ptr
__v = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nvars = x_int()
__nvars.val = 0
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lrunpack(ctypes.byref(_error_msg), ctypes.byref(__lm), ctypes.byref(__v), ctypes.byref(__nvars))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lrunpack'")
__r__v = list_from_x(__v)
__r__nvars = __nvars.val
return (__r__v, __r__nvars)
finally:
x_vector_clear(__v)
_lib_alglib.alglib_lrpack.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lrpack.restype = ctypes.c_int32
def lrpack(v, nvars):
pass
if not is_real_vector(v):
raise ValueError("'v' parameter can't be cast to real_vector")
__v = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__lm = ctypes.c_void_p(0)
try:
x_from_list(__v, v, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lrpack(ctypes.byref(_error_msg), ctypes.byref(__v), ctypes.byref(__nvars), ctypes.byref(__lm))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lrpack'")
__r__lm = linearmodel(__lm)
return __r__lm
finally:
x_vector_clear(__v)
_lib_alglib.alglib_lrprocess.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lrprocess.restype = ctypes.c_int32
def lrprocess(lm, x):
pass
__result = ctypes.c_double(0)
__lm = lm.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lrprocess(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__lm), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lrprocess'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__x)
_lib_alglib.alglib_lrrmserror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lrrmserror.restype = ctypes.c_int32
def lrrmserror(lm, xy, npoints):
pass
__result = ctypes.c_double(0)
__lm = lm.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lrrmserror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__lm), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lrrmserror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_lravgerror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lravgerror.restype = ctypes.c_int32
def lravgerror(lm, xy, npoints):
pass
__result = ctypes.c_double(0)
__lm = lm.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lravgerror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__lm), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lravgerror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_lravgrelerror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lravgrelerror.restype = ctypes.c_int32
def lravgrelerror(lm, xy, npoints):
pass
__result = ctypes.c_double(0)
__lm = lm.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lravgrelerror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__lm), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lravgrelerror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_filtersma.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_filtersma.restype = ctypes.c_int32
def filtersma(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,n,k = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,k = functionargs
n = safe_len("'filtersma': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'filtersma': function must have 2 or 3 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_filtersma(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__k))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'filtersma'")
__r__x = list_from_x(__x)
return __r__x
finally:
x_vector_clear(__x)
_lib_alglib.alglib_filterema.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_filterema.restype = ctypes.c_int32
def filterema(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,n,alpha = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,alpha = functionargs
n = safe_len("'filterema': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'filterema': function must have 2 or 3 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_filterema(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__alpha))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'filterema'")
__r__x = list_from_x(__x)
return __r__x
finally:
x_vector_clear(__x)
_lib_alglib.alglib_filterlrma.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_filterlrma.restype = ctypes.c_int32
def filterlrma(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,n,k = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,k = functionargs
n = safe_len("'filterlrma': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'filterlrma': function must have 2 or 3 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_filterlrma(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__k))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'filterlrma'")
__r__x = list_from_x(__x)
return __r__x
finally:
x_vector_clear(__x)
_lib_alglib.x_obj_free_logitmodel.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_logitmodel.restype = None
class logitmodel(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_logitmodel(self.ptr)
class x_mnlreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("ngrad", x_int),
("nhess", x_int)
]
class mnlreport(object):
def __init__(self):
self.ngrad = 0
self.nhess = 0
def x_mnlreport_zero_fields(x):
x.ngrad.val = 0
x.nhess.val = 0
return
def x_mnlreport_clear(x):
x_mnlreport_zero_fields(x)
return
def x_from_mnlreport(x,v):
x.ngrad.val = int(v.ngrad)
x.nhess.val = int(v.nhess)
return
def mnlreport_from_x(x):
r = mnlreport()
r.ngrad = x.ngrad.val
r.nhess = x.nhess.val
return r
_lib_alglib.alglib_mnltrainh.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mnltrainh.restype = ctypes.c_int32
def mnltrainh(xy, npoints, nvars, nclasses):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__nclasses = x_int()
__nclasses.val = int(nclasses)
if __nclasses.val!=nclasses:
raise ValueError("Error while converting 'nclasses' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__lm = ctypes.c_void_p(0)
__rep = x_mnlreport()
x_mnlreport_zero_fields(__rep)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mnltrainh(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__nclasses), ctypes.byref(__info), ctypes.byref(__lm), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mnltrainh'")
__r__info = __info.val
__r__lm = logitmodel(__lm)
__r__rep = mnlreport_from_x(__rep)
return (__r__info, __r__lm, __r__rep)
finally:
x_matrix_clear(__xy)
x_mnlreport_clear(__rep)
_lib_alglib.alglib_mnlprocess.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mnlprocess.restype = ctypes.c_int32
def mnlprocess(lm, x, y):
pass
__lm = lm.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mnlprocess(ctypes.byref(_error_msg), ctypes.byref(__lm), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mnlprocess'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_mnlprocessi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mnlprocessi.restype = ctypes.c_int32
def mnlprocessi(lm, x):
pass
__lm = lm.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__y = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mnlprocessi(ctypes.byref(_error_msg), ctypes.byref(__lm), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mnlprocessi'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_mnlunpack.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mnlunpack.restype = ctypes.c_int32
def mnlunpack(lm):
pass
__lm = lm.ptr
__a = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nvars = x_int()
__nvars.val = 0
__nclasses = x_int()
__nclasses.val = 0
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mnlunpack(ctypes.byref(_error_msg), ctypes.byref(__lm), ctypes.byref(__a), ctypes.byref(__nvars), ctypes.byref(__nclasses))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mnlunpack'")
__r__a = listlist_from_x(__a)
__r__nvars = __nvars.val
__r__nclasses = __nclasses.val
return (__r__a, __r__nvars, __r__nclasses)
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_mnlpack.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mnlpack.restype = ctypes.c_int32
def mnlpack(a, nvars, nclasses):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__nclasses = x_int()
__nclasses.val = int(nclasses)
if __nclasses.val!=nclasses:
raise ValueError("Error while converting 'nclasses' parameter to 'x_int'")
__lm = ctypes.c_void_p(0)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mnlpack(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__nvars), ctypes.byref(__nclasses), ctypes.byref(__lm))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mnlpack'")
__r__lm = logitmodel(__lm)
return __r__lm
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_mnlavgce.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mnlavgce.restype = ctypes.c_int32
def mnlavgce(lm, xy, npoints):
pass
__result = ctypes.c_double(0)
__lm = lm.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mnlavgce(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__lm), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mnlavgce'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mnlrelclserror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mnlrelclserror.restype = ctypes.c_int32
def mnlrelclserror(lm, xy, npoints):
pass
__result = ctypes.c_double(0)
__lm = lm.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mnlrelclserror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__lm), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mnlrelclserror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mnlrmserror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mnlrmserror.restype = ctypes.c_int32
def mnlrmserror(lm, xy, npoints):
pass
__result = ctypes.c_double(0)
__lm = lm.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mnlrmserror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__lm), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mnlrmserror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mnlavgerror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mnlavgerror.restype = ctypes.c_int32
def mnlavgerror(lm, xy, npoints):
pass
__result = ctypes.c_double(0)
__lm = lm.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mnlavgerror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__lm), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mnlavgerror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mnlavgrelerror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mnlavgrelerror.restype = ctypes.c_int32
def mnlavgrelerror(lm, xy, ssize):
pass
__result = ctypes.c_double(0)
__lm = lm.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__ssize = x_int()
__ssize.val = int(ssize)
if __ssize.val!=ssize:
raise ValueError("Error while converting 'ssize' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mnlavgrelerror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__lm), ctypes.byref(__xy), ctypes.byref(__ssize))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mnlavgrelerror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mnlclserror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mnlclserror.restype = ctypes.c_int32
def mnlclserror(lm, xy, npoints):
pass
__result = x_int()
__result.val = 0
__lm = lm.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mnlclserror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__lm), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mnlclserror'")
__r__result = __result.val
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.x_obj_free_mcpdstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_mcpdstate.restype = None
class mcpdstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_mcpdstate(self.ptr)
class x_mcpdreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("inneriterationscount", x_int),
("outeriterationscount", x_int),
("nfev", x_int),
("terminationtype", x_int)
]
class mcpdreport(object):
def __init__(self):
self.inneriterationscount = 0
self.outeriterationscount = 0
self.nfev = 0
self.terminationtype = 0
def x_mcpdreport_zero_fields(x):
x.inneriterationscount.val = 0
x.outeriterationscount.val = 0
x.nfev.val = 0
x.terminationtype.val = 0
return
def x_mcpdreport_clear(x):
x_mcpdreport_zero_fields(x)
return
def x_from_mcpdreport(x,v):
x.inneriterationscount.val = int(v.inneriterationscount)
x.outeriterationscount.val = int(v.outeriterationscount)
x.nfev.val = int(v.nfev)
x.terminationtype.val = int(v.terminationtype)
return
def mcpdreport_from_x(x):
r = mcpdreport()
r.inneriterationscount = x.inneriterationscount.val
r.outeriterationscount = x.outeriterationscount.val
r.nfev = x.nfev.val
r.terminationtype = x.terminationtype.val
return r
_lib_alglib.alglib_mcpdcreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdcreate.restype = ctypes.c_int32
def mcpdcreate(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__s = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdcreate(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdcreate'")
__r__s = mcpdstate(__s)
return __r__s
finally:
pass
_lib_alglib.alglib_mcpdcreateentry.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdcreateentry.restype = ctypes.c_int32
def mcpdcreateentry(n, entrystate):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__entrystate = x_int()
__entrystate.val = int(entrystate)
if __entrystate.val!=entrystate:
raise ValueError("Error while converting 'entrystate' parameter to 'x_int'")
__s = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdcreateentry(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__entrystate), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdcreateentry'")
__r__s = mcpdstate(__s)
return __r__s
finally:
pass
_lib_alglib.alglib_mcpdcreateexit.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdcreateexit.restype = ctypes.c_int32
def mcpdcreateexit(n, exitstate):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__exitstate = x_int()
__exitstate.val = int(exitstate)
if __exitstate.val!=exitstate:
raise ValueError("Error while converting 'exitstate' parameter to 'x_int'")
__s = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdcreateexit(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__exitstate), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdcreateexit'")
__r__s = mcpdstate(__s)
return __r__s
finally:
pass
_lib_alglib.alglib_mcpdcreateentryexit.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdcreateentryexit.restype = ctypes.c_int32
def mcpdcreateentryexit(n, entrystate, exitstate):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__entrystate = x_int()
__entrystate.val = int(entrystate)
if __entrystate.val!=entrystate:
raise ValueError("Error while converting 'entrystate' parameter to 'x_int'")
__exitstate = x_int()
__exitstate.val = int(exitstate)
if __exitstate.val!=exitstate:
raise ValueError("Error while converting 'exitstate' parameter to 'x_int'")
__s = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdcreateentryexit(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__entrystate), ctypes.byref(__exitstate), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdcreateentryexit'")
__r__s = mcpdstate(__s)
return __r__s
finally:
pass
_lib_alglib.alglib_mcpdaddtrack.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdaddtrack.restype = ctypes.c_int32
def mcpdaddtrack(*functionargs):
if len(functionargs)==3:
__friendly_form = False
s,xy,k = functionargs
elif len(functionargs)==2:
__friendly_form = True
s,xy = functionargs
k = safe_rows("'mcpdaddtrack': incorrect parameters",xy)
else:
raise RuntimeError("Error while calling 'mcpdaddtrack': function must have 2 or 3 parameters")
__s = s.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdaddtrack(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__xy), ctypes.byref(__k))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdaddtrack'")
return
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mcpdsetec.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdsetec.restype = ctypes.c_int32
def mcpdsetec(s, ec):
pass
__s = s.ptr
if not is_real_matrix(ec):
raise ValueError("'ec' parameter can't be cast to real_matrix")
__ec = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__ec, ec, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdsetec(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__ec))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdsetec'")
return
finally:
x_matrix_clear(__ec)
_lib_alglib.alglib_mcpdaddec.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdaddec.restype = ctypes.c_int32
def mcpdaddec(s, i, j, c):
pass
__s = s.ptr
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
__j = x_int()
__j.val = int(j)
if __j.val!=j:
raise ValueError("Error while converting 'j' parameter to 'x_int'")
__c = ctypes.c_double(c)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdaddec(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__i), ctypes.byref(__j), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdaddec'")
return
finally:
pass
_lib_alglib.alglib_mcpdsetbc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdsetbc.restype = ctypes.c_int32
def mcpdsetbc(s, bndl, bndu):
pass
__s = s.ptr
if not is_real_matrix(bndl):
raise ValueError("'bndl' parameter can't be cast to real_matrix")
__bndl = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(bndu):
raise ValueError("'bndu' parameter can't be cast to real_matrix")
__bndu = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__bndl, bndl, DT_REAL, X_CREATE)
x_from_listlist(__bndu, bndu, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdsetbc(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__bndl), ctypes.byref(__bndu))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdsetbc'")
return
finally:
x_matrix_clear(__bndl)
x_matrix_clear(__bndu)
_lib_alglib.alglib_mcpdaddbc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdaddbc.restype = ctypes.c_int32
def mcpdaddbc(s, i, j, bndl, bndu):
pass
__s = s.ptr
__i = x_int()
__i.val = int(i)
if __i.val!=i:
raise ValueError("Error while converting 'i' parameter to 'x_int'")
__j = x_int()
__j.val = int(j)
if __j.val!=j:
raise ValueError("Error while converting 'j' parameter to 'x_int'")
__bndl = ctypes.c_double(bndl)
__bndu = ctypes.c_double(bndu)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdaddbc(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__i), ctypes.byref(__j), ctypes.byref(__bndl), ctypes.byref(__bndu))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdaddbc'")
return
finally:
pass
_lib_alglib.alglib_mcpdsetlc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdsetlc.restype = ctypes.c_int32
def mcpdsetlc(*functionargs):
if len(functionargs)==4:
__friendly_form = False
s,c,ct,k = functionargs
elif len(functionargs)==3:
__friendly_form = True
s,c,ct = functionargs
if safe_rows("'mcpdsetlc': incorrect parameters",c)!=safe_len("'mcpdsetlc': incorrect parameters",ct):
raise RuntimeError("Error while calling 'mcpdsetlc': looks like one of arguments has wrong size")
k = safe_rows("'mcpdsetlc': incorrect parameters",c)
else:
raise RuntimeError("Error while calling 'mcpdsetlc': function must have 3 or 4 parameters")
__s = s.ptr
if not is_real_matrix(c):
raise ValueError("'c' parameter can't be cast to real_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(ct):
raise ValueError("'ct' parameter can't be cast to int_vector")
__ct = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
try:
x_from_listlist(__c, c, DT_REAL, X_CREATE)
x_from_list(__ct, ct, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdsetlc(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__c), ctypes.byref(__ct), ctypes.byref(__k))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdsetlc'")
return
finally:
x_matrix_clear(__c)
x_vector_clear(__ct)
_lib_alglib.alglib_mcpdsettikhonovregularizer.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdsettikhonovregularizer.restype = ctypes.c_int32
def mcpdsettikhonovregularizer(s, v):
pass
__s = s.ptr
__v = ctypes.c_double(v)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdsettikhonovregularizer(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__v))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdsettikhonovregularizer'")
return
finally:
pass
_lib_alglib.alglib_mcpdsetprior.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdsetprior.restype = ctypes.c_int32
def mcpdsetprior(s, pp):
pass
__s = s.ptr
if not is_real_matrix(pp):
raise ValueError("'pp' parameter can't be cast to real_matrix")
__pp = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__pp, pp, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdsetprior(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__pp))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdsetprior'")
return
finally:
x_matrix_clear(__pp)
_lib_alglib.alglib_mcpdsetpredictionweights.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdsetpredictionweights.restype = ctypes.c_int32
def mcpdsetpredictionweights(s, pw):
pass
__s = s.ptr
if not is_real_vector(pw):
raise ValueError("'pw' parameter can't be cast to real_vector")
__pw = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__pw, pw, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdsetpredictionweights(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__pw))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdsetpredictionweights'")
return
finally:
x_vector_clear(__pw)
_lib_alglib.alglib_mcpdsolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdsolve.restype = ctypes.c_int32
def mcpdsolve(s):
pass
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdsolve(ctypes.byref(_error_msg), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdsolve'")
return
finally:
pass
_lib_alglib.alglib_mcpdresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mcpdresults.restype = ctypes.c_int32
def mcpdresults(s):
pass
__s = s.ptr
__p = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_mcpdreport()
x_mcpdreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mcpdresults(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__p), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mcpdresults'")
__r__p = listlist_from_x(__p)
__r__rep = mcpdreport_from_x(__rep)
return (__r__p, __r__rep)
finally:
x_matrix_clear(__p)
x_mcpdreport_clear(__rep)
_lib_alglib.x_obj_free_mlpensemble.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_mlpensemble.restype = None
class mlpensemble(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_mlpensemble(self.ptr)
_lib_alglib.alglib_mlpeserialize.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpeserialize.restype = ctypes.c_int32
def mlpeserialize(obj):
error_msg = ctypes.c_char_p(0)
_s_out = ctypes.c_char_p(0)
retval = _lib_alglib.alglib_mlpeserialize(ctypes.byref(error_msg), ctypes.byref(obj.ptr), ctypes.byref(_s_out))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpeserialize'")
s_out = _s_out.value
_lib_alglib.x_free(_s_out)
return s_out
_lib_alglib.alglib_mlpeunserialize.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpeunserialize.restype = ctypes.c_int32
def mlpeunserialize(s_in):
error_msg = ctypes.c_char_p(0)
_s_in = ctypes.c_char_p(s_in)
_obj = ctypes.c_void_p(0)
retval = _lib_alglib.alglib_mlpeunserialize(ctypes.byref(error_msg), ctypes.byref(_s_in), ctypes.byref(_obj), )
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpeserialize'")
return mlpensemble(_obj)
_lib_alglib.alglib_mlpecreate0.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpecreate0.restype = ctypes.c_int32
def mlpecreate0(nin, nout, ensemblesize):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__ensemblesize = x_int()
__ensemblesize.val = int(ensemblesize)
if __ensemblesize.val!=ensemblesize:
raise ValueError("Error while converting 'ensemblesize' parameter to 'x_int'")
__ensemble = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpecreate0(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nout), ctypes.byref(__ensemblesize), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpecreate0'")
__r__ensemble = mlpensemble(__ensemble)
return __r__ensemble
finally:
pass
_lib_alglib.alglib_mlpecreate1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpecreate1.restype = ctypes.c_int32
def mlpecreate1(nin, nhid, nout, ensemblesize):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid = x_int()
__nhid.val = int(nhid)
if __nhid.val!=nhid:
raise ValueError("Error while converting 'nhid' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__ensemblesize = x_int()
__ensemblesize.val = int(ensemblesize)
if __ensemblesize.val!=ensemblesize:
raise ValueError("Error while converting 'ensemblesize' parameter to 'x_int'")
__ensemble = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpecreate1(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid), ctypes.byref(__nout), ctypes.byref(__ensemblesize), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpecreate1'")
__r__ensemble = mlpensemble(__ensemble)
return __r__ensemble
finally:
pass
_lib_alglib.alglib_mlpecreate2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpecreate2.restype = ctypes.c_int32
def mlpecreate2(nin, nhid1, nhid2, nout, ensemblesize):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid1 = x_int()
__nhid1.val = int(nhid1)
if __nhid1.val!=nhid1:
raise ValueError("Error while converting 'nhid1' parameter to 'x_int'")
__nhid2 = x_int()
__nhid2.val = int(nhid2)
if __nhid2.val!=nhid2:
raise ValueError("Error while converting 'nhid2' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__ensemblesize = x_int()
__ensemblesize.val = int(ensemblesize)
if __ensemblesize.val!=ensemblesize:
raise ValueError("Error while converting 'ensemblesize' parameter to 'x_int'")
__ensemble = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpecreate2(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid1), ctypes.byref(__nhid2), ctypes.byref(__nout), ctypes.byref(__ensemblesize), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpecreate2'")
__r__ensemble = mlpensemble(__ensemble)
return __r__ensemble
finally:
pass
_lib_alglib.alglib_mlpecreateb0.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpecreateb0.restype = ctypes.c_int32
def mlpecreateb0(nin, nout, b, d, ensemblesize):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__b = ctypes.c_double(b)
__d = ctypes.c_double(d)
__ensemblesize = x_int()
__ensemblesize.val = int(ensemblesize)
if __ensemblesize.val!=ensemblesize:
raise ValueError("Error while converting 'ensemblesize' parameter to 'x_int'")
__ensemble = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpecreateb0(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nout), ctypes.byref(__b), ctypes.byref(__d), ctypes.byref(__ensemblesize), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpecreateb0'")
__r__ensemble = mlpensemble(__ensemble)
return __r__ensemble
finally:
pass
_lib_alglib.alglib_mlpecreateb1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpecreateb1.restype = ctypes.c_int32
def mlpecreateb1(nin, nhid, nout, b, d, ensemblesize):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid = x_int()
__nhid.val = int(nhid)
if __nhid.val!=nhid:
raise ValueError("Error while converting 'nhid' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__b = ctypes.c_double(b)
__d = ctypes.c_double(d)
__ensemblesize = x_int()
__ensemblesize.val = int(ensemblesize)
if __ensemblesize.val!=ensemblesize:
raise ValueError("Error while converting 'ensemblesize' parameter to 'x_int'")
__ensemble = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpecreateb1(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid), ctypes.byref(__nout), ctypes.byref(__b), ctypes.byref(__d), ctypes.byref(__ensemblesize), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpecreateb1'")
__r__ensemble = mlpensemble(__ensemble)
return __r__ensemble
finally:
pass
_lib_alglib.alglib_mlpecreateb2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpecreateb2.restype = ctypes.c_int32
def mlpecreateb2(nin, nhid1, nhid2, nout, b, d, ensemblesize):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid1 = x_int()
__nhid1.val = int(nhid1)
if __nhid1.val!=nhid1:
raise ValueError("Error while converting 'nhid1' parameter to 'x_int'")
__nhid2 = x_int()
__nhid2.val = int(nhid2)
if __nhid2.val!=nhid2:
raise ValueError("Error while converting 'nhid2' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__b = ctypes.c_double(b)
__d = ctypes.c_double(d)
__ensemblesize = x_int()
__ensemblesize.val = int(ensemblesize)
if __ensemblesize.val!=ensemblesize:
raise ValueError("Error while converting 'ensemblesize' parameter to 'x_int'")
__ensemble = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpecreateb2(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid1), ctypes.byref(__nhid2), ctypes.byref(__nout), ctypes.byref(__b), ctypes.byref(__d), ctypes.byref(__ensemblesize), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpecreateb2'")
__r__ensemble = mlpensemble(__ensemble)
return __r__ensemble
finally:
pass
_lib_alglib.alglib_mlpecreater0.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpecreater0.restype = ctypes.c_int32
def mlpecreater0(nin, nout, a, b, ensemblesize):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__ensemblesize = x_int()
__ensemblesize.val = int(ensemblesize)
if __ensemblesize.val!=ensemblesize:
raise ValueError("Error while converting 'ensemblesize' parameter to 'x_int'")
__ensemble = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpecreater0(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nout), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__ensemblesize), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpecreater0'")
__r__ensemble = mlpensemble(__ensemble)
return __r__ensemble
finally:
pass
_lib_alglib.alglib_mlpecreater1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpecreater1.restype = ctypes.c_int32
def mlpecreater1(nin, nhid, nout, a, b, ensemblesize):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid = x_int()
__nhid.val = int(nhid)
if __nhid.val!=nhid:
raise ValueError("Error while converting 'nhid' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__ensemblesize = x_int()
__ensemblesize.val = int(ensemblesize)
if __ensemblesize.val!=ensemblesize:
raise ValueError("Error while converting 'ensemblesize' parameter to 'x_int'")
__ensemble = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpecreater1(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid), ctypes.byref(__nout), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__ensemblesize), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpecreater1'")
__r__ensemble = mlpensemble(__ensemble)
return __r__ensemble
finally:
pass
_lib_alglib.alglib_mlpecreater2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpecreater2.restype = ctypes.c_int32
def mlpecreater2(nin, nhid1, nhid2, nout, a, b, ensemblesize):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid1 = x_int()
__nhid1.val = int(nhid1)
if __nhid1.val!=nhid1:
raise ValueError("Error while converting 'nhid1' parameter to 'x_int'")
__nhid2 = x_int()
__nhid2.val = int(nhid2)
if __nhid2.val!=nhid2:
raise ValueError("Error while converting 'nhid2' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__ensemblesize = x_int()
__ensemblesize.val = int(ensemblesize)
if __ensemblesize.val!=ensemblesize:
raise ValueError("Error while converting 'ensemblesize' parameter to 'x_int'")
__ensemble = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpecreater2(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid1), ctypes.byref(__nhid2), ctypes.byref(__nout), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__ensemblesize), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpecreater2'")
__r__ensemble = mlpensemble(__ensemble)
return __r__ensemble
finally:
pass
_lib_alglib.alglib_mlpecreatec0.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpecreatec0.restype = ctypes.c_int32
def mlpecreatec0(nin, nout, ensemblesize):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__ensemblesize = x_int()
__ensemblesize.val = int(ensemblesize)
if __ensemblesize.val!=ensemblesize:
raise ValueError("Error while converting 'ensemblesize' parameter to 'x_int'")
__ensemble = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpecreatec0(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nout), ctypes.byref(__ensemblesize), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpecreatec0'")
__r__ensemble = mlpensemble(__ensemble)
return __r__ensemble
finally:
pass
_lib_alglib.alglib_mlpecreatec1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpecreatec1.restype = ctypes.c_int32
def mlpecreatec1(nin, nhid, nout, ensemblesize):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid = x_int()
__nhid.val = int(nhid)
if __nhid.val!=nhid:
raise ValueError("Error while converting 'nhid' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__ensemblesize = x_int()
__ensemblesize.val = int(ensemblesize)
if __ensemblesize.val!=ensemblesize:
raise ValueError("Error while converting 'ensemblesize' parameter to 'x_int'")
__ensemble = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpecreatec1(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid), ctypes.byref(__nout), ctypes.byref(__ensemblesize), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpecreatec1'")
__r__ensemble = mlpensemble(__ensemble)
return __r__ensemble
finally:
pass
_lib_alglib.alglib_mlpecreatec2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpecreatec2.restype = ctypes.c_int32
def mlpecreatec2(nin, nhid1, nhid2, nout, ensemblesize):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nhid1 = x_int()
__nhid1.val = int(nhid1)
if __nhid1.val!=nhid1:
raise ValueError("Error while converting 'nhid1' parameter to 'x_int'")
__nhid2 = x_int()
__nhid2.val = int(nhid2)
if __nhid2.val!=nhid2:
raise ValueError("Error while converting 'nhid2' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__ensemblesize = x_int()
__ensemblesize.val = int(ensemblesize)
if __ensemblesize.val!=ensemblesize:
raise ValueError("Error while converting 'ensemblesize' parameter to 'x_int'")
__ensemble = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpecreatec2(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nhid1), ctypes.byref(__nhid2), ctypes.byref(__nout), ctypes.byref(__ensemblesize), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpecreatec2'")
__r__ensemble = mlpensemble(__ensemble)
return __r__ensemble
finally:
pass
_lib_alglib.alglib_mlpecreatefromnetwork.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpecreatefromnetwork.restype = ctypes.c_int32
def mlpecreatefromnetwork(network, ensemblesize):
pass
__network = network.ptr
__ensemblesize = x_int()
__ensemblesize.val = int(ensemblesize)
if __ensemblesize.val!=ensemblesize:
raise ValueError("Error while converting 'ensemblesize' parameter to 'x_int'")
__ensemble = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpecreatefromnetwork(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__ensemblesize), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpecreatefromnetwork'")
__r__ensemble = mlpensemble(__ensemble)
return __r__ensemble
finally:
pass
_lib_alglib.alglib_mlperandomize.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlperandomize.restype = ctypes.c_int32
def mlperandomize(ensemble):
pass
__ensemble = ensemble.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlperandomize(ctypes.byref(_error_msg), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlperandomize'")
return
finally:
pass
_lib_alglib.alglib_mlpeproperties.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpeproperties.restype = ctypes.c_int32
def mlpeproperties(ensemble):
pass
__ensemble = ensemble.ptr
__nin = x_int()
__nin.val = 0
__nout = x_int()
__nout.val = 0
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpeproperties(ctypes.byref(_error_msg), ctypes.byref(__ensemble), ctypes.byref(__nin), ctypes.byref(__nout))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpeproperties'")
__r__nin = __nin.val
__r__nout = __nout.val
return (__r__nin, __r__nout)
finally:
pass
_lib_alglib.alglib_mlpeissoftmax.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpeissoftmax.restype = ctypes.c_int32
def mlpeissoftmax(ensemble):
pass
__result = ctypes.c_uint8(0)
__ensemble = ensemble.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpeissoftmax(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__ensemble))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpeissoftmax'")
__r__result = __result.value!=0
return __r__result
finally:
pass
_lib_alglib.alglib_mlpeprocess.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpeprocess.restype = ctypes.c_int32
def mlpeprocess(ensemble, x, y):
pass
__ensemble = ensemble.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpeprocess(ctypes.byref(_error_msg), ctypes.byref(__ensemble), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpeprocess'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_mlpeprocessi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpeprocessi.restype = ctypes.c_int32
def mlpeprocessi(ensemble, x):
pass
__ensemble = ensemble.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__y = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpeprocessi(ctypes.byref(_error_msg), ctypes.byref(__ensemble), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpeprocessi'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_mlperelclserror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlperelclserror.restype = ctypes.c_int32
def mlperelclserror(ensemble, xy, npoints):
pass
__result = ctypes.c_double(0)
__ensemble = ensemble.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlperelclserror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__ensemble), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlperelclserror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mlpeavgce.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpeavgce.restype = ctypes.c_int32
def mlpeavgce(ensemble, xy, npoints):
pass
__result = ctypes.c_double(0)
__ensemble = ensemble.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpeavgce(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__ensemble), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpeavgce'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mlpermserror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpermserror.restype = ctypes.c_int32
def mlpermserror(ensemble, xy, npoints):
pass
__result = ctypes.c_double(0)
__ensemble = ensemble.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpermserror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__ensemble), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpermserror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mlpeavgerror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpeavgerror.restype = ctypes.c_int32
def mlpeavgerror(ensemble, xy, npoints):
pass
__result = ctypes.c_double(0)
__ensemble = ensemble.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpeavgerror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__ensemble), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpeavgerror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mlpeavgrelerror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpeavgrelerror.restype = ctypes.c_int32
def mlpeavgrelerror(ensemble, xy, npoints):
pass
__result = ctypes.c_double(0)
__ensemble = ensemble.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpeavgrelerror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__ensemble), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpeavgrelerror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
class x_mlpreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("relclserror", ctypes.c_double),
("avgce", ctypes.c_double),
("rmserror", ctypes.c_double),
("avgerror", ctypes.c_double),
("avgrelerror", ctypes.c_double),
("ngrad", x_int),
("nhess", x_int),
("ncholesky", x_int)
]
class mlpreport(object):
def __init__(self):
self.relclserror = 0
self.avgce = 0
self.rmserror = 0
self.avgerror = 0
self.avgrelerror = 0
self.ngrad = 0
self.nhess = 0
self.ncholesky = 0
def x_mlpreport_zero_fields(x):
x.relclserror = 0
x.avgce = 0
x.rmserror = 0
x.avgerror = 0
x.avgrelerror = 0
x.ngrad.val = 0
x.nhess.val = 0
x.ncholesky.val = 0
return
def x_mlpreport_clear(x):
x_mlpreport_zero_fields(x)
return
def x_from_mlpreport(x,v):
x.relclserror = float(v.relclserror)
x.avgce = float(v.avgce)
x.rmserror = float(v.rmserror)
x.avgerror = float(v.avgerror)
x.avgrelerror = float(v.avgrelerror)
x.ngrad.val = int(v.ngrad)
x.nhess.val = int(v.nhess)
x.ncholesky.val = int(v.ncholesky)
return
def mlpreport_from_x(x):
r = mlpreport()
r.relclserror = x.relclserror
r.avgce = x.avgce
r.rmserror = x.rmserror
r.avgerror = x.avgerror
r.avgrelerror = x.avgrelerror
r.ngrad = x.ngrad.val
r.nhess = x.nhess.val
r.ncholesky = x.ncholesky.val
return r
class x_mlpcvreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("relclserror", ctypes.c_double),
("avgce", ctypes.c_double),
("rmserror", ctypes.c_double),
("avgerror", ctypes.c_double),
("avgrelerror", ctypes.c_double)
]
class mlpcvreport(object):
def __init__(self):
self.relclserror = 0
self.avgce = 0
self.rmserror = 0
self.avgerror = 0
self.avgrelerror = 0
def x_mlpcvreport_zero_fields(x):
x.relclserror = 0
x.avgce = 0
x.rmserror = 0
x.avgerror = 0
x.avgrelerror = 0
return
def x_mlpcvreport_clear(x):
x_mlpcvreport_zero_fields(x)
return
def x_from_mlpcvreport(x,v):
x.relclserror = float(v.relclserror)
x.avgce = float(v.avgce)
x.rmserror = float(v.rmserror)
x.avgerror = float(v.avgerror)
x.avgrelerror = float(v.avgrelerror)
return
def mlpcvreport_from_x(x):
r = mlpcvreport()
r.relclserror = x.relclserror
r.avgce = x.avgce
r.rmserror = x.rmserror
r.avgerror = x.avgerror
r.avgrelerror = x.avgrelerror
return r
_lib_alglib.x_obj_free_mlptrainer.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_mlptrainer.restype = None
class mlptrainer(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_mlptrainer(self.ptr)
_lib_alglib.alglib_mlptrainlm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlptrainlm.restype = ctypes.c_int32
def mlptrainlm(network, xy, npoints, decay, restarts):
pass
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__decay = ctypes.c_double(decay)
__restarts = x_int()
__restarts.val = int(restarts)
if __restarts.val!=restarts:
raise ValueError("Error while converting 'restarts' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_mlpreport()
x_mlpreport_zero_fields(__rep)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlptrainlm(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__decay), ctypes.byref(__restarts), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlptrainlm'")
__r__info = __info.val
__r__rep = mlpreport_from_x(__rep)
return (__r__info, __r__rep)
finally:
x_matrix_clear(__xy)
x_mlpreport_clear(__rep)
_lib_alglib.alglib_mlptrainlbfgs.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlptrainlbfgs.restype = ctypes.c_int32
def mlptrainlbfgs(network, xy, npoints, decay, restarts, wstep, maxits):
pass
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__decay = ctypes.c_double(decay)
__restarts = x_int()
__restarts.val = int(restarts)
if __restarts.val!=restarts:
raise ValueError("Error while converting 'restarts' parameter to 'x_int'")
__wstep = ctypes.c_double(wstep)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_mlpreport()
x_mlpreport_zero_fields(__rep)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlptrainlbfgs(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__decay), ctypes.byref(__restarts), ctypes.byref(__wstep), ctypes.byref(__maxits), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlptrainlbfgs'")
__r__info = __info.val
__r__rep = mlpreport_from_x(__rep)
return (__r__info, __r__rep)
finally:
x_matrix_clear(__xy)
x_mlpreport_clear(__rep)
_lib_alglib.alglib_mlptraines.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlptraines.restype = ctypes.c_int32
def mlptraines(network, trnxy, trnsize, valxy, valsize, decay, restarts):
pass
__network = network.ptr
if not is_real_matrix(trnxy):
raise ValueError("'trnxy' parameter can't be cast to real_matrix")
__trnxy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__trnsize = x_int()
__trnsize.val = int(trnsize)
if __trnsize.val!=trnsize:
raise ValueError("Error while converting 'trnsize' parameter to 'x_int'")
if not is_real_matrix(valxy):
raise ValueError("'valxy' parameter can't be cast to real_matrix")
__valxy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__valsize = x_int()
__valsize.val = int(valsize)
if __valsize.val!=valsize:
raise ValueError("Error while converting 'valsize' parameter to 'x_int'")
__decay = ctypes.c_double(decay)
__restarts = x_int()
__restarts.val = int(restarts)
if __restarts.val!=restarts:
raise ValueError("Error while converting 'restarts' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_mlpreport()
x_mlpreport_zero_fields(__rep)
try:
x_from_listlist(__trnxy, trnxy, DT_REAL, X_CREATE)
x_from_listlist(__valxy, valxy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlptraines(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__trnxy), ctypes.byref(__trnsize), ctypes.byref(__valxy), ctypes.byref(__valsize), ctypes.byref(__decay), ctypes.byref(__restarts), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlptraines'")
__r__info = __info.val
__r__rep = mlpreport_from_x(__rep)
return (__r__info, __r__rep)
finally:
x_matrix_clear(__trnxy)
x_matrix_clear(__valxy)
x_mlpreport_clear(__rep)
_lib_alglib.alglib_mlpkfoldcvlbfgs.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpkfoldcvlbfgs.restype = ctypes.c_int32
def mlpkfoldcvlbfgs(network, xy, npoints, decay, restarts, wstep, maxits, foldscount):
pass
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__decay = ctypes.c_double(decay)
__restarts = x_int()
__restarts.val = int(restarts)
if __restarts.val!=restarts:
raise ValueError("Error while converting 'restarts' parameter to 'x_int'")
__wstep = ctypes.c_double(wstep)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
__foldscount = x_int()
__foldscount.val = int(foldscount)
if __foldscount.val!=foldscount:
raise ValueError("Error while converting 'foldscount' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_mlpreport()
x_mlpreport_zero_fields(__rep)
__cvrep = x_mlpcvreport()
x_mlpcvreport_zero_fields(__cvrep)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpkfoldcvlbfgs(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__decay), ctypes.byref(__restarts), ctypes.byref(__wstep), ctypes.byref(__maxits), ctypes.byref(__foldscount), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__cvrep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpkfoldcvlbfgs'")
__r__info = __info.val
__r__rep = mlpreport_from_x(__rep)
__r__cvrep = mlpcvreport_from_x(__cvrep)
return (__r__info, __r__rep, __r__cvrep)
finally:
x_matrix_clear(__xy)
x_mlpreport_clear(__rep)
x_mlpcvreport_clear(__cvrep)
_lib_alglib.alglib_mlpkfoldcvlm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpkfoldcvlm.restype = ctypes.c_int32
def mlpkfoldcvlm(network, xy, npoints, decay, restarts, foldscount):
pass
__network = network.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__decay = ctypes.c_double(decay)
__restarts = x_int()
__restarts.val = int(restarts)
if __restarts.val!=restarts:
raise ValueError("Error while converting 'restarts' parameter to 'x_int'")
__foldscount = x_int()
__foldscount.val = int(foldscount)
if __foldscount.val!=foldscount:
raise ValueError("Error while converting 'foldscount' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_mlpreport()
x_mlpreport_zero_fields(__rep)
__cvrep = x_mlpcvreport()
x_mlpcvreport_zero_fields(__cvrep)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpkfoldcvlm(ctypes.byref(_error_msg), ctypes.byref(__network), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__decay), ctypes.byref(__restarts), ctypes.byref(__foldscount), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__cvrep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpkfoldcvlm'")
__r__info = __info.val
__r__rep = mlpreport_from_x(__rep)
__r__cvrep = mlpcvreport_from_x(__cvrep)
return (__r__info, __r__rep, __r__cvrep)
finally:
x_matrix_clear(__xy)
x_mlpreport_clear(__rep)
x_mlpcvreport_clear(__cvrep)
_lib_alglib.alglib_mlpkfoldcv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpkfoldcv.restype = ctypes.c_int32
def mlpkfoldcv(s, network, nrestarts, foldscount):
pass
__s = s.ptr
__network = network.ptr
__nrestarts = x_int()
__nrestarts.val = int(nrestarts)
if __nrestarts.val!=nrestarts:
raise ValueError("Error while converting 'nrestarts' parameter to 'x_int'")
__foldscount = x_int()
__foldscount.val = int(foldscount)
if __foldscount.val!=foldscount:
raise ValueError("Error while converting 'foldscount' parameter to 'x_int'")
__rep = x_mlpreport()
x_mlpreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpkfoldcv(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__network), ctypes.byref(__nrestarts), ctypes.byref(__foldscount), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpkfoldcv'")
__r__rep = mlpreport_from_x(__rep)
return __r__rep
finally:
x_mlpreport_clear(__rep)
_lib_alglib.alglib_smp_mlpkfoldcv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpkfoldcv.restype = ctypes.c_int32
def smp_mlpkfoldcv(s, network, nrestarts, foldscount):
pass
__s = s.ptr
__network = network.ptr
__nrestarts = x_int()
__nrestarts.val = int(nrestarts)
if __nrestarts.val!=nrestarts:
raise ValueError("Error while converting 'nrestarts' parameter to 'x_int'")
__foldscount = x_int()
__foldscount.val = int(foldscount)
if __foldscount.val!=foldscount:
raise ValueError("Error while converting 'foldscount' parameter to 'x_int'")
__rep = x_mlpreport()
x_mlpreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpkfoldcv(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__network), ctypes.byref(__nrestarts), ctypes.byref(__foldscount), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpkfoldcv'")
__r__rep = mlpreport_from_x(__rep)
return __r__rep
finally:
x_mlpreport_clear(__rep)
_lib_alglib.alglib_mlpcreatetrainer.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcreatetrainer.restype = ctypes.c_int32
def mlpcreatetrainer(nin, nout):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nout = x_int()
__nout.val = int(nout)
if __nout.val!=nout:
raise ValueError("Error while converting 'nout' parameter to 'x_int'")
__s = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcreatetrainer(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nout), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcreatetrainer'")
__r__s = mlptrainer(__s)
return __r__s
finally:
pass
_lib_alglib.alglib_mlpcreatetrainercls.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcreatetrainercls.restype = ctypes.c_int32
def mlpcreatetrainercls(nin, nclasses):
pass
__nin = x_int()
__nin.val = int(nin)
if __nin.val!=nin:
raise ValueError("Error while converting 'nin' parameter to 'x_int'")
__nclasses = x_int()
__nclasses.val = int(nclasses)
if __nclasses.val!=nclasses:
raise ValueError("Error while converting 'nclasses' parameter to 'x_int'")
__s = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcreatetrainercls(ctypes.byref(_error_msg), ctypes.byref(__nin), ctypes.byref(__nclasses), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcreatetrainercls'")
__r__s = mlptrainer(__s)
return __r__s
finally:
pass
_lib_alglib.alglib_mlpsetdataset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpsetdataset.restype = ctypes.c_int32
def mlpsetdataset(s, xy, npoints):
pass
__s = s.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpsetdataset(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpsetdataset'")
return
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_mlpsetsparsedataset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpsetsparsedataset.restype = ctypes.c_int32
def mlpsetsparsedataset(s, xy, npoints):
pass
__s = s.ptr
__xy = xy.ptr
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpsetsparsedataset(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpsetsparsedataset'")
return
finally:
pass
_lib_alglib.alglib_mlpsetdecay.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpsetdecay.restype = ctypes.c_int32
def mlpsetdecay(s, decay):
pass
__s = s.ptr
__decay = ctypes.c_double(decay)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpsetdecay(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__decay))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpsetdecay'")
return
finally:
pass
_lib_alglib.alglib_mlpsetcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpsetcond.restype = ctypes.c_int32
def mlpsetcond(s, wstep, maxits):
pass
__s = s.ptr
__wstep = ctypes.c_double(wstep)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpsetcond(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__wstep), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpsetcond'")
return
finally:
pass
_lib_alglib.alglib_mlpsetalgobatch.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpsetalgobatch.restype = ctypes.c_int32
def mlpsetalgobatch(s):
pass
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpsetalgobatch(ctypes.byref(_error_msg), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpsetalgobatch'")
return
finally:
pass
_lib_alglib.alglib_mlptrainnetwork.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlptrainnetwork.restype = ctypes.c_int32
def mlptrainnetwork(s, network, nrestarts):
pass
__s = s.ptr
__network = network.ptr
__nrestarts = x_int()
__nrestarts.val = int(nrestarts)
if __nrestarts.val!=nrestarts:
raise ValueError("Error while converting 'nrestarts' parameter to 'x_int'")
__rep = x_mlpreport()
x_mlpreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlptrainnetwork(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__network), ctypes.byref(__nrestarts), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlptrainnetwork'")
__r__rep = mlpreport_from_x(__rep)
return __r__rep
finally:
x_mlpreport_clear(__rep)
_lib_alglib.alglib_smp_mlptrainnetwork.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlptrainnetwork.restype = ctypes.c_int32
def smp_mlptrainnetwork(s, network, nrestarts):
pass
__s = s.ptr
__network = network.ptr
__nrestarts = x_int()
__nrestarts.val = int(nrestarts)
if __nrestarts.val!=nrestarts:
raise ValueError("Error while converting 'nrestarts' parameter to 'x_int'")
__rep = x_mlpreport()
x_mlpreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlptrainnetwork(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__network), ctypes.byref(__nrestarts), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlptrainnetwork'")
__r__rep = mlpreport_from_x(__rep)
return __r__rep
finally:
x_mlpreport_clear(__rep)
_lib_alglib.alglib_mlpstarttraining.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpstarttraining.restype = ctypes.c_int32
def mlpstarttraining(s, network, randomstart):
pass
__s = s.ptr
__network = network.ptr
__randomstart = ctypes.c_uint8(randomstart)
if __randomstart.value!=0:
__randomstart = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpstarttraining(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__network), ctypes.byref(__randomstart))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpstarttraining'")
return
finally:
pass
_lib_alglib.alglib_mlpcontinuetraining.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpcontinuetraining.restype = ctypes.c_int32
def mlpcontinuetraining(s, network):
pass
__result = ctypes.c_uint8(0)
__s = s.ptr
__network = network.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpcontinuetraining(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpcontinuetraining'")
__r__result = __result.value!=0
return __r__result
finally:
pass
_lib_alglib.alglib_smp_mlpcontinuetraining.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlpcontinuetraining.restype = ctypes.c_int32
def smp_mlpcontinuetraining(s, network):
pass
__result = ctypes.c_uint8(0)
__s = s.ptr
__network = network.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlpcontinuetraining(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s), ctypes.byref(__network))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlpcontinuetraining'")
__r__result = __result.value!=0
return __r__result
finally:
pass
_lib_alglib.alglib_mlpebagginglm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpebagginglm.restype = ctypes.c_int32
def mlpebagginglm(ensemble, xy, npoints, decay, restarts):
pass
__ensemble = ensemble.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__decay = ctypes.c_double(decay)
__restarts = x_int()
__restarts.val = int(restarts)
if __restarts.val!=restarts:
raise ValueError("Error while converting 'restarts' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_mlpreport()
x_mlpreport_zero_fields(__rep)
__ooberrors = x_mlpcvreport()
x_mlpcvreport_zero_fields(__ooberrors)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpebagginglm(ctypes.byref(_error_msg), ctypes.byref(__ensemble), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__decay), ctypes.byref(__restarts), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__ooberrors))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpebagginglm'")
__r__info = __info.val
__r__rep = mlpreport_from_x(__rep)
__r__ooberrors = mlpcvreport_from_x(__ooberrors)
return (__r__info, __r__rep, __r__ooberrors)
finally:
x_matrix_clear(__xy)
x_mlpreport_clear(__rep)
x_mlpcvreport_clear(__ooberrors)
_lib_alglib.alglib_mlpebagginglbfgs.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpebagginglbfgs.restype = ctypes.c_int32
def mlpebagginglbfgs(ensemble, xy, npoints, decay, restarts, wstep, maxits):
pass
__ensemble = ensemble.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__decay = ctypes.c_double(decay)
__restarts = x_int()
__restarts.val = int(restarts)
if __restarts.val!=restarts:
raise ValueError("Error while converting 'restarts' parameter to 'x_int'")
__wstep = ctypes.c_double(wstep)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_mlpreport()
x_mlpreport_zero_fields(__rep)
__ooberrors = x_mlpcvreport()
x_mlpcvreport_zero_fields(__ooberrors)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpebagginglbfgs(ctypes.byref(_error_msg), ctypes.byref(__ensemble), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__decay), ctypes.byref(__restarts), ctypes.byref(__wstep), ctypes.byref(__maxits), ctypes.byref(__info), ctypes.byref(__rep), ctypes.byref(__ooberrors))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpebagginglbfgs'")
__r__info = __info.val
__r__rep = mlpreport_from_x(__rep)
__r__ooberrors = mlpcvreport_from_x(__ooberrors)
return (__r__info, __r__rep, __r__ooberrors)
finally:
x_matrix_clear(__xy)
x_mlpreport_clear(__rep)
x_mlpcvreport_clear(__ooberrors)
_lib_alglib.alglib_mlpetraines.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlpetraines.restype = ctypes.c_int32
def mlpetraines(ensemble, xy, npoints, decay, restarts):
pass
__ensemble = ensemble.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__decay = ctypes.c_double(decay)
__restarts = x_int()
__restarts.val = int(restarts)
if __restarts.val!=restarts:
raise ValueError("Error while converting 'restarts' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__rep = x_mlpreport()
x_mlpreport_zero_fields(__rep)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlpetraines(ctypes.byref(_error_msg), ctypes.byref(__ensemble), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__decay), ctypes.byref(__restarts), ctypes.byref(__info), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlpetraines'")
__r__info = __info.val
__r__rep = mlpreport_from_x(__rep)
return (__r__info, __r__rep)
finally:
x_matrix_clear(__xy)
x_mlpreport_clear(__rep)
_lib_alglib.alglib_mlptrainensemblees.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mlptrainensemblees.restype = ctypes.c_int32
def mlptrainensemblees(s, ensemble, nrestarts):
pass
__s = s.ptr
__ensemble = ensemble.ptr
__nrestarts = x_int()
__nrestarts.val = int(nrestarts)
if __nrestarts.val!=nrestarts:
raise ValueError("Error while converting 'nrestarts' parameter to 'x_int'")
__rep = x_mlpreport()
x_mlpreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mlptrainensemblees(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__ensemble), ctypes.byref(__nrestarts), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mlptrainensemblees'")
__r__rep = mlpreport_from_x(__rep)
return __r__rep
finally:
x_mlpreport_clear(__rep)
_lib_alglib.alglib_smp_mlptrainensemblees.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_mlptrainensemblees.restype = ctypes.c_int32
def smp_mlptrainensemblees(s, ensemble, nrestarts):
pass
__s = s.ptr
__ensemble = ensemble.ptr
__nrestarts = x_int()
__nrestarts.val = int(nrestarts)
if __nrestarts.val!=nrestarts:
raise ValueError("Error while converting 'nrestarts' parameter to 'x_int'")
__rep = x_mlpreport()
x_mlpreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_mlptrainensemblees(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__ensemble), ctypes.byref(__nrestarts), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_mlptrainensemblees'")
__r__rep = mlpreport_from_x(__rep)
return __r__rep
finally:
x_mlpreport_clear(__rep)
_lib_alglib.x_obj_free_clusterizerstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_clusterizerstate.restype = None
class clusterizerstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_clusterizerstate(self.ptr)
class x_ahcreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("terminationtype", x_int),
("npoints", x_int),
("p", x_vector),
("z", x_matrix),
("pz", x_matrix),
("pm", x_matrix),
("mergedist", x_vector)
]
class ahcreport(object):
def __init__(self):
self.terminationtype = 0
self.npoints = 0
self.p = []
self.z = [[]]
self.pz = [[]]
self.pm = [[]]
self.mergedist = []
def x_ahcreport_zero_fields(x):
x.terminationtype.val = 0
x.npoints.val = 0
x.p = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
x.z = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
x.pz = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
x.pm = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
x.mergedist = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
return
def x_ahcreport_clear(x):
x_vector_clear(x.p)
x_matrix_clear(x.z)
x_matrix_clear(x.pz)
x_matrix_clear(x.pm)
x_vector_clear(x.mergedist)
x_ahcreport_zero_fields(x)
return
def x_from_ahcreport(x,v):
x.terminationtype.val = int(v.terminationtype)
x.npoints.val = int(v.npoints)
x_from_list(x.p, v.p, DT_INT, X_CREATE)
x_from_listlist(x.z, v.z, DT_INT, X_CREATE)
x_from_listlist(x.pz, v.pz, DT_INT, X_CREATE)
x_from_listlist(x.pm, v.pm, DT_INT, X_CREATE)
x_from_list(x.mergedist, v.mergedist, DT_REAL, X_CREATE)
return
def ahcreport_from_x(x):
r = ahcreport()
r.terminationtype = x.terminationtype.val
r.npoints = x.npoints.val
r.p = list_from_x(x.p)
r.z = listlist_from_x(x.z)
r.pz = listlist_from_x(x.pz)
r.pm = listlist_from_x(x.pm)
r.mergedist = list_from_x(x.mergedist)
return r
class x_kmeansreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("npoints", x_int),
("nfeatures", x_int),
("terminationtype", x_int),
("iterationscount", x_int),
("energy", ctypes.c_double),
("k", x_int),
("c", x_matrix),
("cidx", x_vector)
]
class kmeansreport(object):
def __init__(self):
self.npoints = 0
self.nfeatures = 0
self.terminationtype = 0
self.iterationscount = 0
self.energy = 0
self.k = 0
self.c = [[]]
self.cidx = []
def x_kmeansreport_zero_fields(x):
x.npoints.val = 0
x.nfeatures.val = 0
x.terminationtype.val = 0
x.iterationscount.val = 0
x.energy = 0
x.k.val = 0
x.c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
x.cidx = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
return
def x_kmeansreport_clear(x):
x_matrix_clear(x.c)
x_vector_clear(x.cidx)
x_kmeansreport_zero_fields(x)
return
def x_from_kmeansreport(x,v):
x.npoints.val = int(v.npoints)
x.nfeatures.val = int(v.nfeatures)
x.terminationtype.val = int(v.terminationtype)
x.iterationscount.val = int(v.iterationscount)
x.energy = float(v.energy)
x.k.val = int(v.k)
x_from_listlist(x.c, v.c, DT_REAL, X_CREATE)
x_from_list(x.cidx, v.cidx, DT_INT, X_CREATE)
return
def kmeansreport_from_x(x):
r = kmeansreport()
r.npoints = x.npoints.val
r.nfeatures = x.nfeatures.val
r.terminationtype = x.terminationtype.val
r.iterationscount = x.iterationscount.val
r.energy = x.energy
r.k = x.k.val
r.c = listlist_from_x(x.c)
r.cidx = list_from_x(x.cidx)
return r
_lib_alglib.alglib_clusterizercreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_clusterizercreate.restype = ctypes.c_int32
def clusterizercreate():
pass
__s = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_clusterizercreate(ctypes.byref(_error_msg), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'clusterizercreate'")
__r__s = clusterizerstate(__s)
return __r__s
finally:
pass
_lib_alglib.alglib_clusterizersetpoints.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_clusterizersetpoints.restype = ctypes.c_int32
def clusterizersetpoints(*functionargs):
if len(functionargs)==5:
__friendly_form = False
s,xy,npoints,nfeatures,disttype = functionargs
elif len(functionargs)==3:
__friendly_form = True
s,xy,disttype = functionargs
npoints = safe_rows("'clusterizersetpoints': incorrect parameters",xy)
nfeatures = safe_cols("'clusterizersetpoints': incorrect parameters",xy)
else:
raise RuntimeError("Error while calling 'clusterizersetpoints': function must have 3 or 5 parameters")
__s = s.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nfeatures = x_int()
__nfeatures.val = int(nfeatures)
if __nfeatures.val!=nfeatures:
raise ValueError("Error while converting 'nfeatures' parameter to 'x_int'")
__disttype = x_int()
__disttype.val = int(disttype)
if __disttype.val!=disttype:
raise ValueError("Error while converting 'disttype' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_clusterizersetpoints(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nfeatures), ctypes.byref(__disttype))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'clusterizersetpoints'")
return
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_clusterizersetdistances.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_clusterizersetdistances.restype = ctypes.c_int32
def clusterizersetdistances(*functionargs):
if len(functionargs)==4:
__friendly_form = False
s,d,npoints,isupper = functionargs
elif len(functionargs)==3:
__friendly_form = True
s,d,isupper = functionargs
if safe_rows("'clusterizersetdistances': incorrect parameters",d)!=safe_cols("'clusterizersetdistances': incorrect parameters",d):
raise RuntimeError("Error while calling 'clusterizersetdistances': looks like one of arguments has wrong size")
npoints = safe_rows("'clusterizersetdistances': incorrect parameters",d)
else:
raise RuntimeError("Error while calling 'clusterizersetdistances': function must have 3 or 4 parameters")
__s = s.ptr
if not is_real_matrix(d):
raise ValueError("'d' parameter can't be cast to real_matrix")
__d = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__d, d, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_clusterizersetdistances(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__d), ctypes.byref(__npoints), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'clusterizersetdistances'")
return
finally:
x_matrix_clear(__d)
_lib_alglib.alglib_clusterizersetahcalgo.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_clusterizersetahcalgo.restype = ctypes.c_int32
def clusterizersetahcalgo(s, algo):
pass
__s = s.ptr
__algo = x_int()
__algo.val = int(algo)
if __algo.val!=algo:
raise ValueError("Error while converting 'algo' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_clusterizersetahcalgo(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__algo))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'clusterizersetahcalgo'")
return
finally:
pass
_lib_alglib.alglib_clusterizersetkmeanslimits.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_clusterizersetkmeanslimits.restype = ctypes.c_int32
def clusterizersetkmeanslimits(s, restarts, maxits):
pass
__s = s.ptr
__restarts = x_int()
__restarts.val = int(restarts)
if __restarts.val!=restarts:
raise ValueError("Error while converting 'restarts' parameter to 'x_int'")
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_clusterizersetkmeanslimits(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__restarts), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'clusterizersetkmeanslimits'")
return
finally:
pass
_lib_alglib.alglib_clusterizersetkmeansinit.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_clusterizersetkmeansinit.restype = ctypes.c_int32
def clusterizersetkmeansinit(s, initalgo):
pass
__s = s.ptr
__initalgo = x_int()
__initalgo.val = int(initalgo)
if __initalgo.val!=initalgo:
raise ValueError("Error while converting 'initalgo' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_clusterizersetkmeansinit(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__initalgo))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'clusterizersetkmeansinit'")
return
finally:
pass
_lib_alglib.alglib_clusterizersetseed.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_clusterizersetseed.restype = ctypes.c_int32
def clusterizersetseed(s, seed):
pass
__s = s.ptr
__seed = x_int()
__seed.val = int(seed)
if __seed.val!=seed:
raise ValueError("Error while converting 'seed' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_clusterizersetseed(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__seed))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'clusterizersetseed'")
return
finally:
pass
_lib_alglib.alglib_clusterizerrunahc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_clusterizerrunahc.restype = ctypes.c_int32
def clusterizerrunahc(s):
pass
__s = s.ptr
__rep = x_ahcreport()
x_ahcreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_clusterizerrunahc(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'clusterizerrunahc'")
__r__rep = ahcreport_from_x(__rep)
return __r__rep
finally:
x_ahcreport_clear(__rep)
_lib_alglib.alglib_smp_clusterizerrunahc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_clusterizerrunahc.restype = ctypes.c_int32
def smp_clusterizerrunahc(s):
pass
__s = s.ptr
__rep = x_ahcreport()
x_ahcreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_clusterizerrunahc(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_clusterizerrunahc'")
__r__rep = ahcreport_from_x(__rep)
return __r__rep
finally:
x_ahcreport_clear(__rep)
_lib_alglib.alglib_clusterizerrunkmeans.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_clusterizerrunkmeans.restype = ctypes.c_int32
def clusterizerrunkmeans(s, k):
pass
__s = s.ptr
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__rep = x_kmeansreport()
x_kmeansreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_clusterizerrunkmeans(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__k), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'clusterizerrunkmeans'")
__r__rep = kmeansreport_from_x(__rep)
return __r__rep
finally:
x_kmeansreport_clear(__rep)
_lib_alglib.alglib_smp_clusterizerrunkmeans.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_clusterizerrunkmeans.restype = ctypes.c_int32
def smp_clusterizerrunkmeans(s, k):
pass
__s = s.ptr
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__rep = x_kmeansreport()
x_kmeansreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_clusterizerrunkmeans(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__k), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_clusterizerrunkmeans'")
__r__rep = kmeansreport_from_x(__rep)
return __r__rep
finally:
x_kmeansreport_clear(__rep)
_lib_alglib.alglib_clusterizergetdistances.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_clusterizergetdistances.restype = ctypes.c_int32
def clusterizergetdistances(xy, npoints, nfeatures, disttype):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nfeatures = x_int()
__nfeatures.val = int(nfeatures)
if __nfeatures.val!=nfeatures:
raise ValueError("Error while converting 'nfeatures' parameter to 'x_int'")
__disttype = x_int()
__disttype.val = int(disttype)
if __disttype.val!=disttype:
raise ValueError("Error while converting 'disttype' parameter to 'x_int'")
__d = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_clusterizergetdistances(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nfeatures), ctypes.byref(__disttype), ctypes.byref(__d))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'clusterizergetdistances'")
__r__d = listlist_from_x(__d)
return __r__d
finally:
x_matrix_clear(__xy)
x_matrix_clear(__d)
_lib_alglib.alglib_smp_clusterizergetdistances.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_clusterizergetdistances.restype = ctypes.c_int32
def smp_clusterizergetdistances(xy, npoints, nfeatures, disttype):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nfeatures = x_int()
__nfeatures.val = int(nfeatures)
if __nfeatures.val!=nfeatures:
raise ValueError("Error while converting 'nfeatures' parameter to 'x_int'")
__disttype = x_int()
__disttype.val = int(disttype)
if __disttype.val!=disttype:
raise ValueError("Error while converting 'disttype' parameter to 'x_int'")
__d = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_clusterizergetdistances(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nfeatures), ctypes.byref(__disttype), ctypes.byref(__d))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_clusterizergetdistances'")
__r__d = listlist_from_x(__d)
return __r__d
finally:
x_matrix_clear(__xy)
x_matrix_clear(__d)
_lib_alglib.alglib_clusterizergetkclusters.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_clusterizergetkclusters.restype = ctypes.c_int32
def clusterizergetkclusters(rep, k):
pass
__rep = x_ahcreport()
x_ahcreport_zero_fields(__rep)
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__cidx = x_vector(cnt=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__cz = x_vector(cnt=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_ahcreport(__rep, rep)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_clusterizergetkclusters(ctypes.byref(_error_msg), ctypes.byref(__rep), ctypes.byref(__k), ctypes.byref(__cidx), ctypes.byref(__cz))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'clusterizergetkclusters'")
__r__cidx = list_from_x(__cidx)
__r__cz = list_from_x(__cz)
return (__r__cidx, __r__cz)
finally:
x_ahcreport_clear(__rep)
x_vector_clear(__cidx)
x_vector_clear(__cz)
_lib_alglib.alglib_clusterizerseparatedbydist.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_clusterizerseparatedbydist.restype = ctypes.c_int32
def clusterizerseparatedbydist(rep, r):
pass
__rep = x_ahcreport()
x_ahcreport_zero_fields(__rep)
__r = ctypes.c_double(r)
__k = x_int()
__k.val = 0
__cidx = x_vector(cnt=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__cz = x_vector(cnt=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_ahcreport(__rep, rep)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_clusterizerseparatedbydist(ctypes.byref(_error_msg), ctypes.byref(__rep), ctypes.byref(__r), ctypes.byref(__k), ctypes.byref(__cidx), ctypes.byref(__cz))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'clusterizerseparatedbydist'")
__r__k = __k.val
__r__cidx = list_from_x(__cidx)
__r__cz = list_from_x(__cz)
return (__r__k, __r__cidx, __r__cz)
finally:
x_ahcreport_clear(__rep)
x_vector_clear(__cidx)
x_vector_clear(__cz)
_lib_alglib.alglib_clusterizerseparatedbycorr.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_clusterizerseparatedbycorr.restype = ctypes.c_int32
def clusterizerseparatedbycorr(rep, r):
pass
__rep = x_ahcreport()
x_ahcreport_zero_fields(__rep)
__r = ctypes.c_double(r)
__k = x_int()
__k.val = 0
__cidx = x_vector(cnt=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__cz = x_vector(cnt=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_ahcreport(__rep, rep)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_clusterizerseparatedbycorr(ctypes.byref(_error_msg), ctypes.byref(__rep), ctypes.byref(__r), ctypes.byref(__k), ctypes.byref(__cidx), ctypes.byref(__cz))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'clusterizerseparatedbycorr'")
__r__k = __k.val
__r__cidx = list_from_x(__cidx)
__r__cz = list_from_x(__cz)
return (__r__k, __r__cidx, __r__cz)
finally:
x_ahcreport_clear(__rep)
x_vector_clear(__cidx)
x_vector_clear(__cz)
_lib_alglib.x_obj_free_decisionforest.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_decisionforest.restype = None
class decisionforest(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_decisionforest(self.ptr)
class x_dfreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("relclserror", ctypes.c_double),
("avgce", ctypes.c_double),
("rmserror", ctypes.c_double),
("avgerror", ctypes.c_double),
("avgrelerror", ctypes.c_double),
("oobrelclserror", ctypes.c_double),
("oobavgce", ctypes.c_double),
("oobrmserror", ctypes.c_double),
("oobavgerror", ctypes.c_double),
("oobavgrelerror", ctypes.c_double)
]
class dfreport(object):
def __init__(self):
self.relclserror = 0
self.avgce = 0
self.rmserror = 0
self.avgerror = 0
self.avgrelerror = 0
self.oobrelclserror = 0
self.oobavgce = 0
self.oobrmserror = 0
self.oobavgerror = 0
self.oobavgrelerror = 0
def x_dfreport_zero_fields(x):
x.relclserror = 0
x.avgce = 0
x.rmserror = 0
x.avgerror = 0
x.avgrelerror = 0
x.oobrelclserror = 0
x.oobavgce = 0
x.oobrmserror = 0
x.oobavgerror = 0
x.oobavgrelerror = 0
return
def x_dfreport_clear(x):
x_dfreport_zero_fields(x)
return
def x_from_dfreport(x,v):
x.relclserror = float(v.relclserror)
x.avgce = float(v.avgce)
x.rmserror = float(v.rmserror)
x.avgerror = float(v.avgerror)
x.avgrelerror = float(v.avgrelerror)
x.oobrelclserror = float(v.oobrelclserror)
x.oobavgce = float(v.oobavgce)
x.oobrmserror = float(v.oobrmserror)
x.oobavgerror = float(v.oobavgerror)
x.oobavgrelerror = float(v.oobavgrelerror)
return
def dfreport_from_x(x):
r = dfreport()
r.relclserror = x.relclserror
r.avgce = x.avgce
r.rmserror = x.rmserror
r.avgerror = x.avgerror
r.avgrelerror = x.avgrelerror
r.oobrelclserror = x.oobrelclserror
r.oobavgce = x.oobavgce
r.oobrmserror = x.oobrmserror
r.oobavgerror = x.oobavgerror
r.oobavgrelerror = x.oobavgrelerror
return r
_lib_alglib.alglib_dfserialize.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_dfserialize.restype = ctypes.c_int32
def dfserialize(obj):
error_msg = ctypes.c_char_p(0)
_s_out = ctypes.c_char_p(0)
retval = _lib_alglib.alglib_dfserialize(ctypes.byref(error_msg), ctypes.byref(obj.ptr), ctypes.byref(_s_out))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(error_msg.value)
else:
raise RuntimeError("Error while calling 'dfserialize'")
s_out = _s_out.value
_lib_alglib.x_free(_s_out)
return s_out
_lib_alglib.alglib_dfunserialize.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_dfunserialize.restype = ctypes.c_int32
def dfunserialize(s_in):
error_msg = ctypes.c_char_p(0)
_s_in = ctypes.c_char_p(s_in)
_obj = ctypes.c_void_p(0)
retval = _lib_alglib.alglib_dfunserialize(ctypes.byref(error_msg), ctypes.byref(_s_in), ctypes.byref(_obj), )
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(error_msg.value)
else:
raise RuntimeError("Error while calling 'dfserialize'")
return decisionforest(_obj)
_lib_alglib.alglib_dfbuildrandomdecisionforest.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_dfbuildrandomdecisionforest.restype = ctypes.c_int32
def dfbuildrandomdecisionforest(xy, npoints, nvars, nclasses, ntrees, r):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__nclasses = x_int()
__nclasses.val = int(nclasses)
if __nclasses.val!=nclasses:
raise ValueError("Error while converting 'nclasses' parameter to 'x_int'")
__ntrees = x_int()
__ntrees.val = int(ntrees)
if __ntrees.val!=ntrees:
raise ValueError("Error while converting 'ntrees' parameter to 'x_int'")
__r = ctypes.c_double(r)
__info = x_int()
__info.val = 0
__df = ctypes.c_void_p(0)
__rep = x_dfreport()
x_dfreport_zero_fields(__rep)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_dfbuildrandomdecisionforest(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__nclasses), ctypes.byref(__ntrees), ctypes.byref(__r), ctypes.byref(__info), ctypes.byref(__df), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'dfbuildrandomdecisionforest'")
__r__info = __info.val
__r__df = decisionforest(__df)
__r__rep = dfreport_from_x(__rep)
return (__r__info, __r__df, __r__rep)
finally:
x_matrix_clear(__xy)
x_dfreport_clear(__rep)
_lib_alglib.alglib_dfbuildrandomdecisionforestx1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_dfbuildrandomdecisionforestx1.restype = ctypes.c_int32
def dfbuildrandomdecisionforestx1(xy, npoints, nvars, nclasses, ntrees, nrndvars, r):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__nclasses = x_int()
__nclasses.val = int(nclasses)
if __nclasses.val!=nclasses:
raise ValueError("Error while converting 'nclasses' parameter to 'x_int'")
__ntrees = x_int()
__ntrees.val = int(ntrees)
if __ntrees.val!=ntrees:
raise ValueError("Error while converting 'ntrees' parameter to 'x_int'")
__nrndvars = x_int()
__nrndvars.val = int(nrndvars)
if __nrndvars.val!=nrndvars:
raise ValueError("Error while converting 'nrndvars' parameter to 'x_int'")
__r = ctypes.c_double(r)
__info = x_int()
__info.val = 0
__df = ctypes.c_void_p(0)
__rep = x_dfreport()
x_dfreport_zero_fields(__rep)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_dfbuildrandomdecisionforestx1(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__nclasses), ctypes.byref(__ntrees), ctypes.byref(__nrndvars), ctypes.byref(__r), ctypes.byref(__info), ctypes.byref(__df), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'dfbuildrandomdecisionforestx1'")
__r__info = __info.val
__r__df = decisionforest(__df)
__r__rep = dfreport_from_x(__rep)
return (__r__info, __r__df, __r__rep)
finally:
x_matrix_clear(__xy)
x_dfreport_clear(__rep)
_lib_alglib.alglib_dfprocess.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_dfprocess.restype = ctypes.c_int32
def dfprocess(df, x, y):
pass
__df = df.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_dfprocess(ctypes.byref(_error_msg), ctypes.byref(__df), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'dfprocess'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_dfprocessi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_dfprocessi.restype = ctypes.c_int32
def dfprocessi(df, x):
pass
__df = df.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__y = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_dfprocessi(ctypes.byref(_error_msg), ctypes.byref(__df), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'dfprocessi'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_dfrelclserror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_dfrelclserror.restype = ctypes.c_int32
def dfrelclserror(df, xy, npoints):
pass
__result = ctypes.c_double(0)
__df = df.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_dfrelclserror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__df), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'dfrelclserror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_dfavgce.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_dfavgce.restype = ctypes.c_int32
def dfavgce(df, xy, npoints):
pass
__result = ctypes.c_double(0)
__df = df.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_dfavgce(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__df), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'dfavgce'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_dfrmserror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_dfrmserror.restype = ctypes.c_int32
def dfrmserror(df, xy, npoints):
pass
__result = ctypes.c_double(0)
__df = df.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_dfrmserror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__df), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'dfrmserror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_dfavgerror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_dfavgerror.restype = ctypes.c_int32
def dfavgerror(df, xy, npoints):
pass
__result = ctypes.c_double(0)
__df = df.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_dfavgerror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__df), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'dfavgerror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_dfavgrelerror.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_dfavgrelerror.restype = ctypes.c_int32
def dfavgrelerror(df, xy, npoints):
pass
__result = ctypes.c_double(0)
__df = df.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_dfavgrelerror(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__df), ctypes.byref(__xy), ctypes.byref(__npoints))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'dfavgrelerror'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_kmeansgenerate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_kmeansgenerate.restype = ctypes.c_int32
def kmeansgenerate(xy, npoints, nvars, k, restarts):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nvars = x_int()
__nvars.val = int(nvars)
if __nvars.val!=nvars:
raise ValueError("Error while converting 'nvars' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__restarts = x_int()
__restarts.val = int(restarts)
if __restarts.val!=restarts:
raise ValueError("Error while converting 'restarts' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__c = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__xyc = x_vector(cnt=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_kmeansgenerate(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nvars), ctypes.byref(__k), ctypes.byref(__restarts), ctypes.byref(__info), ctypes.byref(__c), ctypes.byref(__xyc))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'kmeansgenerate'")
__r__info = __info.val
__r__c = listlist_from_x(__c)
__r__xyc = list_from_x(__xyc)
return (__r__info, __r__c, __r__xyc)
finally:
x_matrix_clear(__xy)
x_matrix_clear(__c)
x_vector_clear(__xyc)
_lib_alglib.alglib_gqgeneraterec.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_gqgeneraterec.restype = ctypes.c_int32
def gqgeneraterec(alpha, beta, mu0, n):
pass
if not is_real_vector(alpha):
raise ValueError("'alpha' parameter can't be cast to real_vector")
__alpha = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(beta):
raise ValueError("'beta' parameter can't be cast to real_vector")
__beta = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__mu0 = ctypes.c_double(mu0)
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__alpha, alpha, DT_REAL, X_CREATE)
x_from_list(__beta, beta, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_gqgeneraterec(ctypes.byref(_error_msg), ctypes.byref(__alpha), ctypes.byref(__beta), ctypes.byref(__mu0), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__x), ctypes.byref(__w))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'gqgeneraterec'")
__r__info = __info.val
__r__x = list_from_x(__x)
__r__w = list_from_x(__w)
return (__r__info, __r__x, __r__w)
finally:
x_vector_clear(__alpha)
x_vector_clear(__beta)
x_vector_clear(__x)
x_vector_clear(__w)
_lib_alglib.alglib_gqgenerategausslobattorec.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_gqgenerategausslobattorec.restype = ctypes.c_int32
def gqgenerategausslobattorec(alpha, beta, mu0, a, b, n):
pass
if not is_real_vector(alpha):
raise ValueError("'alpha' parameter can't be cast to real_vector")
__alpha = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(beta):
raise ValueError("'beta' parameter can't be cast to real_vector")
__beta = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__mu0 = ctypes.c_double(mu0)
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__alpha, alpha, DT_REAL, X_CREATE)
x_from_list(__beta, beta, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_gqgenerategausslobattorec(ctypes.byref(_error_msg), ctypes.byref(__alpha), ctypes.byref(__beta), ctypes.byref(__mu0), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__x), ctypes.byref(__w))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'gqgenerategausslobattorec'")
__r__info = __info.val
__r__x = list_from_x(__x)
__r__w = list_from_x(__w)
return (__r__info, __r__x, __r__w)
finally:
x_vector_clear(__alpha)
x_vector_clear(__beta)
x_vector_clear(__x)
x_vector_clear(__w)
_lib_alglib.alglib_gqgenerategaussradaurec.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_gqgenerategaussradaurec.restype = ctypes.c_int32
def gqgenerategaussradaurec(alpha, beta, mu0, a, n):
pass
if not is_real_vector(alpha):
raise ValueError("'alpha' parameter can't be cast to real_vector")
__alpha = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(beta):
raise ValueError("'beta' parameter can't be cast to real_vector")
__beta = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__mu0 = ctypes.c_double(mu0)
__a = ctypes.c_double(a)
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__alpha, alpha, DT_REAL, X_CREATE)
x_from_list(__beta, beta, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_gqgenerategaussradaurec(ctypes.byref(_error_msg), ctypes.byref(__alpha), ctypes.byref(__beta), ctypes.byref(__mu0), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__x), ctypes.byref(__w))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'gqgenerategaussradaurec'")
__r__info = __info.val
__r__x = list_from_x(__x)
__r__w = list_from_x(__w)
return (__r__info, __r__x, __r__w)
finally:
x_vector_clear(__alpha)
x_vector_clear(__beta)
x_vector_clear(__x)
x_vector_clear(__w)
_lib_alglib.alglib_gqgenerategausslegendre.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_gqgenerategausslegendre.restype = ctypes.c_int32
def gqgenerategausslegendre(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_gqgenerategausslegendre(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__x), ctypes.byref(__w))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'gqgenerategausslegendre'")
__r__info = __info.val
__r__x = list_from_x(__x)
__r__w = list_from_x(__w)
return (__r__info, __r__x, __r__w)
finally:
x_vector_clear(__x)
x_vector_clear(__w)
_lib_alglib.alglib_gqgenerategaussjacobi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_gqgenerategaussjacobi.restype = ctypes.c_int32
def gqgenerategaussjacobi(n, alpha, beta):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
__beta = ctypes.c_double(beta)
__info = x_int()
__info.val = 0
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_gqgenerategaussjacobi(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__alpha), ctypes.byref(__beta), ctypes.byref(__info), ctypes.byref(__x), ctypes.byref(__w))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'gqgenerategaussjacobi'")
__r__info = __info.val
__r__x = list_from_x(__x)
__r__w = list_from_x(__w)
return (__r__info, __r__x, __r__w)
finally:
x_vector_clear(__x)
x_vector_clear(__w)
_lib_alglib.alglib_gqgenerategausslaguerre.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_gqgenerategausslaguerre.restype = ctypes.c_int32
def gqgenerategausslaguerre(n, alpha):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
__info = x_int()
__info.val = 0
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_gqgenerategausslaguerre(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__alpha), ctypes.byref(__info), ctypes.byref(__x), ctypes.byref(__w))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'gqgenerategausslaguerre'")
__r__info = __info.val
__r__x = list_from_x(__x)
__r__w = list_from_x(__w)
return (__r__info, __r__x, __r__w)
finally:
x_vector_clear(__x)
x_vector_clear(__w)
_lib_alglib.alglib_gqgenerategausshermite.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_gqgenerategausshermite.restype = ctypes.c_int32
def gqgenerategausshermite(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_gqgenerategausshermite(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__x), ctypes.byref(__w))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'gqgenerategausshermite'")
__r__info = __info.val
__r__x = list_from_x(__x)
__r__w = list_from_x(__w)
return (__r__info, __r__x, __r__w)
finally:
x_vector_clear(__x)
x_vector_clear(__w)
_lib_alglib.alglib_gkqgeneraterec.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_gkqgeneraterec.restype = ctypes.c_int32
def gkqgeneraterec(alpha, beta, mu0, n):
pass
if not is_real_vector(alpha):
raise ValueError("'alpha' parameter can't be cast to real_vector")
__alpha = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(beta):
raise ValueError("'beta' parameter can't be cast to real_vector")
__beta = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__mu0 = ctypes.c_double(mu0)
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__wkronrod = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__wgauss = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__alpha, alpha, DT_REAL, X_CREATE)
x_from_list(__beta, beta, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_gkqgeneraterec(ctypes.byref(_error_msg), ctypes.byref(__alpha), ctypes.byref(__beta), ctypes.byref(__mu0), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__x), ctypes.byref(__wkronrod), ctypes.byref(__wgauss))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'gkqgeneraterec'")
__r__info = __info.val
__r__x = list_from_x(__x)
__r__wkronrod = list_from_x(__wkronrod)
__r__wgauss = list_from_x(__wgauss)
return (__r__info, __r__x, __r__wkronrod, __r__wgauss)
finally:
x_vector_clear(__alpha)
x_vector_clear(__beta)
x_vector_clear(__x)
x_vector_clear(__wkronrod)
x_vector_clear(__wgauss)
_lib_alglib.alglib_gkqgenerategausslegendre.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_gkqgenerategausslegendre.restype = ctypes.c_int32
def gkqgenerategausslegendre(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__wkronrod = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__wgauss = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_gkqgenerategausslegendre(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__x), ctypes.byref(__wkronrod), ctypes.byref(__wgauss))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'gkqgenerategausslegendre'")
__r__info = __info.val
__r__x = list_from_x(__x)
__r__wkronrod = list_from_x(__wkronrod)
__r__wgauss = list_from_x(__wgauss)
return (__r__info, __r__x, __r__wkronrod, __r__wgauss)
finally:
x_vector_clear(__x)
x_vector_clear(__wkronrod)
x_vector_clear(__wgauss)
_lib_alglib.alglib_gkqgenerategaussjacobi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_gkqgenerategaussjacobi.restype = ctypes.c_int32
def gkqgenerategaussjacobi(n, alpha, beta):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__alpha = ctypes.c_double(alpha)
__beta = ctypes.c_double(beta)
__info = x_int()
__info.val = 0
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__wkronrod = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__wgauss = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_gkqgenerategaussjacobi(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__alpha), ctypes.byref(__beta), ctypes.byref(__info), ctypes.byref(__x), ctypes.byref(__wkronrod), ctypes.byref(__wgauss))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'gkqgenerategaussjacobi'")
__r__info = __info.val
__r__x = list_from_x(__x)
__r__wkronrod = list_from_x(__wkronrod)
__r__wgauss = list_from_x(__wgauss)
return (__r__info, __r__x, __r__wkronrod, __r__wgauss)
finally:
x_vector_clear(__x)
x_vector_clear(__wkronrod)
x_vector_clear(__wgauss)
_lib_alglib.alglib_gkqlegendrecalc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_gkqlegendrecalc.restype = ctypes.c_int32
def gkqlegendrecalc(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__wkronrod = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__wgauss = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_gkqlegendrecalc(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__info), ctypes.byref(__x), ctypes.byref(__wkronrod), ctypes.byref(__wgauss))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'gkqlegendrecalc'")
__r__info = __info.val
__r__x = list_from_x(__x)
__r__wkronrod = list_from_x(__wkronrod)
__r__wgauss = list_from_x(__wgauss)
return (__r__info, __r__x, __r__wkronrod, __r__wgauss)
finally:
x_vector_clear(__x)
x_vector_clear(__wkronrod)
x_vector_clear(__wgauss)
_lib_alglib.alglib_gkqlegendretbl.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_gkqlegendretbl.restype = ctypes.c_int32
def gkqlegendretbl(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__wkronrod = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__wgauss = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__eps = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_gkqlegendretbl(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__wkronrod), ctypes.byref(__wgauss), ctypes.byref(__eps))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'gkqlegendretbl'")
__r__x = list_from_x(__x)
__r__wkronrod = list_from_x(__wkronrod)
__r__wgauss = list_from_x(__wgauss)
__r__eps = __eps.value
return (__r__x, __r__wkronrod, __r__wgauss, __r__eps)
finally:
x_vector_clear(__x)
x_vector_clear(__wkronrod)
x_vector_clear(__wgauss)
class x_autogkreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("terminationtype", x_int),
("nfev", x_int),
("nintervals", x_int)
]
class autogkreport(object):
def __init__(self):
self.terminationtype = 0
self.nfev = 0
self.nintervals = 0
def x_autogkreport_zero_fields(x):
x.terminationtype.val = 0
x.nfev.val = 0
x.nintervals.val = 0
return
def x_autogkreport_clear(x):
x_autogkreport_zero_fields(x)
return
def x_from_autogkreport(x,v):
x.terminationtype.val = int(v.terminationtype)
x.nfev.val = int(v.nfev)
x.nintervals.val = int(v.nintervals)
return
def autogkreport_from_x(x):
r = autogkreport()
r.terminationtype = x.terminationtype.val
r.nfev = x.nfev.val
r.nintervals = x.nintervals.val
return r
_lib_alglib.x_obj_free_autogkstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_autogkstate.restype = None
_lib_alglib.x_autogkstate_get_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_autogkstate_get_needf.restype = None
_lib_alglib.x_autogkstate_set_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_autogkstate_set_needf.restype = None
_lib_alglib.x_autogkstate_get_x.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_autogkstate_get_x.restype = None
_lib_alglib.x_autogkstate_set_x.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_autogkstate_set_x.restype = None
_lib_alglib.x_autogkstate_get_xminusa.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_autogkstate_get_xminusa.restype = None
_lib_alglib.x_autogkstate_set_xminusa.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_autogkstate_set_xminusa.restype = None
_lib_alglib.x_autogkstate_get_bminusx.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_autogkstate_get_bminusx.restype = None
_lib_alglib.x_autogkstate_set_bminusx.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_autogkstate_set_bminusx.restype = None
_lib_alglib.x_autogkstate_get_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_autogkstate_get_f.restype = None
_lib_alglib.x_autogkstate_set_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_autogkstate_set_f.restype = None
class autogkstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_autogkstate(self.ptr)
_lib_alglib.alglib_autogksmooth.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_autogksmooth.restype = ctypes.c_int32
def autogksmooth(a, b):
pass
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__state = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_autogksmooth(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'autogksmooth'")
__r__state = autogkstate(__state)
return __r__state
finally:
pass
_lib_alglib.alglib_autogksmoothw.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_autogksmoothw.restype = ctypes.c_int32
def autogksmoothw(a, b, xwidth):
pass
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__xwidth = ctypes.c_double(xwidth)
__state = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_autogksmoothw(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__xwidth), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'autogksmoothw'")
__r__state = autogkstate(__state)
return __r__state
finally:
pass
_lib_alglib.alglib_autogksingular.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_autogksingular.restype = ctypes.c_int32
def autogksingular(a, b, alpha, beta):
pass
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__alpha = ctypes.c_double(alpha)
__beta = ctypes.c_double(beta)
__state = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_autogksingular(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__alpha), ctypes.byref(__beta), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'autogksingular'")
__r__state = autogkstate(__state)
return __r__state
finally:
pass
def autogkintegrate(state, func, param = None):
# initialize temporaries
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_flag = ctypes.c_uint8()
# initialize reverse communication variables
_xc_x = ctypes.c_double()
_xc_xminusa = ctypes.c_double()
_xc_bminusx = ctypes.c_double()
_xc_f = ctypes.c_double()
# algorithm iterations
while True:
retval = _lib_alglib.alglib_autogkiteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'autogkiteration'")
if not _xc_result:
break
_lib_alglib.x_autogkstate_get_needf(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
_lib_alglib.x_autogkstate_get_x(state.ptr, ctypes.byref(_xc_x))
_lib_alglib.x_autogkstate_get_xminusa(state.ptr, ctypes.byref(_xc_xminusa))
_lib_alglib.x_autogkstate_get_bminusx(state.ptr, ctypes.byref(_xc_bminusx))
_xc_f.value = func(_xc_x.value, _xc_xminusa.value, _xc_bminusx.value, param)
_lib_alglib.x_autogkstate_set_f(state.ptr, ctypes.byref(_xc_f))
continue
raise RuntimeError("ALGLIB: unexpected error in 'autogkintegrate'")
return
_lib_alglib.alglib_autogkresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_autogkresults.restype = ctypes.c_int32
def autogkresults(state):
pass
__state = state.ptr
__v = ctypes.c_double(0)
__rep = x_autogkreport()
x_autogkreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_autogkresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__v), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'autogkresults'")
__r__v = __v.value
__r__rep = autogkreport_from_x(__rep)
return (__r__v, __r__rep)
finally:
x_autogkreport_clear(__rep)
_lib_alglib.alglib_fftc1d.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_fftc1d.restype = ctypes.c_int32
def fftc1d(*functionargs):
if len(functionargs)==2:
__friendly_form = False
a,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
n = safe_len("'fftc1d': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'fftc1d': function must have 1 or 2 parameters")
if not is_complex_vector(a):
raise ValueError("'a' parameter can't be cast to complex_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_fftc1d(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'fftc1d'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_fftc1dinv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_fftc1dinv.restype = ctypes.c_int32
def fftc1dinv(*functionargs):
if len(functionargs)==2:
__friendly_form = False
a,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
n = safe_len("'fftc1dinv': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'fftc1dinv': function must have 1 or 2 parameters")
if not is_complex_vector(a):
raise ValueError("'a' parameter can't be cast to complex_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_fftc1dinv(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'fftc1dinv'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_fftr1d.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_fftr1d.restype = ctypes.c_int32
def fftr1d(*functionargs):
if len(functionargs)==2:
__friendly_form = False
a,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
n = safe_len("'fftr1d': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'fftr1d': function must have 1 or 2 parameters")
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__f = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_fftr1d(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__f))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'fftr1d'")
__r__f = list_from_x(__f)
return __r__f
finally:
x_vector_clear(__a)
x_vector_clear(__f)
_lib_alglib.alglib_fftr1dinv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_fftr1dinv.restype = ctypes.c_int32
def fftr1dinv(*functionargs):
if len(functionargs)==2:
__friendly_form = False
f,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
f, = functionargs
n = safe_len("'fftr1dinv': incorrect parameters",f)
else:
raise RuntimeError("Error while calling 'fftr1dinv': function must have 1 or 2 parameters")
if not is_complex_vector(f):
raise ValueError("'f' parameter can't be cast to complex_vector")
__f = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__a = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__f, f, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_fftr1dinv(ctypes.byref(_error_msg), ctypes.byref(__f), ctypes.byref(__n), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'fftr1dinv'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__f)
x_vector_clear(__a)
_lib_alglib.alglib_fhtr1d.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_fhtr1d.restype = ctypes.c_int32
def fhtr1d(a, n):
pass
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_fhtr1d(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'fhtr1d'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_fhtr1dinv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_fhtr1dinv.restype = ctypes.c_int32
def fhtr1dinv(a, n):
pass
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_fhtr1dinv(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'fhtr1dinv'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_convc1d.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_convc1d.restype = ctypes.c_int32
def convc1d(a, m, b, n):
pass
if not is_complex_vector(a):
raise ValueError("'a' parameter can't be cast to complex_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__r = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_convc1d(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__b), ctypes.byref(__n), ctypes.byref(__r))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'convc1d'")
__r__r = list_from_x(__r)
return __r__r
finally:
x_vector_clear(__a)
x_vector_clear(__b)
x_vector_clear(__r)
_lib_alglib.alglib_convc1dinv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_convc1dinv.restype = ctypes.c_int32
def convc1dinv(a, m, b, n):
pass
if not is_complex_vector(a):
raise ValueError("'a' parameter can't be cast to complex_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__r = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_convc1dinv(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__b), ctypes.byref(__n), ctypes.byref(__r))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'convc1dinv'")
__r__r = list_from_x(__r)
return __r__r
finally:
x_vector_clear(__a)
x_vector_clear(__b)
x_vector_clear(__r)
_lib_alglib.alglib_convc1dcircular.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_convc1dcircular.restype = ctypes.c_int32
def convc1dcircular(s, m, r, n):
pass
if not is_complex_vector(s):
raise ValueError("'s' parameter can't be cast to complex_vector")
__s = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_complex_vector(r):
raise ValueError("'r' parameter can't be cast to complex_vector")
__r = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__s, s, DT_COMPLEX, X_CREATE)
x_from_list(__r, r, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_convc1dcircular(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__m), ctypes.byref(__r), ctypes.byref(__n), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'convc1dcircular'")
__r__c = list_from_x(__c)
return __r__c
finally:
x_vector_clear(__s)
x_vector_clear(__r)
x_vector_clear(__c)
_lib_alglib.alglib_convc1dcircularinv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_convc1dcircularinv.restype = ctypes.c_int32
def convc1dcircularinv(a, m, b, n):
pass
if not is_complex_vector(a):
raise ValueError("'a' parameter can't be cast to complex_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_complex_vector(b):
raise ValueError("'b' parameter can't be cast to complex_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__r = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__b, b, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_convc1dcircularinv(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__b), ctypes.byref(__n), ctypes.byref(__r))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'convc1dcircularinv'")
__r__r = list_from_x(__r)
return __r__r
finally:
x_vector_clear(__a)
x_vector_clear(__b)
x_vector_clear(__r)
_lib_alglib.alglib_convr1d.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_convr1d.restype = ctypes.c_int32
def convr1d(a, m, b, n):
pass
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__r = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_convr1d(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__b), ctypes.byref(__n), ctypes.byref(__r))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'convr1d'")
__r__r = list_from_x(__r)
return __r__r
finally:
x_vector_clear(__a)
x_vector_clear(__b)
x_vector_clear(__r)
_lib_alglib.alglib_convr1dinv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_convr1dinv.restype = ctypes.c_int32
def convr1dinv(a, m, b, n):
pass
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__r = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_convr1dinv(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__b), ctypes.byref(__n), ctypes.byref(__r))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'convr1dinv'")
__r__r = list_from_x(__r)
return __r__r
finally:
x_vector_clear(__a)
x_vector_clear(__b)
x_vector_clear(__r)
_lib_alglib.alglib_convr1dcircular.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_convr1dcircular.restype = ctypes.c_int32
def convr1dcircular(s, m, r, n):
pass
if not is_real_vector(s):
raise ValueError("'s' parameter can't be cast to real_vector")
__s = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(r):
raise ValueError("'r' parameter can't be cast to real_vector")
__r = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__s, s, DT_REAL, X_CREATE)
x_from_list(__r, r, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_convr1dcircular(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__m), ctypes.byref(__r), ctypes.byref(__n), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'convr1dcircular'")
__r__c = list_from_x(__c)
return __r__c
finally:
x_vector_clear(__s)
x_vector_clear(__r)
x_vector_clear(__c)
_lib_alglib.alglib_convr1dcircularinv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_convr1dcircularinv.restype = ctypes.c_int32
def convr1dcircularinv(a, m, b, n):
pass
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__r = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_convr1dcircularinv(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__m), ctypes.byref(__b), ctypes.byref(__n), ctypes.byref(__r))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'convr1dcircularinv'")
__r__r = list_from_x(__r)
return __r__r
finally:
x_vector_clear(__a)
x_vector_clear(__b)
x_vector_clear(__r)
_lib_alglib.alglib_corrc1d.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_corrc1d.restype = ctypes.c_int32
def corrc1d(signal, n, pattern, m):
pass
if not is_complex_vector(signal):
raise ValueError("'signal' parameter can't be cast to complex_vector")
__signal = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_complex_vector(pattern):
raise ValueError("'pattern' parameter can't be cast to complex_vector")
__pattern = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__r = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__signal, signal, DT_COMPLEX, X_CREATE)
x_from_list(__pattern, pattern, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_corrc1d(ctypes.byref(_error_msg), ctypes.byref(__signal), ctypes.byref(__n), ctypes.byref(__pattern), ctypes.byref(__m), ctypes.byref(__r))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'corrc1d'")
__r__r = list_from_x(__r)
return __r__r
finally:
x_vector_clear(__signal)
x_vector_clear(__pattern)
x_vector_clear(__r)
_lib_alglib.alglib_corrc1dcircular.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_corrc1dcircular.restype = ctypes.c_int32
def corrc1dcircular(signal, m, pattern, n):
pass
if not is_complex_vector(signal):
raise ValueError("'signal' parameter can't be cast to complex_vector")
__signal = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_complex_vector(pattern):
raise ValueError("'pattern' parameter can't be cast to complex_vector")
__pattern = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__signal, signal, DT_COMPLEX, X_CREATE)
x_from_list(__pattern, pattern, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_corrc1dcircular(ctypes.byref(_error_msg), ctypes.byref(__signal), ctypes.byref(__m), ctypes.byref(__pattern), ctypes.byref(__n), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'corrc1dcircular'")
__r__c = list_from_x(__c)
return __r__c
finally:
x_vector_clear(__signal)
x_vector_clear(__pattern)
x_vector_clear(__c)
_lib_alglib.alglib_corrr1d.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_corrr1d.restype = ctypes.c_int32
def corrr1d(signal, n, pattern, m):
pass
if not is_real_vector(signal):
raise ValueError("'signal' parameter can't be cast to real_vector")
__signal = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(pattern):
raise ValueError("'pattern' parameter can't be cast to real_vector")
__pattern = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__r = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__signal, signal, DT_REAL, X_CREATE)
x_from_list(__pattern, pattern, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_corrr1d(ctypes.byref(_error_msg), ctypes.byref(__signal), ctypes.byref(__n), ctypes.byref(__pattern), ctypes.byref(__m), ctypes.byref(__r))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'corrr1d'")
__r__r = list_from_x(__r)
return __r__r
finally:
x_vector_clear(__signal)
x_vector_clear(__pattern)
x_vector_clear(__r)
_lib_alglib.alglib_corrr1dcircular.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_corrr1dcircular.restype = ctypes.c_int32
def corrr1dcircular(signal, m, pattern, n):
pass
if not is_real_vector(signal):
raise ValueError("'signal' parameter can't be cast to real_vector")
__signal = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(pattern):
raise ValueError("'pattern' parameter can't be cast to real_vector")
__pattern = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__signal, signal, DT_REAL, X_CREATE)
x_from_list(__pattern, pattern, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_corrr1dcircular(ctypes.byref(_error_msg), ctypes.byref(__signal), ctypes.byref(__m), ctypes.byref(__pattern), ctypes.byref(__n), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'corrr1dcircular'")
__r__c = list_from_x(__c)
return __r__c
finally:
x_vector_clear(__signal)
x_vector_clear(__pattern)
x_vector_clear(__c)
_lib_alglib.x_obj_free_idwinterpolant.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_idwinterpolant.restype = None
class idwinterpolant(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_idwinterpolant(self.ptr)
_lib_alglib.alglib_idwcalc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_idwcalc.restype = ctypes.c_int32
def idwcalc(z, x):
pass
__result = ctypes.c_double(0)
__z = z.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_idwcalc(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__z), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'idwcalc'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__x)
_lib_alglib.alglib_idwbuildmodifiedshepard.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_idwbuildmodifiedshepard.restype = ctypes.c_int32
def idwbuildmodifiedshepard(xy, n, nx, d, nq, nw):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__nx = x_int()
__nx.val = int(nx)
if __nx.val!=nx:
raise ValueError("Error while converting 'nx' parameter to 'x_int'")
__d = x_int()
__d.val = int(d)
if __d.val!=d:
raise ValueError("Error while converting 'd' parameter to 'x_int'")
__nq = x_int()
__nq.val = int(nq)
if __nq.val!=nq:
raise ValueError("Error while converting 'nq' parameter to 'x_int'")
__nw = x_int()
__nw.val = int(nw)
if __nw.val!=nw:
raise ValueError("Error while converting 'nw' parameter to 'x_int'")
__z = ctypes.c_void_p(0)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_idwbuildmodifiedshepard(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__n), ctypes.byref(__nx), ctypes.byref(__d), ctypes.byref(__nq), ctypes.byref(__nw), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'idwbuildmodifiedshepard'")
__r__z = idwinterpolant(__z)
return __r__z
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_idwbuildmodifiedshepardr.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_idwbuildmodifiedshepardr.restype = ctypes.c_int32
def idwbuildmodifiedshepardr(xy, n, nx, r):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__nx = x_int()
__nx.val = int(nx)
if __nx.val!=nx:
raise ValueError("Error while converting 'nx' parameter to 'x_int'")
__r = ctypes.c_double(r)
__z = ctypes.c_void_p(0)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_idwbuildmodifiedshepardr(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__n), ctypes.byref(__nx), ctypes.byref(__r), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'idwbuildmodifiedshepardr'")
__r__z = idwinterpolant(__z)
return __r__z
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_idwbuildnoisy.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_idwbuildnoisy.restype = ctypes.c_int32
def idwbuildnoisy(xy, n, nx, d, nq, nw):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__nx = x_int()
__nx.val = int(nx)
if __nx.val!=nx:
raise ValueError("Error while converting 'nx' parameter to 'x_int'")
__d = x_int()
__d.val = int(d)
if __d.val!=d:
raise ValueError("Error while converting 'd' parameter to 'x_int'")
__nq = x_int()
__nq.val = int(nq)
if __nq.val!=nq:
raise ValueError("Error while converting 'nq' parameter to 'x_int'")
__nw = x_int()
__nw.val = int(nw)
if __nw.val!=nw:
raise ValueError("Error while converting 'nw' parameter to 'x_int'")
__z = ctypes.c_void_p(0)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_idwbuildnoisy(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__n), ctypes.byref(__nx), ctypes.byref(__d), ctypes.byref(__nq), ctypes.byref(__nw), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'idwbuildnoisy'")
__r__z = idwinterpolant(__z)
return __r__z
finally:
x_matrix_clear(__xy)
_lib_alglib.x_obj_free_barycentricinterpolant.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_barycentricinterpolant.restype = None
class barycentricinterpolant(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_barycentricinterpolant(self.ptr)
_lib_alglib.alglib_barycentriccalc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_barycentriccalc.restype = ctypes.c_int32
def barycentriccalc(b, t):
pass
__result = ctypes.c_double(0)
__b = b.ptr
__t = ctypes.c_double(t)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_barycentriccalc(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__b), ctypes.byref(__t))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'barycentriccalc'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_barycentricdiff1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_barycentricdiff1.restype = ctypes.c_int32
def barycentricdiff1(b, t):
pass
__b = b.ptr
__t = ctypes.c_double(t)
__f = ctypes.c_double(0)
__df = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_barycentricdiff1(ctypes.byref(_error_msg), ctypes.byref(__b), ctypes.byref(__t), ctypes.byref(__f), ctypes.byref(__df))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'barycentricdiff1'")
__r__f = __f.value
__r__df = __df.value
return (__r__f, __r__df)
finally:
pass
_lib_alglib.alglib_barycentricdiff2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_barycentricdiff2.restype = ctypes.c_int32
def barycentricdiff2(b, t):
pass
__b = b.ptr
__t = ctypes.c_double(t)
__f = ctypes.c_double(0)
__df = ctypes.c_double(0)
__d2f = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_barycentricdiff2(ctypes.byref(_error_msg), ctypes.byref(__b), ctypes.byref(__t), ctypes.byref(__f), ctypes.byref(__df), ctypes.byref(__d2f))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'barycentricdiff2'")
__r__f = __f.value
__r__df = __df.value
__r__d2f = __d2f.value
return (__r__f, __r__df, __r__d2f)
finally:
pass
_lib_alglib.alglib_barycentriclintransx.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_barycentriclintransx.restype = ctypes.c_int32
def barycentriclintransx(b, ca, cb):
pass
__b = b.ptr
__ca = ctypes.c_double(ca)
__cb = ctypes.c_double(cb)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_barycentriclintransx(ctypes.byref(_error_msg), ctypes.byref(__b), ctypes.byref(__ca), ctypes.byref(__cb))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'barycentriclintransx'")
return
finally:
pass
_lib_alglib.alglib_barycentriclintransy.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_barycentriclintransy.restype = ctypes.c_int32
def barycentriclintransy(b, ca, cb):
pass
__b = b.ptr
__ca = ctypes.c_double(ca)
__cb = ctypes.c_double(cb)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_barycentriclintransy(ctypes.byref(_error_msg), ctypes.byref(__b), ctypes.byref(__ca), ctypes.byref(__cb))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'barycentriclintransy'")
return
finally:
pass
_lib_alglib.alglib_barycentricunpack.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_barycentricunpack.restype = ctypes.c_int32
def barycentricunpack(b):
pass
__b = b.ptr
__n = x_int()
__n.val = 0
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__y = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__w = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_barycentricunpack(ctypes.byref(_error_msg), ctypes.byref(__b), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'barycentricunpack'")
__r__n = __n.val
__r__x = list_from_x(__x)
__r__y = list_from_x(__y)
__r__w = list_from_x(__w)
return (__r__n, __r__x, __r__y, __r__w)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
_lib_alglib.alglib_barycentricbuildxyw.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_barycentricbuildxyw.restype = ctypes.c_int32
def barycentricbuildxyw(x, y, w, n):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__b = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_barycentricbuildxyw(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__n), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'barycentricbuildxyw'")
__r__b = barycentricinterpolant(__b)
return __r__b
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
_lib_alglib.alglib_barycentricbuildfloaterhormann.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_barycentricbuildfloaterhormann.restype = ctypes.c_int32
def barycentricbuildfloaterhormann(x, y, n, d):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__d = x_int()
__d.val = int(d)
if __d.val!=d:
raise ValueError("Error while converting 'd' parameter to 'x_int'")
__b = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_barycentricbuildfloaterhormann(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__d), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'barycentricbuildfloaterhormann'")
__r__b = barycentricinterpolant(__b)
return __r__b
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.x_obj_free_spline1dinterpolant.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_spline1dinterpolant.restype = None
class spline1dinterpolant(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_spline1dinterpolant(self.ptr)
class x_spline1dfitreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("taskrcond", ctypes.c_double),
("rmserror", ctypes.c_double),
("avgerror", ctypes.c_double),
("avgrelerror", ctypes.c_double),
("maxerror", ctypes.c_double)
]
class spline1dfitreport(object):
def __init__(self):
self.taskrcond = 0
self.rmserror = 0
self.avgerror = 0
self.avgrelerror = 0
self.maxerror = 0
def x_spline1dfitreport_zero_fields(x):
x.taskrcond = 0
x.rmserror = 0
x.avgerror = 0
x.avgrelerror = 0
x.maxerror = 0
return
def x_spline1dfitreport_clear(x):
x_spline1dfitreport_zero_fields(x)
return
def x_from_spline1dfitreport(x,v):
x.taskrcond = float(v.taskrcond)
x.rmserror = float(v.rmserror)
x.avgerror = float(v.avgerror)
x.avgrelerror = float(v.avgrelerror)
x.maxerror = float(v.maxerror)
return
def spline1dfitreport_from_x(x):
r = spline1dfitreport()
r.taskrcond = x.taskrcond
r.rmserror = x.rmserror
r.avgerror = x.avgerror
r.avgrelerror = x.avgrelerror
r.maxerror = x.maxerror
return r
_lib_alglib.alglib_spline1dbuildlinear.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dbuildlinear.restype = ctypes.c_int32
def spline1dbuildlinear(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,y,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_len("'spline1dbuildlinear': incorrect parameters",x)!=safe_len("'spline1dbuildlinear': incorrect parameters",y):
raise RuntimeError("Error while calling 'spline1dbuildlinear': looks like one of arguments has wrong size")
n = safe_len("'spline1dbuildlinear': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'spline1dbuildlinear': function must have 2 or 3 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dbuildlinear(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dbuildlinear'")
__r__c = spline1dinterpolant(__c)
return __r__c
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_spline1dbuildcubic.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dbuildcubic.restype = ctypes.c_int32
def spline1dbuildcubic(*functionargs):
if len(functionargs)==7:
__friendly_form = False
x,y,n,boundltype,boundl,boundrtype,boundr = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_len("'spline1dbuildcubic': incorrect parameters",x)!=safe_len("'spline1dbuildcubic': incorrect parameters",y):
raise RuntimeError("Error while calling 'spline1dbuildcubic': looks like one of arguments has wrong size")
n = safe_len("'spline1dbuildcubic': incorrect parameters",x)
boundltype = 0
boundl = 0
boundrtype = 0
boundr = 0
else:
raise RuntimeError("Error while calling 'spline1dbuildcubic': function must have 2 or 7 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__boundltype = x_int()
__boundltype.val = int(boundltype)
if __boundltype.val!=boundltype:
raise ValueError("Error while converting 'boundltype' parameter to 'x_int'")
__boundl = ctypes.c_double(boundl)
__boundrtype = x_int()
__boundrtype.val = int(boundrtype)
if __boundrtype.val!=boundrtype:
raise ValueError("Error while converting 'boundrtype' parameter to 'x_int'")
__boundr = ctypes.c_double(boundr)
__c = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dbuildcubic(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__boundltype), ctypes.byref(__boundl), ctypes.byref(__boundrtype), ctypes.byref(__boundr), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dbuildcubic'")
__r__c = spline1dinterpolant(__c)
return __r__c
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_spline1dgriddiffcubic.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dgriddiffcubic.restype = ctypes.c_int32
def spline1dgriddiffcubic(*functionargs):
if len(functionargs)==7:
__friendly_form = False
x,y,n,boundltype,boundl,boundrtype,boundr = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_len("'spline1dgriddiffcubic': incorrect parameters",x)!=safe_len("'spline1dgriddiffcubic': incorrect parameters",y):
raise RuntimeError("Error while calling 'spline1dgriddiffcubic': looks like one of arguments has wrong size")
n = safe_len("'spline1dgriddiffcubic': incorrect parameters",x)
boundltype = 0
boundl = 0
boundrtype = 0
boundr = 0
else:
raise RuntimeError("Error while calling 'spline1dgriddiffcubic': function must have 2 or 7 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__boundltype = x_int()
__boundltype.val = int(boundltype)
if __boundltype.val!=boundltype:
raise ValueError("Error while converting 'boundltype' parameter to 'x_int'")
__boundl = ctypes.c_double(boundl)
__boundrtype = x_int()
__boundrtype.val = int(boundrtype)
if __boundrtype.val!=boundrtype:
raise ValueError("Error while converting 'boundrtype' parameter to 'x_int'")
__boundr = ctypes.c_double(boundr)
__d = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dgriddiffcubic(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__boundltype), ctypes.byref(__boundl), ctypes.byref(__boundrtype), ctypes.byref(__boundr), ctypes.byref(__d))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dgriddiffcubic'")
__r__d = list_from_x(__d)
return __r__d
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__d)
_lib_alglib.alglib_spline1dgriddiff2cubic.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dgriddiff2cubic.restype = ctypes.c_int32
def spline1dgriddiff2cubic(*functionargs):
if len(functionargs)==7:
__friendly_form = False
x,y,n,boundltype,boundl,boundrtype,boundr = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_len("'spline1dgriddiff2cubic': incorrect parameters",x)!=safe_len("'spline1dgriddiff2cubic': incorrect parameters",y):
raise RuntimeError("Error while calling 'spline1dgriddiff2cubic': looks like one of arguments has wrong size")
n = safe_len("'spline1dgriddiff2cubic': incorrect parameters",x)
boundltype = 0
boundl = 0
boundrtype = 0
boundr = 0
else:
raise RuntimeError("Error while calling 'spline1dgriddiff2cubic': function must have 2 or 7 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__boundltype = x_int()
__boundltype.val = int(boundltype)
if __boundltype.val!=boundltype:
raise ValueError("Error while converting 'boundltype' parameter to 'x_int'")
__boundl = ctypes.c_double(boundl)
__boundrtype = x_int()
__boundrtype.val = int(boundrtype)
if __boundrtype.val!=boundrtype:
raise ValueError("Error while converting 'boundrtype' parameter to 'x_int'")
__boundr = ctypes.c_double(boundr)
__d1 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__d2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dgriddiff2cubic(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__boundltype), ctypes.byref(__boundl), ctypes.byref(__boundrtype), ctypes.byref(__boundr), ctypes.byref(__d1), ctypes.byref(__d2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dgriddiff2cubic'")
__r__d1 = list_from_x(__d1)
__r__d2 = list_from_x(__d2)
return (__r__d1, __r__d2)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__d1)
x_vector_clear(__d2)
_lib_alglib.alglib_spline1dconvcubic.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dconvcubic.restype = ctypes.c_int32
def spline1dconvcubic(*functionargs):
if len(functionargs)==9:
__friendly_form = False
x,y,n,boundltype,boundl,boundrtype,boundr,x2,n2 = functionargs
elif len(functionargs)==3:
__friendly_form = True
x,y,x2 = functionargs
if safe_len("'spline1dconvcubic': incorrect parameters",x)!=safe_len("'spline1dconvcubic': incorrect parameters",y):
raise RuntimeError("Error while calling 'spline1dconvcubic': looks like one of arguments has wrong size")
n = safe_len("'spline1dconvcubic': incorrect parameters",x)
boundltype = 0
boundl = 0
boundrtype = 0
boundr = 0
n2 = safe_len("'spline1dconvcubic': incorrect parameters",x2)
else:
raise RuntimeError("Error while calling 'spline1dconvcubic': function must have 3 or 9 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__boundltype = x_int()
__boundltype.val = int(boundltype)
if __boundltype.val!=boundltype:
raise ValueError("Error while converting 'boundltype' parameter to 'x_int'")
__boundl = ctypes.c_double(boundl)
__boundrtype = x_int()
__boundrtype.val = int(boundrtype)
if __boundrtype.val!=boundrtype:
raise ValueError("Error while converting 'boundrtype' parameter to 'x_int'")
__boundr = ctypes.c_double(boundr)
if not is_real_vector(x2):
raise ValueError("'x2' parameter can't be cast to real_vector")
__x2 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n2 = x_int()
__n2.val = int(n2)
if __n2.val!=n2:
raise ValueError("Error while converting 'n2' parameter to 'x_int'")
__y2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__x2, x2, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dconvcubic(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__boundltype), ctypes.byref(__boundl), ctypes.byref(__boundrtype), ctypes.byref(__boundr), ctypes.byref(__x2), ctypes.byref(__n2), ctypes.byref(__y2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dconvcubic'")
__r__y2 = list_from_x(__y2)
return __r__y2
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__x2)
x_vector_clear(__y2)
_lib_alglib.alglib_spline1dconvdiffcubic.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dconvdiffcubic.restype = ctypes.c_int32
def spline1dconvdiffcubic(*functionargs):
if len(functionargs)==9:
__friendly_form = False
x,y,n,boundltype,boundl,boundrtype,boundr,x2,n2 = functionargs
elif len(functionargs)==3:
__friendly_form = True
x,y,x2 = functionargs
if safe_len("'spline1dconvdiffcubic': incorrect parameters",x)!=safe_len("'spline1dconvdiffcubic': incorrect parameters",y):
raise RuntimeError("Error while calling 'spline1dconvdiffcubic': looks like one of arguments has wrong size")
n = safe_len("'spline1dconvdiffcubic': incorrect parameters",x)
boundltype = 0
boundl = 0
boundrtype = 0
boundr = 0
n2 = safe_len("'spline1dconvdiffcubic': incorrect parameters",x2)
else:
raise RuntimeError("Error while calling 'spline1dconvdiffcubic': function must have 3 or 9 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__boundltype = x_int()
__boundltype.val = int(boundltype)
if __boundltype.val!=boundltype:
raise ValueError("Error while converting 'boundltype' parameter to 'x_int'")
__boundl = ctypes.c_double(boundl)
__boundrtype = x_int()
__boundrtype.val = int(boundrtype)
if __boundrtype.val!=boundrtype:
raise ValueError("Error while converting 'boundrtype' parameter to 'x_int'")
__boundr = ctypes.c_double(boundr)
if not is_real_vector(x2):
raise ValueError("'x2' parameter can't be cast to real_vector")
__x2 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n2 = x_int()
__n2.val = int(n2)
if __n2.val!=n2:
raise ValueError("Error while converting 'n2' parameter to 'x_int'")
__y2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__d2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__x2, x2, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dconvdiffcubic(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__boundltype), ctypes.byref(__boundl), ctypes.byref(__boundrtype), ctypes.byref(__boundr), ctypes.byref(__x2), ctypes.byref(__n2), ctypes.byref(__y2), ctypes.byref(__d2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dconvdiffcubic'")
__r__y2 = list_from_x(__y2)
__r__d2 = list_from_x(__d2)
return (__r__y2, __r__d2)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__x2)
x_vector_clear(__y2)
x_vector_clear(__d2)
_lib_alglib.alglib_spline1dconvdiff2cubic.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dconvdiff2cubic.restype = ctypes.c_int32
def spline1dconvdiff2cubic(*functionargs):
if len(functionargs)==9:
__friendly_form = False
x,y,n,boundltype,boundl,boundrtype,boundr,x2,n2 = functionargs
elif len(functionargs)==3:
__friendly_form = True
x,y,x2 = functionargs
if safe_len("'spline1dconvdiff2cubic': incorrect parameters",x)!=safe_len("'spline1dconvdiff2cubic': incorrect parameters",y):
raise RuntimeError("Error while calling 'spline1dconvdiff2cubic': looks like one of arguments has wrong size")
n = safe_len("'spline1dconvdiff2cubic': incorrect parameters",x)
boundltype = 0
boundl = 0
boundrtype = 0
boundr = 0
n2 = safe_len("'spline1dconvdiff2cubic': incorrect parameters",x2)
else:
raise RuntimeError("Error while calling 'spline1dconvdiff2cubic': function must have 3 or 9 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__boundltype = x_int()
__boundltype.val = int(boundltype)
if __boundltype.val!=boundltype:
raise ValueError("Error while converting 'boundltype' parameter to 'x_int'")
__boundl = ctypes.c_double(boundl)
__boundrtype = x_int()
__boundrtype.val = int(boundrtype)
if __boundrtype.val!=boundrtype:
raise ValueError("Error while converting 'boundrtype' parameter to 'x_int'")
__boundr = ctypes.c_double(boundr)
if not is_real_vector(x2):
raise ValueError("'x2' parameter can't be cast to real_vector")
__x2 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n2 = x_int()
__n2.val = int(n2)
if __n2.val!=n2:
raise ValueError("Error while converting 'n2' parameter to 'x_int'")
__y2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__d2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__dd2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__x2, x2, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dconvdiff2cubic(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__boundltype), ctypes.byref(__boundl), ctypes.byref(__boundrtype), ctypes.byref(__boundr), ctypes.byref(__x2), ctypes.byref(__n2), ctypes.byref(__y2), ctypes.byref(__d2), ctypes.byref(__dd2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dconvdiff2cubic'")
__r__y2 = list_from_x(__y2)
__r__d2 = list_from_x(__d2)
__r__dd2 = list_from_x(__dd2)
return (__r__y2, __r__d2, __r__dd2)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__x2)
x_vector_clear(__y2)
x_vector_clear(__d2)
x_vector_clear(__dd2)
_lib_alglib.alglib_spline1dbuildcatmullrom.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dbuildcatmullrom.restype = ctypes.c_int32
def spline1dbuildcatmullrom(*functionargs):
if len(functionargs)==5:
__friendly_form = False
x,y,n,boundtype,tension = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_len("'spline1dbuildcatmullrom': incorrect parameters",x)!=safe_len("'spline1dbuildcatmullrom': incorrect parameters",y):
raise RuntimeError("Error while calling 'spline1dbuildcatmullrom': looks like one of arguments has wrong size")
n = safe_len("'spline1dbuildcatmullrom': incorrect parameters",x)
boundtype = 0
tension = 0
else:
raise RuntimeError("Error while calling 'spline1dbuildcatmullrom': function must have 2 or 5 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__boundtype = x_int()
__boundtype.val = int(boundtype)
if __boundtype.val!=boundtype:
raise ValueError("Error while converting 'boundtype' parameter to 'x_int'")
__tension = ctypes.c_double(tension)
__c = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dbuildcatmullrom(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__boundtype), ctypes.byref(__tension), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dbuildcatmullrom'")
__r__c = spline1dinterpolant(__c)
return __r__c
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_spline1dbuildhermite.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dbuildhermite.restype = ctypes.c_int32
def spline1dbuildhermite(*functionargs):
if len(functionargs)==4:
__friendly_form = False
x,y,d,n = functionargs
elif len(functionargs)==3:
__friendly_form = True
x,y,d = functionargs
if safe_len("'spline1dbuildhermite': incorrect parameters",x)!=safe_len("'spline1dbuildhermite': incorrect parameters",y) or safe_len("'spline1dbuildhermite': incorrect parameters",x)!=safe_len("'spline1dbuildhermite': incorrect parameters",d):
raise RuntimeError("Error while calling 'spline1dbuildhermite': looks like one of arguments has wrong size")
n = safe_len("'spline1dbuildhermite': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'spline1dbuildhermite': function must have 3 or 4 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(d):
raise ValueError("'d' parameter can't be cast to real_vector")
__d = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__d, d, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dbuildhermite(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__d), ctypes.byref(__n), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dbuildhermite'")
__r__c = spline1dinterpolant(__c)
return __r__c
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__d)
_lib_alglib.alglib_spline1dbuildakima.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dbuildakima.restype = ctypes.c_int32
def spline1dbuildakima(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,y,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_len("'spline1dbuildakima': incorrect parameters",x)!=safe_len("'spline1dbuildakima': incorrect parameters",y):
raise RuntimeError("Error while calling 'spline1dbuildakima': looks like one of arguments has wrong size")
n = safe_len("'spline1dbuildakima': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'spline1dbuildakima': function must have 2 or 3 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dbuildakima(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dbuildakima'")
__r__c = spline1dinterpolant(__c)
return __r__c
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_spline1dcalc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dcalc.restype = ctypes.c_int32
def spline1dcalc(c, x):
pass
__result = ctypes.c_double(0)
__c = c.ptr
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dcalc(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__c), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dcalc'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_spline1ddiff.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1ddiff.restype = ctypes.c_int32
def spline1ddiff(c, x):
pass
__c = c.ptr
__x = ctypes.c_double(x)
__s = ctypes.c_double(0)
__ds = ctypes.c_double(0)
__d2s = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1ddiff(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__x), ctypes.byref(__s), ctypes.byref(__ds), ctypes.byref(__d2s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1ddiff'")
__r__s = __s.value
__r__ds = __ds.value
__r__d2s = __d2s.value
return (__r__s, __r__ds, __r__d2s)
finally:
pass
_lib_alglib.alglib_spline1dunpack.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dunpack.restype = ctypes.c_int32
def spline1dunpack(c):
pass
__c = c.ptr
__n = x_int()
__n.val = 0
__tbl = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dunpack(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__n), ctypes.byref(__tbl))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dunpack'")
__r__n = __n.val
__r__tbl = listlist_from_x(__tbl)
return (__r__n, __r__tbl)
finally:
x_matrix_clear(__tbl)
_lib_alglib.alglib_spline1dlintransx.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dlintransx.restype = ctypes.c_int32
def spline1dlintransx(c, a, b):
pass
__c = c.ptr
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dlintransx(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__a), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dlintransx'")
return
finally:
pass
_lib_alglib.alglib_spline1dlintransy.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dlintransy.restype = ctypes.c_int32
def spline1dlintransy(c, a, b):
pass
__c = c.ptr
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dlintransy(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__a), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dlintransy'")
return
finally:
pass
_lib_alglib.alglib_spline1dintegrate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dintegrate.restype = ctypes.c_int32
def spline1dintegrate(c, x):
pass
__result = ctypes.c_double(0)
__c = c.ptr
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dintegrate(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__c), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dintegrate'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_spline1dfitpenalized.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dfitpenalized.restype = ctypes.c_int32
def spline1dfitpenalized(*functionargs):
if len(functionargs)==5:
__friendly_form = False
x,y,n,m,rho = functionargs
elif len(functionargs)==4:
__friendly_form = True
x,y,m,rho = functionargs
if safe_len("'spline1dfitpenalized': incorrect parameters",x)!=safe_len("'spline1dfitpenalized': incorrect parameters",y):
raise RuntimeError("Error while calling 'spline1dfitpenalized': looks like one of arguments has wrong size")
n = safe_len("'spline1dfitpenalized': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'spline1dfitpenalized': function must have 4 or 5 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__rho = ctypes.c_double(rho)
__info = x_int()
__info.val = 0
__s = ctypes.c_void_p(0)
__rep = x_spline1dfitreport()
x_spline1dfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dfitpenalized(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__rho), ctypes.byref(__info), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dfitpenalized'")
__r__info = __info.val
__r__s = spline1dinterpolant(__s)
__r__rep = spline1dfitreport_from_x(__rep)
return (__r__info, __r__s, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_spline1dfitreport_clear(__rep)
_lib_alglib.alglib_smp_spline1dfitpenalized.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spline1dfitpenalized.restype = ctypes.c_int32
def smp_spline1dfitpenalized(*functionargs):
if len(functionargs)==5:
__friendly_form = False
x,y,n,m,rho = functionargs
elif len(functionargs)==4:
__friendly_form = True
x,y,m,rho = functionargs
if safe_len("'smp_spline1dfitpenalized': incorrect parameters",x)!=safe_len("'smp_spline1dfitpenalized': incorrect parameters",y):
raise RuntimeError("Error while calling 'smp_spline1dfitpenalized': looks like one of arguments has wrong size")
n = safe_len("'smp_spline1dfitpenalized': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'smp_spline1dfitpenalized': function must have 4 or 5 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__rho = ctypes.c_double(rho)
__info = x_int()
__info.val = 0
__s = ctypes.c_void_p(0)
__rep = x_spline1dfitreport()
x_spline1dfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spline1dfitpenalized(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__rho), ctypes.byref(__info), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spline1dfitpenalized'")
__r__info = __info.val
__r__s = spline1dinterpolant(__s)
__r__rep = spline1dfitreport_from_x(__rep)
return (__r__info, __r__s, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_spline1dfitreport_clear(__rep)
_lib_alglib.alglib_spline1dfitpenalizedw.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dfitpenalizedw.restype = ctypes.c_int32
def spline1dfitpenalizedw(*functionargs):
if len(functionargs)==6:
__friendly_form = False
x,y,w,n,m,rho = functionargs
elif len(functionargs)==5:
__friendly_form = True
x,y,w,m,rho = functionargs
if safe_len("'spline1dfitpenalizedw': incorrect parameters",x)!=safe_len("'spline1dfitpenalizedw': incorrect parameters",y) or safe_len("'spline1dfitpenalizedw': incorrect parameters",x)!=safe_len("'spline1dfitpenalizedw': incorrect parameters",w):
raise RuntimeError("Error while calling 'spline1dfitpenalizedw': looks like one of arguments has wrong size")
n = safe_len("'spline1dfitpenalizedw': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'spline1dfitpenalizedw': function must have 5 or 6 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__rho = ctypes.c_double(rho)
__info = x_int()
__info.val = 0
__s = ctypes.c_void_p(0)
__rep = x_spline1dfitreport()
x_spline1dfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dfitpenalizedw(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__rho), ctypes.byref(__info), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dfitpenalizedw'")
__r__info = __info.val
__r__s = spline1dinterpolant(__s)
__r__rep = spline1dfitreport_from_x(__rep)
return (__r__info, __r__s, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
x_spline1dfitreport_clear(__rep)
_lib_alglib.alglib_smp_spline1dfitpenalizedw.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spline1dfitpenalizedw.restype = ctypes.c_int32
def smp_spline1dfitpenalizedw(*functionargs):
if len(functionargs)==6:
__friendly_form = False
x,y,w,n,m,rho = functionargs
elif len(functionargs)==5:
__friendly_form = True
x,y,w,m,rho = functionargs
if safe_len("'smp_spline1dfitpenalizedw': incorrect parameters",x)!=safe_len("'smp_spline1dfitpenalizedw': incorrect parameters",y) or safe_len("'smp_spline1dfitpenalizedw': incorrect parameters",x)!=safe_len("'smp_spline1dfitpenalizedw': incorrect parameters",w):
raise RuntimeError("Error while calling 'smp_spline1dfitpenalizedw': looks like one of arguments has wrong size")
n = safe_len("'smp_spline1dfitpenalizedw': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'smp_spline1dfitpenalizedw': function must have 5 or 6 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__rho = ctypes.c_double(rho)
__info = x_int()
__info.val = 0
__s = ctypes.c_void_p(0)
__rep = x_spline1dfitreport()
x_spline1dfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spline1dfitpenalizedw(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__rho), ctypes.byref(__info), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spline1dfitpenalizedw'")
__r__info = __info.val
__r__s = spline1dinterpolant(__s)
__r__rep = spline1dfitreport_from_x(__rep)
return (__r__info, __r__s, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
x_spline1dfitreport_clear(__rep)
_lib_alglib.alglib_spline1dbuildmonotone.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dbuildmonotone.restype = ctypes.c_int32
def spline1dbuildmonotone(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,y,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_len("'spline1dbuildmonotone': incorrect parameters",x)!=safe_len("'spline1dbuildmonotone': incorrect parameters",y):
raise RuntimeError("Error while calling 'spline1dbuildmonotone': looks like one of arguments has wrong size")
n = safe_len("'spline1dbuildmonotone': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'spline1dbuildmonotone': function must have 2 or 3 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dbuildmonotone(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dbuildmonotone'")
__r__c = spline1dinterpolant(__c)
return __r__c
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.x_obj_free_pspline2interpolant.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_pspline2interpolant.restype = None
class pspline2interpolant(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_pspline2interpolant(self.ptr)
_lib_alglib.x_obj_free_pspline3interpolant.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_pspline3interpolant.restype = None
class pspline3interpolant(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_pspline3interpolant(self.ptr)
_lib_alglib.alglib_pspline2build.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline2build.restype = ctypes.c_int32
def pspline2build(xy, n, st, pt):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__st = x_int()
__st.val = int(st)
if __st.val!=st:
raise ValueError("Error while converting 'st' parameter to 'x_int'")
__pt = x_int()
__pt.val = int(pt)
if __pt.val!=pt:
raise ValueError("Error while converting 'pt' parameter to 'x_int'")
__p = ctypes.c_void_p(0)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline2build(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__n), ctypes.byref(__st), ctypes.byref(__pt), ctypes.byref(__p))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline2build'")
__r__p = pspline2interpolant(__p)
return __r__p
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_pspline3build.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline3build.restype = ctypes.c_int32
def pspline3build(xy, n, st, pt):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__st = x_int()
__st.val = int(st)
if __st.val!=st:
raise ValueError("Error while converting 'st' parameter to 'x_int'")
__pt = x_int()
__pt.val = int(pt)
if __pt.val!=pt:
raise ValueError("Error while converting 'pt' parameter to 'x_int'")
__p = ctypes.c_void_p(0)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline3build(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__n), ctypes.byref(__st), ctypes.byref(__pt), ctypes.byref(__p))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline3build'")
__r__p = pspline3interpolant(__p)
return __r__p
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_pspline2buildperiodic.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline2buildperiodic.restype = ctypes.c_int32
def pspline2buildperiodic(xy, n, st, pt):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__st = x_int()
__st.val = int(st)
if __st.val!=st:
raise ValueError("Error while converting 'st' parameter to 'x_int'")
__pt = x_int()
__pt.val = int(pt)
if __pt.val!=pt:
raise ValueError("Error while converting 'pt' parameter to 'x_int'")
__p = ctypes.c_void_p(0)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline2buildperiodic(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__n), ctypes.byref(__st), ctypes.byref(__pt), ctypes.byref(__p))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline2buildperiodic'")
__r__p = pspline2interpolant(__p)
return __r__p
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_pspline3buildperiodic.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline3buildperiodic.restype = ctypes.c_int32
def pspline3buildperiodic(xy, n, st, pt):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__st = x_int()
__st.val = int(st)
if __st.val!=st:
raise ValueError("Error while converting 'st' parameter to 'x_int'")
__pt = x_int()
__pt.val = int(pt)
if __pt.val!=pt:
raise ValueError("Error while converting 'pt' parameter to 'x_int'")
__p = ctypes.c_void_p(0)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline3buildperiodic(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__n), ctypes.byref(__st), ctypes.byref(__pt), ctypes.byref(__p))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline3buildperiodic'")
__r__p = pspline3interpolant(__p)
return __r__p
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_pspline2parametervalues.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline2parametervalues.restype = ctypes.c_int32
def pspline2parametervalues(p):
pass
__p = p.ptr
__n = x_int()
__n.val = 0
__t = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline2parametervalues(ctypes.byref(_error_msg), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__t))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline2parametervalues'")
__r__n = __n.val
__r__t = list_from_x(__t)
return (__r__n, __r__t)
finally:
x_vector_clear(__t)
_lib_alglib.alglib_pspline3parametervalues.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline3parametervalues.restype = ctypes.c_int32
def pspline3parametervalues(p):
pass
__p = p.ptr
__n = x_int()
__n.val = 0
__t = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline3parametervalues(ctypes.byref(_error_msg), ctypes.byref(__p), ctypes.byref(__n), ctypes.byref(__t))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline3parametervalues'")
__r__n = __n.val
__r__t = list_from_x(__t)
return (__r__n, __r__t)
finally:
x_vector_clear(__t)
_lib_alglib.alglib_pspline2calc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline2calc.restype = ctypes.c_int32
def pspline2calc(p, t):
pass
__p = p.ptr
__t = ctypes.c_double(t)
__x = ctypes.c_double(0)
__y = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline2calc(ctypes.byref(_error_msg), ctypes.byref(__p), ctypes.byref(__t), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline2calc'")
__r__x = __x.value
__r__y = __y.value
return (__r__x, __r__y)
finally:
pass
_lib_alglib.alglib_pspline3calc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline3calc.restype = ctypes.c_int32
def pspline3calc(p, t):
pass
__p = p.ptr
__t = ctypes.c_double(t)
__x = ctypes.c_double(0)
__y = ctypes.c_double(0)
__z = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline3calc(ctypes.byref(_error_msg), ctypes.byref(__p), ctypes.byref(__t), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline3calc'")
__r__x = __x.value
__r__y = __y.value
__r__z = __z.value
return (__r__x, __r__y, __r__z)
finally:
pass
_lib_alglib.alglib_pspline2tangent.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline2tangent.restype = ctypes.c_int32
def pspline2tangent(p, t):
pass
__p = p.ptr
__t = ctypes.c_double(t)
__x = ctypes.c_double(0)
__y = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline2tangent(ctypes.byref(_error_msg), ctypes.byref(__p), ctypes.byref(__t), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline2tangent'")
__r__x = __x.value
__r__y = __y.value
return (__r__x, __r__y)
finally:
pass
_lib_alglib.alglib_pspline3tangent.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline3tangent.restype = ctypes.c_int32
def pspline3tangent(p, t):
pass
__p = p.ptr
__t = ctypes.c_double(t)
__x = ctypes.c_double(0)
__y = ctypes.c_double(0)
__z = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline3tangent(ctypes.byref(_error_msg), ctypes.byref(__p), ctypes.byref(__t), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline3tangent'")
__r__x = __x.value
__r__y = __y.value
__r__z = __z.value
return (__r__x, __r__y, __r__z)
finally:
pass
_lib_alglib.alglib_pspline2diff.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline2diff.restype = ctypes.c_int32
def pspline2diff(p, t):
pass
__p = p.ptr
__t = ctypes.c_double(t)
__x = ctypes.c_double(0)
__dx = ctypes.c_double(0)
__y = ctypes.c_double(0)
__dy = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline2diff(ctypes.byref(_error_msg), ctypes.byref(__p), ctypes.byref(__t), ctypes.byref(__x), ctypes.byref(__dx), ctypes.byref(__y), ctypes.byref(__dy))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline2diff'")
__r__x = __x.value
__r__dx = __dx.value
__r__y = __y.value
__r__dy = __dy.value
return (__r__x, __r__dx, __r__y, __r__dy)
finally:
pass
_lib_alglib.alglib_pspline3diff.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline3diff.restype = ctypes.c_int32
def pspline3diff(p, t):
pass
__p = p.ptr
__t = ctypes.c_double(t)
__x = ctypes.c_double(0)
__dx = ctypes.c_double(0)
__y = ctypes.c_double(0)
__dy = ctypes.c_double(0)
__z = ctypes.c_double(0)
__dz = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline3diff(ctypes.byref(_error_msg), ctypes.byref(__p), ctypes.byref(__t), ctypes.byref(__x), ctypes.byref(__dx), ctypes.byref(__y), ctypes.byref(__dy), ctypes.byref(__z), ctypes.byref(__dz))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline3diff'")
__r__x = __x.value
__r__dx = __dx.value
__r__y = __y.value
__r__dy = __dy.value
__r__z = __z.value
__r__dz = __dz.value
return (__r__x, __r__dx, __r__y, __r__dy, __r__z, __r__dz)
finally:
pass
_lib_alglib.alglib_pspline2diff2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline2diff2.restype = ctypes.c_int32
def pspline2diff2(p, t):
pass
__p = p.ptr
__t = ctypes.c_double(t)
__x = ctypes.c_double(0)
__dx = ctypes.c_double(0)
__d2x = ctypes.c_double(0)
__y = ctypes.c_double(0)
__dy = ctypes.c_double(0)
__d2y = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline2diff2(ctypes.byref(_error_msg), ctypes.byref(__p), ctypes.byref(__t), ctypes.byref(__x), ctypes.byref(__dx), ctypes.byref(__d2x), ctypes.byref(__y), ctypes.byref(__dy), ctypes.byref(__d2y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline2diff2'")
__r__x = __x.value
__r__dx = __dx.value
__r__d2x = __d2x.value
__r__y = __y.value
__r__dy = __dy.value
__r__d2y = __d2y.value
return (__r__x, __r__dx, __r__d2x, __r__y, __r__dy, __r__d2y)
finally:
pass
_lib_alglib.alglib_pspline3diff2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline3diff2.restype = ctypes.c_int32
def pspline3diff2(p, t):
pass
__p = p.ptr
__t = ctypes.c_double(t)
__x = ctypes.c_double(0)
__dx = ctypes.c_double(0)
__d2x = ctypes.c_double(0)
__y = ctypes.c_double(0)
__dy = ctypes.c_double(0)
__d2y = ctypes.c_double(0)
__z = ctypes.c_double(0)
__dz = ctypes.c_double(0)
__d2z = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline3diff2(ctypes.byref(_error_msg), ctypes.byref(__p), ctypes.byref(__t), ctypes.byref(__x), ctypes.byref(__dx), ctypes.byref(__d2x), ctypes.byref(__y), ctypes.byref(__dy), ctypes.byref(__d2y), ctypes.byref(__z), ctypes.byref(__dz), ctypes.byref(__d2z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline3diff2'")
__r__x = __x.value
__r__dx = __dx.value
__r__d2x = __d2x.value
__r__y = __y.value
__r__dy = __dy.value
__r__d2y = __d2y.value
__r__z = __z.value
__r__dz = __dz.value
__r__d2z = __d2z.value
return (__r__x, __r__dx, __r__d2x, __r__y, __r__dy, __r__d2y, __r__z, __r__dz, __r__d2z)
finally:
pass
_lib_alglib.alglib_pspline2arclength.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline2arclength.restype = ctypes.c_int32
def pspline2arclength(p, a, b):
pass
__result = ctypes.c_double(0)
__p = p.ptr
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline2arclength(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__p), ctypes.byref(__a), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline2arclength'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_pspline3arclength.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pspline3arclength.restype = ctypes.c_int32
def pspline3arclength(p, a, b):
pass
__result = ctypes.c_double(0)
__p = p.ptr
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pspline3arclength(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__p), ctypes.byref(__a), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pspline3arclength'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_parametricrdpfixed.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_parametricrdpfixed.restype = ctypes.c_int32
def parametricrdpfixed(x, n, d, stopm, stopeps):
pass
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__d = x_int()
__d.val = int(d)
if __d.val!=d:
raise ValueError("Error while converting 'd' parameter to 'x_int'")
__stopm = x_int()
__stopm.val = int(stopm)
if __stopm.val!=stopm:
raise ValueError("Error while converting 'stopm' parameter to 'x_int'")
__stopeps = ctypes.c_double(stopeps)
__x2 = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__idx2 = x_vector(cnt=0,datatype=DT_INT,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nsections = x_int()
__nsections.val = 0
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_parametricrdpfixed(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__d), ctypes.byref(__stopm), ctypes.byref(__stopeps), ctypes.byref(__x2), ctypes.byref(__idx2), ctypes.byref(__nsections))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'parametricrdpfixed'")
__r__x2 = listlist_from_x(__x2)
__r__idx2 = list_from_x(__idx2)
__r__nsections = __nsections.val
return (__r__x2, __r__idx2, __r__nsections)
finally:
x_matrix_clear(__x)
x_matrix_clear(__x2)
x_vector_clear(__idx2)
_lib_alglib.x_obj_free_spline3dinterpolant.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_spline3dinterpolant.restype = None
class spline3dinterpolant(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_spline3dinterpolant(self.ptr)
_lib_alglib.alglib_spline3dcalc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline3dcalc.restype = ctypes.c_int32
def spline3dcalc(c, x, y, z):
pass
__result = ctypes.c_double(0)
__c = c.ptr
__x = ctypes.c_double(x)
__y = ctypes.c_double(y)
__z = ctypes.c_double(z)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline3dcalc(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__c), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline3dcalc'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_spline3dlintransxyz.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline3dlintransxyz.restype = ctypes.c_int32
def spline3dlintransxyz(c, ax, bx, ay, by, az, bz):
pass
__c = c.ptr
__ax = ctypes.c_double(ax)
__bx = ctypes.c_double(bx)
__ay = ctypes.c_double(ay)
__by = ctypes.c_double(by)
__az = ctypes.c_double(az)
__bz = ctypes.c_double(bz)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline3dlintransxyz(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__ax), ctypes.byref(__bx), ctypes.byref(__ay), ctypes.byref(__by), ctypes.byref(__az), ctypes.byref(__bz))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline3dlintransxyz'")
return
finally:
pass
_lib_alglib.alglib_spline3dlintransf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline3dlintransf.restype = ctypes.c_int32
def spline3dlintransf(c, a, b):
pass
__c = c.ptr
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline3dlintransf(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__a), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline3dlintransf'")
return
finally:
pass
_lib_alglib.alglib_spline3dresampletrilinear.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline3dresampletrilinear.restype = ctypes.c_int32
def spline3dresampletrilinear(a, oldzcount, oldycount, oldxcount, newzcount, newycount, newxcount):
pass
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__oldzcount = x_int()
__oldzcount.val = int(oldzcount)
if __oldzcount.val!=oldzcount:
raise ValueError("Error while converting 'oldzcount' parameter to 'x_int'")
__oldycount = x_int()
__oldycount.val = int(oldycount)
if __oldycount.val!=oldycount:
raise ValueError("Error while converting 'oldycount' parameter to 'x_int'")
__oldxcount = x_int()
__oldxcount.val = int(oldxcount)
if __oldxcount.val!=oldxcount:
raise ValueError("Error while converting 'oldxcount' parameter to 'x_int'")
__newzcount = x_int()
__newzcount.val = int(newzcount)
if __newzcount.val!=newzcount:
raise ValueError("Error while converting 'newzcount' parameter to 'x_int'")
__newycount = x_int()
__newycount.val = int(newycount)
if __newycount.val!=newycount:
raise ValueError("Error while converting 'newycount' parameter to 'x_int'")
__newxcount = x_int()
__newxcount.val = int(newxcount)
if __newxcount.val!=newxcount:
raise ValueError("Error while converting 'newxcount' parameter to 'x_int'")
__b = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline3dresampletrilinear(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__oldzcount), ctypes.byref(__oldycount), ctypes.byref(__oldxcount), ctypes.byref(__newzcount), ctypes.byref(__newycount), ctypes.byref(__newxcount), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline3dresampletrilinear'")
__r__b = list_from_x(__b)
return __r__b
finally:
x_vector_clear(__a)
x_vector_clear(__b)
_lib_alglib.alglib_spline3dbuildtrilinearv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline3dbuildtrilinearv.restype = ctypes.c_int32
def spline3dbuildtrilinearv(x, n, y, m, z, l, f, d):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(z):
raise ValueError("'z' parameter can't be cast to real_vector")
__z = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__l = x_int()
__l.val = int(l)
if __l.val!=l:
raise ValueError("Error while converting 'l' parameter to 'x_int'")
if not is_real_vector(f):
raise ValueError("'f' parameter can't be cast to real_vector")
__f = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__d = x_int()
__d.val = int(d)
if __d.val!=d:
raise ValueError("Error while converting 'd' parameter to 'x_int'")
__c = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__z, z, DT_REAL, X_CREATE)
x_from_list(__f, f, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline3dbuildtrilinearv(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__y), ctypes.byref(__m), ctypes.byref(__z), ctypes.byref(__l), ctypes.byref(__f), ctypes.byref(__d), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline3dbuildtrilinearv'")
__r__c = spline3dinterpolant(__c)
return __r__c
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__z)
x_vector_clear(__f)
_lib_alglib.alglib_spline3dcalcvbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline3dcalcvbuf.restype = ctypes.c_int32
def spline3dcalcvbuf(c, x, y, z, f):
pass
__c = c.ptr
__x = ctypes.c_double(x)
__y = ctypes.c_double(y)
__z = ctypes.c_double(z)
if not is_real_vector(f):
raise ValueError("'f' parameter can't be cast to real_vector")
__f = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__f, f, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline3dcalcvbuf(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__z), ctypes.byref(__f))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline3dcalcvbuf'")
__r__f = list_from_x(__f)
return __r__f
finally:
x_vector_clear(__f)
_lib_alglib.alglib_spline3dcalcv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline3dcalcv.restype = ctypes.c_int32
def spline3dcalcv(c, x, y, z):
pass
__c = c.ptr
__x = ctypes.c_double(x)
__y = ctypes.c_double(y)
__z = ctypes.c_double(z)
__f = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline3dcalcv(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__z), ctypes.byref(__f))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline3dcalcv'")
__r__f = list_from_x(__f)
return __r__f
finally:
x_vector_clear(__f)
_lib_alglib.alglib_spline3dunpackv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline3dunpackv.restype = ctypes.c_int32
def spline3dunpackv(c):
pass
__c = c.ptr
__n = x_int()
__n.val = 0
__m = x_int()
__m.val = 0
__l = x_int()
__l.val = 0
__d = x_int()
__d.val = 0
__stype = x_int()
__stype.val = 0
__tbl = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline3dunpackv(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__l), ctypes.byref(__d), ctypes.byref(__stype), ctypes.byref(__tbl))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline3dunpackv'")
__r__n = __n.val
__r__m = __m.val
__r__l = __l.val
__r__d = __d.val
__r__stype = __stype.val
__r__tbl = listlist_from_x(__tbl)
return (__r__n, __r__m, __r__l, __r__d, __r__stype, __r__tbl)
finally:
x_matrix_clear(__tbl)
_lib_alglib.alglib_polynomialbar2cheb.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_polynomialbar2cheb.restype = ctypes.c_int32
def polynomialbar2cheb(p, a, b):
pass
__p = p.ptr
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__t = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_polynomialbar2cheb(ctypes.byref(_error_msg), ctypes.byref(__p), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__t))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'polynomialbar2cheb'")
__r__t = list_from_x(__t)
return __r__t
finally:
x_vector_clear(__t)
_lib_alglib.alglib_polynomialcheb2bar.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_polynomialcheb2bar.restype = ctypes.c_int32
def polynomialcheb2bar(*functionargs):
if len(functionargs)==4:
__friendly_form = False
t,n,a,b = functionargs
elif len(functionargs)==3:
__friendly_form = True
t,a,b = functionargs
n = safe_len("'polynomialcheb2bar': incorrect parameters",t)
else:
raise RuntimeError("Error while calling 'polynomialcheb2bar': function must have 3 or 4 parameters")
if not is_real_vector(t):
raise ValueError("'t' parameter can't be cast to real_vector")
__t = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__p = ctypes.c_void_p(0)
try:
x_from_list(__t, t, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_polynomialcheb2bar(ctypes.byref(_error_msg), ctypes.byref(__t), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__p))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'polynomialcheb2bar'")
__r__p = barycentricinterpolant(__p)
return __r__p
finally:
x_vector_clear(__t)
_lib_alglib.alglib_polynomialbar2pow.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_polynomialbar2pow.restype = ctypes.c_int32
def polynomialbar2pow(*functionargs):
if len(functionargs)==3:
__friendly_form = False
p,c,s = functionargs
elif len(functionargs)==1:
__friendly_form = True
p, = functionargs
c = 0
s = 1
else:
raise RuntimeError("Error while calling 'polynomialbar2pow': function must have 1 or 3 parameters")
__p = p.ptr
__c = ctypes.c_double(c)
__s = ctypes.c_double(s)
__a = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_polynomialbar2pow(ctypes.byref(_error_msg), ctypes.byref(__p), ctypes.byref(__c), ctypes.byref(__s), ctypes.byref(__a))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'polynomialbar2pow'")
__r__a = list_from_x(__a)
return __r__a
finally:
x_vector_clear(__a)
_lib_alglib.alglib_polynomialpow2bar.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_polynomialpow2bar.restype = ctypes.c_int32
def polynomialpow2bar(*functionargs):
if len(functionargs)==4:
__friendly_form = False
a,n,c,s = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
n = safe_len("'polynomialpow2bar': incorrect parameters",a)
c = 0
s = 1
else:
raise RuntimeError("Error while calling 'polynomialpow2bar': function must have 1 or 4 parameters")
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = ctypes.c_double(c)
__s = ctypes.c_double(s)
__p = ctypes.c_void_p(0)
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_polynomialpow2bar(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__c), ctypes.byref(__s), ctypes.byref(__p))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'polynomialpow2bar'")
__r__p = barycentricinterpolant(__p)
return __r__p
finally:
x_vector_clear(__a)
_lib_alglib.alglib_polynomialbuild.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_polynomialbuild.restype = ctypes.c_int32
def polynomialbuild(*functionargs):
if len(functionargs)==3:
__friendly_form = False
x,y,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
x,y = functionargs
if safe_len("'polynomialbuild': incorrect parameters",x)!=safe_len("'polynomialbuild': incorrect parameters",y):
raise RuntimeError("Error while calling 'polynomialbuild': looks like one of arguments has wrong size")
n = safe_len("'polynomialbuild': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'polynomialbuild': function must have 2 or 3 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__p = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_polynomialbuild(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__p))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'polynomialbuild'")
__r__p = barycentricinterpolant(__p)
return __r__p
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_polynomialbuildeqdist.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_polynomialbuildeqdist.restype = ctypes.c_int32
def polynomialbuildeqdist(*functionargs):
if len(functionargs)==4:
__friendly_form = False
a,b,y,n = functionargs
elif len(functionargs)==3:
__friendly_form = True
a,b,y = functionargs
n = safe_len("'polynomialbuildeqdist': incorrect parameters",y)
else:
raise RuntimeError("Error while calling 'polynomialbuildeqdist': function must have 3 or 4 parameters")
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__p = ctypes.c_void_p(0)
try:
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_polynomialbuildeqdist(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__p))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'polynomialbuildeqdist'")
__r__p = barycentricinterpolant(__p)
return __r__p
finally:
x_vector_clear(__y)
_lib_alglib.alglib_polynomialbuildcheb1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_polynomialbuildcheb1.restype = ctypes.c_int32
def polynomialbuildcheb1(*functionargs):
if len(functionargs)==4:
__friendly_form = False
a,b,y,n = functionargs
elif len(functionargs)==3:
__friendly_form = True
a,b,y = functionargs
n = safe_len("'polynomialbuildcheb1': incorrect parameters",y)
else:
raise RuntimeError("Error while calling 'polynomialbuildcheb1': function must have 3 or 4 parameters")
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__p = ctypes.c_void_p(0)
try:
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_polynomialbuildcheb1(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__p))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'polynomialbuildcheb1'")
__r__p = barycentricinterpolant(__p)
return __r__p
finally:
x_vector_clear(__y)
_lib_alglib.alglib_polynomialbuildcheb2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_polynomialbuildcheb2.restype = ctypes.c_int32
def polynomialbuildcheb2(*functionargs):
if len(functionargs)==4:
__friendly_form = False
a,b,y,n = functionargs
elif len(functionargs)==3:
__friendly_form = True
a,b,y = functionargs
n = safe_len("'polynomialbuildcheb2': incorrect parameters",y)
else:
raise RuntimeError("Error while calling 'polynomialbuildcheb2': function must have 3 or 4 parameters")
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__p = ctypes.c_void_p(0)
try:
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_polynomialbuildcheb2(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__p))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'polynomialbuildcheb2'")
__r__p = barycentricinterpolant(__p)
return __r__p
finally:
x_vector_clear(__y)
_lib_alglib.alglib_polynomialcalceqdist.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_polynomialcalceqdist.restype = ctypes.c_int32
def polynomialcalceqdist(*functionargs):
if len(functionargs)==5:
__friendly_form = False
a,b,f,n,t = functionargs
elif len(functionargs)==4:
__friendly_form = True
a,b,f,t = functionargs
n = safe_len("'polynomialcalceqdist': incorrect parameters",f)
else:
raise RuntimeError("Error while calling 'polynomialcalceqdist': function must have 4 or 5 parameters")
__result = ctypes.c_double(0)
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
if not is_real_vector(f):
raise ValueError("'f' parameter can't be cast to real_vector")
__f = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__t = ctypes.c_double(t)
try:
x_from_list(__f, f, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_polynomialcalceqdist(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__f), ctypes.byref(__n), ctypes.byref(__t))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'polynomialcalceqdist'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__f)
_lib_alglib.alglib_polynomialcalccheb1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_polynomialcalccheb1.restype = ctypes.c_int32
def polynomialcalccheb1(*functionargs):
if len(functionargs)==5:
__friendly_form = False
a,b,f,n,t = functionargs
elif len(functionargs)==4:
__friendly_form = True
a,b,f,t = functionargs
n = safe_len("'polynomialcalccheb1': incorrect parameters",f)
else:
raise RuntimeError("Error while calling 'polynomialcalccheb1': function must have 4 or 5 parameters")
__result = ctypes.c_double(0)
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
if not is_real_vector(f):
raise ValueError("'f' parameter can't be cast to real_vector")
__f = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__t = ctypes.c_double(t)
try:
x_from_list(__f, f, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_polynomialcalccheb1(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__f), ctypes.byref(__n), ctypes.byref(__t))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'polynomialcalccheb1'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__f)
_lib_alglib.alglib_polynomialcalccheb2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_polynomialcalccheb2.restype = ctypes.c_int32
def polynomialcalccheb2(*functionargs):
if len(functionargs)==5:
__friendly_form = False
a,b,f,n,t = functionargs
elif len(functionargs)==4:
__friendly_form = True
a,b,f,t = functionargs
n = safe_len("'polynomialcalccheb2': incorrect parameters",f)
else:
raise RuntimeError("Error while calling 'polynomialcalccheb2': function must have 4 or 5 parameters")
__result = ctypes.c_double(0)
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
if not is_real_vector(f):
raise ValueError("'f' parameter can't be cast to real_vector")
__f = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__t = ctypes.c_double(t)
try:
x_from_list(__f, f, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_polynomialcalccheb2(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__f), ctypes.byref(__n), ctypes.byref(__t))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'polynomialcalccheb2'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__f)
class x_polynomialfitreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("taskrcond", ctypes.c_double),
("rmserror", ctypes.c_double),
("avgerror", ctypes.c_double),
("avgrelerror", ctypes.c_double),
("maxerror", ctypes.c_double)
]
class polynomialfitreport(object):
def __init__(self):
self.taskrcond = 0
self.rmserror = 0
self.avgerror = 0
self.avgrelerror = 0
self.maxerror = 0
def x_polynomialfitreport_zero_fields(x):
x.taskrcond = 0
x.rmserror = 0
x.avgerror = 0
x.avgrelerror = 0
x.maxerror = 0
return
def x_polynomialfitreport_clear(x):
x_polynomialfitreport_zero_fields(x)
return
def x_from_polynomialfitreport(x,v):
x.taskrcond = float(v.taskrcond)
x.rmserror = float(v.rmserror)
x.avgerror = float(v.avgerror)
x.avgrelerror = float(v.avgrelerror)
x.maxerror = float(v.maxerror)
return
def polynomialfitreport_from_x(x):
r = polynomialfitreport()
r.taskrcond = x.taskrcond
r.rmserror = x.rmserror
r.avgerror = x.avgerror
r.avgrelerror = x.avgrelerror
r.maxerror = x.maxerror
return r
class x_barycentricfitreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("taskrcond", ctypes.c_double),
("dbest", x_int),
("rmserror", ctypes.c_double),
("avgerror", ctypes.c_double),
("avgrelerror", ctypes.c_double),
("maxerror", ctypes.c_double)
]
class barycentricfitreport(object):
def __init__(self):
self.taskrcond = 0
self.dbest = 0
self.rmserror = 0
self.avgerror = 0
self.avgrelerror = 0
self.maxerror = 0
def x_barycentricfitreport_zero_fields(x):
x.taskrcond = 0
x.dbest.val = 0
x.rmserror = 0
x.avgerror = 0
x.avgrelerror = 0
x.maxerror = 0
return
def x_barycentricfitreport_clear(x):
x_barycentricfitreport_zero_fields(x)
return
def x_from_barycentricfitreport(x,v):
x.taskrcond = float(v.taskrcond)
x.dbest.val = int(v.dbest)
x.rmserror = float(v.rmserror)
x.avgerror = float(v.avgerror)
x.avgrelerror = float(v.avgrelerror)
x.maxerror = float(v.maxerror)
return
def barycentricfitreport_from_x(x):
r = barycentricfitreport()
r.taskrcond = x.taskrcond
r.dbest = x.dbest.val
r.rmserror = x.rmserror
r.avgerror = x.avgerror
r.avgrelerror = x.avgrelerror
r.maxerror = x.maxerror
return r
class x_lsfitreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("taskrcond", ctypes.c_double),
("iterationscount", x_int),
("varidx", x_int),
("rmserror", ctypes.c_double),
("avgerror", ctypes.c_double),
("avgrelerror", ctypes.c_double),
("maxerror", ctypes.c_double),
("wrmserror", ctypes.c_double),
("covpar", x_matrix),
("errpar", x_vector),
("errcurve", x_vector),
("noise", x_vector),
("r2", ctypes.c_double)
]
class lsfitreport(object):
def __init__(self):
self.taskrcond = 0
self.iterationscount = 0
self.varidx = 0
self.rmserror = 0
self.avgerror = 0
self.avgrelerror = 0
self.maxerror = 0
self.wrmserror = 0
self.covpar = [[]]
self.errpar = []
self.errcurve = []
self.noise = []
self.r2 = 0
def x_lsfitreport_zero_fields(x):
x.taskrcond = 0
x.iterationscount.val = 0
x.varidx.val = 0
x.rmserror = 0
x.avgerror = 0
x.avgrelerror = 0
x.maxerror = 0
x.wrmserror = 0
x.covpar = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
x.errpar = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
x.errcurve = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
x.noise = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
x.r2 = 0
return
def x_lsfitreport_clear(x):
x_matrix_clear(x.covpar)
x_vector_clear(x.errpar)
x_vector_clear(x.errcurve)
x_vector_clear(x.noise)
x_lsfitreport_zero_fields(x)
return
def x_from_lsfitreport(x,v):
x.taskrcond = float(v.taskrcond)
x.iterationscount.val = int(v.iterationscount)
x.varidx.val = int(v.varidx)
x.rmserror = float(v.rmserror)
x.avgerror = float(v.avgerror)
x.avgrelerror = float(v.avgrelerror)
x.maxerror = float(v.maxerror)
x.wrmserror = float(v.wrmserror)
x_from_listlist(x.covpar, v.covpar, DT_REAL, X_CREATE)
x_from_list(x.errpar, v.errpar, DT_REAL, X_CREATE)
x_from_list(x.errcurve, v.errcurve, DT_REAL, X_CREATE)
x_from_list(x.noise, v.noise, DT_REAL, X_CREATE)
x.r2 = float(v.r2)
return
def lsfitreport_from_x(x):
r = lsfitreport()
r.taskrcond = x.taskrcond
r.iterationscount = x.iterationscount.val
r.varidx = x.varidx.val
r.rmserror = x.rmserror
r.avgerror = x.avgerror
r.avgrelerror = x.avgrelerror
r.maxerror = x.maxerror
r.wrmserror = x.wrmserror
r.covpar = listlist_from_x(x.covpar)
r.errpar = list_from_x(x.errpar)
r.errcurve = list_from_x(x.errcurve)
r.noise = list_from_x(x.noise)
r.r2 = x.r2
return r
_lib_alglib.x_obj_free_lsfitstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_lsfitstate.restype = None
_lib_alglib.x_lsfitstate_get_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_lsfitstate_get_needf.restype = None
_lib_alglib.x_lsfitstate_set_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_lsfitstate_set_needf.restype = None
_lib_alglib.x_lsfitstate_get_needfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_lsfitstate_get_needfg.restype = None
_lib_alglib.x_lsfitstate_set_needfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_lsfitstate_set_needfg.restype = None
_lib_alglib.x_lsfitstate_get_needfgh.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_lsfitstate_get_needfgh.restype = None
_lib_alglib.x_lsfitstate_set_needfgh.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_lsfitstate_set_needfgh.restype = None
_lib_alglib.x_lsfitstate_get_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_lsfitstate_get_xupdated.restype = None
_lib_alglib.x_lsfitstate_set_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_lsfitstate_set_xupdated.restype = None
_lib_alglib.x_lsfitstate_get_c.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_lsfitstate_get_c.restype = None
_lib_alglib.x_lsfitstate_get_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_lsfitstate_get_f.restype = None
_lib_alglib.x_lsfitstate_set_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_lsfitstate_set_f.restype = None
_lib_alglib.x_lsfitstate_get_g.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_lsfitstate_get_g.restype = None
_lib_alglib.x_lsfitstate_get_h.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_lsfitstate_get_h.restype = None
_lib_alglib.x_lsfitstate_get_x.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_lsfitstate_get_x.restype = None
class lsfitstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_lsfitstate(self.ptr)
_lib_alglib.alglib_lstfitpiecewiselinearrdpfixed.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lstfitpiecewiselinearrdpfixed.restype = ctypes.c_int32
def lstfitpiecewiselinearrdpfixed(x, y, n, m):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__x2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__y2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nsections = x_int()
__nsections.val = 0
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lstfitpiecewiselinearrdpfixed(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__x2), ctypes.byref(__y2), ctypes.byref(__nsections))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lstfitpiecewiselinearrdpfixed'")
__r__x2 = list_from_x(__x2)
__r__y2 = list_from_x(__y2)
__r__nsections = __nsections.val
return (__r__x2, __r__y2, __r__nsections)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__x2)
x_vector_clear(__y2)
_lib_alglib.alglib_lstfitpiecewiselinearrdp.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lstfitpiecewiselinearrdp.restype = ctypes.c_int32
def lstfitpiecewiselinearrdp(x, y, n, eps):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__eps = ctypes.c_double(eps)
__x2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__y2 = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nsections = x_int()
__nsections.val = 0
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lstfitpiecewiselinearrdp(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__eps), ctypes.byref(__x2), ctypes.byref(__y2), ctypes.byref(__nsections))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lstfitpiecewiselinearrdp'")
__r__x2 = list_from_x(__x2)
__r__y2 = list_from_x(__y2)
__r__nsections = __nsections.val
return (__r__x2, __r__y2, __r__nsections)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__x2)
x_vector_clear(__y2)
_lib_alglib.alglib_polynomialfit.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_polynomialfit.restype = ctypes.c_int32
def polynomialfit(*functionargs):
if len(functionargs)==4:
__friendly_form = False
x,y,n,m = functionargs
elif len(functionargs)==3:
__friendly_form = True
x,y,m = functionargs
if safe_len("'polynomialfit': incorrect parameters",x)!=safe_len("'polynomialfit': incorrect parameters",y):
raise RuntimeError("Error while calling 'polynomialfit': looks like one of arguments has wrong size")
n = safe_len("'polynomialfit': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'polynomialfit': function must have 3 or 4 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__p = ctypes.c_void_p(0)
__rep = x_polynomialfitreport()
x_polynomialfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_polynomialfit(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__p), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'polynomialfit'")
__r__info = __info.val
__r__p = barycentricinterpolant(__p)
__r__rep = polynomialfitreport_from_x(__rep)
return (__r__info, __r__p, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_polynomialfitreport_clear(__rep)
_lib_alglib.alglib_smp_polynomialfit.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_polynomialfit.restype = ctypes.c_int32
def smp_polynomialfit(*functionargs):
if len(functionargs)==4:
__friendly_form = False
x,y,n,m = functionargs
elif len(functionargs)==3:
__friendly_form = True
x,y,m = functionargs
if safe_len("'smp_polynomialfit': incorrect parameters",x)!=safe_len("'smp_polynomialfit': incorrect parameters",y):
raise RuntimeError("Error while calling 'smp_polynomialfit': looks like one of arguments has wrong size")
n = safe_len("'smp_polynomialfit': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'smp_polynomialfit': function must have 3 or 4 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__p = ctypes.c_void_p(0)
__rep = x_polynomialfitreport()
x_polynomialfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_polynomialfit(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__p), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_polynomialfit'")
__r__info = __info.val
__r__p = barycentricinterpolant(__p)
__r__rep = polynomialfitreport_from_x(__rep)
return (__r__info, __r__p, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_polynomialfitreport_clear(__rep)
_lib_alglib.alglib_polynomialfitwc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_polynomialfitwc.restype = ctypes.c_int32
def polynomialfitwc(*functionargs):
if len(functionargs)==9:
__friendly_form = False
x,y,w,n,xc,yc,dc,k,m = functionargs
elif len(functionargs)==7:
__friendly_form = True
x,y,w,xc,yc,dc,m = functionargs
if safe_len("'polynomialfitwc': incorrect parameters",x)!=safe_len("'polynomialfitwc': incorrect parameters",y) or safe_len("'polynomialfitwc': incorrect parameters",x)!=safe_len("'polynomialfitwc': incorrect parameters",w):
raise RuntimeError("Error while calling 'polynomialfitwc': looks like one of arguments has wrong size")
n = safe_len("'polynomialfitwc': incorrect parameters",x)
if safe_len("'polynomialfitwc': incorrect parameters",xc)!=safe_len("'polynomialfitwc': incorrect parameters",yc) or safe_len("'polynomialfitwc': incorrect parameters",xc)!=safe_len("'polynomialfitwc': incorrect parameters",dc):
raise RuntimeError("Error while calling 'polynomialfitwc': looks like one of arguments has wrong size")
k = safe_len("'polynomialfitwc': incorrect parameters",xc)
else:
raise RuntimeError("Error while calling 'polynomialfitwc': function must have 7 or 9 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(xc):
raise ValueError("'xc' parameter can't be cast to real_vector")
__xc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(yc):
raise ValueError("'yc' parameter can't be cast to real_vector")
__yc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(dc):
raise ValueError("'dc' parameter can't be cast to int_vector")
__dc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__p = ctypes.c_void_p(0)
__rep = x_polynomialfitreport()
x_polynomialfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_list(__xc, xc, DT_REAL, X_CREATE)
x_from_list(__yc, yc, DT_REAL, X_CREATE)
x_from_list(__dc, dc, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_polynomialfitwc(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__n), ctypes.byref(__xc), ctypes.byref(__yc), ctypes.byref(__dc), ctypes.byref(__k), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__p), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'polynomialfitwc'")
__r__info = __info.val
__r__p = barycentricinterpolant(__p)
__r__rep = polynomialfitreport_from_x(__rep)
return (__r__info, __r__p, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
x_vector_clear(__xc)
x_vector_clear(__yc)
x_vector_clear(__dc)
x_polynomialfitreport_clear(__rep)
_lib_alglib.alglib_smp_polynomialfitwc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_polynomialfitwc.restype = ctypes.c_int32
def smp_polynomialfitwc(*functionargs):
if len(functionargs)==9:
__friendly_form = False
x,y,w,n,xc,yc,dc,k,m = functionargs
elif len(functionargs)==7:
__friendly_form = True
x,y,w,xc,yc,dc,m = functionargs
if safe_len("'smp_polynomialfitwc': incorrect parameters",x)!=safe_len("'smp_polynomialfitwc': incorrect parameters",y) or safe_len("'smp_polynomialfitwc': incorrect parameters",x)!=safe_len("'smp_polynomialfitwc': incorrect parameters",w):
raise RuntimeError("Error while calling 'smp_polynomialfitwc': looks like one of arguments has wrong size")
n = safe_len("'smp_polynomialfitwc': incorrect parameters",x)
if safe_len("'smp_polynomialfitwc': incorrect parameters",xc)!=safe_len("'smp_polynomialfitwc': incorrect parameters",yc) or safe_len("'smp_polynomialfitwc': incorrect parameters",xc)!=safe_len("'smp_polynomialfitwc': incorrect parameters",dc):
raise RuntimeError("Error while calling 'smp_polynomialfitwc': looks like one of arguments has wrong size")
k = safe_len("'smp_polynomialfitwc': incorrect parameters",xc)
else:
raise RuntimeError("Error while calling 'smp_polynomialfitwc': function must have 7 or 9 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(xc):
raise ValueError("'xc' parameter can't be cast to real_vector")
__xc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(yc):
raise ValueError("'yc' parameter can't be cast to real_vector")
__yc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(dc):
raise ValueError("'dc' parameter can't be cast to int_vector")
__dc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__p = ctypes.c_void_p(0)
__rep = x_polynomialfitreport()
x_polynomialfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_list(__xc, xc, DT_REAL, X_CREATE)
x_from_list(__yc, yc, DT_REAL, X_CREATE)
x_from_list(__dc, dc, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_polynomialfitwc(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__n), ctypes.byref(__xc), ctypes.byref(__yc), ctypes.byref(__dc), ctypes.byref(__k), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__p), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_polynomialfitwc'")
__r__info = __info.val
__r__p = barycentricinterpolant(__p)
__r__rep = polynomialfitreport_from_x(__rep)
return (__r__info, __r__p, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
x_vector_clear(__xc)
x_vector_clear(__yc)
x_vector_clear(__dc)
x_polynomialfitreport_clear(__rep)
_lib_alglib.alglib_logisticcalc4.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_logisticcalc4.restype = ctypes.c_int32
def logisticcalc4(x, a, b, c, d):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__c = ctypes.c_double(c)
__d = ctypes.c_double(d)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_logisticcalc4(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__c), ctypes.byref(__d))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'logisticcalc4'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_logisticcalc5.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_logisticcalc5.restype = ctypes.c_int32
def logisticcalc5(x, a, b, c, d, g):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__c = ctypes.c_double(c)
__d = ctypes.c_double(d)
__g = ctypes.c_double(g)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_logisticcalc5(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__c), ctypes.byref(__d), ctypes.byref(__g))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'logisticcalc5'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_logisticfit4.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_logisticfit4.restype = ctypes.c_int32
def logisticfit4(x, y, n):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__a = ctypes.c_double(0)
__b = ctypes.c_double(0)
__c = ctypes.c_double(0)
__d = ctypes.c_double(0)
__rep = x_lsfitreport()
x_lsfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_logisticfit4(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__c), ctypes.byref(__d), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'logisticfit4'")
__r__a = __a.value
__r__b = __b.value
__r__c = __c.value
__r__d = __d.value
__r__rep = lsfitreport_from_x(__rep)
return (__r__a, __r__b, __r__c, __r__d, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_lsfitreport_clear(__rep)
_lib_alglib.alglib_logisticfit4ec.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_logisticfit4ec.restype = ctypes.c_int32
def logisticfit4ec(x, y, n, cnstrleft, cnstrright):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__cnstrleft = ctypes.c_double(cnstrleft)
__cnstrright = ctypes.c_double(cnstrright)
__a = ctypes.c_double(0)
__b = ctypes.c_double(0)
__c = ctypes.c_double(0)
__d = ctypes.c_double(0)
__rep = x_lsfitreport()
x_lsfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_logisticfit4ec(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__cnstrleft), ctypes.byref(__cnstrright), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__c), ctypes.byref(__d), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'logisticfit4ec'")
__r__a = __a.value
__r__b = __b.value
__r__c = __c.value
__r__d = __d.value
__r__rep = lsfitreport_from_x(__rep)
return (__r__a, __r__b, __r__c, __r__d, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_lsfitreport_clear(__rep)
_lib_alglib.alglib_logisticfit5.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_logisticfit5.restype = ctypes.c_int32
def logisticfit5(x, y, n):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__a = ctypes.c_double(0)
__b = ctypes.c_double(0)
__c = ctypes.c_double(0)
__d = ctypes.c_double(0)
__g = ctypes.c_double(0)
__rep = x_lsfitreport()
x_lsfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_logisticfit5(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__c), ctypes.byref(__d), ctypes.byref(__g), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'logisticfit5'")
__r__a = __a.value
__r__b = __b.value
__r__c = __c.value
__r__d = __d.value
__r__g = __g.value
__r__rep = lsfitreport_from_x(__rep)
return (__r__a, __r__b, __r__c, __r__d, __r__g, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_lsfitreport_clear(__rep)
_lib_alglib.alglib_logisticfit5ec.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_logisticfit5ec.restype = ctypes.c_int32
def logisticfit5ec(x, y, n, cnstrleft, cnstrright):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__cnstrleft = ctypes.c_double(cnstrleft)
__cnstrright = ctypes.c_double(cnstrright)
__a = ctypes.c_double(0)
__b = ctypes.c_double(0)
__c = ctypes.c_double(0)
__d = ctypes.c_double(0)
__g = ctypes.c_double(0)
__rep = x_lsfitreport()
x_lsfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_logisticfit5ec(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__cnstrleft), ctypes.byref(__cnstrright), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__c), ctypes.byref(__d), ctypes.byref(__g), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'logisticfit5ec'")
__r__a = __a.value
__r__b = __b.value
__r__c = __c.value
__r__d = __d.value
__r__g = __g.value
__r__rep = lsfitreport_from_x(__rep)
return (__r__a, __r__b, __r__c, __r__d, __r__g, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_lsfitreport_clear(__rep)
_lib_alglib.alglib_logisticfit45x.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_logisticfit45x.restype = ctypes.c_int32
def logisticfit45x(x, y, n, cnstrleft, cnstrright, is4pl, lambdav, epsx, rscnt):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__cnstrleft = ctypes.c_double(cnstrleft)
__cnstrright = ctypes.c_double(cnstrright)
__is4pl = ctypes.c_uint8(is4pl)
if __is4pl.value!=0:
__is4pl = ctypes.c_uint8(1)
__lambdav = ctypes.c_double(lambdav)
__epsx = ctypes.c_double(epsx)
__rscnt = x_int()
__rscnt.val = int(rscnt)
if __rscnt.val!=rscnt:
raise ValueError("Error while converting 'rscnt' parameter to 'x_int'")
__a = ctypes.c_double(0)
__b = ctypes.c_double(0)
__c = ctypes.c_double(0)
__d = ctypes.c_double(0)
__g = ctypes.c_double(0)
__rep = x_lsfitreport()
x_lsfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_logisticfit45x(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__cnstrleft), ctypes.byref(__cnstrright), ctypes.byref(__is4pl), ctypes.byref(__lambdav), ctypes.byref(__epsx), ctypes.byref(__rscnt), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__c), ctypes.byref(__d), ctypes.byref(__g), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'logisticfit45x'")
__r__a = __a.value
__r__b = __b.value
__r__c = __c.value
__r__d = __d.value
__r__g = __g.value
__r__rep = lsfitreport_from_x(__rep)
return (__r__a, __r__b, __r__c, __r__d, __r__g, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_lsfitreport_clear(__rep)
_lib_alglib.alglib_barycentricfitfloaterhormannwc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_barycentricfitfloaterhormannwc.restype = ctypes.c_int32
def barycentricfitfloaterhormannwc(x, y, w, n, xc, yc, dc, k, m):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(xc):
raise ValueError("'xc' parameter can't be cast to real_vector")
__xc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(yc):
raise ValueError("'yc' parameter can't be cast to real_vector")
__yc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(dc):
raise ValueError("'dc' parameter can't be cast to int_vector")
__dc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__b = ctypes.c_void_p(0)
__rep = x_barycentricfitreport()
x_barycentricfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_list(__xc, xc, DT_REAL, X_CREATE)
x_from_list(__yc, yc, DT_REAL, X_CREATE)
x_from_list(__dc, dc, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_barycentricfitfloaterhormannwc(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__n), ctypes.byref(__xc), ctypes.byref(__yc), ctypes.byref(__dc), ctypes.byref(__k), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__b), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'barycentricfitfloaterhormannwc'")
__r__info = __info.val
__r__b = barycentricinterpolant(__b)
__r__rep = barycentricfitreport_from_x(__rep)
return (__r__info, __r__b, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
x_vector_clear(__xc)
x_vector_clear(__yc)
x_vector_clear(__dc)
x_barycentricfitreport_clear(__rep)
_lib_alglib.alglib_smp_barycentricfitfloaterhormannwc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_barycentricfitfloaterhormannwc.restype = ctypes.c_int32
def smp_barycentricfitfloaterhormannwc(x, y, w, n, xc, yc, dc, k, m):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(xc):
raise ValueError("'xc' parameter can't be cast to real_vector")
__xc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(yc):
raise ValueError("'yc' parameter can't be cast to real_vector")
__yc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(dc):
raise ValueError("'dc' parameter can't be cast to int_vector")
__dc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__b = ctypes.c_void_p(0)
__rep = x_barycentricfitreport()
x_barycentricfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_list(__xc, xc, DT_REAL, X_CREATE)
x_from_list(__yc, yc, DT_REAL, X_CREATE)
x_from_list(__dc, dc, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_barycentricfitfloaterhormannwc(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__n), ctypes.byref(__xc), ctypes.byref(__yc), ctypes.byref(__dc), ctypes.byref(__k), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__b), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_barycentricfitfloaterhormannwc'")
__r__info = __info.val
__r__b = barycentricinterpolant(__b)
__r__rep = barycentricfitreport_from_x(__rep)
return (__r__info, __r__b, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
x_vector_clear(__xc)
x_vector_clear(__yc)
x_vector_clear(__dc)
x_barycentricfitreport_clear(__rep)
_lib_alglib.alglib_barycentricfitfloaterhormann.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_barycentricfitfloaterhormann.restype = ctypes.c_int32
def barycentricfitfloaterhormann(x, y, n, m):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__b = ctypes.c_void_p(0)
__rep = x_barycentricfitreport()
x_barycentricfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_barycentricfitfloaterhormann(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__b), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'barycentricfitfloaterhormann'")
__r__info = __info.val
__r__b = barycentricinterpolant(__b)
__r__rep = barycentricfitreport_from_x(__rep)
return (__r__info, __r__b, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_barycentricfitreport_clear(__rep)
_lib_alglib.alglib_smp_barycentricfitfloaterhormann.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_barycentricfitfloaterhormann.restype = ctypes.c_int32
def smp_barycentricfitfloaterhormann(x, y, n, m):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__b = ctypes.c_void_p(0)
__rep = x_barycentricfitreport()
x_barycentricfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_barycentricfitfloaterhormann(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__b), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_barycentricfitfloaterhormann'")
__r__info = __info.val
__r__b = barycentricinterpolant(__b)
__r__rep = barycentricfitreport_from_x(__rep)
return (__r__info, __r__b, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_barycentricfitreport_clear(__rep)
_lib_alglib.alglib_spline1dfitcubicwc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dfitcubicwc.restype = ctypes.c_int32
def spline1dfitcubicwc(*functionargs):
if len(functionargs)==9:
__friendly_form = False
x,y,w,n,xc,yc,dc,k,m = functionargs
elif len(functionargs)==7:
__friendly_form = True
x,y,w,xc,yc,dc,m = functionargs
if safe_len("'spline1dfitcubicwc': incorrect parameters",x)!=safe_len("'spline1dfitcubicwc': incorrect parameters",y) or safe_len("'spline1dfitcubicwc': incorrect parameters",x)!=safe_len("'spline1dfitcubicwc': incorrect parameters",w):
raise RuntimeError("Error while calling 'spline1dfitcubicwc': looks like one of arguments has wrong size")
n = safe_len("'spline1dfitcubicwc': incorrect parameters",x)
if safe_len("'spline1dfitcubicwc': incorrect parameters",xc)!=safe_len("'spline1dfitcubicwc': incorrect parameters",yc) or safe_len("'spline1dfitcubicwc': incorrect parameters",xc)!=safe_len("'spline1dfitcubicwc': incorrect parameters",dc):
raise RuntimeError("Error while calling 'spline1dfitcubicwc': looks like one of arguments has wrong size")
k = safe_len("'spline1dfitcubicwc': incorrect parameters",xc)
else:
raise RuntimeError("Error while calling 'spline1dfitcubicwc': function must have 7 or 9 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(xc):
raise ValueError("'xc' parameter can't be cast to real_vector")
__xc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(yc):
raise ValueError("'yc' parameter can't be cast to real_vector")
__yc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(dc):
raise ValueError("'dc' parameter can't be cast to int_vector")
__dc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__s = ctypes.c_void_p(0)
__rep = x_spline1dfitreport()
x_spline1dfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_list(__xc, xc, DT_REAL, X_CREATE)
x_from_list(__yc, yc, DT_REAL, X_CREATE)
x_from_list(__dc, dc, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dfitcubicwc(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__n), ctypes.byref(__xc), ctypes.byref(__yc), ctypes.byref(__dc), ctypes.byref(__k), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dfitcubicwc'")
__r__info = __info.val
__r__s = spline1dinterpolant(__s)
__r__rep = spline1dfitreport_from_x(__rep)
return (__r__info, __r__s, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
x_vector_clear(__xc)
x_vector_clear(__yc)
x_vector_clear(__dc)
x_spline1dfitreport_clear(__rep)
_lib_alglib.alglib_smp_spline1dfitcubicwc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spline1dfitcubicwc.restype = ctypes.c_int32
def smp_spline1dfitcubicwc(*functionargs):
if len(functionargs)==9:
__friendly_form = False
x,y,w,n,xc,yc,dc,k,m = functionargs
elif len(functionargs)==7:
__friendly_form = True
x,y,w,xc,yc,dc,m = functionargs
if safe_len("'smp_spline1dfitcubicwc': incorrect parameters",x)!=safe_len("'smp_spline1dfitcubicwc': incorrect parameters",y) or safe_len("'smp_spline1dfitcubicwc': incorrect parameters",x)!=safe_len("'smp_spline1dfitcubicwc': incorrect parameters",w):
raise RuntimeError("Error while calling 'smp_spline1dfitcubicwc': looks like one of arguments has wrong size")
n = safe_len("'smp_spline1dfitcubicwc': incorrect parameters",x)
if safe_len("'smp_spline1dfitcubicwc': incorrect parameters",xc)!=safe_len("'smp_spline1dfitcubicwc': incorrect parameters",yc) or safe_len("'smp_spline1dfitcubicwc': incorrect parameters",xc)!=safe_len("'smp_spline1dfitcubicwc': incorrect parameters",dc):
raise RuntimeError("Error while calling 'smp_spline1dfitcubicwc': looks like one of arguments has wrong size")
k = safe_len("'smp_spline1dfitcubicwc': incorrect parameters",xc)
else:
raise RuntimeError("Error while calling 'smp_spline1dfitcubicwc': function must have 7 or 9 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(xc):
raise ValueError("'xc' parameter can't be cast to real_vector")
__xc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(yc):
raise ValueError("'yc' parameter can't be cast to real_vector")
__yc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(dc):
raise ValueError("'dc' parameter can't be cast to int_vector")
__dc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__s = ctypes.c_void_p(0)
__rep = x_spline1dfitreport()
x_spline1dfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_list(__xc, xc, DT_REAL, X_CREATE)
x_from_list(__yc, yc, DT_REAL, X_CREATE)
x_from_list(__dc, dc, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spline1dfitcubicwc(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__n), ctypes.byref(__xc), ctypes.byref(__yc), ctypes.byref(__dc), ctypes.byref(__k), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spline1dfitcubicwc'")
__r__info = __info.val
__r__s = spline1dinterpolant(__s)
__r__rep = spline1dfitreport_from_x(__rep)
return (__r__info, __r__s, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
x_vector_clear(__xc)
x_vector_clear(__yc)
x_vector_clear(__dc)
x_spline1dfitreport_clear(__rep)
_lib_alglib.alglib_spline1dfithermitewc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dfithermitewc.restype = ctypes.c_int32
def spline1dfithermitewc(*functionargs):
if len(functionargs)==9:
__friendly_form = False
x,y,w,n,xc,yc,dc,k,m = functionargs
elif len(functionargs)==7:
__friendly_form = True
x,y,w,xc,yc,dc,m = functionargs
if safe_len("'spline1dfithermitewc': incorrect parameters",x)!=safe_len("'spline1dfithermitewc': incorrect parameters",y) or safe_len("'spline1dfithermitewc': incorrect parameters",x)!=safe_len("'spline1dfithermitewc': incorrect parameters",w):
raise RuntimeError("Error while calling 'spline1dfithermitewc': looks like one of arguments has wrong size")
n = safe_len("'spline1dfithermitewc': incorrect parameters",x)
if safe_len("'spline1dfithermitewc': incorrect parameters",xc)!=safe_len("'spline1dfithermitewc': incorrect parameters",yc) or safe_len("'spline1dfithermitewc': incorrect parameters",xc)!=safe_len("'spline1dfithermitewc': incorrect parameters",dc):
raise RuntimeError("Error while calling 'spline1dfithermitewc': looks like one of arguments has wrong size")
k = safe_len("'spline1dfithermitewc': incorrect parameters",xc)
else:
raise RuntimeError("Error while calling 'spline1dfithermitewc': function must have 7 or 9 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(xc):
raise ValueError("'xc' parameter can't be cast to real_vector")
__xc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(yc):
raise ValueError("'yc' parameter can't be cast to real_vector")
__yc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(dc):
raise ValueError("'dc' parameter can't be cast to int_vector")
__dc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__s = ctypes.c_void_p(0)
__rep = x_spline1dfitreport()
x_spline1dfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_list(__xc, xc, DT_REAL, X_CREATE)
x_from_list(__yc, yc, DT_REAL, X_CREATE)
x_from_list(__dc, dc, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dfithermitewc(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__n), ctypes.byref(__xc), ctypes.byref(__yc), ctypes.byref(__dc), ctypes.byref(__k), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dfithermitewc'")
__r__info = __info.val
__r__s = spline1dinterpolant(__s)
__r__rep = spline1dfitreport_from_x(__rep)
return (__r__info, __r__s, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
x_vector_clear(__xc)
x_vector_clear(__yc)
x_vector_clear(__dc)
x_spline1dfitreport_clear(__rep)
_lib_alglib.alglib_smp_spline1dfithermitewc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spline1dfithermitewc.restype = ctypes.c_int32
def smp_spline1dfithermitewc(*functionargs):
if len(functionargs)==9:
__friendly_form = False
x,y,w,n,xc,yc,dc,k,m = functionargs
elif len(functionargs)==7:
__friendly_form = True
x,y,w,xc,yc,dc,m = functionargs
if safe_len("'smp_spline1dfithermitewc': incorrect parameters",x)!=safe_len("'smp_spline1dfithermitewc': incorrect parameters",y) or safe_len("'smp_spline1dfithermitewc': incorrect parameters",x)!=safe_len("'smp_spline1dfithermitewc': incorrect parameters",w):
raise RuntimeError("Error while calling 'smp_spline1dfithermitewc': looks like one of arguments has wrong size")
n = safe_len("'smp_spline1dfithermitewc': incorrect parameters",x)
if safe_len("'smp_spline1dfithermitewc': incorrect parameters",xc)!=safe_len("'smp_spline1dfithermitewc': incorrect parameters",yc) or safe_len("'smp_spline1dfithermitewc': incorrect parameters",xc)!=safe_len("'smp_spline1dfithermitewc': incorrect parameters",dc):
raise RuntimeError("Error while calling 'smp_spline1dfithermitewc': looks like one of arguments has wrong size")
k = safe_len("'smp_spline1dfithermitewc': incorrect parameters",xc)
else:
raise RuntimeError("Error while calling 'smp_spline1dfithermitewc': function must have 7 or 9 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(xc):
raise ValueError("'xc' parameter can't be cast to real_vector")
__xc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(yc):
raise ValueError("'yc' parameter can't be cast to real_vector")
__yc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(dc):
raise ValueError("'dc' parameter can't be cast to int_vector")
__dc = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__s = ctypes.c_void_p(0)
__rep = x_spline1dfitreport()
x_spline1dfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_list(__xc, xc, DT_REAL, X_CREATE)
x_from_list(__yc, yc, DT_REAL, X_CREATE)
x_from_list(__dc, dc, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spline1dfithermitewc(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__n), ctypes.byref(__xc), ctypes.byref(__yc), ctypes.byref(__dc), ctypes.byref(__k), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spline1dfithermitewc'")
__r__info = __info.val
__r__s = spline1dinterpolant(__s)
__r__rep = spline1dfitreport_from_x(__rep)
return (__r__info, __r__s, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
x_vector_clear(__xc)
x_vector_clear(__yc)
x_vector_clear(__dc)
x_spline1dfitreport_clear(__rep)
_lib_alglib.alglib_spline1dfitcubic.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dfitcubic.restype = ctypes.c_int32
def spline1dfitcubic(*functionargs):
if len(functionargs)==4:
__friendly_form = False
x,y,n,m = functionargs
elif len(functionargs)==3:
__friendly_form = True
x,y,m = functionargs
if safe_len("'spline1dfitcubic': incorrect parameters",x)!=safe_len("'spline1dfitcubic': incorrect parameters",y):
raise RuntimeError("Error while calling 'spline1dfitcubic': looks like one of arguments has wrong size")
n = safe_len("'spline1dfitcubic': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'spline1dfitcubic': function must have 3 or 4 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__s = ctypes.c_void_p(0)
__rep = x_spline1dfitreport()
x_spline1dfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dfitcubic(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dfitcubic'")
__r__info = __info.val
__r__s = spline1dinterpolant(__s)
__r__rep = spline1dfitreport_from_x(__rep)
return (__r__info, __r__s, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_spline1dfitreport_clear(__rep)
_lib_alglib.alglib_smp_spline1dfitcubic.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spline1dfitcubic.restype = ctypes.c_int32
def smp_spline1dfitcubic(*functionargs):
if len(functionargs)==4:
__friendly_form = False
x,y,n,m = functionargs
elif len(functionargs)==3:
__friendly_form = True
x,y,m = functionargs
if safe_len("'smp_spline1dfitcubic': incorrect parameters",x)!=safe_len("'smp_spline1dfitcubic': incorrect parameters",y):
raise RuntimeError("Error while calling 'smp_spline1dfitcubic': looks like one of arguments has wrong size")
n = safe_len("'smp_spline1dfitcubic': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'smp_spline1dfitcubic': function must have 3 or 4 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__s = ctypes.c_void_p(0)
__rep = x_spline1dfitreport()
x_spline1dfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spline1dfitcubic(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spline1dfitcubic'")
__r__info = __info.val
__r__s = spline1dinterpolant(__s)
__r__rep = spline1dfitreport_from_x(__rep)
return (__r__info, __r__s, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_spline1dfitreport_clear(__rep)
_lib_alglib.alglib_spline1dfithermite.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline1dfithermite.restype = ctypes.c_int32
def spline1dfithermite(*functionargs):
if len(functionargs)==4:
__friendly_form = False
x,y,n,m = functionargs
elif len(functionargs)==3:
__friendly_form = True
x,y,m = functionargs
if safe_len("'spline1dfithermite': incorrect parameters",x)!=safe_len("'spline1dfithermite': incorrect parameters",y):
raise RuntimeError("Error while calling 'spline1dfithermite': looks like one of arguments has wrong size")
n = safe_len("'spline1dfithermite': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'spline1dfithermite': function must have 3 or 4 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__s = ctypes.c_void_p(0)
__rep = x_spline1dfitreport()
x_spline1dfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline1dfithermite(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline1dfithermite'")
__r__info = __info.val
__r__s = spline1dinterpolant(__s)
__r__rep = spline1dfitreport_from_x(__rep)
return (__r__info, __r__s, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_spline1dfitreport_clear(__rep)
_lib_alglib.alglib_smp_spline1dfithermite.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_spline1dfithermite.restype = ctypes.c_int32
def smp_spline1dfithermite(*functionargs):
if len(functionargs)==4:
__friendly_form = False
x,y,n,m = functionargs
elif len(functionargs)==3:
__friendly_form = True
x,y,m = functionargs
if safe_len("'smp_spline1dfithermite': incorrect parameters",x)!=safe_len("'smp_spline1dfithermite': incorrect parameters",y):
raise RuntimeError("Error while calling 'smp_spline1dfithermite': looks like one of arguments has wrong size")
n = safe_len("'smp_spline1dfithermite': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'smp_spline1dfithermite': function must have 3 or 4 parameters")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__s = ctypes.c_void_p(0)
__rep = x_spline1dfitreport()
x_spline1dfitreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_spline1dfithermite(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_spline1dfithermite'")
__r__info = __info.val
__r__s = spline1dinterpolant(__s)
__r__rep = spline1dfitreport_from_x(__rep)
return (__r__info, __r__s, __r__rep)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_spline1dfitreport_clear(__rep)
_lib_alglib.alglib_lsfitlinearw.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitlinearw.restype = ctypes.c_int32
def lsfitlinearw(*functionargs):
if len(functionargs)==5:
__friendly_form = False
y,w,fmatrix,n,m = functionargs
elif len(functionargs)==3:
__friendly_form = True
y,w,fmatrix = functionargs
if safe_len("'lsfitlinearw': incorrect parameters",y)!=safe_len("'lsfitlinearw': incorrect parameters",w) or safe_len("'lsfitlinearw': incorrect parameters",y)!=safe_rows("'lsfitlinearw': incorrect parameters",fmatrix):
raise RuntimeError("Error while calling 'lsfitlinearw': looks like one of arguments has wrong size")
n = safe_len("'lsfitlinearw': incorrect parameters",y)
m = safe_cols("'lsfitlinearw': incorrect parameters",fmatrix)
else:
raise RuntimeError("Error while calling 'lsfitlinearw': function must have 3 or 5 parameters")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(fmatrix):
raise ValueError("'fmatrix' parameter can't be cast to real_matrix")
__fmatrix = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_lsfitreport()
x_lsfitreport_zero_fields(__rep)
try:
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_listlist(__fmatrix, fmatrix, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitlinearw(ctypes.byref(_error_msg), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__fmatrix), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__c), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitlinearw'")
__r__info = __info.val
__r__c = list_from_x(__c)
__r__rep = lsfitreport_from_x(__rep)
return (__r__info, __r__c, __r__rep)
finally:
x_vector_clear(__y)
x_vector_clear(__w)
x_matrix_clear(__fmatrix)
x_vector_clear(__c)
x_lsfitreport_clear(__rep)
_lib_alglib.alglib_smp_lsfitlinearw.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_lsfitlinearw.restype = ctypes.c_int32
def smp_lsfitlinearw(*functionargs):
if len(functionargs)==5:
__friendly_form = False
y,w,fmatrix,n,m = functionargs
elif len(functionargs)==3:
__friendly_form = True
y,w,fmatrix = functionargs
if safe_len("'smp_lsfitlinearw': incorrect parameters",y)!=safe_len("'smp_lsfitlinearw': incorrect parameters",w) or safe_len("'smp_lsfitlinearw': incorrect parameters",y)!=safe_rows("'smp_lsfitlinearw': incorrect parameters",fmatrix):
raise RuntimeError("Error while calling 'smp_lsfitlinearw': looks like one of arguments has wrong size")
n = safe_len("'smp_lsfitlinearw': incorrect parameters",y)
m = safe_cols("'smp_lsfitlinearw': incorrect parameters",fmatrix)
else:
raise RuntimeError("Error while calling 'smp_lsfitlinearw': function must have 3 or 5 parameters")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(fmatrix):
raise ValueError("'fmatrix' parameter can't be cast to real_matrix")
__fmatrix = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_lsfitreport()
x_lsfitreport_zero_fields(__rep)
try:
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_listlist(__fmatrix, fmatrix, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_lsfitlinearw(ctypes.byref(_error_msg), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__fmatrix), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__c), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_lsfitlinearw'")
__r__info = __info.val
__r__c = list_from_x(__c)
__r__rep = lsfitreport_from_x(__rep)
return (__r__info, __r__c, __r__rep)
finally:
x_vector_clear(__y)
x_vector_clear(__w)
x_matrix_clear(__fmatrix)
x_vector_clear(__c)
x_lsfitreport_clear(__rep)
_lib_alglib.alglib_lsfitlinearwc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitlinearwc.restype = ctypes.c_int32
def lsfitlinearwc(*functionargs):
if len(functionargs)==7:
__friendly_form = False
y,w,fmatrix,cmatrix,n,m,k = functionargs
elif len(functionargs)==4:
__friendly_form = True
y,w,fmatrix,cmatrix = functionargs
if safe_len("'lsfitlinearwc': incorrect parameters",y)!=safe_len("'lsfitlinearwc': incorrect parameters",w) or safe_len("'lsfitlinearwc': incorrect parameters",y)!=safe_rows("'lsfitlinearwc': incorrect parameters",fmatrix):
raise RuntimeError("Error while calling 'lsfitlinearwc': looks like one of arguments has wrong size")
n = safe_len("'lsfitlinearwc': incorrect parameters",y)
if safe_cols("'lsfitlinearwc': incorrect parameters",fmatrix)!=safe_cols("'lsfitlinearwc': incorrect parameters",cmatrix)-1:
raise RuntimeError("Error while calling 'lsfitlinearwc': looks like one of arguments has wrong size")
m = safe_cols("'lsfitlinearwc': incorrect parameters",fmatrix)
k = safe_rows("'lsfitlinearwc': incorrect parameters",cmatrix)
else:
raise RuntimeError("Error while calling 'lsfitlinearwc': function must have 4 or 7 parameters")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(fmatrix):
raise ValueError("'fmatrix' parameter can't be cast to real_matrix")
__fmatrix = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(cmatrix):
raise ValueError("'cmatrix' parameter can't be cast to real_matrix")
__cmatrix = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_lsfitreport()
x_lsfitreport_zero_fields(__rep)
try:
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_listlist(__fmatrix, fmatrix, DT_REAL, X_CREATE)
x_from_listlist(__cmatrix, cmatrix, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitlinearwc(ctypes.byref(_error_msg), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__fmatrix), ctypes.byref(__cmatrix), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__k), ctypes.byref(__info), ctypes.byref(__c), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitlinearwc'")
__r__info = __info.val
__r__c = list_from_x(__c)
__r__rep = lsfitreport_from_x(__rep)
return (__r__info, __r__c, __r__rep)
finally:
x_vector_clear(__y)
x_vector_clear(__w)
x_matrix_clear(__fmatrix)
x_matrix_clear(__cmatrix)
x_vector_clear(__c)
x_lsfitreport_clear(__rep)
_lib_alglib.alglib_smp_lsfitlinearwc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_lsfitlinearwc.restype = ctypes.c_int32
def smp_lsfitlinearwc(*functionargs):
if len(functionargs)==7:
__friendly_form = False
y,w,fmatrix,cmatrix,n,m,k = functionargs
elif len(functionargs)==4:
__friendly_form = True
y,w,fmatrix,cmatrix = functionargs
if safe_len("'smp_lsfitlinearwc': incorrect parameters",y)!=safe_len("'smp_lsfitlinearwc': incorrect parameters",w) or safe_len("'smp_lsfitlinearwc': incorrect parameters",y)!=safe_rows("'smp_lsfitlinearwc': incorrect parameters",fmatrix):
raise RuntimeError("Error while calling 'smp_lsfitlinearwc': looks like one of arguments has wrong size")
n = safe_len("'smp_lsfitlinearwc': incorrect parameters",y)
if safe_cols("'smp_lsfitlinearwc': incorrect parameters",fmatrix)!=safe_cols("'smp_lsfitlinearwc': incorrect parameters",cmatrix)-1:
raise RuntimeError("Error while calling 'smp_lsfitlinearwc': looks like one of arguments has wrong size")
m = safe_cols("'smp_lsfitlinearwc': incorrect parameters",fmatrix)
k = safe_rows("'smp_lsfitlinearwc': incorrect parameters",cmatrix)
else:
raise RuntimeError("Error while calling 'smp_lsfitlinearwc': function must have 4 or 7 parameters")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(fmatrix):
raise ValueError("'fmatrix' parameter can't be cast to real_matrix")
__fmatrix = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(cmatrix):
raise ValueError("'cmatrix' parameter can't be cast to real_matrix")
__cmatrix = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_lsfitreport()
x_lsfitreport_zero_fields(__rep)
try:
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_listlist(__fmatrix, fmatrix, DT_REAL, X_CREATE)
x_from_listlist(__cmatrix, cmatrix, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_lsfitlinearwc(ctypes.byref(_error_msg), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__fmatrix), ctypes.byref(__cmatrix), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__k), ctypes.byref(__info), ctypes.byref(__c), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_lsfitlinearwc'")
__r__info = __info.val
__r__c = list_from_x(__c)
__r__rep = lsfitreport_from_x(__rep)
return (__r__info, __r__c, __r__rep)
finally:
x_vector_clear(__y)
x_vector_clear(__w)
x_matrix_clear(__fmatrix)
x_matrix_clear(__cmatrix)
x_vector_clear(__c)
x_lsfitreport_clear(__rep)
_lib_alglib.alglib_lsfitlinear.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitlinear.restype = ctypes.c_int32
def lsfitlinear(*functionargs):
if len(functionargs)==4:
__friendly_form = False
y,fmatrix,n,m = functionargs
elif len(functionargs)==2:
__friendly_form = True
y,fmatrix = functionargs
if safe_len("'lsfitlinear': incorrect parameters",y)!=safe_rows("'lsfitlinear': incorrect parameters",fmatrix):
raise RuntimeError("Error while calling 'lsfitlinear': looks like one of arguments has wrong size")
n = safe_len("'lsfitlinear': incorrect parameters",y)
m = safe_cols("'lsfitlinear': incorrect parameters",fmatrix)
else:
raise RuntimeError("Error while calling 'lsfitlinear': function must have 2 or 4 parameters")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(fmatrix):
raise ValueError("'fmatrix' parameter can't be cast to real_matrix")
__fmatrix = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_lsfitreport()
x_lsfitreport_zero_fields(__rep)
try:
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_listlist(__fmatrix, fmatrix, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitlinear(ctypes.byref(_error_msg), ctypes.byref(__y), ctypes.byref(__fmatrix), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__c), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitlinear'")
__r__info = __info.val
__r__c = list_from_x(__c)
__r__rep = lsfitreport_from_x(__rep)
return (__r__info, __r__c, __r__rep)
finally:
x_vector_clear(__y)
x_matrix_clear(__fmatrix)
x_vector_clear(__c)
x_lsfitreport_clear(__rep)
_lib_alglib.alglib_smp_lsfitlinear.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_lsfitlinear.restype = ctypes.c_int32
def smp_lsfitlinear(*functionargs):
if len(functionargs)==4:
__friendly_form = False
y,fmatrix,n,m = functionargs
elif len(functionargs)==2:
__friendly_form = True
y,fmatrix = functionargs
if safe_len("'smp_lsfitlinear': incorrect parameters",y)!=safe_rows("'smp_lsfitlinear': incorrect parameters",fmatrix):
raise RuntimeError("Error while calling 'smp_lsfitlinear': looks like one of arguments has wrong size")
n = safe_len("'smp_lsfitlinear': incorrect parameters",y)
m = safe_cols("'smp_lsfitlinear': incorrect parameters",fmatrix)
else:
raise RuntimeError("Error while calling 'smp_lsfitlinear': function must have 2 or 4 parameters")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(fmatrix):
raise ValueError("'fmatrix' parameter can't be cast to real_matrix")
__fmatrix = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_lsfitreport()
x_lsfitreport_zero_fields(__rep)
try:
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_listlist(__fmatrix, fmatrix, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_lsfitlinear(ctypes.byref(_error_msg), ctypes.byref(__y), ctypes.byref(__fmatrix), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__info), ctypes.byref(__c), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_lsfitlinear'")
__r__info = __info.val
__r__c = list_from_x(__c)
__r__rep = lsfitreport_from_x(__rep)
return (__r__info, __r__c, __r__rep)
finally:
x_vector_clear(__y)
x_matrix_clear(__fmatrix)
x_vector_clear(__c)
x_lsfitreport_clear(__rep)
_lib_alglib.alglib_lsfitlinearc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitlinearc.restype = ctypes.c_int32
def lsfitlinearc(*functionargs):
if len(functionargs)==6:
__friendly_form = False
y,fmatrix,cmatrix,n,m,k = functionargs
elif len(functionargs)==3:
__friendly_form = True
y,fmatrix,cmatrix = functionargs
if safe_len("'lsfitlinearc': incorrect parameters",y)!=safe_rows("'lsfitlinearc': incorrect parameters",fmatrix):
raise RuntimeError("Error while calling 'lsfitlinearc': looks like one of arguments has wrong size")
n = safe_len("'lsfitlinearc': incorrect parameters",y)
if safe_cols("'lsfitlinearc': incorrect parameters",fmatrix)!=safe_cols("'lsfitlinearc': incorrect parameters",cmatrix)-1:
raise RuntimeError("Error while calling 'lsfitlinearc': looks like one of arguments has wrong size")
m = safe_cols("'lsfitlinearc': incorrect parameters",fmatrix)
k = safe_rows("'lsfitlinearc': incorrect parameters",cmatrix)
else:
raise RuntimeError("Error while calling 'lsfitlinearc': function must have 3 or 6 parameters")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(fmatrix):
raise ValueError("'fmatrix' parameter can't be cast to real_matrix")
__fmatrix = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(cmatrix):
raise ValueError("'cmatrix' parameter can't be cast to real_matrix")
__cmatrix = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_lsfitreport()
x_lsfitreport_zero_fields(__rep)
try:
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_listlist(__fmatrix, fmatrix, DT_REAL, X_CREATE)
x_from_listlist(__cmatrix, cmatrix, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitlinearc(ctypes.byref(_error_msg), ctypes.byref(__y), ctypes.byref(__fmatrix), ctypes.byref(__cmatrix), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__k), ctypes.byref(__info), ctypes.byref(__c), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitlinearc'")
__r__info = __info.val
__r__c = list_from_x(__c)
__r__rep = lsfitreport_from_x(__rep)
return (__r__info, __r__c, __r__rep)
finally:
x_vector_clear(__y)
x_matrix_clear(__fmatrix)
x_matrix_clear(__cmatrix)
x_vector_clear(__c)
x_lsfitreport_clear(__rep)
_lib_alglib.alglib_smp_lsfitlinearc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_lsfitlinearc.restype = ctypes.c_int32
def smp_lsfitlinearc(*functionargs):
if len(functionargs)==6:
__friendly_form = False
y,fmatrix,cmatrix,n,m,k = functionargs
elif len(functionargs)==3:
__friendly_form = True
y,fmatrix,cmatrix = functionargs
if safe_len("'smp_lsfitlinearc': incorrect parameters",y)!=safe_rows("'smp_lsfitlinearc': incorrect parameters",fmatrix):
raise RuntimeError("Error while calling 'smp_lsfitlinearc': looks like one of arguments has wrong size")
n = safe_len("'smp_lsfitlinearc': incorrect parameters",y)
if safe_cols("'smp_lsfitlinearc': incorrect parameters",fmatrix)!=safe_cols("'smp_lsfitlinearc': incorrect parameters",cmatrix)-1:
raise RuntimeError("Error while calling 'smp_lsfitlinearc': looks like one of arguments has wrong size")
m = safe_cols("'smp_lsfitlinearc': incorrect parameters",fmatrix)
k = safe_rows("'smp_lsfitlinearc': incorrect parameters",cmatrix)
else:
raise RuntimeError("Error while calling 'smp_lsfitlinearc': function must have 3 or 6 parameters")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(fmatrix):
raise ValueError("'fmatrix' parameter can't be cast to real_matrix")
__fmatrix = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(cmatrix):
raise ValueError("'cmatrix' parameter can't be cast to real_matrix")
__cmatrix = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__info = x_int()
__info.val = 0
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_lsfitreport()
x_lsfitreport_zero_fields(__rep)
try:
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_listlist(__fmatrix, fmatrix, DT_REAL, X_CREATE)
x_from_listlist(__cmatrix, cmatrix, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_lsfitlinearc(ctypes.byref(_error_msg), ctypes.byref(__y), ctypes.byref(__fmatrix), ctypes.byref(__cmatrix), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__k), ctypes.byref(__info), ctypes.byref(__c), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_lsfitlinearc'")
__r__info = __info.val
__r__c = list_from_x(__c)
__r__rep = lsfitreport_from_x(__rep)
return (__r__info, __r__c, __r__rep)
finally:
x_vector_clear(__y)
x_matrix_clear(__fmatrix)
x_matrix_clear(__cmatrix)
x_vector_clear(__c)
x_lsfitreport_clear(__rep)
_lib_alglib.alglib_lsfitcreatewf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitcreatewf.restype = ctypes.c_int32
def lsfitcreatewf(*functionargs):
if len(functionargs)==8:
__friendly_form = False
x,y,w,c,n,m,k,diffstep = functionargs
elif len(functionargs)==5:
__friendly_form = True
x,y,w,c,diffstep = functionargs
if safe_rows("'lsfitcreatewf': incorrect parameters",x)!=safe_len("'lsfitcreatewf': incorrect parameters",y) or safe_rows("'lsfitcreatewf': incorrect parameters",x)!=safe_len("'lsfitcreatewf': incorrect parameters",w):
raise RuntimeError("Error while calling 'lsfitcreatewf': looks like one of arguments has wrong size")
n = safe_rows("'lsfitcreatewf': incorrect parameters",x)
m = safe_cols("'lsfitcreatewf': incorrect parameters",x)
k = safe_len("'lsfitcreatewf': incorrect parameters",c)
else:
raise RuntimeError("Error while calling 'lsfitcreatewf': function must have 5 or 8 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(c):
raise ValueError("'c' parameter can't be cast to real_vector")
__c = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__diffstep = ctypes.c_double(diffstep)
__state = ctypes.c_void_p(0)
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_list(__c, c, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitcreatewf(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__c), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__k), ctypes.byref(__diffstep), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitcreatewf'")
__r__state = lsfitstate(__state)
return __r__state
finally:
x_matrix_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
x_vector_clear(__c)
_lib_alglib.alglib_lsfitcreatef.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitcreatef.restype = ctypes.c_int32
def lsfitcreatef(*functionargs):
if len(functionargs)==7:
__friendly_form = False
x,y,c,n,m,k,diffstep = functionargs
elif len(functionargs)==4:
__friendly_form = True
x,y,c,diffstep = functionargs
if safe_rows("'lsfitcreatef': incorrect parameters",x)!=safe_len("'lsfitcreatef': incorrect parameters",y):
raise RuntimeError("Error while calling 'lsfitcreatef': looks like one of arguments has wrong size")
n = safe_rows("'lsfitcreatef': incorrect parameters",x)
m = safe_cols("'lsfitcreatef': incorrect parameters",x)
k = safe_len("'lsfitcreatef': incorrect parameters",c)
else:
raise RuntimeError("Error while calling 'lsfitcreatef': function must have 4 or 7 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(c):
raise ValueError("'c' parameter can't be cast to real_vector")
__c = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__diffstep = ctypes.c_double(diffstep)
__state = ctypes.c_void_p(0)
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__c, c, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitcreatef(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__c), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__k), ctypes.byref(__diffstep), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitcreatef'")
__r__state = lsfitstate(__state)
return __r__state
finally:
x_matrix_clear(__x)
x_vector_clear(__y)
x_vector_clear(__c)
_lib_alglib.alglib_lsfitcreatewfg.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitcreatewfg.restype = ctypes.c_int32
def lsfitcreatewfg(*functionargs):
if len(functionargs)==8:
__friendly_form = False
x,y,w,c,n,m,k,cheapfg = functionargs
elif len(functionargs)==5:
__friendly_form = True
x,y,w,c,cheapfg = functionargs
if safe_rows("'lsfitcreatewfg': incorrect parameters",x)!=safe_len("'lsfitcreatewfg': incorrect parameters",y) or safe_rows("'lsfitcreatewfg': incorrect parameters",x)!=safe_len("'lsfitcreatewfg': incorrect parameters",w):
raise RuntimeError("Error while calling 'lsfitcreatewfg': looks like one of arguments has wrong size")
n = safe_rows("'lsfitcreatewfg': incorrect parameters",x)
m = safe_cols("'lsfitcreatewfg': incorrect parameters",x)
k = safe_len("'lsfitcreatewfg': incorrect parameters",c)
else:
raise RuntimeError("Error while calling 'lsfitcreatewfg': function must have 5 or 8 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(c):
raise ValueError("'c' parameter can't be cast to real_vector")
__c = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__cheapfg = ctypes.c_uint8(cheapfg)
if __cheapfg.value!=0:
__cheapfg = ctypes.c_uint8(1)
__state = ctypes.c_void_p(0)
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_list(__c, c, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitcreatewfg(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__c), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__k), ctypes.byref(__cheapfg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitcreatewfg'")
__r__state = lsfitstate(__state)
return __r__state
finally:
x_matrix_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
x_vector_clear(__c)
_lib_alglib.alglib_lsfitcreatefg.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitcreatefg.restype = ctypes.c_int32
def lsfitcreatefg(*functionargs):
if len(functionargs)==7:
__friendly_form = False
x,y,c,n,m,k,cheapfg = functionargs
elif len(functionargs)==4:
__friendly_form = True
x,y,c,cheapfg = functionargs
if safe_rows("'lsfitcreatefg': incorrect parameters",x)!=safe_len("'lsfitcreatefg': incorrect parameters",y):
raise RuntimeError("Error while calling 'lsfitcreatefg': looks like one of arguments has wrong size")
n = safe_rows("'lsfitcreatefg': incorrect parameters",x)
m = safe_cols("'lsfitcreatefg': incorrect parameters",x)
k = safe_len("'lsfitcreatefg': incorrect parameters",c)
else:
raise RuntimeError("Error while calling 'lsfitcreatefg': function must have 4 or 7 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(c):
raise ValueError("'c' parameter can't be cast to real_vector")
__c = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__cheapfg = ctypes.c_uint8(cheapfg)
if __cheapfg.value!=0:
__cheapfg = ctypes.c_uint8(1)
__state = ctypes.c_void_p(0)
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__c, c, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitcreatefg(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__c), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__k), ctypes.byref(__cheapfg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitcreatefg'")
__r__state = lsfitstate(__state)
return __r__state
finally:
x_matrix_clear(__x)
x_vector_clear(__y)
x_vector_clear(__c)
_lib_alglib.alglib_lsfitcreatewfgh.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitcreatewfgh.restype = ctypes.c_int32
def lsfitcreatewfgh(*functionargs):
if len(functionargs)==7:
__friendly_form = False
x,y,w,c,n,m,k = functionargs
elif len(functionargs)==4:
__friendly_form = True
x,y,w,c = functionargs
if safe_rows("'lsfitcreatewfgh': incorrect parameters",x)!=safe_len("'lsfitcreatewfgh': incorrect parameters",y) or safe_rows("'lsfitcreatewfgh': incorrect parameters",x)!=safe_len("'lsfitcreatewfgh': incorrect parameters",w):
raise RuntimeError("Error while calling 'lsfitcreatewfgh': looks like one of arguments has wrong size")
n = safe_rows("'lsfitcreatewfgh': incorrect parameters",x)
m = safe_cols("'lsfitcreatewfgh': incorrect parameters",x)
k = safe_len("'lsfitcreatewfgh': incorrect parameters",c)
else:
raise RuntimeError("Error while calling 'lsfitcreatewfgh': function must have 4 or 7 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(w):
raise ValueError("'w' parameter can't be cast to real_vector")
__w = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(c):
raise ValueError("'c' parameter can't be cast to real_vector")
__c = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__state = ctypes.c_void_p(0)
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__w, w, DT_REAL, X_CREATE)
x_from_list(__c, c, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitcreatewfgh(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__w), ctypes.byref(__c), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__k), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitcreatewfgh'")
__r__state = lsfitstate(__state)
return __r__state
finally:
x_matrix_clear(__x)
x_vector_clear(__y)
x_vector_clear(__w)
x_vector_clear(__c)
_lib_alglib.alglib_lsfitcreatefgh.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitcreatefgh.restype = ctypes.c_int32
def lsfitcreatefgh(*functionargs):
if len(functionargs)==6:
__friendly_form = False
x,y,c,n,m,k = functionargs
elif len(functionargs)==3:
__friendly_form = True
x,y,c = functionargs
if safe_rows("'lsfitcreatefgh': incorrect parameters",x)!=safe_len("'lsfitcreatefgh': incorrect parameters",y):
raise RuntimeError("Error while calling 'lsfitcreatefgh': looks like one of arguments has wrong size")
n = safe_rows("'lsfitcreatefgh': incorrect parameters",x)
m = safe_cols("'lsfitcreatefgh': incorrect parameters",x)
k = safe_len("'lsfitcreatefgh': incorrect parameters",c)
else:
raise RuntimeError("Error while calling 'lsfitcreatefgh': function must have 3 or 6 parameters")
if not is_real_matrix(x):
raise ValueError("'x' parameter can't be cast to real_matrix")
__x = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(c):
raise ValueError("'c' parameter can't be cast to real_vector")
__c = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__state = ctypes.c_void_p(0)
try:
x_from_listlist(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__c, c, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitcreatefgh(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__c), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__k), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitcreatefgh'")
__r__state = lsfitstate(__state)
return __r__state
finally:
x_matrix_clear(__x)
x_vector_clear(__y)
x_vector_clear(__c)
_lib_alglib.alglib_lsfitsetcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitsetcond.restype = ctypes.c_int32
def lsfitsetcond(state, epsx, maxits):
pass
__state = state.ptr
__epsx = ctypes.c_double(epsx)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitsetcond(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsx), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitsetcond'")
return
finally:
pass
_lib_alglib.alglib_lsfitsetstpmax.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitsetstpmax.restype = ctypes.c_int32
def lsfitsetstpmax(state, stpmax):
pass
__state = state.ptr
__stpmax = ctypes.c_double(stpmax)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitsetstpmax(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__stpmax))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitsetstpmax'")
return
finally:
pass
_lib_alglib.alglib_lsfitsetxrep.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitsetxrep.restype = ctypes.c_int32
def lsfitsetxrep(state, needxrep):
pass
__state = state.ptr
__needxrep = ctypes.c_uint8(needxrep)
if __needxrep.value!=0:
__needxrep = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitsetxrep(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__needxrep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitsetxrep'")
return
finally:
pass
_lib_alglib.alglib_lsfitsetscale.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitsetscale.restype = ctypes.c_int32
def lsfitsetscale(state, s):
pass
__state = state.ptr
if not is_real_vector(s):
raise ValueError("'s' parameter can't be cast to real_vector")
__s = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__s, s, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitsetscale(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitsetscale'")
return
finally:
x_vector_clear(__s)
_lib_alglib.alglib_lsfitsetbc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitsetbc.restype = ctypes.c_int32
def lsfitsetbc(state, bndl, bndu):
pass
__state = state.ptr
if not is_real_vector(bndl):
raise ValueError("'bndl' parameter can't be cast to real_vector")
__bndl = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(bndu):
raise ValueError("'bndu' parameter can't be cast to real_vector")
__bndu = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__bndl, bndl, DT_REAL, X_CREATE)
x_from_list(__bndu, bndu, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitsetbc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__bndl), ctypes.byref(__bndu))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitsetbc'")
return
finally:
x_vector_clear(__bndl)
x_vector_clear(__bndu)
_lib_alglib.alglib_lsfitsetlc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitsetlc.restype = ctypes.c_int32
def lsfitsetlc(*functionargs):
if len(functionargs)==4:
__friendly_form = False
state,c,ct,k = functionargs
elif len(functionargs)==3:
__friendly_form = True
state,c,ct = functionargs
if safe_rows("'lsfitsetlc': incorrect parameters",c)!=safe_len("'lsfitsetlc': incorrect parameters",ct):
raise RuntimeError("Error while calling 'lsfitsetlc': looks like one of arguments has wrong size")
k = safe_rows("'lsfitsetlc': incorrect parameters",c)
else:
raise RuntimeError("Error while calling 'lsfitsetlc': function must have 3 or 4 parameters")
__state = state.ptr
if not is_real_matrix(c):
raise ValueError("'c' parameter can't be cast to real_matrix")
__c = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(ct):
raise ValueError("'ct' parameter can't be cast to int_vector")
__ct = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
try:
x_from_listlist(__c, c, DT_REAL, X_CREATE)
x_from_list(__ct, ct, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitsetlc(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__c), ctypes.byref(__ct), ctypes.byref(__k))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitsetlc'")
return
finally:
x_matrix_clear(__c)
x_vector_clear(__ct)
def lsfitfit_f(state, func, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_c = x_vector()
_lib_alglib.x_lsfitstate_get_c(state.ptr, ctypes.byref(_xc_c))
_py_c = create_real_vector(_xc_c.cnt)
_xc_x = x_vector()
_lib_alglib.x_lsfitstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
while True:
retval = _lib_alglib.alglib_lsfititeration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'lsfititeration'")
if not _xc_result:
break
_lib_alglib.x_lsfitstate_get_needf(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_c, _py_c)
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = func(_py_c, _py_x, param)
_lib_alglib.x_lsfitstate_set_f(state.ptr, ctypes.byref(_xc_f))
continue
_lib_alglib.x_lsfitstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_c, _py_c)
_lib_alglib.x_lsfitstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_c, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'lsfitfit' (some derivatives were not provided?)")
return
def lsfitfit_fg(state, func, grad, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_c = x_vector()
_lib_alglib.x_lsfitstate_get_c(state.ptr, ctypes.byref(_xc_c))
_py_c = create_real_vector(_xc_c.cnt)
_xc_x = x_vector()
_lib_alglib.x_lsfitstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
_xc_g = x_vector()
_lib_alglib.x_lsfitstate_get_g(state.ptr, ctypes.byref(_xc_g))
_py_g = create_real_vector(_xc_g.cnt)
while True:
retval = _lib_alglib.alglib_lsfititeration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'lsfititeration'")
if not _xc_result:
break
_lib_alglib.x_lsfitstate_get_needf(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_c, _py_c)
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = func(_py_c, _py_x, param)
_lib_alglib.x_lsfitstate_set_f(state.ptr, ctypes.byref(_xc_f))
continue
_lib_alglib.x_lsfitstate_get_needfg(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_c, _py_c)
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = grad(_py_c, _py_x, _py_g, param)
_lib_alglib.x_lsfitstate_set_f(state.ptr, ctypes.byref(_xc_f))
x_from_list(_xc_g, _py_g, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_lsfitstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_c, _py_c)
_lib_alglib.x_lsfitstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_c, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'lsfitfit' (some derivatives were not provided?)")
return
def lsfitfit_fgh(state, func, grad, hess, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_c = x_vector()
_lib_alglib.x_lsfitstate_get_c(state.ptr, ctypes.byref(_xc_c))
_py_c = create_real_vector(_xc_c.cnt)
_xc_x = x_vector()
_lib_alglib.x_lsfitstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
_xc_g = x_vector()
_lib_alglib.x_lsfitstate_get_g(state.ptr, ctypes.byref(_xc_g))
_py_g = create_real_vector(_xc_g.cnt)
_xc_h = x_matrix()
_lib_alglib.x_lsfitstate_get_h(state.ptr, ctypes.byref(_xc_h))
_py_h = create_real_matrix(_xc_h.rows,_xc_h.cols)
while True:
retval = _lib_alglib.alglib_lsfititeration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'lsfititeration'")
if not _xc_result:
break
_lib_alglib.x_lsfitstate_get_needf(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_c, _py_c)
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = func(_py_c, _py_x, param)
_lib_alglib.x_lsfitstate_set_f(state.ptr, ctypes.byref(_xc_f))
continue
_lib_alglib.x_lsfitstate_get_needfg(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_c, _py_c)
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = grad(_py_c, _py_x, _py_g, param)
_lib_alglib.x_lsfitstate_set_f(state.ptr, ctypes.byref(_xc_f))
x_from_list(_xc_g, _py_g, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_lsfitstate_get_needfgh(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_c, _py_c)
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = hess(_py_c, _py_x, _py_g, _py_h, param)
_lib_alglib.x_lsfitstate_set_f(state.ptr, ctypes.byref(_xc_f))
x_from_list(_xc_g, _py_g, DT_REAL, X_REWRITE)
x_from_listlist(_xc_h, _py_h, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_lsfitstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_c, _py_c)
_lib_alglib.x_lsfitstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_c, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'lsfitfit' (some derivatives were not provided?)")
return
_lib_alglib.alglib_lsfitresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitresults.restype = ctypes.c_int32
def lsfitresults(state):
pass
__state = state.ptr
__info = x_int()
__info.val = 0
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_lsfitreport()
x_lsfitreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__info), ctypes.byref(__c), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitresults'")
__r__info = __info.val
__r__c = list_from_x(__c)
__r__rep = lsfitreport_from_x(__rep)
return (__r__info, __r__c, __r__rep)
finally:
x_vector_clear(__c)
x_lsfitreport_clear(__rep)
_lib_alglib.alglib_lsfitsetgradientcheck.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lsfitsetgradientcheck.restype = ctypes.c_int32
def lsfitsetgradientcheck(state, teststep):
pass
__state = state.ptr
__teststep = ctypes.c_double(teststep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lsfitsetgradientcheck(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__teststep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lsfitsetgradientcheck'")
return
finally:
pass
_lib_alglib.alglib_nsfitspheremcc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_nsfitspheremcc.restype = ctypes.c_int32
def nsfitspheremcc(xy, npoints, nx):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nx = x_int()
__nx.val = int(nx)
if __nx.val!=nx:
raise ValueError("Error while converting 'nx' parameter to 'x_int'")
__cx = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rhi = ctypes.c_double(0)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_nsfitspheremcc(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nx), ctypes.byref(__cx), ctypes.byref(__rhi))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'nsfitspheremcc'")
__r__cx = list_from_x(__cx)
__r__rhi = __rhi.value
return (__r__cx, __r__rhi)
finally:
x_matrix_clear(__xy)
x_vector_clear(__cx)
_lib_alglib.alglib_nsfitspheremic.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_nsfitspheremic.restype = ctypes.c_int32
def nsfitspheremic(xy, npoints, nx):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nx = x_int()
__nx.val = int(nx)
if __nx.val!=nx:
raise ValueError("Error while converting 'nx' parameter to 'x_int'")
__cx = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rlo = ctypes.c_double(0)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_nsfitspheremic(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nx), ctypes.byref(__cx), ctypes.byref(__rlo))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'nsfitspheremic'")
__r__cx = list_from_x(__cx)
__r__rlo = __rlo.value
return (__r__cx, __r__rlo)
finally:
x_matrix_clear(__xy)
x_vector_clear(__cx)
_lib_alglib.alglib_nsfitspheremzc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_nsfitspheremzc.restype = ctypes.c_int32
def nsfitspheremzc(xy, npoints, nx):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nx = x_int()
__nx.val = int(nx)
if __nx.val!=nx:
raise ValueError("Error while converting 'nx' parameter to 'x_int'")
__cx = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rlo = ctypes.c_double(0)
__rhi = ctypes.c_double(0)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_nsfitspheremzc(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nx), ctypes.byref(__cx), ctypes.byref(__rlo), ctypes.byref(__rhi))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'nsfitspheremzc'")
__r__cx = list_from_x(__cx)
__r__rlo = __rlo.value
__r__rhi = __rhi.value
return (__r__cx, __r__rlo, __r__rhi)
finally:
x_matrix_clear(__xy)
x_vector_clear(__cx)
_lib_alglib.alglib_nsfitspherex.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_nsfitspherex.restype = ctypes.c_int32
def nsfitspherex(xy, npoints, nx, problemtype, epsx, aulits, penalty):
pass
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__npoints = x_int()
__npoints.val = int(npoints)
if __npoints.val!=npoints:
raise ValueError("Error while converting 'npoints' parameter to 'x_int'")
__nx = x_int()
__nx.val = int(nx)
if __nx.val!=nx:
raise ValueError("Error while converting 'nx' parameter to 'x_int'")
__problemtype = x_int()
__problemtype.val = int(problemtype)
if __problemtype.val!=problemtype:
raise ValueError("Error while converting 'problemtype' parameter to 'x_int'")
__epsx = ctypes.c_double(epsx)
__aulits = x_int()
__aulits.val = int(aulits)
if __aulits.val!=aulits:
raise ValueError("Error while converting 'aulits' parameter to 'x_int'")
__penalty = ctypes.c_double(penalty)
__cx = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rlo = ctypes.c_double(0)
__rhi = ctypes.c_double(0)
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_nsfitspherex(ctypes.byref(_error_msg), ctypes.byref(__xy), ctypes.byref(__npoints), ctypes.byref(__nx), ctypes.byref(__problemtype), ctypes.byref(__epsx), ctypes.byref(__aulits), ctypes.byref(__penalty), ctypes.byref(__cx), ctypes.byref(__rlo), ctypes.byref(__rhi))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'nsfitspherex'")
__r__cx = list_from_x(__cx)
__r__rlo = __rlo.value
__r__rhi = __rhi.value
return (__r__cx, __r__rlo, __r__rhi)
finally:
x_matrix_clear(__xy)
x_vector_clear(__cx)
_lib_alglib.x_obj_free_spline2dinterpolant.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_spline2dinterpolant.restype = None
class spline2dinterpolant(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_spline2dinterpolant(self.ptr)
_lib_alglib.alglib_spline2dcalc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2dcalc.restype = ctypes.c_int32
def spline2dcalc(c, x, y):
pass
__result = ctypes.c_double(0)
__c = c.ptr
__x = ctypes.c_double(x)
__y = ctypes.c_double(y)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2dcalc(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__c), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2dcalc'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_spline2ddiff.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2ddiff.restype = ctypes.c_int32
def spline2ddiff(c, x, y):
pass
__c = c.ptr
__x = ctypes.c_double(x)
__y = ctypes.c_double(y)
__f = ctypes.c_double(0)
__fx = ctypes.c_double(0)
__fy = ctypes.c_double(0)
__fxy = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2ddiff(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__f), ctypes.byref(__fx), ctypes.byref(__fy), ctypes.byref(__fxy))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2ddiff'")
__r__f = __f.value
__r__fx = __fx.value
__r__fy = __fy.value
__r__fxy = __fxy.value
return (__r__f, __r__fx, __r__fy, __r__fxy)
finally:
pass
_lib_alglib.alglib_spline2dlintransxy.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2dlintransxy.restype = ctypes.c_int32
def spline2dlintransxy(c, ax, bx, ay, by):
pass
__c = c.ptr
__ax = ctypes.c_double(ax)
__bx = ctypes.c_double(bx)
__ay = ctypes.c_double(ay)
__by = ctypes.c_double(by)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2dlintransxy(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__ax), ctypes.byref(__bx), ctypes.byref(__ay), ctypes.byref(__by))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2dlintransxy'")
return
finally:
pass
_lib_alglib.alglib_spline2dlintransf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2dlintransf.restype = ctypes.c_int32
def spline2dlintransf(c, a, b):
pass
__c = c.ptr
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2dlintransf(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__a), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2dlintransf'")
return
finally:
pass
_lib_alglib.alglib_spline2dcopy.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2dcopy.restype = ctypes.c_int32
def spline2dcopy(c):
pass
__c = c.ptr
__cc = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2dcopy(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__cc))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2dcopy'")
__r__cc = spline2dinterpolant(__cc)
return __r__cc
finally:
pass
_lib_alglib.alglib_spline2dresamplebicubic.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2dresamplebicubic.restype = ctypes.c_int32
def spline2dresamplebicubic(a, oldheight, oldwidth, newheight, newwidth):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__oldheight = x_int()
__oldheight.val = int(oldheight)
if __oldheight.val!=oldheight:
raise ValueError("Error while converting 'oldheight' parameter to 'x_int'")
__oldwidth = x_int()
__oldwidth.val = int(oldwidth)
if __oldwidth.val!=oldwidth:
raise ValueError("Error while converting 'oldwidth' parameter to 'x_int'")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__newheight = x_int()
__newheight.val = int(newheight)
if __newheight.val!=newheight:
raise ValueError("Error while converting 'newheight' parameter to 'x_int'")
__newwidth = x_int()
__newwidth.val = int(newwidth)
if __newwidth.val!=newwidth:
raise ValueError("Error while converting 'newwidth' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2dresamplebicubic(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__oldheight), ctypes.byref(__oldwidth), ctypes.byref(__b), ctypes.byref(__newheight), ctypes.byref(__newwidth))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2dresamplebicubic'")
__r__b = listlist_from_x(__b)
return __r__b
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_spline2dresamplebilinear.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2dresamplebilinear.restype = ctypes.c_int32
def spline2dresamplebilinear(a, oldheight, oldwidth, newheight, newwidth):
pass
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__oldheight = x_int()
__oldheight.val = int(oldheight)
if __oldheight.val!=oldheight:
raise ValueError("Error while converting 'oldheight' parameter to 'x_int'")
__oldwidth = x_int()
__oldwidth.val = int(oldwidth)
if __oldwidth.val!=oldwidth:
raise ValueError("Error while converting 'oldwidth' parameter to 'x_int'")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__newheight = x_int()
__newheight.val = int(newheight)
if __newheight.val!=newheight:
raise ValueError("Error while converting 'newheight' parameter to 'x_int'")
__newwidth = x_int()
__newwidth.val = int(newwidth)
if __newwidth.val!=newwidth:
raise ValueError("Error while converting 'newwidth' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2dresamplebilinear(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__oldheight), ctypes.byref(__oldwidth), ctypes.byref(__b), ctypes.byref(__newheight), ctypes.byref(__newwidth))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2dresamplebilinear'")
__r__b = listlist_from_x(__b)
return __r__b
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
_lib_alglib.alglib_spline2dbuildbilinearv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2dbuildbilinearv.restype = ctypes.c_int32
def spline2dbuildbilinearv(x, n, y, m, f, d):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(f):
raise ValueError("'f' parameter can't be cast to real_vector")
__f = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__d = x_int()
__d.val = int(d)
if __d.val!=d:
raise ValueError("Error while converting 'd' parameter to 'x_int'")
__c = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__f, f, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2dbuildbilinearv(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__y), ctypes.byref(__m), ctypes.byref(__f), ctypes.byref(__d), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2dbuildbilinearv'")
__r__c = spline2dinterpolant(__c)
return __r__c
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__f)
_lib_alglib.alglib_spline2dbuildbicubicv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2dbuildbicubicv.restype = ctypes.c_int32
def spline2dbuildbicubicv(x, n, y, m, f, d):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(f):
raise ValueError("'f' parameter can't be cast to real_vector")
__f = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__d = x_int()
__d.val = int(d)
if __d.val!=d:
raise ValueError("Error while converting 'd' parameter to 'x_int'")
__c = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_list(__f, f, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2dbuildbicubicv(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__y), ctypes.byref(__m), ctypes.byref(__f), ctypes.byref(__d), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2dbuildbicubicv'")
__r__c = spline2dinterpolant(__c)
return __r__c
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_vector_clear(__f)
_lib_alglib.alglib_spline2dcalcvbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2dcalcvbuf.restype = ctypes.c_int32
def spline2dcalcvbuf(c, x, y, f):
pass
__c = c.ptr
__x = ctypes.c_double(x)
__y = ctypes.c_double(y)
if not is_real_vector(f):
raise ValueError("'f' parameter can't be cast to real_vector")
__f = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__f, f, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2dcalcvbuf(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__f))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2dcalcvbuf'")
__r__f = list_from_x(__f)
return __r__f
finally:
x_vector_clear(__f)
_lib_alglib.alglib_spline2dcalcv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2dcalcv.restype = ctypes.c_int32
def spline2dcalcv(c, x, y):
pass
__c = c.ptr
__x = ctypes.c_double(x)
__y = ctypes.c_double(y)
__f = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2dcalcv(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__f))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2dcalcv'")
__r__f = list_from_x(__f)
return __r__f
finally:
x_vector_clear(__f)
_lib_alglib.alglib_spline2dunpackv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2dunpackv.restype = ctypes.c_int32
def spline2dunpackv(c):
pass
__c = c.ptr
__m = x_int()
__m.val = 0
__n = x_int()
__n.val = 0
__d = x_int()
__d.val = 0
__tbl = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2dunpackv(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__d), ctypes.byref(__tbl))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2dunpackv'")
__r__m = __m.val
__r__n = __n.val
__r__d = __d.val
__r__tbl = listlist_from_x(__tbl)
return (__r__m, __r__n, __r__d, __r__tbl)
finally:
x_matrix_clear(__tbl)
_lib_alglib.alglib_spline2dbuildbilinear.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2dbuildbilinear.restype = ctypes.c_int32
def spline2dbuildbilinear(x, y, f, m, n):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(f):
raise ValueError("'f' parameter can't be cast to real_matrix")
__f = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_listlist(__f, f, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2dbuildbilinear(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__f), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2dbuildbilinear'")
__r__c = spline2dinterpolant(__c)
return __r__c
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_matrix_clear(__f)
_lib_alglib.alglib_spline2dbuildbicubic.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2dbuildbicubic.restype = ctypes.c_int32
def spline2dbuildbicubic(x, y, f, m, n):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_matrix(f):
raise ValueError("'f' parameter can't be cast to real_matrix")
__f = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
x_from_listlist(__f, f, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2dbuildbicubic(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__y), ctypes.byref(__f), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2dbuildbicubic'")
__r__c = spline2dinterpolant(__c)
return __r__c
finally:
x_vector_clear(__x)
x_vector_clear(__y)
x_matrix_clear(__f)
_lib_alglib.alglib_spline2dunpack.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spline2dunpack.restype = ctypes.c_int32
def spline2dunpack(c):
pass
__c = c.ptr
__m = x_int()
__m.val = 0
__n = x_int()
__n.val = 0
__tbl = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spline2dunpack(ctypes.byref(_error_msg), ctypes.byref(__c), ctypes.byref(__m), ctypes.byref(__n), ctypes.byref(__tbl))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spline2dunpack'")
__r__m = __m.val
__r__n = __n.val
__r__tbl = listlist_from_x(__tbl)
return (__r__m, __r__n, __r__tbl)
finally:
x_matrix_clear(__tbl)
_lib_alglib.x_obj_free_rbfcalcbuffer.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_rbfcalcbuffer.restype = None
class rbfcalcbuffer(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_rbfcalcbuffer(self.ptr)
_lib_alglib.x_obj_free_rbfmodel.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_rbfmodel.restype = None
class rbfmodel(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_rbfmodel(self.ptr)
class x_rbfreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("rmserror", ctypes.c_double),
("maxerror", ctypes.c_double),
("arows", x_int),
("acols", x_int),
("annz", x_int),
("iterationscount", x_int),
("nmv", x_int),
("terminationtype", x_int)
]
class rbfreport(object):
def __init__(self):
self.rmserror = 0
self.maxerror = 0
self.arows = 0
self.acols = 0
self.annz = 0
self.iterationscount = 0
self.nmv = 0
self.terminationtype = 0
def x_rbfreport_zero_fields(x):
x.rmserror = 0
x.maxerror = 0
x.arows.val = 0
x.acols.val = 0
x.annz.val = 0
x.iterationscount.val = 0
x.nmv.val = 0
x.terminationtype.val = 0
return
def x_rbfreport_clear(x):
x_rbfreport_zero_fields(x)
return
def x_from_rbfreport(x,v):
x.rmserror = float(v.rmserror)
x.maxerror = float(v.maxerror)
x.arows.val = int(v.arows)
x.acols.val = int(v.acols)
x.annz.val = int(v.annz)
x.iterationscount.val = int(v.iterationscount)
x.nmv.val = int(v.nmv)
x.terminationtype.val = int(v.terminationtype)
return
def rbfreport_from_x(x):
r = rbfreport()
r.rmserror = x.rmserror
r.maxerror = x.maxerror
r.arows = x.arows.val
r.acols = x.acols.val
r.annz = x.annz.val
r.iterationscount = x.iterationscount.val
r.nmv = x.nmv.val
r.terminationtype = x.terminationtype.val
return r
_lib_alglib.alglib_rbfserialize.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfserialize.restype = ctypes.c_int32
def rbfserialize(obj):
error_msg = ctypes.c_char_p(0)
_s_out = ctypes.c_char_p(0)
retval = _lib_alglib.alglib_rbfserialize(ctypes.byref(error_msg), ctypes.byref(obj.ptr), ctypes.byref(_s_out))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfserialize'")
s_out = _s_out.value
_lib_alglib.x_free(_s_out)
return s_out
_lib_alglib.alglib_rbfunserialize.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfunserialize.restype = ctypes.c_int32
def rbfunserialize(s_in):
error_msg = ctypes.c_char_p(0)
_s_in = ctypes.c_char_p(s_in)
_obj = ctypes.c_void_p(0)
retval = _lib_alglib.alglib_rbfunserialize(ctypes.byref(error_msg), ctypes.byref(_s_in), ctypes.byref(_obj), )
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfserialize'")
return rbfmodel(_obj)
_lib_alglib.alglib_rbfcreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfcreate.restype = ctypes.c_int32
def rbfcreate(nx, ny):
pass
__nx = x_int()
__nx.val = int(nx)
if __nx.val!=nx:
raise ValueError("Error while converting 'nx' parameter to 'x_int'")
__ny = x_int()
__ny.val = int(ny)
if __ny.val!=ny:
raise ValueError("Error while converting 'ny' parameter to 'x_int'")
__s = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfcreate(ctypes.byref(_error_msg), ctypes.byref(__nx), ctypes.byref(__ny), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfcreate'")
__r__s = rbfmodel(__s)
return __r__s
finally:
pass
_lib_alglib.alglib_rbfcreatecalcbuffer.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfcreatecalcbuffer.restype = ctypes.c_int32
def rbfcreatecalcbuffer(s):
pass
__s = s.ptr
__buf = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfcreatecalcbuffer(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__buf))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfcreatecalcbuffer'")
__r__buf = rbfcalcbuffer(__buf)
return __r__buf
finally:
pass
_lib_alglib.alglib_rbfsetpoints.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfsetpoints.restype = ctypes.c_int32
def rbfsetpoints(*functionargs):
if len(functionargs)==3:
__friendly_form = False
s,xy,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
s,xy = functionargs
n = safe_rows("'rbfsetpoints': incorrect parameters",xy)
else:
raise RuntimeError("Error while calling 'rbfsetpoints': function must have 2 or 3 parameters")
__s = s.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfsetpoints(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__xy), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfsetpoints'")
return
finally:
x_matrix_clear(__xy)
_lib_alglib.alglib_rbfsetpointsandscales.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfsetpointsandscales.restype = ctypes.c_int32
def rbfsetpointsandscales(*functionargs):
if len(functionargs)==4:
__friendly_form = False
r,xy,n,s = functionargs
elif len(functionargs)==3:
__friendly_form = True
r,xy,s = functionargs
n = safe_rows("'rbfsetpointsandscales': incorrect parameters",xy)
else:
raise RuntimeError("Error while calling 'rbfsetpointsandscales': function must have 3 or 4 parameters")
__r = r.ptr
if not is_real_matrix(xy):
raise ValueError("'xy' parameter can't be cast to real_matrix")
__xy = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(s):
raise ValueError("'s' parameter can't be cast to real_vector")
__s = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__xy, xy, DT_REAL, X_CREATE)
x_from_list(__s, s, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfsetpointsandscales(ctypes.byref(_error_msg), ctypes.byref(__r), ctypes.byref(__xy), ctypes.byref(__n), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfsetpointsandscales'")
return
finally:
x_matrix_clear(__xy)
x_vector_clear(__s)
_lib_alglib.alglib_rbfsetalgoqnn.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfsetalgoqnn.restype = ctypes.c_int32
def rbfsetalgoqnn(*functionargs):
if len(functionargs)==3:
__friendly_form = False
s,q,z = functionargs
elif len(functionargs)==1:
__friendly_form = True
s, = functionargs
q = 1.0
z = 5.0
else:
raise RuntimeError("Error while calling 'rbfsetalgoqnn': function must have 1 or 3 parameters")
__s = s.ptr
__q = ctypes.c_double(q)
__z = ctypes.c_double(z)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfsetalgoqnn(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__q), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfsetalgoqnn'")
return
finally:
pass
_lib_alglib.alglib_rbfsetalgomultilayer.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfsetalgomultilayer.restype = ctypes.c_int32
def rbfsetalgomultilayer(*functionargs):
if len(functionargs)==4:
__friendly_form = False
s,rbase,nlayers,lambdav = functionargs
elif len(functionargs)==3:
__friendly_form = True
s,rbase,nlayers = functionargs
lambdav = 0.01
else:
raise RuntimeError("Error while calling 'rbfsetalgomultilayer': function must have 3 or 4 parameters")
__s = s.ptr
__rbase = ctypes.c_double(rbase)
__nlayers = x_int()
__nlayers.val = int(nlayers)
if __nlayers.val!=nlayers:
raise ValueError("Error while converting 'nlayers' parameter to 'x_int'")
__lambdav = ctypes.c_double(lambdav)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfsetalgomultilayer(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__rbase), ctypes.byref(__nlayers), ctypes.byref(__lambdav))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfsetalgomultilayer'")
return
finally:
pass
_lib_alglib.alglib_rbfsetalgohierarchical.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfsetalgohierarchical.restype = ctypes.c_int32
def rbfsetalgohierarchical(s, rbase, nlayers, lambdans):
pass
__s = s.ptr
__rbase = ctypes.c_double(rbase)
__nlayers = x_int()
__nlayers.val = int(nlayers)
if __nlayers.val!=nlayers:
raise ValueError("Error while converting 'nlayers' parameter to 'x_int'")
__lambdans = ctypes.c_double(lambdans)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfsetalgohierarchical(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__rbase), ctypes.byref(__nlayers), ctypes.byref(__lambdans))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfsetalgohierarchical'")
return
finally:
pass
_lib_alglib.alglib_rbfsetlinterm.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfsetlinterm.restype = ctypes.c_int32
def rbfsetlinterm(s):
pass
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfsetlinterm(ctypes.byref(_error_msg), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfsetlinterm'")
return
finally:
pass
_lib_alglib.alglib_rbfsetconstterm.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfsetconstterm.restype = ctypes.c_int32
def rbfsetconstterm(s):
pass
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfsetconstterm(ctypes.byref(_error_msg), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfsetconstterm'")
return
finally:
pass
_lib_alglib.alglib_rbfsetzeroterm.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfsetzeroterm.restype = ctypes.c_int32
def rbfsetzeroterm(s):
pass
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfsetzeroterm(ctypes.byref(_error_msg), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfsetzeroterm'")
return
finally:
pass
_lib_alglib.alglib_rbfsetv2bf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfsetv2bf.restype = ctypes.c_int32
def rbfsetv2bf(s, bf):
pass
__s = s.ptr
__bf = x_int()
__bf.val = int(bf)
if __bf.val!=bf:
raise ValueError("Error while converting 'bf' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfsetv2bf(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__bf))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfsetv2bf'")
return
finally:
pass
_lib_alglib.alglib_rbfsetv2its.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfsetv2its.restype = ctypes.c_int32
def rbfsetv2its(s, maxits):
pass
__s = s.ptr
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfsetv2its(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfsetv2its'")
return
finally:
pass
_lib_alglib.alglib_rbfsetv2supportr.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfsetv2supportr.restype = ctypes.c_int32
def rbfsetv2supportr(s, r):
pass
__s = s.ptr
__r = ctypes.c_double(r)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfsetv2supportr(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__r))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfsetv2supportr'")
return
finally:
pass
_lib_alglib.alglib_rbfbuildmodel.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfbuildmodel.restype = ctypes.c_int32
def rbfbuildmodel(s):
pass
__s = s.ptr
__rep = x_rbfreport()
x_rbfreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfbuildmodel(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfbuildmodel'")
__r__rep = rbfreport_from_x(__rep)
return __r__rep
finally:
x_rbfreport_clear(__rep)
_lib_alglib.alglib_rbfcalc1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfcalc1.restype = ctypes.c_int32
def rbfcalc1(s, x0):
pass
__result = ctypes.c_double(0)
__s = s.ptr
__x0 = ctypes.c_double(x0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfcalc1(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s), ctypes.byref(__x0))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfcalc1'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_rbfcalc2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfcalc2.restype = ctypes.c_int32
def rbfcalc2(s, x0, x1):
pass
__result = ctypes.c_double(0)
__s = s.ptr
__x0 = ctypes.c_double(x0)
__x1 = ctypes.c_double(x1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfcalc2(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s), ctypes.byref(__x0), ctypes.byref(__x1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfcalc2'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_rbfcalc3.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfcalc3.restype = ctypes.c_int32
def rbfcalc3(s, x0, x1, x2):
pass
__result = ctypes.c_double(0)
__s = s.ptr
__x0 = ctypes.c_double(x0)
__x1 = ctypes.c_double(x1)
__x2 = ctypes.c_double(x2)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfcalc3(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s), ctypes.byref(__x0), ctypes.byref(__x1), ctypes.byref(__x2))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfcalc3'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_rbfcalc.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfcalc.restype = ctypes.c_int32
def rbfcalc(s, x):
pass
__s = s.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__y = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfcalc(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfcalc'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_rbfcalcbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfcalcbuf.restype = ctypes.c_int32
def rbfcalcbuf(s, x, y):
pass
__s = s.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfcalcbuf(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfcalcbuf'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_rbftscalcbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbftscalcbuf.restype = ctypes.c_int32
def rbftscalcbuf(s, buf, x, y):
pass
__s = s.ptr
__buf = buf.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbftscalcbuf(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__buf), ctypes.byref(__x), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbftscalcbuf'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_rbfgridcalc2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfgridcalc2.restype = ctypes.c_int32
def rbfgridcalc2(s, x0, n0, x1, n1):
pass
__s = s.ptr
if not is_real_vector(x0):
raise ValueError("'x0' parameter can't be cast to real_vector")
__x0 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n0 = x_int()
__n0.val = int(n0)
if __n0.val!=n0:
raise ValueError("Error while converting 'n0' parameter to 'x_int'")
if not is_real_vector(x1):
raise ValueError("'x1' parameter can't be cast to real_vector")
__x1 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n1 = x_int()
__n1.val = int(n1)
if __n1.val!=n1:
raise ValueError("Error while converting 'n1' parameter to 'x_int'")
__y = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x0, x0, DT_REAL, X_CREATE)
x_from_list(__x1, x1, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfgridcalc2(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x0), ctypes.byref(__n0), ctypes.byref(__x1), ctypes.byref(__n1), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfgridcalc2'")
__r__y = listlist_from_x(__y)
return __r__y
finally:
x_vector_clear(__x0)
x_vector_clear(__x1)
x_matrix_clear(__y)
_lib_alglib.alglib_rbfgridcalc2v.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfgridcalc2v.restype = ctypes.c_int32
def rbfgridcalc2v(s, x0, n0, x1, n1):
pass
__s = s.ptr
if not is_real_vector(x0):
raise ValueError("'x0' parameter can't be cast to real_vector")
__x0 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n0 = x_int()
__n0.val = int(n0)
if __n0.val!=n0:
raise ValueError("Error while converting 'n0' parameter to 'x_int'")
if not is_real_vector(x1):
raise ValueError("'x1' parameter can't be cast to real_vector")
__x1 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n1 = x_int()
__n1.val = int(n1)
if __n1.val!=n1:
raise ValueError("Error while converting 'n1' parameter to 'x_int'")
__y = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x0, x0, DT_REAL, X_CREATE)
x_from_list(__x1, x1, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfgridcalc2v(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x0), ctypes.byref(__n0), ctypes.byref(__x1), ctypes.byref(__n1), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfgridcalc2v'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x0)
x_vector_clear(__x1)
x_vector_clear(__y)
_lib_alglib.alglib_smp_rbfgridcalc2v.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rbfgridcalc2v.restype = ctypes.c_int32
def smp_rbfgridcalc2v(s, x0, n0, x1, n1):
pass
__s = s.ptr
if not is_real_vector(x0):
raise ValueError("'x0' parameter can't be cast to real_vector")
__x0 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n0 = x_int()
__n0.val = int(n0)
if __n0.val!=n0:
raise ValueError("Error while converting 'n0' parameter to 'x_int'")
if not is_real_vector(x1):
raise ValueError("'x1' parameter can't be cast to real_vector")
__x1 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n1 = x_int()
__n1.val = int(n1)
if __n1.val!=n1:
raise ValueError("Error while converting 'n1' parameter to 'x_int'")
__y = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x0, x0, DT_REAL, X_CREATE)
x_from_list(__x1, x1, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rbfgridcalc2v(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x0), ctypes.byref(__n0), ctypes.byref(__x1), ctypes.byref(__n1), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rbfgridcalc2v'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x0)
x_vector_clear(__x1)
x_vector_clear(__y)
_lib_alglib.alglib_rbfgridcalc2vsubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfgridcalc2vsubset.restype = ctypes.c_int32
def rbfgridcalc2vsubset(s, x0, n0, x1, n1, flagy):
pass
__s = s.ptr
if not is_real_vector(x0):
raise ValueError("'x0' parameter can't be cast to real_vector")
__x0 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n0 = x_int()
__n0.val = int(n0)
if __n0.val!=n0:
raise ValueError("Error while converting 'n0' parameter to 'x_int'")
if not is_real_vector(x1):
raise ValueError("'x1' parameter can't be cast to real_vector")
__x1 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n1 = x_int()
__n1.val = int(n1)
if __n1.val!=n1:
raise ValueError("Error while converting 'n1' parameter to 'x_int'")
if not is_bool_vector(flagy):
raise ValueError("'flagy' parameter can't be cast to bool_vector")
__flagy = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__y = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x0, x0, DT_REAL, X_CREATE)
x_from_list(__x1, x1, DT_REAL, X_CREATE)
x_from_list(__flagy, flagy, DT_BOOL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfgridcalc2vsubset(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x0), ctypes.byref(__n0), ctypes.byref(__x1), ctypes.byref(__n1), ctypes.byref(__flagy), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfgridcalc2vsubset'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x0)
x_vector_clear(__x1)
x_vector_clear(__flagy)
x_vector_clear(__y)
_lib_alglib.alglib_smp_rbfgridcalc2vsubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rbfgridcalc2vsubset.restype = ctypes.c_int32
def smp_rbfgridcalc2vsubset(s, x0, n0, x1, n1, flagy):
pass
__s = s.ptr
if not is_real_vector(x0):
raise ValueError("'x0' parameter can't be cast to real_vector")
__x0 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n0 = x_int()
__n0.val = int(n0)
if __n0.val!=n0:
raise ValueError("Error while converting 'n0' parameter to 'x_int'")
if not is_real_vector(x1):
raise ValueError("'x1' parameter can't be cast to real_vector")
__x1 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n1 = x_int()
__n1.val = int(n1)
if __n1.val!=n1:
raise ValueError("Error while converting 'n1' parameter to 'x_int'")
if not is_bool_vector(flagy):
raise ValueError("'flagy' parameter can't be cast to bool_vector")
__flagy = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__y = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x0, x0, DT_REAL, X_CREATE)
x_from_list(__x1, x1, DT_REAL, X_CREATE)
x_from_list(__flagy, flagy, DT_BOOL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rbfgridcalc2vsubset(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x0), ctypes.byref(__n0), ctypes.byref(__x1), ctypes.byref(__n1), ctypes.byref(__flagy), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rbfgridcalc2vsubset'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x0)
x_vector_clear(__x1)
x_vector_clear(__flagy)
x_vector_clear(__y)
_lib_alglib.alglib_rbfgridcalc3v.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfgridcalc3v.restype = ctypes.c_int32
def rbfgridcalc3v(s, x0, n0, x1, n1, x2, n2):
pass
__s = s.ptr
if not is_real_vector(x0):
raise ValueError("'x0' parameter can't be cast to real_vector")
__x0 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n0 = x_int()
__n0.val = int(n0)
if __n0.val!=n0:
raise ValueError("Error while converting 'n0' parameter to 'x_int'")
if not is_real_vector(x1):
raise ValueError("'x1' parameter can't be cast to real_vector")
__x1 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n1 = x_int()
__n1.val = int(n1)
if __n1.val!=n1:
raise ValueError("Error while converting 'n1' parameter to 'x_int'")
if not is_real_vector(x2):
raise ValueError("'x2' parameter can't be cast to real_vector")
__x2 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n2 = x_int()
__n2.val = int(n2)
if __n2.val!=n2:
raise ValueError("Error while converting 'n2' parameter to 'x_int'")
__y = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x0, x0, DT_REAL, X_CREATE)
x_from_list(__x1, x1, DT_REAL, X_CREATE)
x_from_list(__x2, x2, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfgridcalc3v(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x0), ctypes.byref(__n0), ctypes.byref(__x1), ctypes.byref(__n1), ctypes.byref(__x2), ctypes.byref(__n2), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfgridcalc3v'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x0)
x_vector_clear(__x1)
x_vector_clear(__x2)
x_vector_clear(__y)
_lib_alglib.alglib_smp_rbfgridcalc3v.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rbfgridcalc3v.restype = ctypes.c_int32
def smp_rbfgridcalc3v(s, x0, n0, x1, n1, x2, n2):
pass
__s = s.ptr
if not is_real_vector(x0):
raise ValueError("'x0' parameter can't be cast to real_vector")
__x0 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n0 = x_int()
__n0.val = int(n0)
if __n0.val!=n0:
raise ValueError("Error while converting 'n0' parameter to 'x_int'")
if not is_real_vector(x1):
raise ValueError("'x1' parameter can't be cast to real_vector")
__x1 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n1 = x_int()
__n1.val = int(n1)
if __n1.val!=n1:
raise ValueError("Error while converting 'n1' parameter to 'x_int'")
if not is_real_vector(x2):
raise ValueError("'x2' parameter can't be cast to real_vector")
__x2 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n2 = x_int()
__n2.val = int(n2)
if __n2.val!=n2:
raise ValueError("Error while converting 'n2' parameter to 'x_int'")
__y = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x0, x0, DT_REAL, X_CREATE)
x_from_list(__x1, x1, DT_REAL, X_CREATE)
x_from_list(__x2, x2, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rbfgridcalc3v(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x0), ctypes.byref(__n0), ctypes.byref(__x1), ctypes.byref(__n1), ctypes.byref(__x2), ctypes.byref(__n2), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rbfgridcalc3v'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x0)
x_vector_clear(__x1)
x_vector_clear(__x2)
x_vector_clear(__y)
_lib_alglib.alglib_rbfgridcalc3vsubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfgridcalc3vsubset.restype = ctypes.c_int32
def rbfgridcalc3vsubset(s, x0, n0, x1, n1, x2, n2, flagy):
pass
__s = s.ptr
if not is_real_vector(x0):
raise ValueError("'x0' parameter can't be cast to real_vector")
__x0 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n0 = x_int()
__n0.val = int(n0)
if __n0.val!=n0:
raise ValueError("Error while converting 'n0' parameter to 'x_int'")
if not is_real_vector(x1):
raise ValueError("'x1' parameter can't be cast to real_vector")
__x1 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n1 = x_int()
__n1.val = int(n1)
if __n1.val!=n1:
raise ValueError("Error while converting 'n1' parameter to 'x_int'")
if not is_real_vector(x2):
raise ValueError("'x2' parameter can't be cast to real_vector")
__x2 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n2 = x_int()
__n2.val = int(n2)
if __n2.val!=n2:
raise ValueError("Error while converting 'n2' parameter to 'x_int'")
if not is_bool_vector(flagy):
raise ValueError("'flagy' parameter can't be cast to bool_vector")
__flagy = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__y = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x0, x0, DT_REAL, X_CREATE)
x_from_list(__x1, x1, DT_REAL, X_CREATE)
x_from_list(__x2, x2, DT_REAL, X_CREATE)
x_from_list(__flagy, flagy, DT_BOOL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfgridcalc3vsubset(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x0), ctypes.byref(__n0), ctypes.byref(__x1), ctypes.byref(__n1), ctypes.byref(__x2), ctypes.byref(__n2), ctypes.byref(__flagy), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfgridcalc3vsubset'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x0)
x_vector_clear(__x1)
x_vector_clear(__x2)
x_vector_clear(__flagy)
x_vector_clear(__y)
_lib_alglib.alglib_smp_rbfgridcalc3vsubset.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smp_rbfgridcalc3vsubset.restype = ctypes.c_int32
def smp_rbfgridcalc3vsubset(s, x0, n0, x1, n1, x2, n2, flagy):
pass
__s = s.ptr
if not is_real_vector(x0):
raise ValueError("'x0' parameter can't be cast to real_vector")
__x0 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n0 = x_int()
__n0.val = int(n0)
if __n0.val!=n0:
raise ValueError("Error while converting 'n0' parameter to 'x_int'")
if not is_real_vector(x1):
raise ValueError("'x1' parameter can't be cast to real_vector")
__x1 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n1 = x_int()
__n1.val = int(n1)
if __n1.val!=n1:
raise ValueError("Error while converting 'n1' parameter to 'x_int'")
if not is_real_vector(x2):
raise ValueError("'x2' parameter can't be cast to real_vector")
__x2 = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n2 = x_int()
__n2.val = int(n2)
if __n2.val!=n2:
raise ValueError("Error while converting 'n2' parameter to 'x_int'")
if not is_bool_vector(flagy):
raise ValueError("'flagy' parameter can't be cast to bool_vector")
__flagy = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__y = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x0, x0, DT_REAL, X_CREATE)
x_from_list(__x1, x1, DT_REAL, X_CREATE)
x_from_list(__x2, x2, DT_REAL, X_CREATE)
x_from_list(__flagy, flagy, DT_BOOL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smp_rbfgridcalc3vsubset(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__x0), ctypes.byref(__n0), ctypes.byref(__x1), ctypes.byref(__n1), ctypes.byref(__x2), ctypes.byref(__n2), ctypes.byref(__flagy), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smp_rbfgridcalc3vsubset'")
__r__y = list_from_x(__y)
return __r__y
finally:
x_vector_clear(__x0)
x_vector_clear(__x1)
x_vector_clear(__x2)
x_vector_clear(__flagy)
x_vector_clear(__y)
_lib_alglib.alglib_rbfunpack.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfunpack.restype = ctypes.c_int32
def rbfunpack(s):
pass
__s = s.ptr
__nx = x_int()
__nx.val = 0
__ny = x_int()
__ny.val = 0
__xwr = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__nc = x_int()
__nc.val = 0
__v = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__modelversion = x_int()
__modelversion.val = 0
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfunpack(ctypes.byref(_error_msg), ctypes.byref(__s), ctypes.byref(__nx), ctypes.byref(__ny), ctypes.byref(__xwr), ctypes.byref(__nc), ctypes.byref(__v), ctypes.byref(__modelversion))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfunpack'")
__r__nx = __nx.val
__r__ny = __ny.val
__r__xwr = listlist_from_x(__xwr)
__r__nc = __nc.val
__r__v = listlist_from_x(__v)
__r__modelversion = __modelversion.val
return (__r__nx, __r__ny, __r__xwr, __r__nc, __r__v, __r__modelversion)
finally:
x_matrix_clear(__xwr)
x_matrix_clear(__v)
_lib_alglib.alglib_rbfgetmodelversion.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rbfgetmodelversion.restype = ctypes.c_int32
def rbfgetmodelversion(s):
pass
__result = x_int()
__result.val = 0
__s = s.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rbfgetmodelversion(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rbfgetmodelversion'")
__r__result = __result.val
return __r__result
finally:
pass
_lib_alglib.alglib_ellipticintegralk.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ellipticintegralk.restype = ctypes.c_int32
def ellipticintegralk(m):
pass
__result = ctypes.c_double(0)
__m = ctypes.c_double(m)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ellipticintegralk(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__m))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ellipticintegralk'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_ellipticintegralkhighprecision.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ellipticintegralkhighprecision.restype = ctypes.c_int32
def ellipticintegralkhighprecision(m1):
pass
__result = ctypes.c_double(0)
__m1 = ctypes.c_double(m1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ellipticintegralkhighprecision(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__m1))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ellipticintegralkhighprecision'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_incompleteellipticintegralk.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_incompleteellipticintegralk.restype = ctypes.c_int32
def incompleteellipticintegralk(phi, m):
pass
__result = ctypes.c_double(0)
__phi = ctypes.c_double(phi)
__m = ctypes.c_double(m)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_incompleteellipticintegralk(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__phi), ctypes.byref(__m))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'incompleteellipticintegralk'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_ellipticintegrale.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ellipticintegrale.restype = ctypes.c_int32
def ellipticintegrale(m):
pass
__result = ctypes.c_double(0)
__m = ctypes.c_double(m)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ellipticintegrale(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__m))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ellipticintegrale'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_incompleteellipticintegrale.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_incompleteellipticintegrale.restype = ctypes.c_int32
def incompleteellipticintegrale(phi, m):
pass
__result = ctypes.c_double(0)
__phi = ctypes.c_double(phi)
__m = ctypes.c_double(m)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_incompleteellipticintegrale(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__phi), ctypes.byref(__m))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'incompleteellipticintegrale'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_hermitecalculate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hermitecalculate.restype = ctypes.c_int32
def hermitecalculate(n, x):
pass
__result = ctypes.c_double(0)
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hermitecalculate(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__n), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hermitecalculate'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_hermitesum.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hermitesum.restype = ctypes.c_int32
def hermitesum(c, n, x):
pass
__result = ctypes.c_double(0)
if not is_real_vector(c):
raise ValueError("'c' parameter can't be cast to real_vector")
__c = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__x = ctypes.c_double(x)
try:
x_from_list(__c, c, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hermitesum(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__c), ctypes.byref(__n), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hermitesum'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__c)
_lib_alglib.alglib_hermitecoefficients.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hermitecoefficients.restype = ctypes.c_int32
def hermitecoefficients(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hermitecoefficients(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hermitecoefficients'")
__r__c = list_from_x(__c)
return __r__c
finally:
x_vector_clear(__c)
_lib_alglib.alglib_dawsonintegral.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_dawsonintegral.restype = ctypes.c_int32
def dawsonintegral(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_dawsonintegral(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'dawsonintegral'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_sinecosineintegrals.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sinecosineintegrals.restype = ctypes.c_int32
def sinecosineintegrals(x):
pass
__x = ctypes.c_double(x)
__si = ctypes.c_double(0)
__ci = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sinecosineintegrals(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__si), ctypes.byref(__ci))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sinecosineintegrals'")
__r__si = __si.value
__r__ci = __ci.value
return (__r__si, __r__ci)
finally:
pass
_lib_alglib.alglib_hyperbolicsinecosineintegrals.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_hyperbolicsinecosineintegrals.restype = ctypes.c_int32
def hyperbolicsinecosineintegrals(x):
pass
__x = ctypes.c_double(x)
__shi = ctypes.c_double(0)
__chi = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_hyperbolicsinecosineintegrals(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__shi), ctypes.byref(__chi))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'hyperbolicsinecosineintegrals'")
__r__shi = __shi.value
__r__chi = __chi.value
return (__r__shi, __r__chi)
finally:
pass
_lib_alglib.alglib_poissondistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_poissondistribution.restype = ctypes.c_int32
def poissondistribution(k, m):
pass
__result = ctypes.c_double(0)
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__m = ctypes.c_double(m)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_poissondistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__k), ctypes.byref(__m))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'poissondistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_poissoncdistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_poissoncdistribution.restype = ctypes.c_int32
def poissoncdistribution(k, m):
pass
__result = ctypes.c_double(0)
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__m = ctypes.c_double(m)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_poissoncdistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__k), ctypes.byref(__m))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'poissoncdistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_invpoissondistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_invpoissondistribution.restype = ctypes.c_int32
def invpoissondistribution(k, y):
pass
__result = ctypes.c_double(0)
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__y = ctypes.c_double(y)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_invpoissondistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__k), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'invpoissondistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_besselj0.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_besselj0.restype = ctypes.c_int32
def besselj0(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_besselj0(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'besselj0'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_besselj1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_besselj1.restype = ctypes.c_int32
def besselj1(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_besselj1(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'besselj1'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_besseljn.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_besseljn.restype = ctypes.c_int32
def besseljn(n, x):
pass
__result = ctypes.c_double(0)
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_besseljn(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__n), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'besseljn'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_bessely0.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_bessely0.restype = ctypes.c_int32
def bessely0(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_bessely0(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'bessely0'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_bessely1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_bessely1.restype = ctypes.c_int32
def bessely1(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_bessely1(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'bessely1'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_besselyn.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_besselyn.restype = ctypes.c_int32
def besselyn(n, x):
pass
__result = ctypes.c_double(0)
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_besselyn(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__n), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'besselyn'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_besseli0.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_besseli0.restype = ctypes.c_int32
def besseli0(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_besseli0(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'besseli0'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_besseli1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_besseli1.restype = ctypes.c_int32
def besseli1(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_besseli1(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'besseli1'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_besselk0.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_besselk0.restype = ctypes.c_int32
def besselk0(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_besselk0(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'besselk0'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_besselk1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_besselk1.restype = ctypes.c_int32
def besselk1(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_besselk1(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'besselk1'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_besselkn.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_besselkn.restype = ctypes.c_int32
def besselkn(nn, x):
pass
__result = ctypes.c_double(0)
__nn = x_int()
__nn.val = int(nn)
if __nn.val!=nn:
raise ValueError("Error while converting 'nn' parameter to 'x_int'")
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_besselkn(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__nn), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'besselkn'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_incompletebeta.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_incompletebeta.restype = ctypes.c_int32
def incompletebeta(a, b, x):
pass
__result = ctypes.c_double(0)
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_incompletebeta(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'incompletebeta'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_invincompletebeta.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_invincompletebeta.restype = ctypes.c_int32
def invincompletebeta(a, b, y):
pass
__result = ctypes.c_double(0)
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
__y = ctypes.c_double(y)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_invincompletebeta(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'invincompletebeta'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_fdistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_fdistribution.restype = ctypes.c_int32
def fdistribution(a, b, x):
pass
__result = ctypes.c_double(0)
__a = x_int()
__a.val = int(a)
if __a.val!=a:
raise ValueError("Error while converting 'a' parameter to 'x_int'")
__b = x_int()
__b.val = int(b)
if __b.val!=b:
raise ValueError("Error while converting 'b' parameter to 'x_int'")
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_fdistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'fdistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_fcdistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_fcdistribution.restype = ctypes.c_int32
def fcdistribution(a, b, x):
pass
__result = ctypes.c_double(0)
__a = x_int()
__a.val = int(a)
if __a.val!=a:
raise ValueError("Error while converting 'a' parameter to 'x_int'")
__b = x_int()
__b.val = int(b)
if __b.val!=b:
raise ValueError("Error while converting 'b' parameter to 'x_int'")
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_fcdistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'fcdistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_invfdistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_invfdistribution.restype = ctypes.c_int32
def invfdistribution(a, b, y):
pass
__result = ctypes.c_double(0)
__a = x_int()
__a.val = int(a)
if __a.val!=a:
raise ValueError("Error while converting 'a' parameter to 'x_int'")
__b = x_int()
__b.val = int(b)
if __b.val!=b:
raise ValueError("Error while converting 'b' parameter to 'x_int'")
__y = ctypes.c_double(y)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_invfdistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__b), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'invfdistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_fresnelintegral.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_fresnelintegral.restype = ctypes.c_int32
def fresnelintegral(x, c, s):
pass
__x = ctypes.c_double(x)
__c = ctypes.c_double(c)
__s = ctypes.c_double(s)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_fresnelintegral(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__c), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'fresnelintegral'")
__r__c = __c.value
__r__s = __s.value
return (__r__c, __r__s)
finally:
pass
_lib_alglib.alglib_jacobianellipticfunctions.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_jacobianellipticfunctions.restype = ctypes.c_int32
def jacobianellipticfunctions(u, m):
pass
__u = ctypes.c_double(u)
__m = ctypes.c_double(m)
__sn = ctypes.c_double(0)
__cn = ctypes.c_double(0)
__dn = ctypes.c_double(0)
__ph = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_jacobianellipticfunctions(ctypes.byref(_error_msg), ctypes.byref(__u), ctypes.byref(__m), ctypes.byref(__sn), ctypes.byref(__cn), ctypes.byref(__dn), ctypes.byref(__ph))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'jacobianellipticfunctions'")
__r__sn = __sn.value
__r__cn = __cn.value
__r__dn = __dn.value
__r__ph = __ph.value
return (__r__sn, __r__cn, __r__dn, __r__ph)
finally:
pass
_lib_alglib.alglib_psi.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_psi.restype = ctypes.c_int32
def psi(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_psi(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'psi'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_exponentialintegralei.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_exponentialintegralei.restype = ctypes.c_int32
def exponentialintegralei(x):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_exponentialintegralei(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'exponentialintegralei'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_exponentialintegralen.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_exponentialintegralen.restype = ctypes.c_int32
def exponentialintegralen(x, n):
pass
__result = ctypes.c_double(0)
__x = ctypes.c_double(x)
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_exponentialintegralen(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__x), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'exponentialintegralen'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_laguerrecalculate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_laguerrecalculate.restype = ctypes.c_int32
def laguerrecalculate(n, x):
pass
__result = ctypes.c_double(0)
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_laguerrecalculate(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__n), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'laguerrecalculate'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_laguerresum.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_laguerresum.restype = ctypes.c_int32
def laguerresum(c, n, x):
pass
__result = ctypes.c_double(0)
if not is_real_vector(c):
raise ValueError("'c' parameter can't be cast to real_vector")
__c = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__x = ctypes.c_double(x)
try:
x_from_list(__c, c, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_laguerresum(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__c), ctypes.byref(__n), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'laguerresum'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__c)
_lib_alglib.alglib_laguerrecoefficients.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_laguerrecoefficients.restype = ctypes.c_int32
def laguerrecoefficients(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_laguerrecoefficients(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'laguerrecoefficients'")
__r__c = list_from_x(__c)
return __r__c
finally:
x_vector_clear(__c)
_lib_alglib.alglib_chisquaredistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_chisquaredistribution.restype = ctypes.c_int32
def chisquaredistribution(v, x):
pass
__result = ctypes.c_double(0)
__v = ctypes.c_double(v)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_chisquaredistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__v), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'chisquaredistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_chisquarecdistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_chisquarecdistribution.restype = ctypes.c_int32
def chisquarecdistribution(v, x):
pass
__result = ctypes.c_double(0)
__v = ctypes.c_double(v)
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_chisquarecdistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__v), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'chisquarecdistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_invchisquaredistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_invchisquaredistribution.restype = ctypes.c_int32
def invchisquaredistribution(v, y):
pass
__result = ctypes.c_double(0)
__v = ctypes.c_double(v)
__y = ctypes.c_double(y)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_invchisquaredistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__v), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'invchisquaredistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_legendrecalculate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_legendrecalculate.restype = ctypes.c_int32
def legendrecalculate(n, x):
pass
__result = ctypes.c_double(0)
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_legendrecalculate(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__n), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'legendrecalculate'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_legendresum.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_legendresum.restype = ctypes.c_int32
def legendresum(c, n, x):
pass
__result = ctypes.c_double(0)
if not is_real_vector(c):
raise ValueError("'c' parameter can't be cast to real_vector")
__c = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__x = ctypes.c_double(x)
try:
x_from_list(__c, c, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_legendresum(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__c), ctypes.byref(__n), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'legendresum'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__c)
_lib_alglib.alglib_legendrecoefficients.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_legendrecoefficients.restype = ctypes.c_int32
def legendrecoefficients(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_legendrecoefficients(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'legendrecoefficients'")
__r__c = list_from_x(__c)
return __r__c
finally:
x_vector_clear(__c)
_lib_alglib.alglib_beta.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_beta.restype = ctypes.c_int32
def beta(a, b):
pass
__result = ctypes.c_double(0)
__a = ctypes.c_double(a)
__b = ctypes.c_double(b)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_beta(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'beta'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_chebyshevcalculate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_chebyshevcalculate.restype = ctypes.c_int32
def chebyshevcalculate(r, n, x):
pass
__result = ctypes.c_double(0)
__r = x_int()
__r.val = int(r)
if __r.val!=r:
raise ValueError("Error while converting 'r' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__x = ctypes.c_double(x)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_chebyshevcalculate(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__r), ctypes.byref(__n), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'chebyshevcalculate'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_chebyshevsum.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_chebyshevsum.restype = ctypes.c_int32
def chebyshevsum(c, r, n, x):
pass
__result = ctypes.c_double(0)
if not is_real_vector(c):
raise ValueError("'c' parameter can't be cast to real_vector")
__c = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__r = x_int()
__r.val = int(r)
if __r.val!=r:
raise ValueError("Error while converting 'r' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__x = ctypes.c_double(x)
try:
x_from_list(__c, c, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_chebyshevsum(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__c), ctypes.byref(__r), ctypes.byref(__n), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'chebyshevsum'")
__r__result = __result.value
return __r__result
finally:
x_vector_clear(__c)
_lib_alglib.alglib_chebyshevcoefficients.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_chebyshevcoefficients.restype = ctypes.c_int32
def chebyshevcoefficients(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__c = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_chebyshevcoefficients(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__c))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'chebyshevcoefficients'")
__r__c = list_from_x(__c)
return __r__c
finally:
x_vector_clear(__c)
_lib_alglib.alglib_fromchebyshev.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_fromchebyshev.restype = ctypes.c_int32
def fromchebyshev(a, n):
pass
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__b = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_fromchebyshev(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'fromchebyshev'")
__r__b = list_from_x(__b)
return __r__b
finally:
x_vector_clear(__a)
x_vector_clear(__b)
_lib_alglib.alglib_studenttdistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_studenttdistribution.restype = ctypes.c_int32
def studenttdistribution(k, t):
pass
__result = ctypes.c_double(0)
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__t = ctypes.c_double(t)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_studenttdistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__k), ctypes.byref(__t))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'studenttdistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_invstudenttdistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_invstudenttdistribution.restype = ctypes.c_int32
def invstudenttdistribution(k, p):
pass
__result = ctypes.c_double(0)
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__p = ctypes.c_double(p)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_invstudenttdistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__k), ctypes.byref(__p))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'invstudenttdistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_binomialdistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_binomialdistribution.restype = ctypes.c_int32
def binomialdistribution(k, n, p):
pass
__result = ctypes.c_double(0)
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__p = ctypes.c_double(p)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_binomialdistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__k), ctypes.byref(__n), ctypes.byref(__p))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'binomialdistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_binomialcdistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_binomialcdistribution.restype = ctypes.c_int32
def binomialcdistribution(k, n, p):
pass
__result = ctypes.c_double(0)
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__p = ctypes.c_double(p)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_binomialcdistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__k), ctypes.byref(__n), ctypes.byref(__p))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'binomialcdistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_invbinomialdistribution.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_invbinomialdistribution.restype = ctypes.c_int32
def invbinomialdistribution(k, n, y):
pass
__result = ctypes.c_double(0)
__k = x_int()
__k.val = int(k)
if __k.val!=k:
raise ValueError("Error while converting 'k' parameter to 'x_int'")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__y = ctypes.c_double(y)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_invbinomialdistribution(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__k), ctypes.byref(__n), ctypes.byref(__y))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'invbinomialdistribution'")
__r__result = __result.value
return __r__result
finally:
pass
_lib_alglib.alglib_airy.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_airy.restype = ctypes.c_int32
def airy(x):
pass
__x = ctypes.c_double(x)
__ai = ctypes.c_double(0)
__aip = ctypes.c_double(0)
__bi = ctypes.c_double(0)
__bip = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_airy(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__ai), ctypes.byref(__aip), ctypes.byref(__bi), ctypes.byref(__bip))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'airy'")
__r__ai = __ai.value
__r__aip = __aip.value
__r__bi = __bi.value
__r__bip = __bip.value
return (__r__ai, __r__aip, __r__bi, __r__bip)
finally:
pass
_lib_alglib.alglib_wilcoxonsignedranktest.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_wilcoxonsignedranktest.restype = ctypes.c_int32
def wilcoxonsignedranktest(x, n, e):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__e = ctypes.c_double(e)
__bothtails = ctypes.c_double(0)
__lefttail = ctypes.c_double(0)
__righttail = ctypes.c_double(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_wilcoxonsignedranktest(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__e), ctypes.byref(__bothtails), ctypes.byref(__lefttail), ctypes.byref(__righttail))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'wilcoxonsignedranktest'")
__r__bothtails = __bothtails.value
__r__lefttail = __lefttail.value
__r__righttail = __righttail.value
return (__r__bothtails, __r__lefttail, __r__righttail)
finally:
x_vector_clear(__x)
_lib_alglib.alglib_onesamplesigntest.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_onesamplesigntest.restype = ctypes.c_int32
def onesamplesigntest(x, n, median):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__median = ctypes.c_double(median)
__bothtails = ctypes.c_double(0)
__lefttail = ctypes.c_double(0)
__righttail = ctypes.c_double(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_onesamplesigntest(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__median), ctypes.byref(__bothtails), ctypes.byref(__lefttail), ctypes.byref(__righttail))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'onesamplesigntest'")
__r__bothtails = __bothtails.value
__r__lefttail = __lefttail.value
__r__righttail = __righttail.value
return (__r__bothtails, __r__lefttail, __r__righttail)
finally:
x_vector_clear(__x)
_lib_alglib.alglib_pearsoncorrelationsignificance.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_pearsoncorrelationsignificance.restype = ctypes.c_int32
def pearsoncorrelationsignificance(r, n):
pass
__r = ctypes.c_double(r)
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__bothtails = ctypes.c_double(0)
__lefttail = ctypes.c_double(0)
__righttail = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_pearsoncorrelationsignificance(ctypes.byref(_error_msg), ctypes.byref(__r), ctypes.byref(__n), ctypes.byref(__bothtails), ctypes.byref(__lefttail), ctypes.byref(__righttail))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'pearsoncorrelationsignificance'")
__r__bothtails = __bothtails.value
__r__lefttail = __lefttail.value
__r__righttail = __righttail.value
return (__r__bothtails, __r__lefttail, __r__righttail)
finally:
pass
_lib_alglib.alglib_spearmanrankcorrelationsignificance.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spearmanrankcorrelationsignificance.restype = ctypes.c_int32
def spearmanrankcorrelationsignificance(r, n):
pass
__r = ctypes.c_double(r)
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__bothtails = ctypes.c_double(0)
__lefttail = ctypes.c_double(0)
__righttail = ctypes.c_double(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spearmanrankcorrelationsignificance(ctypes.byref(_error_msg), ctypes.byref(__r), ctypes.byref(__n), ctypes.byref(__bothtails), ctypes.byref(__lefttail), ctypes.byref(__righttail))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spearmanrankcorrelationsignificance'")
__r__bothtails = __bothtails.value
__r__lefttail = __lefttail.value
__r__righttail = __righttail.value
return (__r__bothtails, __r__lefttail, __r__righttail)
finally:
pass
_lib_alglib.alglib_studentttest1.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_studentttest1.restype = ctypes.c_int32
def studentttest1(x, n, mean):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__mean = ctypes.c_double(mean)
__bothtails = ctypes.c_double(0)
__lefttail = ctypes.c_double(0)
__righttail = ctypes.c_double(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_studentttest1(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__mean), ctypes.byref(__bothtails), ctypes.byref(__lefttail), ctypes.byref(__righttail))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'studentttest1'")
__r__bothtails = __bothtails.value
__r__lefttail = __lefttail.value
__r__righttail = __righttail.value
return (__r__bothtails, __r__lefttail, __r__righttail)
finally:
x_vector_clear(__x)
_lib_alglib.alglib_studentttest2.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_studentttest2.restype = ctypes.c_int32
def studentttest2(x, n, y, m):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__bothtails = ctypes.c_double(0)
__lefttail = ctypes.c_double(0)
__righttail = ctypes.c_double(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_studentttest2(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__y), ctypes.byref(__m), ctypes.byref(__bothtails), ctypes.byref(__lefttail), ctypes.byref(__righttail))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'studentttest2'")
__r__bothtails = __bothtails.value
__r__lefttail = __lefttail.value
__r__righttail = __righttail.value
return (__r__bothtails, __r__lefttail, __r__righttail)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_unequalvariancettest.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_unequalvariancettest.restype = ctypes.c_int32
def unequalvariancettest(x, n, y, m):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__bothtails = ctypes.c_double(0)
__lefttail = ctypes.c_double(0)
__righttail = ctypes.c_double(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_unequalvariancettest(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__y), ctypes.byref(__m), ctypes.byref(__bothtails), ctypes.byref(__lefttail), ctypes.byref(__righttail))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'unequalvariancettest'")
__r__bothtails = __bothtails.value
__r__lefttail = __lefttail.value
__r__righttail = __righttail.value
return (__r__bothtails, __r__lefttail, __r__righttail)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_mannwhitneyutest.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_mannwhitneyutest.restype = ctypes.c_int32
def mannwhitneyutest(x, n, y, m):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__bothtails = ctypes.c_double(0)
__lefttail = ctypes.c_double(0)
__righttail = ctypes.c_double(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_mannwhitneyutest(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__y), ctypes.byref(__m), ctypes.byref(__bothtails), ctypes.byref(__lefttail), ctypes.byref(__righttail))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'mannwhitneyutest'")
__r__bothtails = __bothtails.value
__r__lefttail = __lefttail.value
__r__righttail = __righttail.value
return (__r__bothtails, __r__lefttail, __r__righttail)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_jarqueberatest.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_jarqueberatest.restype = ctypes.c_int32
def jarqueberatest(x, n):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__p = ctypes.c_double(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_jarqueberatest(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__p))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'jarqueberatest'")
__r__p = __p.value
return __r__p
finally:
x_vector_clear(__x)
_lib_alglib.alglib_ftest.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_ftest.restype = ctypes.c_int32
def ftest(x, n, y, m):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(y):
raise ValueError("'y' parameter can't be cast to real_vector")
__y = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
__bothtails = ctypes.c_double(0)
__lefttail = ctypes.c_double(0)
__righttail = ctypes.c_double(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_list(__y, y, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_ftest(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__y), ctypes.byref(__m), ctypes.byref(__bothtails), ctypes.byref(__lefttail), ctypes.byref(__righttail))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'ftest'")
__r__bothtails = __bothtails.value
__r__lefttail = __lefttail.value
__r__righttail = __righttail.value
return (__r__bothtails, __r__lefttail, __r__righttail)
finally:
x_vector_clear(__x)
x_vector_clear(__y)
_lib_alglib.alglib_onesamplevariancetest.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_onesamplevariancetest.restype = ctypes.c_int32
def onesamplevariancetest(x, n, variance):
pass
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__variance = ctypes.c_double(variance)
__bothtails = ctypes.c_double(0)
__lefttail = ctypes.c_double(0)
__righttail = ctypes.c_double(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_onesamplevariancetest(ctypes.byref(_error_msg), ctypes.byref(__x), ctypes.byref(__n), ctypes.byref(__variance), ctypes.byref(__bothtails), ctypes.byref(__lefttail), ctypes.byref(__righttail))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'onesamplevariancetest'")
__r__bothtails = __bothtails.value
__r__lefttail = __lefttail.value
__r__righttail = __righttail.value
return (__r__bothtails, __r__lefttail, __r__righttail)
finally:
x_vector_clear(__x)
_lib_alglib.alglib_rmatrixschur.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixschur.restype = ctypes.c_int32
def rmatrixschur(a, n):
pass
__result = ctypes.c_uint8(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__s = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixschur(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__s))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixschur'")
__r__result = __result.value!=0
__r__a = listlist_from_x(__a)
__r__s = listlist_from_x(__s)
return (__r__result, __r__a, __r__s)
finally:
x_matrix_clear(__a)
x_matrix_clear(__s)
_lib_alglib.alglib_smatrixgevd.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smatrixgevd.restype = ctypes.c_int32
def smatrixgevd(a, n, isuppera, b, isupperb, zneeded, problemtype):
pass
__result = ctypes.c_uint8(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isuppera = ctypes.c_uint8(isuppera)
if __isuppera.value!=0:
__isuppera = ctypes.c_uint8(1)
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__isupperb = ctypes.c_uint8(isupperb)
if __isupperb.value!=0:
__isupperb = ctypes.c_uint8(1)
__zneeded = x_int()
__zneeded.val = int(zneeded)
if __zneeded.val!=zneeded:
raise ValueError("Error while converting 'zneeded' parameter to 'x_int'")
__problemtype = x_int()
__problemtype.val = int(problemtype)
if __problemtype.val!=problemtype:
raise ValueError("Error while converting 'problemtype' parameter to 'x_int'")
__d = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__z = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smatrixgevd(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isuppera), ctypes.byref(__b), ctypes.byref(__isupperb), ctypes.byref(__zneeded), ctypes.byref(__problemtype), ctypes.byref(__d), ctypes.byref(__z))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smatrixgevd'")
__r__result = __result.value!=0
__r__d = list_from_x(__d)
__r__z = listlist_from_x(__z)
return (__r__result, __r__d, __r__z)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_vector_clear(__d)
x_matrix_clear(__z)
_lib_alglib.alglib_smatrixgevdreduce.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_smatrixgevdreduce.restype = ctypes.c_int32
def smatrixgevdreduce(a, n, isuppera, b, isupperb, problemtype):
pass
__result = ctypes.c_uint8(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isuppera = ctypes.c_uint8(isuppera)
if __isuppera.value!=0:
__isuppera = ctypes.c_uint8(1)
if not is_real_matrix(b):
raise ValueError("'b' parameter can't be cast to real_matrix")
__b = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__isupperb = ctypes.c_uint8(isupperb)
if __isupperb.value!=0:
__isupperb = ctypes.c_uint8(1)
__problemtype = x_int()
__problemtype.val = int(problemtype)
if __problemtype.val!=problemtype:
raise ValueError("Error while converting 'problemtype' parameter to 'x_int'")
__r = x_matrix(rows=0,cols=0,stride=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__isupperr = ctypes.c_uint8(0)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_listlist(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_smatrixgevdreduce(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isuppera), ctypes.byref(__b), ctypes.byref(__isupperb), ctypes.byref(__problemtype), ctypes.byref(__r), ctypes.byref(__isupperr))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'smatrixgevdreduce'")
__r__result = __result.value!=0
__r__a = listlist_from_x(__a)
__r__r = listlist_from_x(__r)
__r__isupperr = __isupperr.value!=0
return (__r__result, __r__a, __r__r, __r__isupperr)
finally:
x_matrix_clear(__a)
x_matrix_clear(__b)
x_matrix_clear(__r)
_lib_alglib.alglib_rmatrixinvupdatesimple.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixinvupdatesimple.restype = ctypes.c_int32
def rmatrixinvupdatesimple(inva, n, updrow, updcolumn, updval):
pass
if not is_real_matrix(inva):
raise ValueError("'inva' parameter can't be cast to real_matrix")
__inva = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__updrow = x_int()
__updrow.val = int(updrow)
if __updrow.val!=updrow:
raise ValueError("Error while converting 'updrow' parameter to 'x_int'")
__updcolumn = x_int()
__updcolumn.val = int(updcolumn)
if __updcolumn.val!=updcolumn:
raise ValueError("Error while converting 'updcolumn' parameter to 'x_int'")
__updval = ctypes.c_double(updval)
try:
x_from_listlist(__inva, inva, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixinvupdatesimple(ctypes.byref(_error_msg), ctypes.byref(__inva), ctypes.byref(__n), ctypes.byref(__updrow), ctypes.byref(__updcolumn), ctypes.byref(__updval))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixinvupdatesimple'")
__r__inva = listlist_from_x(__inva)
return __r__inva
finally:
x_matrix_clear(__inva)
_lib_alglib.alglib_rmatrixinvupdaterow.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixinvupdaterow.restype = ctypes.c_int32
def rmatrixinvupdaterow(inva, n, updrow, v):
pass
if not is_real_matrix(inva):
raise ValueError("'inva' parameter can't be cast to real_matrix")
__inva = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__updrow = x_int()
__updrow.val = int(updrow)
if __updrow.val!=updrow:
raise ValueError("Error while converting 'updrow' parameter to 'x_int'")
if not is_real_vector(v):
raise ValueError("'v' parameter can't be cast to real_vector")
__v = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__inva, inva, DT_REAL, X_CREATE)
x_from_list(__v, v, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixinvupdaterow(ctypes.byref(_error_msg), ctypes.byref(__inva), ctypes.byref(__n), ctypes.byref(__updrow), ctypes.byref(__v))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixinvupdaterow'")
__r__inva = listlist_from_x(__inva)
return __r__inva
finally:
x_matrix_clear(__inva)
x_vector_clear(__v)
_lib_alglib.alglib_rmatrixinvupdatecolumn.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixinvupdatecolumn.restype = ctypes.c_int32
def rmatrixinvupdatecolumn(inva, n, updcolumn, u):
pass
if not is_real_matrix(inva):
raise ValueError("'inva' parameter can't be cast to real_matrix")
__inva = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__updcolumn = x_int()
__updcolumn.val = int(updcolumn)
if __updcolumn.val!=updcolumn:
raise ValueError("Error while converting 'updcolumn' parameter to 'x_int'")
if not is_real_vector(u):
raise ValueError("'u' parameter can't be cast to real_vector")
__u = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__inva, inva, DT_REAL, X_CREATE)
x_from_list(__u, u, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixinvupdatecolumn(ctypes.byref(_error_msg), ctypes.byref(__inva), ctypes.byref(__n), ctypes.byref(__updcolumn), ctypes.byref(__u))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixinvupdatecolumn'")
__r__inva = listlist_from_x(__inva)
return __r__inva
finally:
x_matrix_clear(__inva)
x_vector_clear(__u)
_lib_alglib.alglib_rmatrixinvupdateuv.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixinvupdateuv.restype = ctypes.c_int32
def rmatrixinvupdateuv(inva, n, u, v):
pass
if not is_real_matrix(inva):
raise ValueError("'inva' parameter can't be cast to real_matrix")
__inva = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
if not is_real_vector(u):
raise ValueError("'u' parameter can't be cast to real_vector")
__u = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_real_vector(v):
raise ValueError("'v' parameter can't be cast to real_vector")
__v = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_listlist(__inva, inva, DT_REAL, X_CREATE)
x_from_list(__u, u, DT_REAL, X_CREATE)
x_from_list(__v, v, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixinvupdateuv(ctypes.byref(_error_msg), ctypes.byref(__inva), ctypes.byref(__n), ctypes.byref(__u), ctypes.byref(__v))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixinvupdateuv'")
__r__inva = listlist_from_x(__inva)
return __r__inva
finally:
x_matrix_clear(__inva)
x_vector_clear(__u)
x_vector_clear(__v)
_lib_alglib.alglib_rmatrixludet.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixludet.restype = ctypes.c_int32
def rmatrixludet(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,pivots,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
a,pivots = functionargs
if safe_rows("'rmatrixludet': incorrect parameters",a)!=safe_cols("'rmatrixludet': incorrect parameters",a) or safe_rows("'rmatrixludet': incorrect parameters",a)!=safe_len("'rmatrixludet': incorrect parameters",pivots):
raise RuntimeError("Error while calling 'rmatrixludet': looks like one of arguments has wrong size")
n = safe_rows("'rmatrixludet': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'rmatrixludet': function must have 2 or 3 parameters")
__result = ctypes.c_double(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(pivots):
raise ValueError("'pivots' parameter can't be cast to int_vector")
__pivots = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
x_from_list(__pivots, pivots, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixludet(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__pivots), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixludet'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
x_vector_clear(__pivots)
_lib_alglib.alglib_rmatrixdet.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_rmatrixdet.restype = ctypes.c_int32
def rmatrixdet(*functionargs):
if len(functionargs)==2:
__friendly_form = False
a,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_rows("'rmatrixdet': incorrect parameters",a)!=safe_cols("'rmatrixdet': incorrect parameters",a):
raise RuntimeError("Error while calling 'rmatrixdet': looks like one of arguments has wrong size")
n = safe_rows("'rmatrixdet': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'rmatrixdet': function must have 1 or 2 parameters")
__result = ctypes.c_double(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_rmatrixdet(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'rmatrixdet'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_cmatrixludet.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixludet.restype = ctypes.c_int32
def cmatrixludet(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,pivots,n = functionargs
elif len(functionargs)==2:
__friendly_form = True
a,pivots = functionargs
if safe_rows("'cmatrixludet': incorrect parameters",a)!=safe_cols("'cmatrixludet': incorrect parameters",a) or safe_rows("'cmatrixludet': incorrect parameters",a)!=safe_len("'cmatrixludet': incorrect parameters",pivots):
raise RuntimeError("Error while calling 'cmatrixludet': looks like one of arguments has wrong size")
n = safe_rows("'cmatrixludet': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'cmatrixludet': function must have 2 or 3 parameters")
__result = x_complex(x=0,y=0)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
if not is_int_vector(pivots):
raise ValueError("'pivots' parameter can't be cast to int_vector")
__pivots = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
x_from_list(__pivots, pivots, DT_INT, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixludet(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__pivots), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixludet'")
__r__result = complex(__result.x,__result.y)
return __r__result
finally:
x_matrix_clear(__a)
x_vector_clear(__pivots)
_lib_alglib.alglib_cmatrixdet.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_cmatrixdet.restype = ctypes.c_int32
def cmatrixdet(*functionargs):
if len(functionargs)==2:
__friendly_form = False
a,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_rows("'cmatrixdet': incorrect parameters",a)!=safe_cols("'cmatrixdet': incorrect parameters",a):
raise RuntimeError("Error while calling 'cmatrixdet': looks like one of arguments has wrong size")
n = safe_rows("'cmatrixdet': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'cmatrixdet': function must have 1 or 2 parameters")
__result = x_complex(x=0,y=0)
if not is_complex_matrix(a):
raise ValueError("'a' parameter can't be cast to complex_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_COMPLEX, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_cmatrixdet(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'cmatrixdet'")
__r__result = complex(__result.x,__result.y)
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_spdmatrixcholeskydet.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixcholeskydet.restype = ctypes.c_int32
def spdmatrixcholeskydet(*functionargs):
if len(functionargs)==2:
__friendly_form = False
a,n = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_rows("'spdmatrixcholeskydet': incorrect parameters",a)!=safe_cols("'spdmatrixcholeskydet': incorrect parameters",a):
raise RuntimeError("Error while calling 'spdmatrixcholeskydet': looks like one of arguments has wrong size")
n = safe_rows("'spdmatrixcholeskydet': incorrect parameters",a)
else:
raise RuntimeError("Error while calling 'spdmatrixcholeskydet': function must have 1 or 2 parameters")
__result = ctypes.c_double(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to real_matrix")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixcholeskydet(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixcholeskydet'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
_lib_alglib.alglib_spdmatrixdet.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_spdmatrixdet.restype = ctypes.c_int32
def spdmatrixdet(*functionargs):
if len(functionargs)==3:
__friendly_form = False
a,n,isupper = functionargs
elif len(functionargs)==1:
__friendly_form = True
a, = functionargs
if safe_rows("'spdmatrixdet': incorrect parameters",a)!=safe_cols("'spdmatrixdet': incorrect parameters",a):
raise RuntimeError("Error while calling 'spdmatrixdet': looks like one of arguments has wrong size")
n = safe_rows("'spdmatrixdet': incorrect parameters",a)
isupper = False
else:
raise RuntimeError("Error while calling 'spdmatrixdet': function must have 1 or 3 parameters")
__result = ctypes.c_double(0)
if not is_real_matrix(a):
raise ValueError("'a' parameter can't be cast to symmetric")
__a = x_matrix(rows=0,cols=0,stride=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
try:
x_from_listlist(__a, a, DT_REAL, X_CREATE)
if __friendly_form:
if not x_is_symmetric(__a):
raise ValueError("'a' parameter is not symmetric matrix")
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_spdmatrixdet(ctypes.byref(_error_msg), ctypes.byref(__result), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'spdmatrixdet'")
__r__result = __result.value
return __r__result
finally:
x_matrix_clear(__a)
class x_polynomialsolverreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("maxerr", ctypes.c_double)
]
class polynomialsolverreport(object):
def __init__(self):
self.maxerr = 0
def x_polynomialsolverreport_zero_fields(x):
x.maxerr = 0
return
def x_polynomialsolverreport_clear(x):
x_polynomialsolverreport_zero_fields(x)
return
def x_from_polynomialsolverreport(x,v):
x.maxerr = float(v.maxerr)
return
def polynomialsolverreport_from_x(x):
r = polynomialsolverreport()
r.maxerr = x.maxerr
return r
_lib_alglib.alglib_polynomialsolve.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_polynomialsolve.restype = ctypes.c_int32
def polynomialsolve(a, n):
pass
if not is_real_vector(a):
raise ValueError("'a' parameter can't be cast to real_vector")
__a = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__x = x_vector(cnt=0,datatype=DT_COMPLEX,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_polynomialsolverreport()
x_polynomialsolverreport_zero_fields(__rep)
try:
x_from_list(__a, a, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_polynomialsolve(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'polynomialsolve'")
__r__x = list_from_x(__x)
__r__rep = polynomialsolverreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__a)
x_vector_clear(__x)
x_polynomialsolverreport_clear(__rep)
_lib_alglib.x_obj_free_nleqstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_nleqstate.restype = None
_lib_alglib.x_nleqstate_get_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_nleqstate_get_needf.restype = None
_lib_alglib.x_nleqstate_set_needf.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_nleqstate_set_needf.restype = None
_lib_alglib.x_nleqstate_get_needfij.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_nleqstate_get_needfij.restype = None
_lib_alglib.x_nleqstate_set_needfij.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_nleqstate_set_needfij.restype = None
_lib_alglib.x_nleqstate_get_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_nleqstate_get_xupdated.restype = None
_lib_alglib.x_nleqstate_set_xupdated.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_nleqstate_set_xupdated.restype = None
_lib_alglib.x_nleqstate_get_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_nleqstate_get_f.restype = None
_lib_alglib.x_nleqstate_set_f.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_nleqstate_set_f.restype = None
_lib_alglib.x_nleqstate_get_fi.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_nleqstate_get_fi.restype = None
_lib_alglib.x_nleqstate_get_j.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_nleqstate_get_j.restype = None
_lib_alglib.x_nleqstate_get_x.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.x_nleqstate_get_x.restype = None
class nleqstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_nleqstate(self.ptr)
class x_nleqreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("iterationscount", x_int),
("nfunc", x_int),
("njac", x_int),
("terminationtype", x_int)
]
class nleqreport(object):
def __init__(self):
self.iterationscount = 0
self.nfunc = 0
self.njac = 0
self.terminationtype = 0
def x_nleqreport_zero_fields(x):
x.iterationscount.val = 0
x.nfunc.val = 0
x.njac.val = 0
x.terminationtype.val = 0
return
def x_nleqreport_clear(x):
x_nleqreport_zero_fields(x)
return
def x_from_nleqreport(x,v):
x.iterationscount.val = int(v.iterationscount)
x.nfunc.val = int(v.nfunc)
x.njac.val = int(v.njac)
x.terminationtype.val = int(v.terminationtype)
return
def nleqreport_from_x(x):
r = nleqreport()
r.iterationscount = x.iterationscount.val
r.nfunc = x.nfunc.val
r.njac = x.njac.val
r.terminationtype = x.terminationtype.val
return r
_lib_alglib.alglib_nleqcreatelm.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_nleqcreatelm.restype = ctypes.c_int32
def nleqcreatelm(*functionargs):
if len(functionargs)==3:
__friendly_form = False
n,m,x = functionargs
elif len(functionargs)==2:
__friendly_form = True
m,x = functionargs
n = safe_len("'nleqcreatelm': incorrect parameters",x)
else:
raise RuntimeError("Error while calling 'nleqcreatelm': function must have 2 or 3 parameters")
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__m = x_int()
__m.val = int(m)
if __m.val!=m:
raise ValueError("Error while converting 'm' parameter to 'x_int'")
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__state = ctypes.c_void_p(0)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_nleqcreatelm(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__m), ctypes.byref(__x), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'nleqcreatelm'")
__r__state = nleqstate(__state)
return __r__state
finally:
x_vector_clear(__x)
_lib_alglib.alglib_nleqsetcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_nleqsetcond.restype = ctypes.c_int32
def nleqsetcond(state, epsf, maxits):
pass
__state = state.ptr
__epsf = ctypes.c_double(epsf)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_nleqsetcond(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsf), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'nleqsetcond'")
return
finally:
pass
_lib_alglib.alglib_nleqsetxrep.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_nleqsetxrep.restype = ctypes.c_int32
def nleqsetxrep(state, needxrep):
pass
__state = state.ptr
__needxrep = ctypes.c_uint8(needxrep)
if __needxrep.value!=0:
__needxrep = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_nleqsetxrep(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__needxrep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'nleqsetxrep'")
return
finally:
pass
_lib_alglib.alglib_nleqsetstpmax.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_nleqsetstpmax.restype = ctypes.c_int32
def nleqsetstpmax(state, stpmax):
pass
__state = state.ptr
__stpmax = ctypes.c_double(stpmax)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_nleqsetstpmax(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__stpmax))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'nleqsetstpmax'")
return
finally:
pass
def nleqsolve_fj(state, func, jac, rep = None, param = None):
_xc_result = ctypes.c_uint8(0)
_xc_msg = ctypes.c_char_p()
_xc_x = x_vector()
_lib_alglib.x_nleqstate_get_x(state.ptr, ctypes.byref(_xc_x))
_py_x = create_real_vector(_xc_x.cnt)
_xc_flag = ctypes.c_uint8()
_xc_f = ctypes.c_double()
_xc_fi = x_vector()
_lib_alglib.x_nleqstate_get_fi(state.ptr, ctypes.byref(_xc_fi))
_py_fi = create_real_vector(_xc_fi.cnt)
_xc_j = x_matrix()
_lib_alglib.x_nleqstate_get_j(state.ptr, ctypes.byref(_xc_j))
_py_j = create_real_matrix(_xc_j.rows,_xc_j.cols)
while True:
retval = _lib_alglib.alglib_nleqiteration(ctypes.byref(_xc_msg), ctypes.byref(_xc_result), ctypes.byref(state.ptr))
if retval!=0:
if retval==X_ASSERTION_FAILED:
raise RuntimeError(_xc_msg.value)
else:
raise RuntimeError("Error while calling 'nleqiteration'")
if not _xc_result:
break
_lib_alglib.x_nleqstate_get_needf(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
_xc_f.value = func(_py_x, param)
_lib_alglib.x_nleqstate_set_f(state.ptr, ctypes.byref(_xc_f))
continue
_lib_alglib.x_nleqstate_get_needfij(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0:
copy_x_to_list(_xc_x, _py_x)
jac(_py_x, _py_fi, _py_j, param)
x_from_list(_xc_fi, _py_fi, DT_REAL, X_REWRITE)
x_from_listlist(_xc_j, _py_j, DT_REAL, X_REWRITE)
continue
_lib_alglib.x_nleqstate_get_xupdated(state.ptr, ctypes.byref(_xc_flag))
if _xc_flag.value!=0 :
if not (rep is None):
copy_x_to_list(_xc_x, _py_x)
_lib_alglib.x_nleqstate_get_f(state.ptr, ctypes.byref(_xc_f))
rep(_py_x, _xc_f.value, param)
continue
raise RuntimeError("ALGLIB: error in 'nleqsolve' (some derivatives were not provided?)")
return
_lib_alglib.alglib_nleqresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_nleqresults.restype = ctypes.c_int32
def nleqresults(state):
pass
__state = state.ptr
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_nleqreport()
x_nleqreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_nleqresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'nleqresults'")
__r__x = list_from_x(__x)
__r__rep = nleqreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_nleqreport_clear(__rep)
_lib_alglib.alglib_nleqresultsbuf.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_nleqresultsbuf.restype = ctypes.c_int32
def nleqresultsbuf(state, x, rep):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_nleqreport()
x_nleqreport_zero_fields(__rep)
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
x_from_nleqreport(__rep, rep)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_nleqresultsbuf(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'nleqresultsbuf'")
__r__x = list_from_x(__x)
__r__rep = nleqreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_nleqreport_clear(__rep)
_lib_alglib.alglib_nleqrestartfrom.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_nleqrestartfrom.restype = ctypes.c_int32
def nleqrestartfrom(state, x):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_nleqrestartfrom(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'nleqrestartfrom'")
return
finally:
x_vector_clear(__x)
class x_sparsesolverreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("terminationtype", x_int)
]
class sparsesolverreport(object):
def __init__(self):
self.terminationtype = 0
def x_sparsesolverreport_zero_fields(x):
x.terminationtype.val = 0
return
def x_sparsesolverreport_clear(x):
x_sparsesolverreport_zero_fields(x)
return
def x_from_sparsesolverreport(x,v):
x.terminationtype.val = int(v.terminationtype)
return
def sparsesolverreport_from_x(x):
r = sparsesolverreport()
r.terminationtype = x.terminationtype.val
return r
_lib_alglib.alglib_sparsesolvesks.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsesolvesks.restype = ctypes.c_int32
def sparsesolvesks(a, n, isupper, b):
pass
__a = a.ptr
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_sparsesolverreport()
x_sparsesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsesolvesks(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsesolvesks'")
__r__rep = sparsesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__rep, __r__x)
finally:
x_vector_clear(__b)
x_sparsesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.alglib_sparsecholeskysolvesks.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_sparsecholeskysolvesks.restype = ctypes.c_int32
def sparsecholeskysolvesks(a, n, isupper, b):
pass
__a = a.ptr
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_sparsesolverreport()
x_sparsesolverreport_zero_fields(__rep)
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_sparsecholeskysolvesks(ctypes.byref(_error_msg), ctypes.byref(__a), ctypes.byref(__n), ctypes.byref(__isupper), ctypes.byref(__b), ctypes.byref(__rep), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'sparsecholeskysolvesks'")
__r__rep = sparsesolverreport_from_x(__rep)
__r__x = list_from_x(__x)
return (__r__rep, __r__x)
finally:
x_vector_clear(__b)
x_sparsesolverreport_clear(__rep)
x_vector_clear(__x)
_lib_alglib.x_obj_free_lincgstate.argtypes = [ctypes.c_void_p]
_lib_alglib.x_obj_free_lincgstate.restype = None
class lincgstate(object):
def __init__(self,ptr):
self.ptr = ptr
self.lib = _lib_alglib # make sure that _lib_alglib survives as long as object is here
def __del__(self):
self.lib.x_obj_free_lincgstate(self.ptr)
class x_lincgreport(ctypes.Structure):
_pack_ = 8
_fields_ = [
("iterationscount", x_int),
("nmv", x_int),
("terminationtype", x_int),
("r2", ctypes.c_double)
]
class lincgreport(object):
def __init__(self):
self.iterationscount = 0
self.nmv = 0
self.terminationtype = 0
self.r2 = 0
def x_lincgreport_zero_fields(x):
x.iterationscount.val = 0
x.nmv.val = 0
x.terminationtype.val = 0
x.r2 = 0
return
def x_lincgreport_clear(x):
x_lincgreport_zero_fields(x)
return
def x_from_lincgreport(x,v):
x.iterationscount.val = int(v.iterationscount)
x.nmv.val = int(v.nmv)
x.terminationtype.val = int(v.terminationtype)
x.r2 = float(v.r2)
return
def lincgreport_from_x(x):
r = lincgreport()
r.iterationscount = x.iterationscount.val
r.nmv = x.nmv.val
r.terminationtype = x.terminationtype.val
r.r2 = x.r2
return r
_lib_alglib.alglib_lincgcreate.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lincgcreate.restype = ctypes.c_int32
def lincgcreate(n):
pass
__n = x_int()
__n.val = int(n)
if __n.val!=n:
raise ValueError("Error while converting 'n' parameter to 'x_int'")
__state = ctypes.c_void_p(0)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lincgcreate(ctypes.byref(_error_msg), ctypes.byref(__n), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lincgcreate'")
__r__state = lincgstate(__state)
return __r__state
finally:
pass
_lib_alglib.alglib_lincgsetstartingpoint.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lincgsetstartingpoint.restype = ctypes.c_int32
def lincgsetstartingpoint(state, x):
pass
__state = state.ptr
if not is_real_vector(x):
raise ValueError("'x' parameter can't be cast to real_vector")
__x = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__x, x, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lincgsetstartingpoint(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lincgsetstartingpoint'")
return
finally:
x_vector_clear(__x)
_lib_alglib.alglib_lincgsetprecunit.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lincgsetprecunit.restype = ctypes.c_int32
def lincgsetprecunit(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lincgsetprecunit(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lincgsetprecunit'")
return
finally:
pass
_lib_alglib.alglib_lincgsetprecdiag.argtypes = [ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lincgsetprecdiag.restype = ctypes.c_int32
def lincgsetprecdiag(state):
pass
__state = state.ptr
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lincgsetprecdiag(ctypes.byref(_error_msg), ctypes.byref(__state))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lincgsetprecdiag'")
return
finally:
pass
_lib_alglib.alglib_lincgsetcond.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lincgsetcond.restype = ctypes.c_int32
def lincgsetcond(state, epsf, maxits):
pass
__state = state.ptr
__epsf = ctypes.c_double(epsf)
__maxits = x_int()
__maxits.val = int(maxits)
if __maxits.val!=maxits:
raise ValueError("Error while converting 'maxits' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lincgsetcond(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__epsf), ctypes.byref(__maxits))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lincgsetcond'")
return
finally:
pass
_lib_alglib.alglib_lincgsolvesparse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lincgsolvesparse.restype = ctypes.c_int32
def lincgsolvesparse(state, a, isupper, b):
pass
__state = state.ptr
__a = a.ptr
__isupper = ctypes.c_uint8(isupper)
if __isupper.value!=0:
__isupper = ctypes.c_uint8(1)
if not is_real_vector(b):
raise ValueError("'b' parameter can't be cast to real_vector")
__b = x_vector(cnt=0,datatype=0,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
try:
x_from_list(__b, b, DT_REAL, X_CREATE)
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lincgsolvesparse(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__a), ctypes.byref(__isupper), ctypes.byref(__b))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lincgsolvesparse'")
return
finally:
x_vector_clear(__b)
_lib_alglib.alglib_lincgresults.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lincgresults.restype = ctypes.c_int32
def lincgresults(state):
pass
__state = state.ptr
__x = x_vector(cnt=0,datatype=DT_REAL,owner=OWN_CALLER,last_action=0,ptr=x_multiptr(p_ptr=0))
__rep = x_lincgreport()
x_lincgreport_zero_fields(__rep)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lincgresults(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__x), ctypes.byref(__rep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lincgresults'")
__r__x = list_from_x(__x)
__r__rep = lincgreport_from_x(__rep)
return (__r__x, __r__rep)
finally:
x_vector_clear(__x)
x_lincgreport_clear(__rep)
_lib_alglib.alglib_lincgsetrestartfreq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lincgsetrestartfreq.restype = ctypes.c_int32
def lincgsetrestartfreq(state, srf):
pass
__state = state.ptr
__srf = x_int()
__srf.val = int(srf)
if __srf.val!=srf:
raise ValueError("Error while converting 'srf' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lincgsetrestartfreq(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__srf))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lincgsetrestartfreq'")
return
finally:
pass
_lib_alglib.alglib_lincgsetrupdatefreq.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lincgsetrupdatefreq.restype = ctypes.c_int32
def lincgsetrupdatefreq(state, freq):
pass
__state = state.ptr
__freq = x_int()
__freq.val = int(freq)
if __freq.val!=freq:
raise ValueError("Error while converting 'freq' parameter to 'x_int'")
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lincgsetrupdatefreq(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__freq))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lincgsetrupdatefreq'")
return
finally:
pass
_lib_alglib.alglib_lincgsetxrep.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p]
_lib_alglib.alglib_lincgsetxrep.restype = ctypes.c_int32
def lincgsetxrep(state, needxrep):
pass
__state = state.ptr
__needxrep = ctypes.c_uint8(needxrep)
if __needxrep.value!=0:
__needxrep = ctypes.c_uint8(1)
try:
pass
_error_msg = ctypes.c_char_p(0)
__x__retval = _lib_alglib.alglib_lincgsetxrep(ctypes.byref(_error_msg), ctypes.byref(__state), ctypes.byref(__needxrep))
if __x__retval!=0:
if __x__retval==X_ASSERTION_FAILED:
raise RuntimeError(_error_msg.value)
else:
raise RuntimeError("Error while calling 'lincgsetxrep'")
return
finally:
pass
| 1,703,616
| 41.946884
| 412
|
py
|
xaesa
|
xaesa-master/init.py
|
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 24 15:56:46 2016
@author: sasha
"""
QTVer = 0
def qtVersionToUse():
try:
from PyQt4 import QtGui
QTVer = 4
except:
QTVer = 0
if QTVer == 0:
try:
from PyQt5 import QtWidgets as QtGui
QTVer = 5
except:
QTVer = 0
return QTVer
QTVer = qtVersionToUse()
| 416
| 15.038462
| 48
|
py
|
xaesa
|
xaesa-master/tooltiptexts.py
|
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 2 15:46:03 2022
@author: kalinko
"""
xas_es = 'Spectrum start energy.\n' + \
'INFO: Use mouse scroll to change value.\n' + \
'CTRL and SHIFT decrease and increase base change 10 times.'
xas_e3 = 'Spectrum end energy.\n' + \
'INFO: Use mouse scroll to change value.\n' + \
'CTRL and SHIFT decrease and increase base change 10 times.'
| 454
| 29.333333
| 71
|
py
|
xaesa
|
xaesa-master/xaesa_ft.py
|
#import numpy as np
from numpy import sqrt, zeros, pi, arctan, asarray, arange, delete, sum, multiply, sin, cos
def FT(k, exafs, rmin, rmax, dr):
con = sqrt(2 / pi)
nn = len(k)
rx = zeros(int((rmax - rmin) / dr), float)
exafs_re = zeros(nn, float)
# exafs_im = zeros(nn, float)
# transform_re = zeros(nn, float)
# transform_im = zeros(nn, float)
# fourier_re = zeros(int((rmax - rmin) / dr), float)
# fourier_im = zeros(int((rmax - rmin) / dr), float)
# sn = zeros(nn, float)
# cs = zeros(nn, float)
exafs_re = asarray(exafs, float)
rx = arange(rmin, rmax, dr)
r = rx*2
# dx1 = delete(k,0)
# dx2 = delete(k, len(k)-1)
# dx = dx1 - dx2
dx = k[1:]-k[:-1]
v1 = multiply.outer(r, asarray(k,float))
# eix = exp(1j*v1)
# cos1, sin1 = eix.real, eix.imag
sin1 = sin(v1)
cos1 = cos(v1)
sin1 = sin1*(-1)
# transform_re1 = exafs_re * cos1 - exafs_im * sin1
# transform_im1 = exafs_re * sin1 + exafs_im * cos1
transform_re1 = exafs_re * cos1
transform_im1 = exafs_re * sin1
tre11 = delete(transform_re1, 0, 1)
tre22 = delete(transform_re1, len(transform_re1[0])-1, 1)
tim11 = delete(transform_im1, 0, 1)
tim22 = delete(transform_im1, len(transform_im1[0])-1, 1)
tre111 = (tre11+tre22)/2
tim111 = (tim11+tim22)/2
r11 = sum(dx*tre111, axis=1)
r22 = sum(dx*tim111, axis=1)
fourier_re = r11*con
fourier_im = r22*con
return rx, fourier_re, fourier_im
def BFT(r, fre, fim, kmin, kmax, dk):
print(kmin, kmax, dk)
con = sqrt(2 / pi)
n = int((kmax-kmin)/dk + 1.0)
dk = (kmax-kmin)/(n-1.0)
bftk = []
nn = len(r)
bftr = zeros(n, float)
bfti = zeros(n, float)
#transform_re = zeros(nn, float)
#transform_im = zeros(nn, float)
#sn = zeros(nn, float)
#cs = zeros(nn, float)
bftk = arange(kmin, kmax+dk, dk)
dx1 = delete(r,0)
dx2 = delete(r, len(r)-1)
dx = dx1 - dx2
r5 = bftk * 2
v1 = multiply.outer(r5, asarray(r,float))
sin1 = sin(v1)
cos1 = cos(v1)
transform_re1 = fre * cos1 - fim * sin1
transform_im1 = fre * sin1 + fim * cos1
tre11 = delete(transform_re1, 0, 1)
tre22 = delete(transform_re1, len(transform_re1[0])-1, 1)
tim11 = delete(transform_im1, 0, 1)
tim22 = delete(transform_im1, len(transform_im1[0])-1, 1)
tre111 = (tre11+tre22)/2
tim111 = (tim11+tim22)/2
r11 = sum(dx*tre111, axis=1)
r22 = sum(dx*tim111, axis=1)
bftr = r11*con
bfti = r22*con
return bftk, bftr, bfti
def BFTWindow(r, rmin, rmax, a):
xmin = rmin
xmax = rmax
a1 = a
#wind = np.zeros(len(r))
wind = [0] * len(r)
for i in range(0, len(r)):
if r[i] < rmin:
wind[i] = 0.0
if r[i] > rmax:
wind[i] = 0.0
if r[i] >= rmin and r[i] <= rmax:
if r[i]>=(xmin+a1) and r[i]<=(xmax-a1):
wind[i] = 1.0
if r[i] < (xmin+a1):
wind[i] = 0.5*(1-cos(pi*((r[i]-xmin)/a1)))
if r[i] > (xmax-a1):
wind[i] = 0.5*(1+cos(pi*((r[i]-xmax+a1)/a1)))
return wind
def GETPHASE(yr, yi):
n1 = 0
n2 = 0
i = 0
j = 0
p = 0
#{ Phase calculation }
if(yr[0] < 0.0):
n1=-1
if(yr[0] > 0.0):
n1=1
if( (yr[0] == 0.0) and (yr[1]<0.0) ):
n1=1
if( (yr[0] == 0.0) and (yr[1]>0.0) ):
n1=-1
n2 = n1
p = 0
i = 0
fi = []
for j in range(0, len(yr)):
fi.append(0)
for j in range(0, len(yr)):
if (yr[j] < 0.0):
n1=-1
if (yr[j] > 0.0):
n1=+1;
if (yr[j] == 0.0):
n1=-n1
if (n1 != n2):
p=p+1
n2 = n1
if (yr[j] > yr[i]):
i=j
if (yr[j] != 0.0):
fi[j] = arctan(yi[j]/yr[j])+pi/2 + p*pi
else:
fi[j] = p * pi
if (sin(fi[i]) <= 0.0):
for j in range(0, len(yr)):
fi[j]=fi[j] + pi;
return fi
| 4,173
| 21.934066
| 91
|
py
|
xaesa
|
xaesa-master/xaesa_constants_formulas.py
|
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 13 14:49:33 2018
@author: AKalinko
"""
from numpy import asarray, exp, zeros
#constants
me = 9.10938215* 10**-31 # kg
h = 6.626070040* 10**-34 #Js = m^2 kg / s
hev = 4.135667516 * 10**-15 #eV s
c = 299792458 #m/s
hbar = 1.054571800*10**-34
def victoreen(x, a, b):
return (a / x**4 / (hev * c)**3 + b / x**3 / (hev * c)**3 )
def windowGauss10(k, kmin, kmax):
window = zeros(len(k))
ka = (kmin+kmax)/2.0
kw = (kmax-kmin)*(kmax-kmin)/9.210340372
knp = asarray(k, float)
wp = -(knp-ka)*(knp-ka)/kw
exp(wp, window)
return window
| 617
| 21.071429
| 63
|
py
|
xaesa
|
xaesa-master/xaesa_rxes.py
|
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 6 11:20:43 2018
@author: akali
"""
from init import QTVer
if QTVer == 4:
from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
if QTVer == 5:
from PyQt5 import QtWidgets as QtGui
from PyQt5 import QtCore
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
import matplotlib.pyplot as plt
from numpy import where, logical_and, sum, transpose, amax, concatenate, savetxt, asarray, array
class xaesa_rxes(QtGui.QWidget):
def __init__(self, parent=None):
super(xaesa_rxes, self).__init__()
self.fluoEnergy = []
self.incidentEnergy = []
self.rxes = []
self.energyTransfer = False
self.initUI()
def initUI(self):
#Figures
self.fig = plt.figure(997, figsize=(15, 6))
self.ax_rxes = plt.subplot2grid((1,2), (0,0))
self.ax_cuts = plt.subplot2grid((1,2), (0,1))
if self.energyTransfer:
self.ax_rxes.set_xlabel('Incident energy, eV')
self.ax_rxes.set_ylabel('Energy transfer, eV')
self.ax_cuts.set_xlabel('Incident energy, eV')
self.ax_cuts.set_ylabel('Intensity, a.u.')
else:
self.ax_rxes.set_xlabel('Incident energy, eV')
self.ax_rxes.set_ylabel('Emission energy, eV')
self.ax_cuts.set_xlabel('Incident energy, eV')
self.ax_cuts.set_ylabel('HERFD XANES, a.u.')
self.fig.canvas.mpl_connect('button_press_event', self.imageDoubleClick)
self.canv = FigureCanvas(self.fig)
self.tbar = NavigationToolbar(self.canv, self)
fnt = self.tbar.font()
fnt.setPointSize(20)
self.tbar.setFont(fnt)
# plt.tight_layout()
self.sl = QtGui.QSlider(QtCore.Qt.Horizontal)
self.sl.setMinimum(0)
self.sl.setMaximum(100)
self.sl.setValue(100)
self.sl.setTickPosition(QtGui.QSlider.TicksBelow)
self.sl.valueChanged.connect(self.valuechange)
# self.sl.setTickInterval(5)
glout = QtGui.QGridLayout()
glout.addWidget(self.sl, 0, 0, 1, 2)
glout.addWidget(QtGui.QLabel("Energy for HERFD-XANES"), 1, 0 )
glout.addWidget(QtGui.QLabel("Delta energy for HERFD-XANES"), 2, 0 )
self.edtEnergyHerfd = QtGui.QLineEdit()
glout.addWidget(self.edtEnergyHerfd , 1, 1 )
self.edtDeltaHerfd = QtGui.QLineEdit()
glout.addWidget(self.edtDeltaHerfd , 2, 1 )
self.btnCalculateHerfd = QtGui.QPushButton("Show HERFD XANES")
self.btnCalculateHerfd.clicked.connect(self.showHerfd)
glout.addWidget(self.btnCalculateHerfd , 3, 0, 1, 2 )
self.btnCalculateHerfd = QtGui.QPushButton("save HERFD XANES")
self.btnCalculateHerfd.clicked.connect(self.saveHerfd)
glout.addWidget(self.btnCalculateHerfd , 4, 0, 1, 2 )
glout.addWidget(QtGui.QLabel("Energy transfer min "), 1, 2 )
glout.addWidget(QtGui.QLabel("Energy transfer max"), 2, 2 )
self.edtEnergyTransMin = QtGui.QLineEdit()
glout.addWidget(self.edtEnergyTransMin , 1, 3 )
self.edtEnergyTransMax = QtGui.QLineEdit()
glout.addWidget(self.edtEnergyTransMax , 2, 3 )
self.btnCalculateHerfd = QtGui.QPushButton("Show energy transfer")
self.btnCalculateHerfd.clicked.connect(self.showEnergyTrans)
glout.addWidget(self.btnCalculateHerfd , 3, 2, 1, 2 )
self.btnCalculateHerfd = QtGui.QPushButton("Save energy transfer")
self.btnCalculateHerfd.clicked.connect(self.saveEnergyTrans)
glout.addWidget(self.btnCalculateHerfd , 4, 2, 1, 2 )
self.btnCancel = QtGui.QPushButton('Exit')
self.btnCancel.clicked.connect(self.cancel)
lfig = QtGui.QVBoxLayout()
lfig.addWidget(self.tbar)
lfig.addWidget(self.canv)
lfig.addLayout(glout)
lfig.addWidget(self.btnCancel)
self.setLayout(lfig)
self.canv.draw()
def plot(self):
savetxt("x.dat", self.incidentEnergy)
savetxt("y.dat", self.fluoEnergy)
savetxt("z.dat", self.rxes)
# self.image = self.ax_rxes.imshow(self.rxes, vmin = 0, vmax = self.zmax, aspect='auto', interpolation='none',cmap='gist_ncar')
self.image = self.ax_rxes.pcolormesh(self.incidentEnergy, self.fluoEnergy, self.rxes)
# if amax(self.rxes) > 1:
# self.sl.setMaximum(amax(self.rxes))
self.fig.tight_layout()
self.canv.draw()
def cancel(self):
#do whatever you need with self.roiGroups
self.close()
def onpick(self, event):
# on the pick event, find the orig line corresponding to the
# legend proxy line, and toggle the visibility
legline = event.artist
origline = self.lined[legline]
vis = not origline.get_visible()
origline.set_visible(vis)
if self.mode == 1:
origline = self.lined1[legline]
origline.set_visible(vis)
# Change the alpha on the line in the legend so we can see what lines
# have been toggled
if vis:
legline.set_alpha(1.0)
else:
legline.set_alpha(0.2)
self.fig.canvas.draw()
def showHerfd(self):
emin = float(self.edtEnergyHerfd.text()) - float(self.edtDeltaHerfd.text())
emax = float(self.edtEnergyHerfd.text()) + float(self.edtDeltaHerfd.text())
if self.energyTransfer: #plot energy transfer intensity versus incident energy
indexes_where = where( logical_and(self.fluoEnergy[:,0]>emin, self.fluoEnergy[:,0]<emax) )
tmp_array = []
for i in range(len(self.incidentEnergy[0])):
indexes_where = where( logical_and(self.fluoEnergy[:,i]>emin, self.fluoEnergy[:,i]<emax) )
print(self.rxes[indexes_where, i][0])
number = sum(self.rxes[indexes_where, i][0]) / len(self.rxes[indexes_where, i][0])
print(number)
tmp_array.append(number)
# hsum = sum(tmp_array, axis=0)
self.ax_cuts.clear()
self.ax_cuts.set_xlabel('Incident energy, eV')
self.ax_cuts.set_ylabel('Intensity, a.u.')
self.ax_cuts.plot(self.incidentEnergy[0], tmp_array)
else: # plot normal herfd
indexes_where = where( logical_and(self.fluoEnergy[:,0]>emin, self.fluoEnergy[:,0]<emax) )
hsum = sum( (self.rxes[indexes_where, :]), axis=1)
self.ax_cuts.clear()
self.ax_cuts.set_xlabel('Incident energy, eV')
self.ax_cuts.set_ylabel('HERFD XANES, a.u.')
self.ax_cuts.plot(self.incidentEnergy[0], hsum[0])
self.canv.draw()
def saveHerfd(self):
emin = float(self.edtEnergyHerfd.text()) - float(self.edtDeltaHerfd.text())
emax = float(self.edtEnergyHerfd.text()) + float(self.edtDeltaHerfd.text())
if self.energyTransfer: #plot energy transfer intensity versus incident energy
indexes_where = where( logical_and(self.fluoEnergy[:,0]>emin, self.fluoEnergy[:,0]<emax) )
tmp_array = []
for i in range(len(self.incidentEnergy[0])):
indexes_where = where( logical_and(self.fluoEnergy[:,i]>emin, self.fluoEnergy[:,i]<emax) )
print(self.rxes[indexes_where, i][0])
number = sum(self.rxes[indexes_where, i][0]) / len(self.rxes[indexes_where, i][0])
print(number)
tmp_array.append(number)
# hsum = sum(tmp_array, axis=0)
forSave = concatenate(([self.incidentEnergy[0]], [tmp_array]))
else: # plot normal herfd
indexes_where = where( logical_and(self.fluoEnergy[:,0]>emin, self.fluoEnergy[:,0]<emax) )
hsum = sum( (self.rxes[indexes_where, :]), axis=1)
forSave = concatenate(([self.incidentEnergy[0]], [hsum[0]]))
fn = self.savefiledialog_qtgui()
if fn == "":
return
savetxt(fn, transpose(forSave) )
def showEnergyTrans(self):
emin = float(self.edtEnergyTransMin.text())
emax = float(self.edtEnergyTransMax.text())
tmp_array = []
#vert sum Energy transfer
indexes_where = where( logical_and(self.fluoEnergy[:,0]>emin, self.fluoEnergy[:,0]<emax) )
nr_points = len(indexes_where[0])
for i in range(len(self.incidentEnergy[0])):
indexes_where = where( logical_and(self.fluoEnergy[:,i]>emin, self.fluoEnergy[:,i]<emax) )
first_i = indexes_where[0][0]
i_to_take = array(range(first_i, first_i+nr_points))
tmp_array.append(self.rxes[[i_to_take], i][0])
hsum = sum(tmp_array, axis=0)
indexes_where = where( logical_and(self.fluoEnergy[:,0]>emin, self.fluoEnergy[:,0]<emax) )
self.ax_cuts.clear()
self.ax_cuts.set_xlabel('Incident energy, eV')
self.ax_cuts.set_ylabel('Intensity, a.u.')
self.ax_cuts.plot(self.fluoEnergy[:,0][indexes_where], hsum)
self.canv.draw()
def saveEnergyTrans(self):
emin = float(self.edtEnergyTransMin.text())
emax = float(self.edtEnergyTransMax.text())
tmp_array = []
#vert sum Energy transfer
indexes_where = where( logical_and(self.fluoEnergy[:,0]>emin, self.fluoEnergy[:,0]<emax) )
nr_points = len(indexes_where[0])
for i in range(len(self.incidentEnergy[0])):
indexes_where = where( logical_and(self.fluoEnergy[:,i]>emin, self.fluoEnergy[:,i]<emax) )
first_i = indexes_where[0][0]
i_to_take = array(range(first_i, first_i+nr_points))
tmp_array.append(self.rxes[[i_to_take], i][0])
hsum = sum(tmp_array, axis=0)
indexes_where = where( logical_and(self.fluoEnergy[:,0]>emin, self.fluoEnergy[:,0]<emax) )
forSave = concatenate(([self.fluoEnergy[:,0][indexes_where]], [hsum]))
fn = self.savefiledialog_qtgui()
if fn == "":
return
savetxt(fn, transpose(forSave) )
def valuechange(self):
# size = self.sl.value()
print(self.sl.value())
self.image.set_clim(vmin = 0, vmax = (self.sl.value()/100)*amax(self.rxes) )
self.canv.draw()
def imageDoubleClick(self, event):
print(event)
if event.dblclick == True:
#ask to change scale
num, ok = QtGui.QInputDialog.getDouble(self,
"Z scale",
"Z max",
value = self.zmax,
max = 20000000,
min = 0,
decimals = 4)
if ok:
self.zmax = num
self.image.set_clim(vmax=self.zmax)
self.canv.draw()
else:
return
def savefiledialog_qtgui(self):
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.AnyFile)
dlg.setAcceptMode(1) # save dialog
dlg.setNameFilters(["All files (*.*)"])
# dlg.setDirectory(self.currentdir)
if dlg.exec_():
flist = dlg.selectedFiles()
return flist[0]
else:
return ""
class xaesaRxesWindow(QtGui.QDialog):
def __init__(self, parent=None):
super(xaesaRxesWindow, self).__init__()
self.viewer = xaesa_rxes(self)
lout = QtGui.QGridLayout()
lout.addWidget(self.viewer)
self.setLayout(lout)
# self.setCentralWidget(self.wid)
# self.show()
def closeEvent(self, event):
super(xaesaRxesWindow, self).closeEvent(event)
#
#if __name__ == '__main__':
# app = QtGui.QApplication(argv)
#
# main = TestWindow()
#
# exit(app.exec_())
| 12,920
| 35.397183
| 134
|
py
|
xaesa
|
xaesa-master/xaesa_rdf.py
|
# -*- coding: utf-8 -*-
"""
Created on Mon Oct 24 15:55:28 2016
@author: sasha
"""
import os
from .init import QTVer
if QTVer == 4:
from PyQt4 import QtGui, QtCore
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar
if QTVer == 5:
from PyQt5 import QtWidgets as QtGui
from PyQt5 import QtCore
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
import matplotlib.pyplot as plt
import numpy as np
#import pyautogui as pag
from scipy.interpolate import InterpolatedUnivariateSpline
from scipy.optimize import minimize
import scipy
from scipy.integrate import simps
from .xaesa_ft import FT
def exafsrdf_difeval(x, k, exafs, amp_pha_components, dr, kpow):
integral = simps(amp_pha_components*x[:,None], dx=dr, axis=0)
sum_sq = sum((integral * k**kpow - exafs)**2)
return sum_sq
def exafsrdf(x, k, exafs, amp_pha_components, dr, kpow):
# integral = simps(transpose(amp_pha_components*x), dx=dr, axis=0)
# start = timer()
# integral = simps(amp_pha_components*x[:,None], dx=dr, axis=0)
integral = simps(amp_pha_components*x[:,None], dx=dr, axis=0)
# end = timer()
# print("Time needed:", end - start)
return integral * k**kpow - exafs
def Window_Gauss10(k, kmin, kmax):
window = np.zeros(len(k))
ka = (kmin+kmax)/2.0
kw = (kmax-kmin)*(kmax-kmin)/9.210340372
#for i in range(len(k)):
#window = np.append(window, np.exp(-(k[i]-ka)*(k[i]-ka)/kw))
knp = np.asarray(k, float)
wp = -(knp-ka)*(knp-ka)/kw
np.exp(wp, window)
return window
def Gaussian(rdf_r, A, xc, w):
return A * np.exp( -(rdf_r-xc)**2 / (2*w) )
class RDFinder(QtCore.QObject):
rdf = []
options1 = ()
varbounds1 = []
args = ()
updateProgress = QtCore.pyqtSignal(np.ndarray)
finished = QtCore.pyqtSignal(scipy.optimize.OptimizeResult)
def __init__(self, parent=None):
QtCore.QObject.__init__(self, parent)
print("Init RDFinder")
def calculate(self):
print("start calculation")
rdf_result = minimize(exafsrdf_difeval, self.rdf,
method='L-BFGS-B',
# method='TNC', #BAD
# method='SLSQP',
bounds = self.varbounds1,
callback = self.callbackF,
options = self.options1,
args=self.args )
self.finished.emit(rdf_result)
def callbackF(self, Xi):
self.updateProgress.emit(Xi)
pass
class MyStream(QtCore.QObject):
message = QtCore.pyqtSignal(str)
def __init__(self, parent=None):
super(MyStream, self).__init__(parent)
def write(self, message):
self.message.emit(str(message))
class RdfWindow(QtGui.QDialog):
def __init__(self):
super(RdfWindow, self).__init__()
self.bft = []
self.k = []
self.kpow = 0
# self.rdf_r = []
# self.rdf = []
self.params = []
self.amp_orig = [[],[]] #0 - k, 1 - amp or pha
self.pha_orig = [[],[]]
self.rdf_exafs = []
self.rdf_exafs_k = []
self.initUI()
@QtCore.pyqtSlot(str)
def on_myStream_message(self, message):
self.textEdit.moveCursor(QtGui.QTextCursor.End)
self.textEdit.insertPlainText(message)
def initUI(self):
self.fig = plt.figure(5, figsize=(18, 6))
self.ax_bft = plt.subplot2grid((1,3), (0,0))
self.ax_bftft = plt.subplot2grid((1,3), (0,1))
self.ax_rdf = plt.subplot2grid((1,3), (0,2))
self.ax_bft.set_xlabel('Wavevector k, $\AA^{-1}$')
self.ax_bft.set_ylabel('EXAFS, $\AA^{-2}$')
self.ax_bftft.set_xlabel('Distance R, $\AA$')
self.ax_bftft.set_ylabel('Fourier transform, $\AA^{-3}$')
self.ax_rdf.set_xlabel('Distance R, $\AA$')
self.ax_rdf.set_ylabel('RDF G(R)')
self.line1_bft, = self.ax_bft.plot( [], [], label = 'BFT' )
self.line2_bft, = self.ax_bft.plot( [], [], label = 'fit' )
self.line1_bft.set_color('b')
self.line2_bft.set_color('g')
self.ax_bft.legend(handles=[self.line1_bft, self.line2_bft])
self.line1_bftft, self.line2_bftft = self.ax_bftft.plot( [], [], [], [])
self.line1_bftft.set_color('b')
self.line2_bftft.set_color('b')
self.line2_bftft.set_linestyle('dotted')
self.line3_bftft, self.line4_bftft = self.ax_bftft.plot( [], [], [], [])
self.line3_bftft.set_color('g')
self.line4_bftft.set_color('g')
self.line4_bftft.set_linestyle('dotted')
self.line1_rdf, = self.ax_rdf.plot( [], [], marker='o' )
self.line2_rdf, = self.ax_rdf.plot( [], [] )
self.fig.tight_layout()
self.canv = FigureCanvas(self.fig)
self.tbar = NavigationToolbar(self.canv, self)
self.rdf_r = np.arange(0.8, 2.5, 0.01)
self.rdf = np.zeros(len(self.rdf_r))
# self.lblNrShells = QtGui.QLabel("Number of shells")
# self.edtNrShells = QtGui.QLineEdit("1")
self.lblkmin = QtGui.QLabel("K min")
self.lblkmax = QtGui.QLabel("K max")
self.lbldk = QtGui.QLabel("dK")
self.lblrmin = QtGui.QLabel("Rmin")
self.lblrmax = QtGui.QLabel("Rmax")
self.lbldr = QtGui.QLabel("dR")
self.edtkmin = QtGui.QLineEdit("0.5")
self.edtkmax = QtGui.QLineEdit("15")
self.edtdk = QtGui.QLineEdit("0.05")
self.edtrmin = QtGui.QLineEdit("0.5")
self.edtrmax = QtGui.QLineEdit("2.8")
self.edtdr = QtGui.QLineEdit("0.01")
self.edtrmin.editingFinished.connect(self.resetFit)
self.edtrmax.editingFinished.connect(self.resetFit)
self.edtdr.editingFinished.connect(self.resetFit)
# self.lblCentralDist = QtGui.QLabel("Central distance")
# self.edtCentralDist = QtGui.QLineEdit("1.8")
# self.lblWidth = QtGui.QLabel("Width")
# self.edtWidth = QtGui.QLineEdit("0.001")
# self.lblAmplitude = QtGui.QLabel("Amplitude")
# self.edtAmplitude = QtGui.QLineEdit("50")
self.lblIterations = QtGui.QLabel("Max. number of iterations")
self.edtIterations = QtGui.QLineEdit("20")
self.chkFirstFit = QtGui.QCheckBox("Start new fit (checked) / continue fit (unchecked)")
self.chkFirstFit.setChecked(True)
self.Amp = QtGui.QComboBox()
self.Pha = QtGui.QComboBox()
lblAmp = QtGui.QLabel("Amplitude")
lblPha = QtGui.QLabel("Phase")
self.Amp.addItem("")
self.Amp.addItem("E:/work/development/xaslib/fit/amp0001.dat")
self.Pha.addItem("")
self.Pha.addItem("E:/work/development/xaslib/fit/pha0001.dat")
self.lblFuncEval = QtGui.QLabel("Number of function evaluations done")
self.edtFuncEval = QtGui.QLineEdit()
self.lblFitMessage = QtGui.QLabel("Iterations done")
self.edtFitMessage = QtGui.QLineEdit()
self.lblOptimality = QtGui.QLabel("Residual")
self.edtOptimality = QtGui.QLineEdit()
lfit = QtGui.QGridLayout()
lfit.addWidget(self.lblFitMessage, 0, 0)
lfit.addWidget(self.edtFitMessage, 0, 1)
lfit.addWidget(self.lblFuncEval, 1, 0)
lfit.addWidget(self.edtFuncEval, 1, 1)
lfit.addWidget(self.lblOptimality, 2, 0)
lfit.addWidget(self.edtOptimality, 2, 1)
self.btnFit = QtGui.QPushButton('Fit')
self.btnFit.clicked.connect(self.Fit_rdf)
self.btnSaveRdf = QtGui.QPushButton('Save RDF')
self.btnSaveRdf.clicked.connect(self.saveRDF)
self.btnApply = QtGui.QPushButton('Apply')
self.btnApply.clicked.connect(self.apply)
self.btnCancel = QtGui.QPushButton('Cancel')
self.btnCancel.clicked.connect(self.cancel)
self.btnOpenAmp = QtGui.QPushButton('Open amplitude file(s) ...')
self.btnOpenAmp.clicked.connect(self.openamp)
self.btnOpenPha = QtGui.QPushButton('Open phase file(s) ...')
self.btnOpenPha.clicked.connect(self.openpha)
self.btnOpenFeff = QtGui.QPushButton('Open feff file(s) ...')
self.btnOpenFeff.clicked.connect(self.openfeff)
self.btnPrintWindow = QtGui.QPushButton('Print active window to clipboard')
self.btnPrintWindow.clicked.connect(self.printWindow)
# self.textEdit = QtGui.QTextEdit(self)
# lb.addWidget(self.textEdit, 1, 0)
lfig = QtGui.QGridLayout()
lfig.addWidget(self.tbar, 0, 0, 1, 2)
lfig.addWidget(self.canv, 1, 0, 1, 2)
lfig.addLayout(lfit, 2, 0)
lfig.addWidget(self.btnFit, 3, 0)
lfig.addWidget(self.btnSaveRdf, 4, 0)
lfig.addWidget(self.btnApply, 5, 0)
lfig.addWidget(self.btnCancel, 6, 0)
lp = QtGui.QGridLayout()
lp.addWidget(self.lblkmin, 0,0)
lp.addWidget(self.edtkmin, 0,1)
lp.addWidget(self.lblkmax, 0,2)
lp.addWidget(self.edtkmax, 0,3)
lp.addWidget(self.lbldk, 0,4)
lp.addWidget(self.edtdk, 0,5)
lp.addWidget(self.lblrmin, 1,0)
lp.addWidget(self.edtrmin, 1,1)
lp.addWidget(self.lblrmax, 1,2)
lp.addWidget(self.edtrmax, 1,3)
lp.addWidget(self.lbldr, 1,4)
lp.addWidget(self.edtdr, 1,5)
# lfig.addWidget(self.lblAmplitude, 2,1)
# lfig.addWidget(self.edtAmplitude, 2,2)
# lfig.addWidget(self.lblCentralDist, 2,3)
# lfig.addWidget(self.edtCentralDist, 2,4)
# lfig.addWidget(self.lblWidth, 2,5)
# lfig.addWidget(self.edtWidth, 2,6)
lp.addWidget(self.lblIterations, 2, 0, 1, 3)
lp.addWidget(self.edtIterations, 2, 3, 1, 3)
lp.addWidget(self.chkFirstFit, 3, 0, 1, 6)
lp.addWidget(lblAmp, 4,0)
lp.addWidget(self.Amp, 4,1, 1, 4)
lp.addWidget(lblPha, 5,0)
lp.addWidget(self.Pha, 5,1, 1, 4)
lp.addWidget(self.btnOpenAmp, 4, 5)
lp.addWidget(self.btnOpenPha, 5, 5)
lp.addWidget(self.btnOpenFeff, 6, 0)
# lp.addWidget(self.btnPrintWindow, 6, 1, 1, 4)
lfig.addLayout(lp, 2,1, 5, 1)
self.setLayout(lfig)
self.canv.draw()
def Fit_rdf(self):
self.kstart = float(self.edtkmin.text())
self.kend = float(self.edtkmax.text())
self.dk = float(self.edtdk.text())
self.common_k = np.arange(self.kstart, self.kend, self.dk)
self.rstart = float(self.edtrmin.text())
self.rend = float(self.edtrmax.text())
self.dr = float(self.edtdr.text())
self.rdf_r = np.arange(self.rstart, self.rend, self.dr)
if len(self.rdf_r) % 2 == 1: #add one more point fo have even number of points
self.rdf_r = np.append(self.rdf_r, [self.rdf_r[-1] + self.dr] )
print("number of R points:", len(self.rdf_r) )
if self.chkFirstFit.isChecked():
self.rdf = np.zeros(len(self.rdf_r))
#prepare variable and parameter array
splbft = InterpolatedUnivariateSpline(self.k, self.bft)
self.common_bft = splbft(self.common_k)
varbounds = [[],[]]
varbounds1 = []
for i in range(len(self.rdf_r)):
varbounds[0].append(0)
varbounds[1].append(1E6)
varbounds1.append((0,1E6))
varbounds[0] = tuple(varbounds[0])
varbounds[1] = tuple(varbounds[1])
par = []
var_par = []
edtVarBoxes = []
if self.amp_orig[0] == [] or self.pha_orig[0] == []:
kamp, amp_orig = np.genfromtxt(self.Amp.currentText(), usecols=(0,1), unpack=True)
kpha, pha_orig = np.genfromtxt(self.Pha.currentText(), usecols=(0,1), unpack=True)
self.amp_orig[0] = kamp
self.pha_orig[0] = kpha
self.amp_orig[1] = amp_orig
self.pha_orig[1] = pha_orig
else:
kamp = self.amp_orig[0]
amp_orig = self.amp_orig[1]
kpha = self.pha_orig[0]
pha_orig = self.pha_orig[1]
print(kamp, amp_orig)
splamp = InterpolatedUnivariateSpline(kamp, amp_orig)
splpha = InterpolatedUnivariateSpline(kpha, pha_orig)
amp = splamp(self.common_k)
pha = splpha(self.common_k)
pha_component = np.sin(2*np.transpose(np.array([self.rdf_r])).dot(np.array([self.common_k])) + pha)
rdf_r2 = self.rdf_r*self.rdf_r
amp_component = amp * (1/ np.transpose(np.array([rdf_r2])).dot(np.array([self.common_k])) )
self.amptimespha = amp_component * pha_component
options1={'disp': False,
'maxls': 20,
'iprint': -1,
'gtol': 1e-05,
'eps': 1e-08,
'maxiter': int(self.edtIterations.text()),
'ftol': 2.220446049250313e-09,
'maxcor': 10,
'maxfun': 15000}
args=(self.common_k, self.common_bft, self.amptimespha, self.dr, self.kpow)
self.rdffnd = RDFinder()
self.rdffnd.args = args
self.rdffnd.options1 = options1
self.rdffnd.varbounds1 = varbounds1
self.rdffnd.rdf = self.rdf
self.wthread = QtCore.QThread(self)
self.rdffnd.moveToThread(self.wthread)
self.wthread.started.connect(self.rdffnd.calculate)
self.rdffnd.finished.connect(self.RDFinished)
self.rdffnd.updateProgress.connect(self.updateProgress)
self.rdffnd.finished.connect(self.wthread.quit)
print("Starting optimisation...")
self.wthread.start()
print("optimisation started...")
def updateProgress(self, Xi):
fresidual = exafsrdf_difeval(Xi, self.common_k, self.common_bft, self.amptimespha, self.dr, self.kpow)
print("Step residual: ", fresidual)
self.edtOptimality.setText("{:e}".format(fresidual))
self.window = Window_Gauss10(self.common_k, self.kstart, self.kend)
self.bftw = self.common_bft * self.window
self.r, self.fr, self.fi = FT(self.common_k, self.bftw, 0, 4, 0.02)
self.efr = np.sqrt(self.fr*self.fr + self.fi*self.fi)
self.efi = self.fi * (-1)
fit_result = exafsrdf(Xi, self.common_k, self.common_bft, self.amptimespha, self.dr, self.kpow)+self.common_bft
fit_result_w = fit_result * self.window
self.res_r, res_fr, res_fi = FT(self.common_k, fit_result_w, 0, 4, 0.02)
self.res_efr = np.sqrt(res_fr*res_fr + res_fi*res_fi)
self.res_efi = res_fi * (-1)
self.line1_bft.set_xdata(self.k)
self.line1_bft.set_ydata(self.bft)
self.line2_bft.set_xdata(self.common_k)
self.line2_bft.set_ydata(fit_result)
self.line1_bftft.set_xdata(self.r)
self.line1_bftft.set_ydata(self.efr)
self.line2_bftft.set_xdata(self.r)
self.line2_bftft.set_ydata(self.efi)
self.line3_bftft.set_xdata(self.res_r)
self.line3_bftft.set_ydata(self.res_efr)
self.line4_bftft.set_xdata(self.res_r)
self.line4_bftft.set_ydata(self.res_efi)
self.line1_rdf.set_xdata(self.rdf_r)
self.line1_rdf.set_ydata(Xi)
self.ax_bft.relim()
self.ax_bft.autoscale()
self.ax_bftft.relim()
self.ax_bftft.autoscale()
self.ax_rdf.relim()
self.ax_rdf.autoscale()
self.canv.draw()
def RDFinished(self, lsq_result):
print("RDF finnished")
optim = exafsrdf_difeval(lsq_result.x, self.common_k, self.common_bft, self.amptimespha, self.dr, self.kpow)
self.edtFuncEval.setText("{:d}".format(lsq_result.nfev))
self.edtOptimality.setText("{:e}".format(optim))
self.edtFitMessage.setText("{:d}".format(lsq_result.nit))
self.window = Window_Gauss10(self.common_k, self.kstart, self.kend)
self.bftw = self.common_bft * self.window
self.r, self.fr, self.fi = FT(self.common_k, self.bftw, 0, 4, 0.02)
self.efr = np.sqrt(self.fr*self.fr + self.fi*self.fi)
self.efi = self.fi * (-1)
self.fit_result = exafsrdf(lsq_result.x, self.common_k, self.common_bft, self.amptimespha, self.dr, self.kpow)+self.common_bft
fit_result_w = self.fit_result * self.window
res_r, res_fr, res_fi = FT(self.common_k, fit_result_w, 0, 4, 0.02)
self.res_efr = np.sqrt(res_fr*res_fr + res_fi*res_fi)
self.res_efi = res_fi * (-1)
self.rdf_exafs = self.fit_result
self.rdf_exafs_k = self.common_k
self.line1_bft.set_xdata(self.k)
self.line1_bft.set_ydata(self.bft)
self.line2_bft.set_xdata(self.common_k)
self.line2_bft.set_ydata(self.fit_result)
self.line1_bftft.set_xdata(self.r)
self.line1_bftft.set_ydata(self.efr)
self.line2_bftft.set_xdata(self.r)
self.line2_bftft.set_ydata(self.efi)
self.line3_bftft.set_xdata(res_r)
self.line3_bftft.set_ydata(self.res_efr)
self.line4_bftft.set_xdata(res_r)
self.line4_bftft.set_ydata(self.res_efi)
self.line1_rdf.set_xdata(self.rdf_r)
self.line1_rdf.set_ydata(lsq_result.x)
# self.line2_rdf.set_xdata(self.rdf_r)
# self.line2_rdf.set_ydata(self.rdf)
self.ax_bft.relim()
self.ax_bft.autoscale()
self.ax_bftft.relim()
self.ax_bftft.autoscale()
self.ax_rdf.relim()
self.ax_rdf.autoscale()
self.canv.draw()
self.rdf = lsq_result.x
self.chkFirstFit.setChecked(False)
def saveRDF(self):
fn = self.savefiledialog_qtgui()
if fn == "":
return
column_captions = "r rdf"
save_array = []
save_array.append(self.rdf_r)
save_array.append(self.rdf)
np.savetxt(fn+".rdf", np.transpose(save_array), header=column_captions)
column_captions = "k exafs_rdf exafs_exp"
save_array = []
save_array.append(self.common_k)
save_array.append(self.fit_result)
save_array.append(self.common_bft)
np.savetxt(fn+".rdfexafs", np.transpose(save_array), header=column_captions)
column_captions = "r_rdf ft_real_rdf ft_im_rdf r_exp ft_real_exp ft_im_exp"
save_array = []
save_array.append(self.res_r)
save_array.append(self.res_efr)
save_array.append(self.res_efi)
save_array.append(self.r)
save_array.append(self.efr)
save_array.append(self.efi)
np.savetxt(fn+".rdfft", np.transpose(save_array), header=column_captions)
def apply(self):
self.params = []
self.params.append(float(self.edtkmin.text()))
self.params.append(float(self.edtkmax.text()))
self.params.append(float(self.edtdk.text()))
self.params.append(float(self.edtrmin.text()))
self.params.append(float(self.edtrmax.text()))
self.params.append(float(self.edtdr.text()))
self.params.append(float(self.edtIterations.text()))
self.accept()
def cancel(self):
self.close()
def bftft(self):
self.window = Window_Gauss10(self.k, self.k[0], self.k[len(self.k)-1])
self.bftw = self.bft * self.window
self.r, self.fr, self.fi = FT(self.k, self.bftw, 0, 6, 0.02)
self.efr = np.sqrt(self.fr*self.fr + self.fi*self.fi)
self.efi = self.fi * (-1)
def plot(self):
self.line1_bft.set_xdata(self.k)
self.line1_bft.set_ydata(self.bft)
self.line2_bft.set_xdata(self.rdf_exafs_k)
self.line2_bft.set_ydata(self.rdf_exafs)
self.line1_bftft.set_xdata(self.r)
self.line1_bftft.set_ydata(self.efr)
self.line2_bftft.set_xdata(self.r)
self.line2_bftft.set_ydata(self.efi)
self.line1_rdf.set_xdata(self.rdf_r)
self.line1_rdf.set_ydata(self.rdf)
# print(len(self.rdf_exafs_k))
# print(len(self.rdf_exafs))
self.ax_bft.relim()
self.ax_bft.autoscale()
self.ax_bftft.relim()
self.ax_bftft.autoscale()
self.ax_rdf.relim()
self.ax_rdf.autoscale()
self.canv.draw()
def openamp(self):
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.ExistingFiles)
dlg.setAcceptMode(0) # open dialog
dlg.setNameFilters(["All files (*.*)", "Amplitude files (*.amp)"])
# dlg.setDirectory(os.getcwd())
if dlg.exec_():
self.fnamp = dlg.selectedFiles()
else:
return
self.fnamp.sort()
self.Amp.clear()
self.Amp.addItems(self.fnamp)
def openpha(self):
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.ExistingFiles)
dlg.setAcceptMode(0) # open dialog
dlg.setNameFilters(["All files (*.*)", "Amplitude files (*.pha)"])
# dlg.setDirectory(os.getcwd())
if dlg.exec_():
self.fnpha = dlg.selectedFiles()
else:
return
self.fnpha.sort()
self.Pha.clear()
self.Pha.addItems(self.fnpha)
def openfeff(self):
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.ExistingFiles)
dlg.setAcceptMode(0) # open dialog
dlg.setNameFilters(["All files (*.*)"])
# dlg.setDirectory(os.getcwd())
if dlg.exec_():
self.fnfeff = dlg.selectedFiles()
else:
return
self.fnfeff.sort()
#Extract amplitude and phase from feff files and save to disk
for i in range(len(self.fnfeff)):
state = 0
data = []
f = open(self.fnfeff[i])
for line in f:
cols = line.split()
if cols[0] == '-----------------------------------------------------------------------':
state = 1
continue
if cols[0] =='k':
state = 2
continue
if state == 1:
r = float(cols[2])
state = 0
continue
if state == 2:
data.append(cols)
new_data_amp = []
new_data_pha = []
for j in range(len(data)):
k = float(data[j][0])
pha = float(data[j][1]) + float(data[j][3])
amp = float(data[j][2]) * np.exp( -2 * r / float(data[j][5])) * float(data[j][4])
new_data_amp.append([k, amp])
new_data_pha.append([k, pha])
# print(new_data_amp)
# print(new_data_pha)
np.savetxt(self.fnfeff[i] + '.amp', new_data_amp)
np.savetxt(self.fnfeff[i] + '.pha', new_data_pha)
self.Amp.clear()
self.Amp.addItem(self.fnfeff[i] + '.amp')
self.Pha.clear()
self.Pha.addItem(self.fnfeff[i] + '.pha')
def addshell(self):
self.tabs.append(QtGui.QFrame())
caption = "Shell"+str(self.shellnr+1)
self.tabShells.addTab(self.tabs[self.shellnr], caption)
lblN = QtGui.QLabel("N")
lblR = QtGui.QLabel("R")
lblSigma = QtGui.QLabel("Sigma")
lblC3 = QtGui.QLabel("C3")
lblC4 = QtGui.QLabel("C4")
lblC5 = QtGui.QLabel("C5")
lblC6 = QtGui.QLabel("C6")
lblE0 = QtGui.QLabel("E0")
lblAmp = QtGui.QLabel("Amplitude")
lblPha = QtGui.QLabel("Phase")
self.ltShell.append(QtGui.QGridLayout())
self.shellN.append( [QtGui.QLineEdit("4"), QtGui.QLineEdit("0"), QtGui.QLineEdit("8"), QtGui.QLineEdit("0.00001"), QtGui.QCheckBox()])
self.shellR.append([QtGui.QLineEdit("2"), QtGui.QLineEdit("0"), QtGui.QLineEdit("4"), QtGui.QLineEdit("0.0000001"), QtGui.QCheckBox()])
self.shellSigma.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("0"), QtGui.QLineEdit("1"), QtGui.QLineEdit("0.00000001"), QtGui.QCheckBox()])
self.shellC3.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("0"), QtGui.QLineEdit("0.0001"), QtGui.QLineEdit("0.0001"), QtGui.QCheckBox()])
self.shellC4.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("0"), QtGui.QLineEdit("0.0001"), QtGui.QLineEdit("0.0001"), QtGui.QCheckBox()])
self.shellC5.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("0"), QtGui.QLineEdit("0.0001"), QtGui.QLineEdit("0.0001"), QtGui.QCheckBox()])
self.shellC6.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("0"), QtGui.QLineEdit("0.0001"), QtGui.QLineEdit("0.0001"), QtGui.QCheckBox()])
self.shellE0.append([QtGui.QLineEdit("0"), QtGui.QLineEdit("0"), QtGui.QLineEdit("0"), QtGui.QLineEdit("0.0001"), QtGui.QCheckBox()])
self.shellAmp.append(QtGui.QComboBox())
self.shellPha.append(QtGui.QComboBox())
self.shellAmp[len(self.shellAmp)-1].addItem("E:/work/development/xaslib/fit/amp0001.dat")
self.shellPha[len(self.shellPha)-1].addItem("E:/work/development/xaslib/fit/pha0001.dat")
self.ltShell[self.shellnr].addWidget(lblN, 0, 0)
self.ltShell[self.shellnr].addWidget(lblR, 1, 0)
self.ltShell[self.shellnr].addWidget(lblSigma, 2, 0)
self.ltShell[self.shellnr].addWidget(lblC3, 3, 0)
self.ltShell[self.shellnr].addWidget(lblC4, 4, 0)
self.ltShell[self.shellnr].addWidget(lblC5, 5, 0)
self.ltShell[self.shellnr].addWidget(lblC6, 6, 0)
self.ltShell[self.shellnr].addWidget(lblE0, 7, 0)
self.ltShell[self.shellnr].addWidget(lblAmp, 8, 0)
self.ltShell[self.shellnr].addWidget(lblPha, 9, 0)
for i in range(5):
self.ltShell[self.shellnr].addWidget(self.shellN[self.shellnr][i], 0, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellR[self.shellnr][i], 1, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellSigma[self.shellnr][i], 2, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellC3[self.shellnr][i], 3, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellC4[self.shellnr][i], 4, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellC5[self.shellnr][i], 5, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellC6[self.shellnr][i], 6, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellE0[self.shellnr][i], 7, 2*i+1)
self.ltShell[self.shellnr].addWidget(self.shellAmp[self.shellnr], 8, 1, 1, 8)
self.ltShell[self.shellnr].addWidget(self.shellPha[self.shellnr], 9, 1, 1, 8)
for j in range(7):
self.ltShell[self.shellnr].addWidget(QtGui.QLabel("Min. limit"), j, 2)
self.ltShell[self.shellnr].addWidget(QtGui.QLabel("Max. limit"), j, 4)
self.ltShell[self.shellnr].addWidget(QtGui.QLabel("Accuracy"), j, 6)
self.tabs[self.shellnr].setLayout(self.ltShell[self.shellnr])
self.shellnr = self.shellnr +1
def resetFit(self):
self.chkFirstFit.setChecked(True)
def savefiledialog_qtgui(self):
dlg = QtGui.QFileDialog()
dlg.setFileMode(QtGui.QFileDialog.AnyFile)
dlg.setAcceptMode(1) # save dialog
dlg.setNameFilters(["All files (*.*)"])
# dlg.setDirectory(self.currentdir)
if dlg.exec_():
flist = dlg.selectedFiles()
return flist[0]
else:
return ""
def printWindow(self):
# pag.press('prtscr')
pass
| 28,810
| 36.127577
| 148
|
py
|
lingua-py
|
lingua-py-main/scripts/benchmark.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import timeit
def benchmark_preloading_all_language_models_in_low_accuracy_mode():
setup = "from lingua import LanguageDetectorBuilder"
stmt = """LanguageDetectorBuilder\
.from_all_languages()\
.with_low_accuracy_mode()\
.with_preloaded_language_models()\
.build()"""
print("Measuring time to preload all language models in low accuracy mode...")
result = timeit.timeit(setup=setup, stmt=stmt, number=1)
print(f"Time: {result:.2f} seconds")
def benchmark_preloading_all_language_models_in_high_accuracy_mode():
setup = "from lingua import LanguageDetectorBuilder"
stmt = """LanguageDetectorBuilder\
.from_all_languages()\
.with_preloaded_language_models()\
.build()"""
print("Measuring time to preload all language models in high accuracy mode...")
result = timeit.timeit(setup=setup, stmt=stmt, number=1)
print(f"Time: {result:.2f} seconds")
def benchmark_language_detection_in_low_accuracy_mode():
setup = (
"from lingua import LanguageDetectorBuilder\n"
"detector = LanguageDetectorBuilder.from_all_languages().with_low_accuracy_mode().with_preloaded_language_models().build()\n"
"sentences = ("
"'ربما يبتعد العقرب عن بعض الذين يخيبون أمله، أو يشعر بالحاجة إلى الانتقاء، وعدم البحث عن النشاطات التي ترهق أكثر مما تسعده.',"
"'Επί της ουσίας τόσο οι υφιστάμενες ενισχύσεις που οφείλονται στους κτηνοτρόφους όσο και αυτές της νέας προγραμματικής περιόδου παραμένουν στον αέρα.',"
"'It has three co-chairs, one from each of a provincial health and agriculture department, and a third from the federal government.',"
"'અશ્વિની ભટ્ટની નવલકથામાંથી થોડુંક માણસ જ્યારે વેદનાની પરાકાષ્ટાની સીમા વટાવી જાય પછી એક એવી પરિસ્થિતિ આવે છે જ્યારે દર્દ-વેદના નથી રહેતી, વેદના છે કે નહિ તેનો પણ કોઇ ખ્યાલ નથી રહેતો.',"
"'・京都大学施設に電離圏における電子数などの状況を取得可能なイオノゾンデ受信機(斜入射観測装置)を設置することで、新たな観測手法が地震先行現象検出に資するかを検証する。',"
"'ამასთანავე წანარები სათავეში უდგებიან (თუ წარმართავენ?) კახეთის გაერთიანებისა და ერთიანი სამთავროს ჩამოყალიბების პროცესს.',"
"'하지만 금융 전문가들은 “전체 대출 중 부동산 PF로의 쏠림 현상이 심각한 상태에서 각종 대출 규제로 자금 여력이 부족해질 경우 연체율이 높아질 수 있는데 당국이 안이하게 대응하는 측면이 있다”고 지적했다.',"
"'И потому я должен возблагодарить провидение; если бы не провидение, то сердце твое, бедный сэр Пол, все конечно разбилось бы.',"
"'ส.บัญชีรายชื่อ พรรคเพื่อไทย แต่อยู่ในระหว่างการตัดสินเรื่องการเป็นสมาชิกภาพของพรรคการเมือง เพราะถูกคุมขังโดยหมายศาล ระหว่างการสมัครรับเลือกตั้ง ซึ่งขณะนี้อยู่ในระหว่างการพิจารณาของ กกต.',"
"'人们必须面对:遭受严重破坏的自然生态;大自然反扑所造成的天灾人祸;人口快速成长的沈重压力;生存竞争日异严峻的社会情况;传统家庭结构逐渐瓦解的隐忧,社会价值观念混淆等问题。'"
")"
)
stmt = "for sentence in sentences: detector.detect_language_of(sentence)"
print(
"Measuring time to detect language of 10,000 sentences in low accuracy mode..."
)
result = timeit.timeit(setup=setup, stmt=stmt, number=1000)
print(f"Time: {result:.2f} seconds")
def benchmark_language_detection_in_high_accuracy_mode():
setup = (
"from lingua import LanguageDetectorBuilder\n"
"detector = LanguageDetectorBuilder.from_all_languages().with_preloaded_language_models().build()\n"
"sentences = ("
"'ربما يبتعد العقرب عن بعض الذين يخيبون أمله، أو يشعر بالحاجة إلى الانتقاء، وعدم البحث عن النشاطات التي ترهق أكثر مما تسعده.',"
"'Επί της ουσίας τόσο οι υφιστάμενες ενισχύσεις που οφείλονται στους κτηνοτρόφους όσο και αυτές της νέας προγραμματικής περιόδου παραμένουν στον αέρα.',"
"'It has three co-chairs, one from each of a provincial health and agriculture department, and a third from the federal government.',"
"'અશ્વિની ભટ્ટની નવલકથામાંથી થોડુંક માણસ જ્યારે વેદનાની પરાકાષ્ટાની સીમા વટાવી જાય પછી એક એવી પરિસ્થિતિ આવે છે જ્યારે દર્દ-વેદના નથી રહેતી, વેદના છે કે નહિ તેનો પણ કોઇ ખ્યાલ નથી રહેતો.',"
"'・京都大学施設に電離圏における電子数などの状況を取得可能なイオノゾンデ受信機(斜入射観測装置)を設置することで、新たな観測手法が地震先行現象検出に資するかを検証する。',"
"'ამასთანავე წანარები სათავეში უდგებიან (თუ წარმართავენ?) კახეთის გაერთიანებისა და ერთიანი სამთავროს ჩამოყალიბების პროცესს.',"
"'하지만 금융 전문가들은 “전체 대출 중 부동산 PF로의 쏠림 현상이 심각한 상태에서 각종 대출 규제로 자금 여력이 부족해질 경우 연체율이 높아질 수 있는데 당국이 안이하게 대응하는 측면이 있다”고 지적했다.',"
"'И потому я должен возблагодарить провидение; если бы не провидение, то сердце твое, бедный сэр Пол, все конечно разбилось бы.',"
"'ส.บัญชีรายชื่อ พรรคเพื่อไทย แต่อยู่ในระหว่างการตัดสินเรื่องการเป็นสมาชิกภาพของพรรคการเมือง เพราะถูกคุมขังโดยหมายศาล ระหว่างการสมัครรับเลือกตั้ง ซึ่งขณะนี้อยู่ในระหว่างการพิจารณาของ กกต.',"
"'人们必须面对:遭受严重破坏的自然生态;大自然反扑所造成的天灾人祸;人口快速成长的沈重压力;生存竞争日异严峻的社会情况;传统家庭结构逐渐瓦解的隐忧,社会价值观念混淆等问题。'"
")"
)
stmt = "for sentence in sentences: detector.detect_language_of(sentence)"
print(
"Measuring time to detect language of 10,000 sentences in high accuracy mode..."
)
result = timeit.timeit(setup=setup, stmt=stmt, number=1000)
print(f"Time: {result:.2f} seconds")
if __name__ == "__main__":
benchmark_preloading_all_language_models_in_low_accuracy_mode()
print()
benchmark_preloading_all_language_models_in_high_accuracy_mode()
print()
benchmark_language_detection_in_low_accuracy_mode()
print()
benchmark_language_detection_in_high_accuracy_mode()
print()
| 5,912
| 55.314286
| 198
|
py
|
lingua-py
|
lingua-py-main/scripts/memory_profiler.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import psutil
import sys
from lingua import LanguageDetectorBuilder, Language
def report_memory_usage_of_low_accuracy_mode():
LanguageDetectorBuilder.from_all_languages().with_low_accuracy_mode().with_preloaded_language_models().build()
process = psutil.Process(os.getpid())
process_size = process.memory_info().rss
print(
f"Entire Python process in low accuracy mode: {process_size / 1000000:.2f} MB"
)
def report_memory_usage_of_high_accuracy_mode():
unigrams_size = 0
bigrams_size = 0
trigrams_size = 0
quadrigrams_size = 0
fivegrams_size = 0
detector = (
LanguageDetectorBuilder.from_all_languages()
.with_preloaded_language_models()
.build()
)
for language in Language:
if language in detector._unigram_language_models:
unigrams_size += sys.getsizeof(detector._unigram_language_models[language])
if language in detector._bigram_language_models:
bigrams_size += sys.getsizeof(detector._bigram_language_models[language])
if language in detector._trigram_language_models:
trigrams_size += sys.getsizeof(detector._trigram_language_models[language])
if language in detector._quadrigram_language_models:
quadrigrams_size += sys.getsizeof(
detector._quadrigram_language_models[language]
)
if language in detector._fivegram_language_models:
fivegrams_size += sys.getsizeof(
detector._fivegram_language_models[language]
)
process = psutil.Process(os.getpid())
process_size = process.memory_info().rss
print(
f"Entire Python process in high accuracy mode: {process_size / 1000000:.2f} MB"
)
print(f"Unigrams: {unigrams_size / 1000000:.2f} MB")
print(f"Bigrams: {bigrams_size / 1000000:.2f} MB")
print(f"Trigrams: {trigrams_size / 1000000:.2f} MB")
print(f"Quadrigrams: {quadrigrams_size / 1000000:.2f} MB")
print(f"Fivegrams: {fivegrams_size / 1000000:.2f} MB")
if __name__ == "__main__":
report_memory_usage_of_low_accuracy_mode()
report_memory_usage_of_high_accuracy_mode()
| 2,797
| 33.54321
| 114
|
py
|
lingua-py
|
lingua-py-main/scripts/accuracy_reporter.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import csv
import fasttext
import gcld3
import langdetect
import langid
import os
import pycld2
import time
import urllib.request
from collections import Counter
from dataclasses import dataclass
from pathlib import Path
from typing import Counter as TypedCounter, Dict, List, Optional, Tuple
from simplemma.langdetect import lang_detector as simplemma_detector
from lingua import IsoCode639_1, Language, LanguageDetectorBuilder
@dataclass
class DetectorStatistics:
_single_word_statistic: "Statistic"
_word_pair_statistic: "Statistic"
_sentence_statistic: "Statistic"
_average_accuracies: Dict[Language, float]
@classmethod
def new(cls) -> "DetectorStatistics":
return DetectorStatistics(
_single_word_statistic=Statistic.new(),
_word_pair_statistic=Statistic.new(),
_sentence_statistic=Statistic.new(),
_average_accuracies={},
)
def add_single_word_counts(self, language: Optional[Language], single_word: str):
self._single_word_statistic.add_language_count(language)
self._single_word_statistic.add_entity_count()
self._single_word_statistic.add_entity_length_count(single_word)
def add_word_pair_counts(self, language: Optional[Language], word_pair: str):
self._word_pair_statistic.add_language_count(language)
self._word_pair_statistic.add_entity_count()
self._word_pair_statistic.add_entity_length_count(word_pair)
def add_sentence_counts(self, language: Optional[Language], sentence: str):
self._sentence_statistic.add_language_count(language)
self._sentence_statistic.add_entity_count()
self._sentence_statistic.add_entity_length_count(sentence)
def compute_accuracy_values(self):
self._single_word_statistic.map_counts_to_accuracy_values()
self._word_pair_statistic.map_counts_to_accuracy_values()
self._sentence_statistic.map_counts_to_accuracy_values()
def create_report_data(self, language: Language) -> Optional[str]:
(
single_word_accuracy,
single_word_report,
) = self._single_word_statistic.create_report_data(language, "single words")
(
word_pair_accuracy,
word_pair_report,
) = self._word_pair_statistic.create_report_data(language, "word pairs")
(
sentence_accuracy,
sentence_report,
) = self._sentence_statistic.create_report_data(language, "sentences")
average_accuracy = (
single_word_accuracy + word_pair_accuracy + sentence_accuracy
) / 3
self._average_accuracies[language] = average_accuracy
if average_accuracy == 0:
return None
return (
f"##### {language.name.title()} #####\n\n"
f">>> Accuracy on average: {format_accuracy(average_accuracy)}%\n\n"
f"{single_word_report}"
f"{word_pair_report}"
f"{sentence_report}"
)
def create_aggregated_report_row(self, language: Language) -> str:
if language in self._average_accuracies:
accuracy = self._average_accuracies[language]
if accuracy > 0:
average_accuracy_column = format_accuracy(accuracy, digits=0)
else:
average_accuracy_column = "NaN"
else:
average_accuracy_column = "NaN"
if language in self._single_word_statistic._language_accuracies:
single_words_accuracy_column = format_accuracy(
self._single_word_statistic._language_accuracies[language], digits=0
)
else:
single_words_accuracy_column = "NaN"
if language in self._word_pair_statistic._language_accuracies:
word_pairs_accuracy_column = format_accuracy(
self._word_pair_statistic._language_accuracies[language], digits=0
)
else:
word_pairs_accuracy_column = "NaN"
if language in self._sentence_statistic._language_accuracies:
sentences_accuracy_column = format_accuracy(
self._sentence_statistic._language_accuracies[language], digits=0
)
else:
sentences_accuracy_column = "NaN"
return (
f"{average_accuracy_column},"
f"{single_words_accuracy_column},"
f"{word_pairs_accuracy_column},"
f"{sentences_accuracy_column}"
)
@dataclass
class Statistic:
_language_counts: TypedCounter[Optional[Language]]
_language_accuracies: Dict[Optional[Language], float]
_entity_count: int
_entity_length_count: int
@classmethod
def new(cls) -> "Statistic":
return Statistic(
_language_counts=Counter(),
_language_accuracies={},
_entity_count=0,
_entity_length_count=0,
)
def add_language_count(self, language: Optional[Language]):
self._language_counts[language] += 1
def add_entity_count(self):
self._entity_count += 1
def add_entity_length_count(self, entity: str):
self._entity_length_count += len(entity)
def map_counts_to_accuracy_values(self):
sum_of_counts = sum(self._language_counts.values())
for language, count in self._language_counts.items():
self._language_accuracies[language] = count / sum_of_counts
def create_report_data(
self, language: Language, description: str
) -> Tuple[float, str]:
if language in self._language_accuracies:
accuracy = self._language_accuracies[language]
else:
accuracy = 0.0
average_length = round(self._entity_length_count / self._entity_count)
report = (
f">> Detection of {self._entity_count} {description} (average length: {average_length} chars)\n"
f"Accuracy: {format_accuracy(accuracy)}%\n"
f"Erroneously classified as {self.format_language_accuracies(language)}\n\n"
)
return accuracy, report
def format_language_accuracies(self, language: Language) -> str:
sorted_accuracies = []
for lang, accuracy in self._language_accuracies.items():
if lang != language:
sorted_accuracies.append((lang, accuracy))
sorted_accuracies.sort(key=lambda elem: (-elem[1], elem[0]))
substrs = [
f"{language.name.title()}: {format_accuracy(accuracy)}%"
if language is not None
else f"Unknown: {format_accuracy(accuracy)}%"
for language, accuracy in sorted_accuracies
]
return ", ".join(substrs)
def main():
start = time.perf_counter()
lingua_detector_with_high_accuracy = (
LanguageDetectorBuilder.from_all_languages()
.with_preloaded_language_models()
.build()
)
lingua_detector_with_low_accuracy = (
LanguageDetectorBuilder.from_all_languages()
.with_low_accuracy_mode()
.with_preloaded_language_models()
.build()
)
fasttext_model_url = (
"https://dl.fbaipublicfiles.com/fasttext/supervised-models/lid.176.bin"
)
fasttext_model_file = str(Path(__file__).parent / "fasttext_model.bin")
if not os.path.isfile(fasttext_model_file):
fasttext_model_file = urllib.request.urlretrieve(
fasttext_model_url, fasttext_model_file
)[0]
fasttext_detector = fasttext.load_model(fasttext_model_file)
cld3_detector = gcld3.NNetLanguageIdentifier(min_num_bytes=0, max_num_bytes=512)
simplemma_iso_codes = tuple(
[
language.iso_code_639_1.name.lower()
for language in [
Language.BULGARIAN,
Language.CATALAN,
Language.CZECH,
Language.WELSH,
Language.DANISH,
Language.GERMAN,
Language.GREEK,
Language.ENGLISH,
Language.SPANISH,
Language.ESTONIAN,
Language.PERSIAN,
Language.FINNISH,
Language.FRENCH,
Language.IRISH,
Language.HINDI,
Language.HUNGARIAN,
Language.ARMENIAN,
Language.INDONESIAN,
Language.ICELANDIC,
Language.ITALIAN,
Language.GEORGIAN,
Language.LATIN,
Language.LITHUANIAN,
Language.LATVIAN,
Language.MACEDONIAN,
Language.MALAY,
Language.BOKMAL,
Language.NYNORSK,
Language.DUTCH,
Language.POLISH,
Language.PORTUGUESE,
Language.ROMANIAN,
Language.RUSSIAN,
Language.SLOVAK,
Language.SLOVENE,
Language.ALBANIAN,
Language.SWEDISH,
Language.SWAHILI,
Language.TAGALOG,
Language.TURKISH,
Language.UKRAINIAN,
]
]
)
test_data_directory = Path(__file__).parent / "../language-testdata"
accuracy_reports_directory = Path(__file__).parent / "../accuracy-reports"
lingua_high_accuracy_reports_directory = (
accuracy_reports_directory / "lingua-high-accuracy"
)
lingua_low_accuracy_reports_directory = (
accuracy_reports_directory / "lingua-low-accuracy"
)
langdetect_reports_directory = accuracy_reports_directory / "langdetect"
fasttext_reports_directory = accuracy_reports_directory / "fasttext"
langid_reports_directory = accuracy_reports_directory / "langid"
cld3_reports_directory = accuracy_reports_directory / "cld3"
cld2_reports_directory = accuracy_reports_directory / "cld2"
simplemma_reports_directory = accuracy_reports_directory / "simplemma"
if not lingua_high_accuracy_reports_directory.is_dir():
os.makedirs(lingua_high_accuracy_reports_directory)
if not lingua_low_accuracy_reports_directory.is_dir():
os.makedirs(lingua_low_accuracy_reports_directory)
if not langdetect_reports_directory.is_dir():
os.makedirs(langdetect_reports_directory)
if not fasttext_reports_directory.is_dir():
os.makedirs(fasttext_reports_directory)
if not langid_reports_directory.is_dir():
os.makedirs(langid_reports_directory)
if not cld3_reports_directory.is_dir():
os.makedirs(cld3_reports_directory)
if not cld2_reports_directory.is_dir():
os.makedirs(cld2_reports_directory)
if not simplemma_reports_directory.is_dir():
os.makedirs(simplemma_reports_directory)
aggregated_report_file = (
accuracy_reports_directory / "aggregated-accuracy-values.csv"
)
with aggregated_report_file.open(mode="w", newline="") as csv_file:
csv_writer = csv.writer(csv_file)
csv_writer.writerow(
[
"language",
"average-simplemma",
"single-words-simplemma",
"word-pairs-simplemma",
"sentences-simplemma",
"average-cld2",
"single-words-cld2",
"word-pairs-cld2",
"sentences-cld2",
"average-cld3",
"single-words-cld3",
"word-pairs-cld3",
"sentences-cld3",
"average-langid",
"single-words-langid",
"word-pairs-langid",
"sentences-langid",
"average-fasttext",
"single-words-fasttext",
"word-pairs-fasttext",
"sentences-fasttext",
"average-langdetect",
"single-words-langdetect",
"word-pairs-langdetect",
"sentences-langdetect",
"average-lingua-low",
"single-words-lingua-low",
"word-pairs-lingua-low",
"sentences-lingua-low",
"average-lingua-high",
"single-words-lingua-high",
"word-pairs-lingua-high",
"sentences-lingua-high",
]
)
total_language_count = len(Language)
for idx, language in enumerate(Language):
print(
f"Writing reports for {language.name.title()}... ({idx+1}/{total_language_count})"
)
single_words = get_file_content(
test_data_directory, "single-words", language
)
word_pairs = get_file_content(test_data_directory, "word-pairs", language)
sentences = get_file_content(test_data_directory, "sentences", language)
lingua_high_accuracy_statistics = DetectorStatistics.new()
lingua_low_accuracy_statistics = DetectorStatistics.new()
langdetect_statistics = DetectorStatistics.new()
fasttext_statistics = DetectorStatistics.new()
langid_statistics = DetectorStatistics.new()
cld3_statistics = DetectorStatistics.new()
cld2_statistics = DetectorStatistics.new()
simplemma_statistics = DetectorStatistics.new()
for single_word in single_words:
lingua_language_in_high_accuracy_mode = (
lingua_detector_with_high_accuracy.detect_language_of(single_word)
)
lingua_high_accuracy_statistics.add_single_word_counts(
lingua_language_in_high_accuracy_mode, single_word
)
lingua_language_in_low_accuracy_mode = (
lingua_detector_with_low_accuracy.detect_language_of(single_word)
)
lingua_low_accuracy_statistics.add_single_word_counts(
lingua_language_in_low_accuracy_mode, single_word
)
try:
langdetect_language = map_detector_to_lingua(
langdetect.detect(single_word)
)
except langdetect.lang_detect_exception.LangDetectException:
langdetect_language = None
langdetect_statistics.add_single_word_counts(
langdetect_language, single_word
)
fasttext_language = map_detector_to_lingua(
fasttext_detector.predict(single_word)[0][0].split("__label__")[1]
)
fasttext_statistics.add_single_word_counts(
fasttext_language, single_word
)
langid_language = map_detector_to_lingua(
langid.classify(single_word)[0]
)
langid_statistics.add_single_word_counts(langid_language, single_word)
cld3_language = map_detector_to_lingua(
cld3_detector.FindLanguage(single_word).language
)
cld3_statistics.add_single_word_counts(cld3_language, single_word)
try:
cld2_language = map_detector_to_lingua(
pycld2.detect(single_word)[2][0][1]
)
except pycld2.error:
cld2_language = None
cld2_statistics.add_single_word_counts(cld2_language, single_word)
simplemma_language = map_detector_to_lingua(
simplemma_detector(single_word, simplemma_iso_codes)[0][0]
)
simplemma_statistics.add_single_word_counts(
simplemma_language, single_word
)
for word_pair in word_pairs:
lingua_language_in_high_accuracy_mode = (
lingua_detector_with_high_accuracy.detect_language_of(word_pair)
)
lingua_high_accuracy_statistics.add_word_pair_counts(
lingua_language_in_high_accuracy_mode, word_pair
)
lingua_language_in_low_accuracy_mode = (
lingua_detector_with_low_accuracy.detect_language_of(word_pair)
)
lingua_low_accuracy_statistics.add_word_pair_counts(
lingua_language_in_low_accuracy_mode, word_pair
)
try:
langdetect_language = map_detector_to_lingua(
langdetect.detect(word_pair)
)
except langdetect.lang_detect_exception.LangDetectException:
langdetect_language = None
langdetect_statistics.add_word_pair_counts(
langdetect_language, word_pair
)
fasttext_language = map_detector_to_lingua(
fasttext_detector.predict(word_pair)[0][0].split("__label__")[1]
)
fasttext_statistics.add_word_pair_counts(fasttext_language, word_pair)
langid_language = map_detector_to_lingua(langid.classify(word_pair)[0])
langid_statistics.add_word_pair_counts(langid_language, word_pair)
cld3_language = map_detector_to_lingua(
cld3_detector.FindLanguage(word_pair).language
)
cld3_statistics.add_word_pair_counts(cld3_language, word_pair)
try:
cld2_language = map_detector_to_lingua(
pycld2.detect(word_pair)[2][0][1]
)
except pycld2.error:
cld2_language = None
cld2_statistics.add_word_pair_counts(cld2_language, word_pair)
simplemma_language = map_detector_to_lingua(
simplemma_detector(word_pair, simplemma_iso_codes)[0][0]
)
simplemma_statistics.add_word_pair_counts(simplemma_language, word_pair)
for sentence in sentences:
lingua_language_in_high_accuracy_mode = (
lingua_detector_with_high_accuracy.detect_language_of(sentence)
)
lingua_high_accuracy_statistics.add_sentence_counts(
lingua_language_in_high_accuracy_mode, sentence
)
lingua_language_in_low_accuracy_mode = (
lingua_detector_with_low_accuracy.detect_language_of(sentence)
)
lingua_low_accuracy_statistics.add_sentence_counts(
lingua_language_in_low_accuracy_mode, sentence
)
try:
langdetect_language = map_detector_to_lingua(
langdetect.detect(sentence)
)
except langdetect.lang_detect_exception.LangDetectException:
langdetect_language = None
langdetect_statistics.add_sentence_counts(langdetect_language, sentence)
fasttext_language = map_detector_to_lingua(
fasttext_detector.predict(sentence)[0][0].split("__label__")[1]
)
fasttext_statistics.add_sentence_counts(fasttext_language, sentence)
langid_language = map_detector_to_lingua(langid.classify(sentence)[0])
langid_statistics.add_sentence_counts(langid_language, sentence)
cld3_language = map_detector_to_lingua(
cld3_detector.FindLanguage(sentence).language
)
cld3_statistics.add_sentence_counts(cld3_language, sentence)
try:
cld2_language = map_detector_to_lingua(
pycld2.detect(sentence)[2][0][1]
)
except pycld2.error:
cld2_language = None
cld2_statistics.add_sentence_counts(cld2_language, sentence)
simplemma_language = map_detector_to_lingua(
simplemma_detector(sentence, simplemma_iso_codes)[0][0]
)
simplemma_statistics.add_sentence_counts(simplemma_language, sentence)
lingua_high_accuracy_statistics.compute_accuracy_values()
lingua_low_accuracy_statistics.compute_accuracy_values()
langdetect_statistics.compute_accuracy_values()
fasttext_statistics.compute_accuracy_values()
langid_statistics.compute_accuracy_values()
cld3_statistics.compute_accuracy_values()
cld2_statistics.compute_accuracy_values()
simplemma_statistics.compute_accuracy_values()
lingua_high_accuracy_report = (
lingua_high_accuracy_statistics.create_report_data(language)
)
lingua_low_accuracy_report = (
lingua_low_accuracy_statistics.create_report_data(language)
)
langdetect_report = langdetect_statistics.create_report_data(language)
fasttext_report = fasttext_statistics.create_report_data(language)
langid_report = langid_statistics.create_report_data(language)
cld3_report = cld3_statistics.create_report_data(language)
cld2_report = cld2_statistics.create_report_data(language)
simplemma_report = simplemma_statistics.create_report_data(language)
lingua_high_accuracy_aggregated_report_row = (
lingua_high_accuracy_statistics.create_aggregated_report_row(language)
)
lingua_low_accuracy_aggregated_report_row = (
lingua_low_accuracy_statistics.create_aggregated_report_row(language)
)
langdetect_aggregated_report_row = (
langdetect_statistics.create_aggregated_report_row(language)
)
fasttext_aggregated_report_row = (
fasttext_statistics.create_aggregated_report_row(language)
)
langid_aggregated_report_row = (
langid_statistics.create_aggregated_report_row(language)
)
cld3_aggregated_report_row = cld3_statistics.create_aggregated_report_row(
language
)
cld2_aggregated_report_row = cld2_statistics.create_aggregated_report_row(
language
)
simplemma_aggregated_report_row = (
simplemma_statistics.create_aggregated_report_row(language)
)
total_aggregated_report_row = (
f"{language.name.title()},"
f"{simplemma_aggregated_report_row},"
f"{cld2_aggregated_report_row},"
f"{cld3_aggregated_report_row},"
f"{langid_aggregated_report_row},"
f"{fasttext_aggregated_report_row},"
f"{langdetect_aggregated_report_row},"
f"{lingua_low_accuracy_aggregated_report_row},"
f"{lingua_high_accuracy_aggregated_report_row}"
)
csv_writer.writerow(total_aggregated_report_row.split(","))
report_file_name = f"{language.name.title()}.txt"
lingua_high_accuracy_reports_file_path = (
lingua_high_accuracy_reports_directory / report_file_name
)
lingua_low_accuracy_reports_file_path = (
lingua_low_accuracy_reports_directory / report_file_name
)
langdetect_reports_file_path = (
langdetect_reports_directory / report_file_name
)
fasttext_reports_file_path = fasttext_reports_directory / report_file_name
langid_reports_file_path = langid_reports_directory / report_file_name
cld3_reports_file_path = cld3_reports_directory / report_file_name
cld2_reports_file_path = cld2_reports_directory / report_file_name
simplemma_reports_file_path = simplemma_reports_directory / report_file_name
if lingua_high_accuracy_report is not None:
with lingua_high_accuracy_reports_file_path.open(
mode="w"
) as lingua_high_accuracy_reports_file:
lingua_high_accuracy_reports_file.write(lingua_high_accuracy_report)
if lingua_low_accuracy_report is not None:
with lingua_low_accuracy_reports_file_path.open(
mode="w"
) as lingua_low_accuracy_reports_file:
lingua_low_accuracy_reports_file.write(lingua_low_accuracy_report)
if langdetect_report is not None:
with langdetect_reports_file_path.open(
mode="w"
) as langdetect_reports_file:
langdetect_reports_file.write(langdetect_report)
if fasttext_report is not None:
with fasttext_reports_file_path.open(mode="w") as fasttext_reports_file:
fasttext_reports_file.write(fasttext_report)
if langid_report is not None:
with langid_reports_file_path.open(mode="w") as langid_reports_file:
langid_reports_file.write(langid_report)
if cld3_report is not None:
with cld3_reports_file_path.open(mode="w") as cld3_reports_file:
cld3_reports_file.write(cld3_report)
if cld2_report is not None:
with cld2_reports_file_path.open(mode="w") as cld2_reports_file:
cld2_reports_file.write(cld2_report)
if simplemma_report is not None:
with simplemma_reports_file_path.open(
mode="w"
) as simplemma_reports_file:
simplemma_reports_file.write(simplemma_report)
print("Done\n")
elapsed = time.perf_counter() - start
print(f"All accuracy reports successfully written in {elapsed:.2f} seconds")
def get_file_content(
test_data_directory: Path, subdirectory: str, language: Language
) -> List[str]:
test_data_file_name = f"{language.iso_code_639_1.name.lower()}.txt"
test_data_file_path = test_data_directory / subdirectory / test_data_file_name
with test_data_file_path.open(mode="r") as test_data_file:
lines = []
for line in test_data_file:
stripped_line = line.rstrip()
if len(stripped_line) > 0:
lines.append(stripped_line)
return lines
def format_accuracy(accuracy: float, digits: int = 2) -> str:
return f"{accuracy*100:.{digits}f}"
def map_detector_to_lingua(iso_code: str) -> Optional[Language]:
if iso_code in ["zh-cn", "zh-tw"]:
iso_code = "zh"
try:
lingua_iso_code = IsoCode639_1[iso_code.upper()]
for language in Language:
if language.iso_code_639_1 == lingua_iso_code:
return language
return None
except KeyError:
return None
if __name__ == "__main__":
main()
| 27,800
| 39.001439
| 108
|
py
|
lingua-py
|
lingua-py-main/scripts/accuracy_table_writer.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import math
import pandas as pd
from pathlib import Path
class AccuracyTableWriter:
_columns = (
"average-lingua-high",
"average-lingua-low",
"average-langdetect",
"average-fasttext",
"average-langid",
"average-cld3",
"average-cld2",
"average-simplemma",
"single-words-lingua-high",
"single-words-lingua-low",
"single-words-langdetect",
"single-words-fasttext",
"single-words-langid",
"single-words-cld3",
"single-words-cld2",
"single-words-simplemma",
"word-pairs-lingua-high",
"word-pairs-lingua-low",
"word-pairs-langdetect",
"word-pairs-fasttext",
"word-pairs-langid",
"word-pairs-cld3",
"word-pairs-cld2",
"word-pairs-simplemma",
"sentences-lingua-high",
"sentences-lingua-low",
"sentences-langdetect",
"sentences-fasttext",
"sentences-langid",
"sentences-cld3",
"sentences-cld2",
"sentences-simplemma",
)
_table = """<table>
<tr>
<th>Language</th>
<th colspan="8">Average</th>
<th colspan="8">Single Words</th>
<th colspan="8">Word Pairs</th>
<th colspan="8">Sentences</th>
</tr>
<tr>
<th></th>
<th>Lingua<br>(high accuracy mode)</th>
<th>Lingua<br>(low accuracy mode)</th>
<th>Langdetect</th>
<th>FastText</th>
<th>Langid</th>
<th> CLD3 </th>
<th> CLD2 </th>
<th>Simplemma</th>
<th>Lingua<br>(high accuracy mode)</th>
<th>Lingua<br>(low accuracy mode)</th>
<th>Langdetect</th>
<th>FastText</th>
<th>Langid</th>
<th> CLD3 </th>
<th> CLD2 </th>
<th>Simplemma</th>
<th>Lingua<br>(high accuracy mode)</th>
<th>Lingua<br>(low accuracy mode)</th>
<th>Langdetect</th>
<th>FastText</th>
<th>Langid</th>
<th> CLD3 </th>
<th> CLD2 </th>
<th>Simplemma</th>
<th>Lingua<br>(high accuracy mode)</th>
<th>Lingua<br>(low accuracy mode)</th>
<th>Langdetect</th>
<th>FastText</th>
<th>Langid</th>
<th> CLD3 </th>
<th> CLD2 </th>
<th>Simplemma</th>
</tr>
"""
def __init__(self, file_path):
self._dataframe = self._read_into_dataframe(file_path)
def write_accuracy_table(self, file_name):
mean = self._dataframe.mean().round().astype(int)
median = self._dataframe.median().round(2)
std = self._dataframe.std().round(2)
for language in self._dataframe.index:
language_data = self._dataframe.loc[language]
self._table += f"\t<tr>\n\t\t<td>{language}</td>\n"
for column in self._columns:
accuracy_value = language_data.loc[[column]][0]
if not math.isnan(accuracy_value):
accuracy_value = int(round(accuracy_value))
accuracy_str = str(accuracy_value)
else:
accuracy_str = "-"
color = self._get_square_color(accuracy_value)
self._table += f'\t\t<td><img src="https://raw.githubusercontent.com/pemistahl/lingua-py/main/images/{color}.png"> {accuracy_str}</td>\n'
self._table += "\t</tr>\n"
self._table += '\t<tr>\n\t\t<td colspan="32"></td>\n\t</tr>\n'
self._table += "\t<tr>\n\t\t<td><strong>Mean</strong></td>\n"
for column in self._columns:
accuracy_value = mean.loc[[column]][0]
color = self._get_square_color(accuracy_value)
self._table += f'\t\t<td><img src="https://raw.githubusercontent.com/pemistahl/lingua-py/main/images/{color}.png"> <strong>{accuracy_value}</strong></td>\n'
self._table += "\t</tr>\n"
self._table += '\t<tr>\n\t\t<td colspan="32"></td>\n\t</tr>\n'
self._table += "\t<tr>\n\t\t<td>Median</td>\n"
for column in self._columns:
accuracy_value = median.loc[[column]][0]
self._table += f"\t\t<td>{accuracy_value}</td>\n"
self._table += "\t</tr>\n"
self._table += "\t<tr>\n\t\t<td>Standard Deviation</td>\n"
for column in self._columns:
accuracy_value = std.loc[[column]][0]
self._table += f"\t\t<td>{accuracy_value}</td>\n"
self._table += "\t</tr>\n"
self._table += "</table>"
with open(
Path(__file__).parent / f"../{file_name}", mode="w"
) as accuracy_table_file:
accuracy_table_file.write(self._table)
def _read_into_dataframe(self, file_path) -> pd.DataFrame:
frame = pd.read_csv(filepath_or_buffer=file_path).set_index("language")
return frame.reindex(sorted(frame.columns), axis=1)
def _get_square_color(self, accuracy_value: float):
if math.isnan(accuracy_value):
return "grey"
elif 0 <= accuracy_value <= 20:
return "red"
elif 21 <= accuracy_value <= 40:
return "orange"
elif 41 <= accuracy_value <= 60:
return "yellow"
elif 61 <= accuracy_value <= 80:
return "lightgreen"
elif 81 <= accuracy_value <= 100:
return "green"
else:
raise ValueError("invalid accuracy value:", accuracy_value)
if __name__ == "__main__":
file_path = (
Path(__file__).parent / "../accuracy-reports/aggregated-accuracy-values.csv"
)
writer = AccuracyTableWriter(file_path)
writer.write_accuracy_table(file_name="ACCURACY_TABLE.md")
print("Accuracy table written successfully")
| 6,510
| 34.005376
| 168
|
py
|
lingua-py
|
lingua-py-main/scripts/accuracy_plot_drawer.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from math import floor
from matplotlib.patches import Patch
from pathlib import Path
matplotlib.use("TkAgg")
sns.set()
sns.set_style("whitegrid")
class AccuracyPlotDrawer:
_dpi = 40
_ticks_fontsize = 35
_label_fontsize = 38
_title_fontsize = 45
_fontweight = "bold"
_hue = "classifier"
_grid_color = "#474747"
_plot_filepath = Path(__file__).parent / "../images/plots/"
_plot_titles = ("Single Word", "Word Pair", "Sentence", "Average")
_plot_title_suffix = "Detection Performance"
_column_prefixes = ("single-words", "word-pairs", "sentences", "average")
_column_suffixes = (
"simplemma",
"cld2",
"cld3",
"langid",
"fasttext",
"langdetect",
"lingua-low",
"lingua-high",
)
_legend_labels = (
"Simplemma 0.8.2",
"CLD 2",
"CLD 3",
"langid 1.1.6",
"fastText 0.9.2",
"langdetect 1.0.9",
"Lingua 1.3.0\nlow accuracy mode",
"Lingua 1.3.0\nhigh accuracy mode",
)
_hatches = ("|", "-", "/", "x", "+", ".", "*", "O")
_palette = (
"#39d7e6",
"#6bbcff",
"#347deb",
"#b259ff",
"#ff6347",
"#ff8800",
"#ffc400",
"#41c46b",
)
_ticks = np.arange(0, 101, 10)
_legend_handles = [
Patch(facecolor=color, edgecolor="black", label=label, hatch=hatch)
for color, label, hatch in zip(_palette, _legend_labels, _hatches)
]
def __init__(self, file_path):
self._dataframe = self._read_into_dataframe(file_path)
def draw_all_barplots(self):
for title, prefix in zip(self._plot_titles, self._column_prefixes):
suffixed_title = f"{title} {self._plot_title_suffix}"
columns = [f"{prefix}-{suffix}" for suffix in self._column_suffixes]
self._draw_barplot(
columns,
suffixed_title,
xlim=(0, 100),
filename=f"barplot-{prefix}.png",
)
def draw_all_boxplots(self):
for title, prefix in zip(self._plot_titles, self._column_prefixes):
suffixed_title = f"{title} {self._plot_title_suffix}"
columns = [f"{prefix}-{suffix}" for suffix in self._column_suffixes]
self._draw_boxplot(
columns,
suffixed_title,
ylim=(0, 100),
filename=f"boxplot-{prefix}.png",
)
def _read_into_dataframe(self, file_path):
frame = pd.read_csv(filepath_or_buffer=file_path)
return pd.melt(
frame=frame, id_vars="language", value_name="accuracy", var_name=self._hue
)
def _draw_barplot(self, columns, title, xlim, filename):
row_filter = self._dataframe[self._hue].isin(columns)
data = self._dataframe[row_filter]
plt.figure(figsize=(16, 180))
plt.title(
title + "\n", fontsize=self._title_fontsize, fontweight=self._fontweight
)
plt.xticks(fontsize=self._ticks_fontsize, ticks=self._ticks)
plt.yticks(fontsize=self._ticks_fontsize)
plt.grid(color=self._grid_color)
axes = sns.barplot(
data=data, x="accuracy", y="language", hue=self._hue, palette=self._palette
)
axes.set_xlabel(
"Accuracy (%)\n", fontsize=self._label_fontsize, fontweight=self._fontweight
)
axes.set_ylabel(
"Language", fontsize=self._label_fontsize, fontweight=self._fontweight
)
axes.set_xlim(xlim)
axes.xaxis.tick_top()
axes.xaxis.set_label_position("top")
axes.tick_params(axis="both", which="major", labelsize=self._label_fontsize)
axes.tick_params(axis="both", which="minor", labelsize=self._label_fontsize)
axes.legend(handles=self._legend_handles, fontsize=28, loc="upper left")
language_count = len(axes.patches) / len(self._legend_labels)
for i, current_bar in enumerate(axes.patches):
current_bar.set_edgecolor(self._grid_color)
current_bar.set_hatch(self._hatches[floor(i / language_count)])
plt.tight_layout()
plt.savefig(self._plot_filepath / filename, dpi=self._dpi)
def _draw_boxplot(self, columns, title, ylim, filename):
row_filter = self._dataframe[self._hue].isin(columns)
data = self._dataframe[row_filter]
plt.figure(figsize=(40, 12))
plt.title(title, fontsize=self._title_fontsize, fontweight=self._fontweight)
plt.xticks(fontsize=self._ticks_fontsize)
plt.yticks(fontsize=self._ticks_fontsize, ticks=self._ticks)
plt.grid(self._grid_color)
axes = sns.boxplot(
data=data, x="classifier", y="accuracy", linewidth=5, palette=self._palette
)
axes.set_ylim(ylim)
axes.set_xlabel(
"Classifier", fontsize=self._label_fontsize, fontweight=self._fontweight
)
axes.set_ylabel(
"Accuracy (%)", fontsize=self._label_fontsize, fontweight=self._fontweight
)
axes.set_xticklabels(self._legend_labels)
plt.tight_layout()
plt.savefig(self._plot_filepath / filename, dpi=self._dpi)
if __name__ == "__main__":
file_path = (
Path(__file__).parent / "../accuracy-reports/aggregated-accuracy-values.csv"
)
drawer = AccuracyPlotDrawer(file_path)
drawer.draw_all_barplots()
drawer.draw_all_boxplots()
print("All plots created successfully")
| 6,253
| 33.362637
| 88
|
py
|
lingua-py
|
lingua-py-main/tests/test_ngram.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import pytest
from lingua._ngram import _NgramRange
def test_ngram_iterator():
ngram = "äbcde"
ngram_range = _NgramRange(ngram)
assert next(ngram_range) == "äbcde"
assert next(ngram_range) == "äbcd"
assert next(ngram_range) == "äbc"
assert next(ngram_range) == "äb"
assert next(ngram_range) == "ä"
with pytest.raises(StopIteration):
next(ngram_range)
| 1,004
| 30.40625
| 76
|
py
|
lingua-py
|
lingua-py-main/tests/test_builder.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import pytest
from lingua.builder import LanguageDetectorBuilder
from lingua.isocode import IsoCode639_1, IsoCode639_3
from lingua.language import Language
def test_build_from_all_languages():
builder = LanguageDetectorBuilder.from_all_languages()
assert builder._languages == Language.all()
def test_build_from_spoken_languages():
builder = LanguageDetectorBuilder.from_all_spoken_languages()
assert builder._languages == Language.all_spoken_ones()
def test_build_from_languages_with_arabic_script():
builder = LanguageDetectorBuilder.from_all_languages_with_arabic_script()
assert builder._languages == Language.all_with_arabic_script()
def test_build_from_languages_with_cyrillic_script():
builder = LanguageDetectorBuilder.from_all_languages_with_cyrillic_script()
assert builder._languages == Language.all_with_cyrillic_script()
def test_build_from_languages_with_devanagari_script():
builder = LanguageDetectorBuilder.from_all_languages_with_devanagari_script()
assert builder._languages == Language.all_with_devanagari_script()
def test_build_from_languages_with_latin_script():
builder = LanguageDetectorBuilder.from_all_languages_with_latin_script()
assert builder._languages == Language.all_with_latin_script()
def test_build_from_blacklist():
languages = {Language.TURKISH, Language.ROMANIAN}
builder = LanguageDetectorBuilder.from_all_languages_without(*languages)
expected_languages = Language.all().difference(languages)
assert builder._languages == expected_languages
def test_cannot_build_from_blacklist():
languages = Language.all().difference({Language.GERMAN})
with pytest.raises(ValueError) as exception_info:
LanguageDetectorBuilder.from_all_languages_without(*languages)
assert (
exception_info.value.args[0]
== "LanguageDetector needs at least 2 languages to choose from"
)
def test_build_from_whitelist():
languages = {Language.GERMAN, Language.ENGLISH}
builder = LanguageDetectorBuilder.from_languages(*languages)
assert builder._languages == languages
def test_cannot_build_from_whitelist():
with pytest.raises(ValueError) as exception_info:
LanguageDetectorBuilder.from_languages(Language.GERMAN)
assert (
exception_info.value.args[0]
== "LanguageDetector needs at least 2 languages to choose from"
)
def test_build_from_iso_639_1_codes():
builder = LanguageDetectorBuilder.from_iso_codes_639_1(
IsoCode639_1.DE, IsoCode639_1.SV
)
assert builder._languages == {Language.GERMAN, Language.SWEDISH}
def test_cannot_build_from_iso_639_1_codes():
with pytest.raises(ValueError) as exception_info:
LanguageDetectorBuilder.from_iso_codes_639_1(IsoCode639_1.DE)
assert (
exception_info.value.args[0]
== "LanguageDetector needs at least 2 languages to choose from"
)
def test_build_from_iso_639_3_codes():
builder = LanguageDetectorBuilder.from_iso_codes_639_3(
IsoCode639_3.DEU, IsoCode639_3.SWE
)
assert builder._languages == {Language.GERMAN, Language.SWEDISH}
def test_cannot_build_from_iso_639_3_codes():
with pytest.raises(ValueError) as exception_info:
LanguageDetectorBuilder.from_iso_codes_639_3(IsoCode639_3.DEU)
assert (
exception_info.value.args[0]
== "LanguageDetector needs at least 2 languages to choose from"
)
def test_build_with_minimum_relative_distance():
builder = LanguageDetectorBuilder.from_all_languages()
assert builder._minimum_relative_distance == 0.0
builder.with_minimum_relative_distance(0.2)
assert builder._minimum_relative_distance == 0.2
def test_cannot_build_with_minimum_relative_distance():
builder = LanguageDetectorBuilder.from_all_languages()
for value in (-0.01, -2.3, 1.0, 1.7):
with pytest.raises(ValueError) as exception_info:
builder.with_minimum_relative_distance(value)
assert (
exception_info.value.args[0]
== "Minimum relative distance must lie in between 0.0 and 0.99"
)
def test_build_with_low_accuracy_mode():
builder = LanguageDetectorBuilder.from_all_languages()
assert builder._is_low_accuracy_mode_enabled is False
builder.with_low_accuracy_mode()
assert builder._is_low_accuracy_mode_enabled is True
| 4,984
| 34.607143
| 81
|
py
|
lingua-py
|
lingua-py-main/tests/test_language.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from lingua.isocode import IsoCode639_1, IsoCode639_3
from lingua.language import Language
def test_all_languages_are_available():
assert Language.all() == frozenset(
[
Language.AFRIKAANS,
Language.ALBANIAN,
Language.ARABIC,
Language.ARMENIAN,
Language.AZERBAIJANI,
Language.BASQUE,
Language.BELARUSIAN,
Language.BENGALI,
Language.BOKMAL,
Language.BOSNIAN,
Language.BULGARIAN,
Language.CATALAN,
Language.CHINESE,
Language.CROATIAN,
Language.CZECH,
Language.DANISH,
Language.DUTCH,
Language.ENGLISH,
Language.ESPERANTO,
Language.ESTONIAN,
Language.FINNISH,
Language.FRENCH,
Language.GANDA,
Language.GEORGIAN,
Language.GERMAN,
Language.GREEK,
Language.GUJARATI,
Language.HEBREW,
Language.HINDI,
Language.HUNGARIAN,
Language.ICELANDIC,
Language.INDONESIAN,
Language.IRISH,
Language.ITALIAN,
Language.JAPANESE,
Language.KAZAKH,
Language.KOREAN,
Language.LATIN,
Language.LATVIAN,
Language.LITHUANIAN,
Language.MACEDONIAN,
Language.MALAY,
Language.MAORI,
Language.MARATHI,
Language.MONGOLIAN,
Language.NYNORSK,
Language.PERSIAN,
Language.POLISH,
Language.PORTUGUESE,
Language.PUNJABI,
Language.ROMANIAN,
Language.RUSSIAN,
Language.SERBIAN,
Language.SHONA,
Language.SLOVAK,
Language.SLOVENE,
Language.SOMALI,
Language.SOTHO,
Language.SPANISH,
Language.SWAHILI,
Language.SWEDISH,
Language.TAGALOG,
Language.TAMIL,
Language.TELUGU,
Language.THAI,
Language.TSONGA,
Language.TSWANA,
Language.TURKISH,
Language.UKRAINIAN,
Language.URDU,
Language.VIETNAMESE,
Language.WELSH,
Language.XHOSA,
Language.YORUBA,
Language.ZULU,
]
)
def test_all_spoken_languages_are_available():
assert Language.all_spoken_ones() == frozenset(
[
Language.AFRIKAANS,
Language.ALBANIAN,
Language.ARABIC,
Language.ARMENIAN,
Language.AZERBAIJANI,
Language.BASQUE,
Language.BELARUSIAN,
Language.BENGALI,
Language.BOKMAL,
Language.BOSNIAN,
Language.BULGARIAN,
Language.CATALAN,
Language.CHINESE,
Language.CROATIAN,
Language.CZECH,
Language.DANISH,
Language.DUTCH,
Language.ENGLISH,
Language.ESPERANTO,
Language.ESTONIAN,
Language.FINNISH,
Language.FRENCH,
Language.GANDA,
Language.GEORGIAN,
Language.GERMAN,
Language.GREEK,
Language.GUJARATI,
Language.HEBREW,
Language.HINDI,
Language.HUNGARIAN,
Language.ICELANDIC,
Language.INDONESIAN,
Language.IRISH,
Language.ITALIAN,
Language.JAPANESE,
Language.KAZAKH,
Language.KOREAN,
Language.LATVIAN,
Language.LITHUANIAN,
Language.MACEDONIAN,
Language.MALAY,
Language.MAORI,
Language.MARATHI,
Language.MONGOLIAN,
Language.NYNORSK,
Language.PERSIAN,
Language.POLISH,
Language.PORTUGUESE,
Language.PUNJABI,
Language.ROMANIAN,
Language.RUSSIAN,
Language.SERBIAN,
Language.SHONA,
Language.SLOVAK,
Language.SLOVENE,
Language.SOMALI,
Language.SOTHO,
Language.SPANISH,
Language.SWAHILI,
Language.SWEDISH,
Language.TAGALOG,
Language.TAMIL,
Language.TELUGU,
Language.THAI,
Language.TSONGA,
Language.TSWANA,
Language.TURKISH,
Language.UKRAINIAN,
Language.URDU,
Language.VIETNAMESE,
Language.WELSH,
Language.XHOSA,
Language.YORUBA,
Language.ZULU,
]
)
def test_languages_support_arabic_script():
assert Language.all_with_arabic_script() == frozenset(
[Language.ARABIC, Language.PERSIAN, Language.URDU]
)
def test_languages_support_cyrillic_alphabet():
assert Language.all_with_cyrillic_script() == frozenset(
[
Language.BELARUSIAN,
Language.BULGARIAN,
Language.KAZAKH,
Language.MACEDONIAN,
Language.MONGOLIAN,
Language.RUSSIAN,
Language.SERBIAN,
Language.UKRAINIAN,
]
)
def test_languages_support_devanagari_script():
assert Language.all_with_devanagari_script() == frozenset(
[Language.HINDI, Language.MARATHI]
)
def test_languages_support_latin_script():
assert Language.all_with_latin_script() == frozenset(
[
Language.AFRIKAANS,
Language.ALBANIAN,
Language.AZERBAIJANI,
Language.BASQUE,
Language.BOKMAL,
Language.BOSNIAN,
Language.CATALAN,
Language.CROATIAN,
Language.CZECH,
Language.DANISH,
Language.DUTCH,
Language.ENGLISH,
Language.ESPERANTO,
Language.ESTONIAN,
Language.FINNISH,
Language.FRENCH,
Language.GANDA,
Language.GERMAN,
Language.HUNGARIAN,
Language.ICELANDIC,
Language.INDONESIAN,
Language.IRISH,
Language.ITALIAN,
Language.LATIN,
Language.LATVIAN,
Language.LITHUANIAN,
Language.MALAY,
Language.MAORI,
Language.NYNORSK,
Language.POLISH,
Language.PORTUGUESE,
Language.ROMANIAN,
Language.SHONA,
Language.SLOVAK,
Language.SLOVENE,
Language.SOMALI,
Language.SOTHO,
Language.SPANISH,
Language.SWAHILI,
Language.SWEDISH,
Language.TAGALOG,
Language.TSONGA,
Language.TSWANA,
Language.TURKISH,
Language.VIETNAMESE,
Language.WELSH,
Language.XHOSA,
Language.YORUBA,
Language.ZULU,
]
)
def test_language_from_iso_code_639_1():
assert Language.from_iso_code_639_1(IsoCode639_1.DE) == Language.GERMAN
def test_language_from_iso_code_639_3():
assert Language.from_iso_code_639_3(IsoCode639_3.DEU) == Language.GERMAN
| 7,939
| 28.191176
| 76
|
py
|
lingua-py
|
lingua-py-main/tests/__init__.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
| 608
| 39.6
| 76
|
py
|
lingua-py
|
lingua-py-main/tests/test_model.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy as np
import pytest
from fractions import Fraction
from typing import Dict, List
from lingua.detector import _split_text_into_words
from lingua.language import Language
from lingua._model import _TrainingDataLanguageModel, _TestDataLanguageModel
TEXT: str = """These sentences are intended for testing purposes.
⚠ Do not use them in production
By the way, they consist of 23 words in total."""
def map_values_to_fractions(dct: Dict[str, str]) -> Dict[str, Fraction]:
ngrams = {}
for key, value in dct.items():
numerator, denominator = value.split("/")
ngrams[key] = Fraction(int(numerator), int(denominator))
return ngrams
def expected_unigrams() -> List[List[str]]:
return [
["a"],
["b"],
["c"],
["d"],
["e"],
["f"],
["g"],
["h"],
["i"],
["l"],
["m"],
["n"],
["o"],
["p"],
["r"],
["s"],
["t"],
["u"],
["w"],
["y"],
]
def expected_unigram_absolute_frequencies() -> Dict[str, int]:
return {
"a": 3,
"b": 1,
"c": 3,
"d": 5,
"e": 14,
"f": 2,
"g": 1,
"h": 4,
"i": 6,
"l": 1,
"m": 1,
"n": 10,
"o": 10,
"p": 3,
"r": 5,
"s": 10,
"t": 13,
"u": 3,
"w": 2,
"y": 3,
}
def expected_unigram_relative_frequencies() -> Dict[str, Fraction]:
return map_values_to_fractions(
{
"a": "3/100",
"b": "1/100",
"c": "3/100",
"d": "1/20",
"e": "7/50",
"f": "1/50",
"g": "1/100",
"h": "1/25",
"i": "3/50",
"l": "1/100",
"m": "1/100",
"n": "1/10",
"o": "1/10",
"p": "3/100",
"r": "1/20",
"s": "1/10",
"t": "13/100",
"u": "3/100",
"w": "1/50",
"y": "3/100",
}
)
def expected_bigrams() -> List[List[str]]:
return [
["al", "a"],
["ar", "a"],
["ay", "a"],
["by", "b"],
["ce", "c"],
["co", "c"],
["ct", "c"],
["de", "d"],
["do", "d"],
["ds", "d"],
["du", "d"],
["ed", "e"],
["em", "e"],
["en", "e"],
["es", "e"],
["ey", "e"],
["fo", "f"],
["he", "h"],
["in", "i"],
["io", "i"],
["is", "i"],
["nc", "n"],
["nd", "n"],
["ng", "n"],
["no", "n"],
["ns", "n"],
["nt", "n"],
["od", "o"],
["of", "o"],
["on", "o"],
["or", "o"],
["os", "o"],
["ot", "o"],
["po", "p"],
["pr", "p"],
["pu", "p"],
["rd", "r"],
["re", "r"],
["ro", "r"],
["rp", "r"],
["se", "s"],
["si", "s"],
["st", "s"],
["ta", "t"],
["te", "t"],
["th", "t"],
["ti", "t"],
["to", "t"],
["uc", "u"],
["ur", "u"],
["us", "u"],
["wa", "w"],
["wo", "w"],
]
def expected_unigram_json_relative_frequencies() -> Dict[str, float]:
return {
ngram: frac.numerator / frac.denominator
for ngram, frac in expected_unigram_relative_frequencies().items()
}
def expected_bigram_absolute_frequencies() -> Dict[str, int]:
return {
"de": 1,
"pr": 1,
"pu": 1,
"do": 1,
"uc": 1,
"ds": 1,
"du": 1,
"ur": 1,
"us": 1,
"ed": 1,
"in": 4,
"io": 1,
"em": 1,
"en": 3,
"is": 1,
"al": 1,
"es": 4,
"ar": 1,
"rd": 1,
"re": 1,
"ey": 1,
"nc": 1,
"nd": 1,
"ay": 1,
"ng": 1,
"ro": 1,
"rp": 1,
"no": 1,
"ns": 1,
"nt": 2,
"fo": 1,
"wa": 1,
"se": 4,
"od": 1,
"si": 1,
"of": 1,
"by": 1,
"wo": 1,
"on": 2,
"st": 2,
"ce": 1,
"or": 2,
"os": 1,
"ot": 2,
"co": 1,
"ta": 1,
"ct": 1,
"te": 3,
"th": 4,
"ti": 2,
"to": 1,
"he": 4,
"po": 1,
}
def expected_bigram_relative_frequencies() -> Dict[str, Fraction]:
return map_values_to_fractions(
{
"de": "1/5",
"pr": "1/3",
"pu": "1/3",
"do": "1/5",
"uc": "1/3",
"ds": "1/5",
"du": "1/5",
"ur": "1/3",
"us": "1/3",
"ed": "1/14",
"in": "2/3",
"io": "1/6",
"em": "1/14",
"en": "3/14",
"is": "1/6",
"al": "1/3",
"es": "2/7",
"ar": "1/3",
"rd": "1/5",
"re": "1/5",
"ey": "1/14",
"nc": "1/10",
"nd": "1/10",
"ay": "1/3",
"ng": "1/10",
"ro": "1/5",
"rp": "1/5",
"no": "1/10",
"ns": "1/10",
"nt": "1/5",
"fo": "1/2",
"wa": "1/2",
"se": "2/5",
"od": "1/10",
"si": "1/10",
"of": "1/10",
"by": "1/1",
"wo": "1/2",
"on": "1/5",
"st": "1/5",
"ce": "1/3",
"or": "1/5",
"os": "1/10",
"ot": "1/5",
"co": "1/3",
"ta": "1/13",
"ct": "1/3",
"te": "3/13",
"th": "4/13",
"ti": "2/13",
"to": "1/13",
"he": "1/1",
"po": "1/3",
}
)
def expected_trigrams() -> List[List[str]]:
return [
["are", "ar", "a"],
["ces", "ce", "c"],
["con", "co", "c"],
["cti", "ct", "c"],
["ded", "de", "d"],
["duc", "du", "d"],
["enc", "en", "e"],
["end", "en", "e"],
["ent", "en", "e"],
["ese", "es", "e"],
["est", "es", "e"],
["for", "fo", "f"],
["hem", "he", "h"],
["hes", "he", "h"],
["hey", "he", "h"],
["ing", "in", "i"],
["int", "in", "i"],
["ion", "io", "i"],
["ist", "is", "i"],
["nce", "nc", "n"],
["nde", "nd", "n"],
["not", "no", "n"],
["nsi", "ns", "n"],
["nte", "nt", "n"],
["odu", "od", "o"],
["ons", "on", "o"],
["ord", "or", "o"],
["ose", "os", "o"],
["ota", "ot", "o"],
["pos", "po", "p"],
["pro", "pr", "p"],
["pur", "pu", "p"],
["rds", "rd", "r"],
["rod", "ro", "r"],
["rpo", "rp", "r"],
["sen", "se", "s"],
["ses", "se", "s"],
["sis", "si", "s"],
["sti", "st", "s"],
["tal", "ta", "t"],
["ten", "te", "t"],
["tes", "te", "t"],
["the", "th", "t"],
["tin", "ti", "t"],
["tio", "ti", "t"],
["tot", "to", "t"],
["uct", "uc", "u"],
["urp", "ur", "u"],
["use", "us", "u"],
["way", "wa", "w"],
["wor", "wo", "w"],
]
def expected_trigram_absolute_frequencies() -> Dict[str, int]:
return {
"rds": 1,
"ose": 1,
"ded": 1,
"con": 1,
"use": 1,
"est": 1,
"ion": 1,
"ist": 1,
"pur": 1,
"hem": 1,
"hes": 1,
"tin": 1,
"cti": 1,
"wor": 1,
"tio": 1,
"ten": 2,
"ota": 1,
"hey": 1,
"tal": 1,
"tes": 1,
"uct": 1,
"sti": 1,
"pro": 1,
"odu": 1,
"nsi": 1,
"rod": 1,
"for": 1,
"ces": 1,
"nce": 1,
"not": 1,
"pos": 1,
"are": 1,
"tot": 1,
"end": 1,
"enc": 1,
"sis": 1,
"sen": 1,
"nte": 2,
"ord": 1,
"ses": 1,
"ing": 1,
"ent": 1,
"way": 1,
"nde": 1,
"int": 1,
"rpo": 1,
"the": 4,
"urp": 1,
"duc": 1,
"ons": 1,
"ese": 1,
}
def expected_trigram_relative_frequencies() -> Dict[str, Fraction]:
return map_values_to_fractions(
{
"rds": "1/1",
"ose": "1/1",
"ded": "1/1",
"con": "1/1",
"use": "1/1",
"est": "1/4",
"ion": "1/1",
"ist": "1/1",
"pur": "1/1",
"hem": "1/4",
"hes": "1/4",
"tin": "1/2",
"cti": "1/1",
"wor": "1/1",
"tio": "1/2",
"ten": "2/3",
"ota": "1/2",
"hey": "1/4",
"tal": "1/1",
"tes": "1/3",
"uct": "1/1",
"sti": "1/2",
"pro": "1/1",
"odu": "1/1",
"nsi": "1/1",
"rod": "1/1",
"for": "1/1",
"ces": "1/1",
"nce": "1/1",
"not": "1/1",
"pos": "1/1",
"are": "1/1",
"tot": "1/1",
"end": "1/3",
"enc": "1/3",
"sis": "1/1",
"sen": "1/4",
"nte": "1/1",
"ord": "1/2",
"ses": "1/4",
"ing": "1/4",
"ent": "1/3",
"way": "1/1",
"nde": "1/1",
"int": "1/4",
"rpo": "1/1",
"the": "1/1",
"urp": "1/1",
"duc": "1/1",
"ons": "1/2",
"ese": "1/4",
}
)
def expected_quadrigrams() -> List[List[str]]:
return [
["cons", "con", "co", "c"],
["ctio", "cti", "ct", "c"],
["duct", "duc", "du", "d"],
["ence", "enc", "en", "e"],
["ende", "end", "en", "e"],
["ente", "ent", "en", "e"],
["esti", "est", "es", "e"],
["hese", "hes", "he", "h"],
["inte", "int", "in", "i"],
["nces", "nce", "nc", "n"],
["nded", "nde", "nd", "n"],
["nsis", "nsi", "ns", "n"],
["nten", "nte", "nt", "n"],
["oduc", "odu", "od", "o"],
["onsi", "ons", "on", "o"],
["ords", "ord", "or", "o"],
["oses", "ose", "os", "o"],
["otal", "ota", "ot", "o"],
["pose", "pos", "po", "p"],
["prod", "pro", "pr", "p"],
["purp", "pur", "pu", "p"],
["rodu", "rod", "ro", "r"],
["rpos", "rpo", "rp", "r"],
["sent", "sen", "se", "s"],
["sist", "sis", "si", "s"],
["stin", "sti", "st", "s"],
["tenc", "ten", "te", "t"],
["tend", "ten", "te", "t"],
["test", "tes", "te", "t"],
["them", "the", "th", "t"],
["thes", "the", "th", "t"],
["they", "the", "th", "t"],
["ting", "tin", "ti", "t"],
["tion", "tio", "ti", "t"],
["tota", "tot", "to", "t"],
["ucti", "uct", "uc", "u"],
["urpo", "urp", "ur", "u"],
["word", "wor", "wo", "w"],
]
def expected_quadrigram_absolute_frequencies() -> Dict[str, int]:
return {
"onsi": 1,
"sist": 1,
"ende": 1,
"ords": 1,
"esti": 1,
"oduc": 1,
"nces": 1,
"tenc": 1,
"tend": 1,
"thes": 1,
"rpos": 1,
"ting": 1,
"nsis": 1,
"nten": 2,
"tota": 1,
"they": 1,
"cons": 1,
"tion": 1,
"prod": 1,
"otal": 1,
"test": 1,
"ence": 1,
"pose": 1,
"oses": 1,
"nded": 1,
"inte": 1,
"them": 1,
"urpo": 1,
"duct": 1,
"sent": 1,
"stin": 1,
"ucti": 1,
"ente": 1,
"purp": 1,
"ctio": 1,
"rodu": 1,
"word": 1,
"hese": 1,
}
def expected_quadrigram_relative_frequencies() -> Dict[str, Fraction]:
return map_values_to_fractions(
{
"onsi": "1/1",
"sist": "1/1",
"ende": "1/1",
"ords": "1/1",
"esti": "1/1",
"oduc": "1/1",
"nces": "1/1",
"tenc": "1/2",
"tend": "1/2",
"thes": "1/4",
"rpos": "1/1",
"ting": "1/1",
"nsis": "1/1",
"nten": "1/1",
"tota": "1/1",
"they": "1/4",
"cons": "1/1",
"tion": "1/1",
"prod": "1/1",
"otal": "1/1",
"test": "1/1",
"ence": "1/1",
"pose": "1/1",
"oses": "1/1",
"nded": "1/1",
"inte": "1/1",
"them": "1/4",
"urpo": "1/1",
"duct": "1/1",
"sent": "1/1",
"stin": "1/1",
"ucti": "1/1",
"ente": "1/1",
"purp": "1/1",
"ctio": "1/1",
"rodu": "1/1",
"word": "1/1",
"hese": "1/1",
}
)
def expected_fivegrams() -> List[List[str]]:
return [
["consi", "cons", "con", "co", "c"],
["ction", "ctio", "cti", "ct", "c"],
["ducti", "duct", "duc", "du", "d"],
["ences", "ence", "enc", "en", "e"],
["ended", "ende", "end", "en", "e"],
["enten", "ente", "ent", "en", "e"],
["estin", "esti", "est", "es", "e"],
["inten", "inte", "int", "in", "i"],
["nsist", "nsis", "nsi", "ns", "n"],
["ntenc", "nten", "nte", "nt", "n"],
["ntend", "nten", "nte", "nt", "n"],
["oduct", "oduc", "odu", "od", "o"],
["onsis", "onsi", "ons", "on", "o"],
["poses", "pose", "pos", "po", "p"],
["produ", "prod", "pro", "pr", "p"],
["purpo", "purp", "pur", "pu", "p"],
["roduc", "rodu", "rod", "ro", "r"],
["rpose", "rpos", "rpo", "rp", "r"],
["sente", "sent", "sen", "se", "s"],
["sting", "stin", "sti", "st", "s"],
["tence", "tenc", "ten", "te", "t"],
["tende", "tend", "ten", "te", "t"],
["testi", "test", "tes", "te", "t"],
["these", "thes", "the", "th", "t"],
["total", "tota", "tot", "to", "t"],
["uctio", "ucti", "uct", "uc", "u"],
["urpos", "urpo", "urp", "ur", "u"],
["words", "word", "wor", "wo", "w"],
]
def expected_fivegram_absolute_frequencies() -> Dict[str, int]:
return {
"testi": 1,
"sente": 1,
"ences": 1,
"tende": 1,
"ducti": 1,
"ntenc": 1,
"these": 1,
"onsis": 1,
"ntend": 1,
"total": 1,
"uctio": 1,
"enten": 1,
"poses": 1,
"ction": 1,
"produ": 1,
"inten": 1,
"nsist": 1,
"words": 1,
"sting": 1,
"purpo": 1,
"tence": 1,
"estin": 1,
"roduc": 1,
"urpos": 1,
"rpose": 1,
"ended": 1,
"oduct": 1,
"consi": 1,
}
def expected_fivegram_relative_frequencies() -> Dict[str, Fraction]:
return map_values_to_fractions(
{
"testi": "1/1",
"sente": "1/1",
"ences": "1/1",
"tende": "1/1",
"ducti": "1/1",
"ntenc": "1/2",
"these": "1/1",
"onsis": "1/1",
"ntend": "1/2",
"total": "1/1",
"uctio": "1/1",
"enten": "1/1",
"poses": "1/1",
"ction": "1/1",
"produ": "1/1",
"inten": "1/1",
"nsist": "1/1",
"words": "1/1",
"sting": "1/1",
"purpo": "1/1",
"tence": "1/1",
"estin": "1/1",
"roduc": "1/1",
"urpos": "1/1",
"rpose": "1/1",
"ended": "1/1",
"oduct": "1/1",
"consi": "1/1",
}
)
@pytest.fixture
def expected_numpy_array() -> np.ndarray:
return np.array(
[
("a", -2.47),
("b", -4.16),
("c", -3.44),
("d", -3.252),
("e", -2.113),
("f", -3.842),
("g", -3.865),
("h", -3.045),
("i", -2.623),
("j", -6.113),
("k", -4.812),
("l", -3.17),
("m", -3.682),
("n", -2.637),
("o", -2.574),
("p", -3.85),
("q", -7.03),
("r", -2.758),
("s", -2.709),
("t", -2.408),
("u", -3.6),
("v", -4.516),
("w", -3.979),
("x", -6.297),
("y", -4.02),
("z", -6.81),
("º", -14.74),
("ß", -15.79),
("à", -14.02),
("á", -12.06),
("â", -11.54),
("ã", -15.02),
("ä", -13.586),
("å", -14.62),
("æ", -16.56),
("ç", -13.516),
("è", -13.445),
("é", -10.63),
("ê", -14.55),
("ë", -14.74),
("ì", -15.95),
("í", -12.3),
("î", -15.414),
("ï", -14.01),
("ð", -15.31),
("ñ", -12.19),
("ò", -14.484),
("ó", -12.164),
("ô", -14.41),
("õ", -13.82),
("ö", -13.055),
("ø", -14.89),
("ù", -17.66),
("ú", -13.4),
("û", -15.72),
("ü", -13.35),
("ý", -15.22),
("ÿ", -16.97),
("ā", -14.77),
("ă", -16.4),
("ą", -16.75),
("ć", -15.09),
("ċ", -17.66),
("č", -14.46),
("đ", -16.28),
("ē", -18.36),
("ė", -17.66),
("ę", -16.16),
("ě", -16.28),
("ğ", -14.664),
("ġ", -18.36),
("ħ", -16.75),
("ĩ", -17.66),
("ī", -15.79),
("ı", -14.92),
("ł", -14.69),
("ń", -15.13),
("ņ", -18.36),
("ň", -17.25),
("ō", -16.05),
("œ", -14.26),
("ř", -15.95),
("ś", -16.75),
("ş", -15.46),
("š", -14.41),
("ţ", -17.66),
("ũ", -17.66),
("ū", -15.72),
("ů", -17.25),
("ű", -18.36),
("ź", -16.28),
("ż", -16.16),
("ž", -15.36),
("ƅ", -18.36),
("ơ", -17.66),
("ư", -17.25),
("ƴ", -18.36),
("ș", -16.97),
("ț", -18.36),
("ȼ", -17.66),
("ɑ", -18.36),
("ɔ", -17.66),
("ə", -18.36),
("ɛ", -18.36),
("ɦ", -18.36),
("ʔ", -17.66),
("ḵ", -18.36),
("ạ", -18.36),
("ả", -17.66),
("ặ", -18.36),
("ế", -18.36),
("ệ", -16.4),
("ỉ", -18.36),
("ị", -17.25),
("ộ", -17.66),
("ờ", -18.36),
("ủ", -18.36),
("ứ", -18.36),
("ff", -17.66),
("fi", -15.586),
("m", -17.25),
],
dtype=[("ngram", "U1"), ("frequency", "f2")],
)
def test_training_data_model_retrieval(expected_numpy_array):
arr = _TrainingDataLanguageModel.from_numpy_binary_file(Language.ENGLISH, 1)
assert np.array_equal(arr, expected_numpy_array)
@pytest.mark.parametrize(
"ngram_length,"
"expected_absolute_frequencies,"
"expected_relative_frequencies,"
"lower_ngram_absolute_frequencies",
[
pytest.param(
1,
expected_unigram_absolute_frequencies(),
expected_unigram_relative_frequencies(),
{},
id="unigram_model",
),
pytest.param(
2,
expected_bigram_absolute_frequencies(),
expected_bigram_relative_frequencies(),
expected_unigram_absolute_frequencies(),
id="bigram_model",
),
pytest.param(
3,
expected_trigram_absolute_frequencies(),
expected_trigram_relative_frequencies(),
expected_bigram_absolute_frequencies(),
id="trigram_model",
),
pytest.param(
4,
expected_quadrigram_absolute_frequencies(),
expected_quadrigram_relative_frequencies(),
expected_trigram_absolute_frequencies(),
id="quadrigram_model",
),
pytest.param(
5,
expected_fivegram_absolute_frequencies(),
expected_fivegram_relative_frequencies(),
expected_quadrigram_absolute_frequencies(),
id="fivegram_model",
),
],
)
def test_training_data_model_creation(
ngram_length,
expected_absolute_frequencies,
expected_relative_frequencies,
lower_ngram_absolute_frequencies,
):
model = _TrainingDataLanguageModel.from_text(
TEXT.strip().lower().splitlines(),
Language.ENGLISH,
ngram_length,
"\\p{L}&&\\p{Latin}",
lower_ngram_absolute_frequencies,
)
assert model.language == Language.ENGLISH
assert model.absolute_frequencies == expected_absolute_frequencies
assert model.relative_frequencies == expected_relative_frequencies
@pytest.mark.parametrize(
"ngram_length,expected_ngrams",
[
pytest.param(1, expected_unigrams(), id="unigram_model"),
pytest.param(2, expected_bigrams(), id="bigram_model"),
pytest.param(3, expected_trigrams(), id="trigram_model"),
pytest.param(4, expected_quadrigrams(), id="quadrigram_model"),
pytest.param(5, expected_fivegrams(), id="fivegram_model"),
],
)
def test_test_data_model_creation(ngram_length, expected_ngrams):
model = _TestDataLanguageModel.from_text(_split_text_into_words(TEXT), ngram_length)
assert sorted(model.ngrams) == expected_ngrams
| 22,964
| 24.236264
| 88
|
py
|
lingua-py
|
lingua-py-main/tests/test_writer.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy as np
import os
import pytest
from math import log
from pathlib import Path
from tempfile import NamedTemporaryFile, TemporaryDirectory
from lingua.language import Language
from lingua.writer import LanguageModelFilesWriter, TestDataFilesWriter
@pytest.fixture
def language_model_files_text():
return (
"These sentences are intended for testing purposes.\n"
"Do not use them in production!\n"
"By the way, they consist of 23 words in total."
)
@pytest.fixture
def test_data_files_text():
return (
"There are many attributes associated with good software.\n"
"Some of these can be mutually contradictory, and different customers and participants may have different priorities.\n"
"Weinberg provides an example of how different goals can have a dramatic effect on both effort required and efficiency.\n"
"Furthermore, he notes that programmers will generally aim to achieve any explicit goals which may be set, probably at the expense of any other quality attributes.\n"
"Sommerville has identified four generalised attributes which are not concerned with what a program does, but how well the program does it:\n"
"Maintainability, Dependability, Efficiency, Usability\n"
)
@pytest.fixture
def expected_unigram_model():
return np.array(
[
("a", log(3 / 100)),
("b", log(1 / 100)),
("c", log(3 / 100)),
("d", log(1 / 20)),
("e", log(7 / 50)),
("f", log(1 / 50)),
("g", log(1 / 100)),
("h", log(1 / 25)),
("i", log(3 / 50)),
("l", log(1 / 100)),
("m", log(1 / 100)),
("n", log(1 / 10)),
("o", log(1 / 10)),
("p", log(3 / 100)),
("r", log(1 / 20)),
("s", log(1 / 10)),
("t", log(13 / 100)),
("u", log(3 / 100)),
("w", log(1 / 50)),
("y", log(3 / 100)),
],
dtype=[("ngram", "U1"), ("frequency", "f2")],
)
@pytest.fixture
def expected_bigram_model():
return np.array(
[
("al", log(1 / 3)),
("ar", log(1 / 3)),
("ay", log(1 / 3)),
("by", log(1 / 1)),
("ce", log(1 / 3)),
("co", log(1 / 3)),
("ct", log(1 / 3)),
("de", log(1 / 5)),
("do", log(1 / 5)),
("ds", log(1 / 5)),
("du", log(1 / 5)),
("ed", log(1 / 14)),
("em", log(1 / 14)),
("en", log(3 / 14)),
("es", log(2 / 7)),
("ey", log(1 / 14)),
("fo", log(1 / 2)),
("he", log(1 / 1)),
("in", log(2 / 3)),
("io", log(1 / 6)),
("is", log(1 / 6)),
("nc", log(1 / 10)),
("nd", log(1 / 10)),
("ng", log(1 / 10)),
("no", log(1 / 10)),
("ns", log(1 / 10)),
("nt", log(1 / 5)),
("od", log(1 / 10)),
("of", log(1 / 10)),
("on", log(1 / 5)),
("or", log(1 / 5)),
("os", log(1 / 10)),
("ot", log(1 / 5)),
("po", log(1 / 3)),
("pr", log(1 / 3)),
("pu", log(1 / 3)),
("rd", log(1 / 5)),
("re", log(1 / 5)),
("ro", log(1 / 5)),
("rp", log(1 / 5)),
("se", log(2 / 5)),
("si", log(1 / 10)),
("st", log(1 / 5)),
("ta", log(1 / 13)),
("te", log(3 / 13)),
("th", log(4 / 13)),
("ti", log(2 / 13)),
("to", log(1 / 13)),
("uc", log(1 / 3)),
("ur", log(1 / 3)),
("us", log(1 / 3)),
("wa", log(1 / 2)),
("wo", log(1 / 2)),
],
dtype=[("ngram", "U2"), ("frequency", "f2")],
)
@pytest.fixture
def expected_trigram_model():
return np.array(
[
("are", log(1 / 1)),
("ces", log(1 / 1)),
("con", log(1 / 1)),
("cti", log(1 / 1)),
("ded", log(1 / 1)),
("duc", log(1 / 1)),
("enc", log(1 / 3)),
("end", log(1 / 3)),
("ent", log(1 / 3)),
("ese", log(1 / 4)),
("est", log(1 / 4)),
("for", log(1 / 1)),
("hem", log(1 / 4)),
("hes", log(1 / 4)),
("hey", log(1 / 4)),
("ing", log(1 / 4)),
("int", log(1 / 4)),
("ion", log(1 / 1)),
("ist", log(1 / 1)),
("nce", log(1 / 1)),
("nde", log(1 / 1)),
("not", log(1 / 1)),
("nsi", log(1 / 1)),
("nte", log(1 / 1)),
("odu", log(1 / 1)),
("ons", log(1 / 2)),
("ord", log(1 / 2)),
("ose", log(1 / 1)),
("ota", log(1 / 2)),
("pos", log(1 / 1)),
("pro", log(1 / 1)),
("pur", log(1 / 1)),
("rds", log(1 / 1)),
("rod", log(1 / 1)),
("rpo", log(1 / 1)),
("sen", log(1 / 4)),
("ses", log(1 / 4)),
("sis", log(1 / 1)),
("sti", log(1 / 2)),
("tal", log(1 / 1)),
("ten", log(2 / 3)),
("tes", log(1 / 3)),
("the", log(1 / 1)),
("tin", log(1 / 2)),
("tio", log(1 / 2)),
("tot", log(1 / 1)),
("uct", log(1 / 1)),
("urp", log(1 / 1)),
("use", log(1 / 1)),
("way", log(1 / 1)),
("wor", log(1 / 1)),
],
dtype=[("ngram", "U3"), ("frequency", "f2")],
)
@pytest.fixture
def expected_quadrigram_model():
return np.array(
[
("cons", log(1 / 1)),
("ctio", log(1 / 1)),
("duct", log(1 / 1)),
("ence", log(1 / 1)),
("ende", log(1 / 1)),
("ente", log(1 / 1)),
("esti", log(1 / 1)),
("hese", log(1 / 1)),
("inte", log(1 / 1)),
("nces", log(1 / 1)),
("nded", log(1 / 1)),
("nsis", log(1 / 1)),
("nten", log(1 / 1)),
("oduc", log(1 / 1)),
("onsi", log(1 / 1)),
("ords", log(1 / 1)),
("oses", log(1 / 1)),
("otal", log(1 / 1)),
("pose", log(1 / 1)),
("prod", log(1 / 1)),
("purp", log(1 / 1)),
("rodu", log(1 / 1)),
("rpos", log(1 / 1)),
("sent", log(1 / 1)),
("sist", log(1 / 1)),
("stin", log(1 / 1)),
("tenc", log(1 / 2)),
("tend", log(1 / 2)),
("test", log(1 / 1)),
("them", log(1 / 4)),
("thes", log(1 / 4)),
("they", log(1 / 4)),
("ting", log(1 / 1)),
("tion", log(1 / 1)),
("tota", log(1 / 1)),
("ucti", log(1 / 1)),
("urpo", log(1 / 1)),
("word", log(1 / 1)),
],
dtype=[("ngram", "U4"), ("frequency", "f2")],
)
@pytest.fixture
def expected_fivegram_model():
return np.array(
[
("consi", log(1 / 1)),
("ction", log(1 / 1)),
("ducti", log(1 / 1)),
("ences", log(1 / 1)),
("ended", log(1 / 1)),
("enten", log(1 / 1)),
("estin", log(1 / 1)),
("inten", log(1 / 1)),
("nsist", log(1 / 1)),
("ntenc", log(1 / 2)),
("ntend", log(1 / 2)),
("oduct", log(1 / 1)),
("onsis", log(1 / 1)),
("poses", log(1 / 1)),
("produ", log(1 / 1)),
("purpo", log(1 / 1)),
("roduc", log(1 / 1)),
("rpose", log(1 / 1)),
("sente", log(1 / 1)),
("sting", log(1 / 1)),
("tence", log(1 / 1)),
("tende", log(1 / 1)),
("testi", log(1 / 1)),
("these", log(1 / 1)),
("total", log(1 / 1)),
("uctio", log(1 / 1)),
("urpos", log(1 / 1)),
("words", log(1 / 1)),
],
dtype=[("ngram", "U5"), ("frequency", "f2")],
)
@pytest.fixture
def expected_sentences_file_content():
return (
"There are many attributes associated with good software.\n"
"Some of these can be mutually contradictory, and different customers and participants may have different priorities.\n"
"Weinberg provides an example of how different goals can have a dramatic effect on both effort required and efficiency.\n"
"Furthermore, he notes that programmers will generally aim to achieve any explicit goals which may be set, probably at the expense of any other quality attributes.\n"
)
@pytest.fixture
def expected_single_words_file_content():
return "there\n" "attributes\n" "associated\n" "software\n"
@pytest.fixture
def expected_word_pairs_file_content():
return (
"there attributes\n"
"associated software\n"
"these mutually\n"
"contradictory different\n"
)
def test_language_model_files_writer(
language_model_files_text,
expected_unigram_model,
expected_bigram_model,
expected_trigram_model,
expected_quadrigram_model,
expected_fivegram_model,
):
input_file = create_temp_input_file(language_model_files_text)
input_file_path = Path(input_file.name)
output_directory = TemporaryDirectory()
output_directory_path = Path(output_directory.name)
LanguageModelFilesWriter.create_and_write_language_model_files(
input_file_path=input_file_path,
output_directory_path=output_directory_path,
language=Language.ENGLISH,
char_class="\\p{L}",
)
files = read_directory_content(output_directory_path)
assert len(files) == 5
assert files[4] == "unigrams.npz"
assert files[0] == "bigrams.npz"
assert files[3] == "trigrams.npz"
assert files[2] == "quadrigrams.npz"
assert files[1] == "fivegrams.npz"
unigrams_file_path = output_directory_path / files[4]
bigrams_file_path = output_directory_path / files[0]
trigrams_file_path = output_directory_path / files[3]
quadrigrams_file_path = output_directory_path / files[2]
fivegrams_file_path = output_directory_path / files[1]
check_npz_file_content(unigrams_file_path, expected_unigram_model)
check_npz_file_content(bigrams_file_path, expected_bigram_model)
check_npz_file_content(trigrams_file_path, expected_trigram_model)
check_npz_file_content(quadrigrams_file_path, expected_quadrigram_model)
check_npz_file_content(fivegrams_file_path, expected_fivegram_model)
def test_test_data_files_writer(
test_data_files_text,
expected_sentences_file_content,
expected_single_words_file_content,
expected_word_pairs_file_content,
):
input_file = create_temp_input_file(test_data_files_text)
input_file_path = Path(input_file.name)
output_directory = TemporaryDirectory()
output_directory_path = Path(output_directory.name)
TestDataFilesWriter.create_and_write_test_data_files(
input_file_path=input_file_path,
output_directory_path=output_directory_path,
char_class="\\p{L}",
maximum_lines=4,
)
files = read_directory_content(output_directory_path)
assert len(files) == 3
sentences_file_path = output_directory_path / files[0]
single_words_file_path = output_directory_path / files[1]
word_pairs_file_path = output_directory_path / files[2]
check_file_content(
sentences_file_path, "sentences.txt", expected_sentences_file_content
)
check_file_content(
single_words_file_path, "single-words.txt", expected_single_words_file_content
)
check_file_content(
word_pairs_file_path, "word-pairs.txt", expected_word_pairs_file_content
)
def test_relative_input_file_path_raises_exception():
relative_input_file_path = Path("some/relative/path/file.txt")
expected_error_message = (
f"input file path '{relative_input_file_path}' is not absolute"
)
with pytest.raises(Exception) as exception_info1:
LanguageModelFilesWriter.create_and_write_language_model_files(
input_file_path=relative_input_file_path,
output_directory_path=Path("/some/output/directory"),
language=Language.ENGLISH,
char_class="\\p{L}",
)
assert exception_info1.value.args[0] == expected_error_message
with pytest.raises(Exception) as exception_info2:
TestDataFilesWriter.create_and_write_test_data_files(
input_file_path=relative_input_file_path,
output_directory_path=Path("/some/output/directory"),
char_class="\\p{L}",
maximum_lines=4,
)
assert exception_info2.value.args[0] == expected_error_message
def test_non_existing_input_file_raises_exception():
non_existing_input_file_path = Path("/some/non-existing/path/file.txt")
expected_error_message = (
f"Input file '{non_existing_input_file_path}' does not exist"
)
with pytest.raises(Exception) as exception_info1:
LanguageModelFilesWriter.create_and_write_language_model_files(
input_file_path=non_existing_input_file_path,
output_directory_path=Path("/some/output/directory"),
language=Language.ENGLISH,
char_class="\\p{L}",
)
assert exception_info1.value.args[0] == expected_error_message
with pytest.raises(Exception) as exception_info2:
TestDataFilesWriter.create_and_write_test_data_files(
input_file_path=non_existing_input_file_path,
output_directory_path=Path("/some/output/directory"),
char_class="\\p{L}",
maximum_lines=4,
)
assert exception_info2.value.args[0] == expected_error_message
def test_directory_as_input_file_raises_exception():
input_file = TemporaryDirectory()
input_file_path = Path(input_file.name)
expected_error_message = (
f"Input file path '{input_file_path}' does not represent a regular file"
)
with pytest.raises(Exception) as exception_info1:
LanguageModelFilesWriter.create_and_write_language_model_files(
input_file_path=input_file_path,
output_directory_path=Path("/some/output/directory"),
language=Language.ENGLISH,
char_class="\\p{L}",
)
assert exception_info1.value.args[0] == expected_error_message
with pytest.raises(Exception) as exception_info2:
TestDataFilesWriter.create_and_write_test_data_files(
input_file_path=input_file_path,
output_directory_path=Path("/some/output/directory"),
char_class="\\p{L}",
maximum_lines=4,
)
assert exception_info2.value.args[0] == expected_error_message
def test_relative_output_directory_path_raises_exception():
input_file = create_temp_input_file("some content")
input_file_path = Path(input_file.name)
relative_output_directory_path = Path("some/relative/path")
expected_error_message = (
f"Output directory path '{relative_output_directory_path}' is not absolute"
)
with pytest.raises(Exception) as exception_info1:
LanguageModelFilesWriter.create_and_write_language_model_files(
input_file_path=input_file_path,
output_directory_path=relative_output_directory_path,
language=Language.ENGLISH,
char_class="\\p{L}",
)
assert exception_info1.value.args[0] == expected_error_message
with pytest.raises(Exception) as exception_info2:
TestDataFilesWriter.create_and_write_test_data_files(
input_file_path=input_file_path,
output_directory_path=relative_output_directory_path,
char_class="\\p{L}",
maximum_lines=4,
)
assert exception_info2.value.args[0] == expected_error_message
def test_non_existing_output_directory_path_raises_exception():
input_file = create_temp_input_file("some content")
input_file_path = Path(input_file.name)
non_existing_output_directory_path = Path("/some/non-existing/directory")
expected_error_message = (
f"Output directory path '{non_existing_output_directory_path}' does not exist"
)
with pytest.raises(Exception) as exception_info1:
LanguageModelFilesWriter.create_and_write_language_model_files(
input_file_path=input_file_path,
output_directory_path=non_existing_output_directory_path,
language=Language.ENGLISH,
char_class="\\p{L}",
)
assert exception_info1.value.args[0] == expected_error_message
with pytest.raises(Exception) as exception_info2:
TestDataFilesWriter.create_and_write_test_data_files(
input_file_path=input_file_path,
output_directory_path=non_existing_output_directory_path,
char_class="\\p{L}",
maximum_lines=4,
)
assert exception_info2.value.args[0] == expected_error_message
def test_file_as_output_directory_raises_exception():
input_file = create_temp_input_file("some content")
input_file_path = Path(input_file.name)
expected_error_message = (
f"Output directory path '{input_file_path}' does not represent a directory"
)
with pytest.raises(Exception) as exception_info1:
LanguageModelFilesWriter.create_and_write_language_model_files(
input_file_path=input_file_path,
output_directory_path=input_file_path,
language=Language.ENGLISH,
char_class="\\p{L}",
)
assert exception_info1.value.args[0] == expected_error_message
with pytest.raises(Exception) as exception_info2:
TestDataFilesWriter.create_and_write_test_data_files(
input_file_path=input_file_path,
output_directory_path=input_file_path,
char_class="\\p{L}",
maximum_lines=4,
)
assert exception_info2.value.args[0] == expected_error_message
def check_npz_file_content(file_path: Path, expected_numpy_array: np.ndarray):
with np.load(file_path) as data:
assert "arr" in data
assert np.array_equal(data["arr"], expected_numpy_array)
def check_file_content(
file_path: Path, expected_file_name: str, expected_file_content: str
):
assert file_path.is_file()
assert file_path.name == expected_file_name
with file_path.open() as txt_file:
assert txt_file.read() == expected_file_content
def create_temp_input_file(content: str):
input_file = NamedTemporaryFile()
input_file.write(bytes(content, "utf-8"))
input_file.seek(0)
return input_file
def read_directory_content(directory):
files = os.listdir(directory)
files.sort()
return files
| 19,704
| 33.329268
| 174
|
py
|
lingua-py
|
lingua-py-main/tests/test_detector.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy as np
import pytest
from math import isclose, log
from lingua.builder import LanguageDetectorBuilder
from lingua.detector import (
ConfidenceValue,
LanguageDetector,
_UNIGRAM_MODELS,
_BIGRAM_MODELS,
_TRIGRAM_MODELS,
_QUADRIGRAM_MODELS,
_FIVEGRAM_MODELS,
_collect_languages_with_unique_characters,
_collect_one_language_alphabets,
_split_text_into_words,
)
from lingua.language import Language
from lingua._model import _TestDataLanguageModel
def f(num):
return np.float16(num)
# ##############################
# INPUT STRINGS
# ##############################
@pytest.fixture
def very_large_input_text():
return "!WA 2!S37c4TXX5HIYfBKDcJBQe1B5xRPSKiTiPiEsszlldWhIuMVma1tlFiwaSK7AbID9UasIk2j2kUUQ51jHPnNM2MeFysCDDBACzs9PUo9yhDVT3E6TnNjS96onnTjHUXj1Xn5g5 kXPv3 z2DXcqqkWhowjxXpBkU7mZ m7m VN 5FeoCDwXd3sWwARUjQltDzo npBk50NmJPUrN6z1npOOO4WIT2syJ6sRNlVPE2Skz6uvlBgtLCVIXnpIAHCzum1YnUuFqfK2T0ESKNusoxo9c5sRySPU7sQlnldLSshiR PHYtafKXO5UbaznHIPYUSK6QqUXvGg3Jj0fYzT2RuxMYJRNBSSAJRMxkHFJ6Io2yANrQzPI9h03dDWesp4dkft3Yck6iYwQsrpn07n0PSv gVWa7wk6HgziPbIg UnK6QhN XsQHtdGVfn99KzSm2VRrJn2PEbZ8s6JjLiVSPLuVkznumNcGYiAWavYOU7PG8jXVun8lnp sJ1nIS54k5vYiLa gZAjfW4g7 mgz1T0oLILKk8bizLw3urQHXn1ly0OrDUflnKzkObT0QXwDMbGpWsH3CP0nHV3y2RjgRnwwTZEwzZmsJORNnVMH5zgASXSuYlmDE90NsX0stp3weESptkEdvnN0PCtLXHYgzsdL4SHY08AKq7SkR5c8 Mx132m8N4iacccIZkxiVQU5qg5biyv7uS2JR3BX31nMPCA2RJe3cM3YxBmTCA5Rn1yW yPw75YBQn 4W4AB700 pFSPZOKQWyJHdfZE7U H75q9hlpoUKlykh4Ci2s2 Yyv7CwfsPCkLC5tuax Nz0oJMyKrtms04JeRa0jPmYkpPIPB1g2ubQw8ed3D 9hN9Mu9QiNnVA8CYtOaJ7c5Shc1oJCU0Wx0W6AqL6S7bhP74xe tfZCYzpmFw8rIBLwoRI4uY50Mqg eJqK6HSRy50ZPCbfzlLe5bIGXZRETZMbg4yngf mmTuGPMmwNdRd rs6i2eYA5G2s6GS3RLC7K7GSp4pRV83uVwMaa M9kt3zgxXyDjEGcYa6tpfYMv6iQA5vMbMXNa7B58YIxK D0d kSRsLOZ4D39G2RG9LdwofduqlZmzmJ2A2S3Fk1E6jwwD5m9eZcw43u8jkayr1gdMZtVjYbRnE6SYww4FLcOeHzq8pNgMGJZWEG5qlLSJXM2iHNg m144eZOLBmDt 8uTPGcgtB8ARl9tkC3NFheXJBCJE4ua0SdBcZPzLgcWyXrJX2kT4bKnpjsjEenGxXnx5Y6hzoKd5eSRsRaBYGZUP5sHutvrfDblPoY6tHmk6RRPo6deQR7 SHpzeYg69fK LNSg4hYM79fI l9ry zisyYnWivcuWmRX1RMpVH1E3ZEC4Z42 9eKCZaAuTK6RLCl1s2 22j5wFmYoi7eWeAG0yTKBJSBslK9qAI0mPvIFsGAjbRLe5riTZW aCfeLXbd6oN3BQV83yAZu4AjdwlP3Ei9HROK7M97 z Ea2V95YQpLfWimTskTjm0nZtAtKSjvYDrIs2czRKTTgY1 2szPmba24 BP1wcq2iYVbqDjVfYqW8qmrsNKUszayTasY jDlsIxl5gRL0Zmnyo8Hh5SDCSXgBqYW1sUNnndGZKwPBKu1kj5Mm9hS9WD4V1ZVNPrESjyJJBOgYrjhJitEltNUGvE9jgr5m5n0gdKVGiBn0slT0yTsWpz1b6vj5jabm53hGMQKoFdT1KBXMk5lyMtkAQuMkNstoVs iR2blmrkycQH865y vd823OKUPuRnwRsUmW68D9qtmYDvtnc468SPbgVz0pDUeNwZqjPXAloOoKrgaSPkW hYXj3Bm8Rijz7dcRYNFtM2m2sfiuRHcfCkKBhJX02itmlq5KwvXkHQ Phk3fSy tu4d8ukiQWmfSugnpNJV60iZtEfjgZIqyuDGRJCEDZ633 qePlIvNZKTtKEw9cyFX6ETmwBlvWoIeYVFSwDFgG7Dc 4kjjW2IhRGPvEgM3om7nA8bqEZyxqodBmy5u1g32we TV95G3DauyWOPXznve9DU06tKslNYa8VOPXVL 1pTcawaXEg 01OQAzuIJYqZa43ZKrZ6 zRNNsjGC2SgRtM93JW5wpGEgLFNAaIGlEsffJOiVQ8Xronjx2ufZzLxl9jNSlB 2QKta0h3 Mi7AwGxhQbekIlxMXSzKokYSuKSRPWszVXwIj8D7iK0wu9ONsZslvwLKonvbyJtIoR9t6mrSIV4SJdSD6Xu5bkOKl9Kd wacPWKDzcWhlyg8xh1wY95WhqM7ZMQqEapLX0uEYPXx3pta0gz1 y21Fk8bxT3eVaUg58gvwHjyc2ydHruH5HCkwwIXWh5L3pS8zTowheJRgX53MXnLhqXhL9loN rngfxaTFsWyRZRcw2 bPJPClR DyvHAA4uZhEo2RDLYedvHZy9SxcAHOJsysFeTm5vJffE8ICGODgLmSx ig36cnmZQmUC6jhDSS6W0Wfyv4 bCrTXMeKKzQNhOzrI4ydo0GDBiTqqzc9mJc4mkj5lwynmACHQCMjbshT0JMx1ubidYMzYPz1kT7IZu2Tkx Pb9cHAzbkWAClleaHAKwd5MlAuhFEsvotXvEJ165LEuFJ92tdRKhXu24ChX p4ZboOR2T1JErbgzOHNL SthmR7WLP82qhAK 7BWUl wuzYMTBJd6BjJuNxE Ts DfjF863Hb5jts KKhN8FNmn5t9iKpTk5ZacrEcYVj5tqEyGK93I8ucKFB2Kf53H8zj 6cKpNa5PzFyKFpYmKpFsYxaAXZiq Fq dipBJK qbYZ50bMjYxixoGjZLVxM0TxIpOmqju5EkvSHgzKHgWT7UrE3Lsvb1B4dq698BevVa5jUZuwWFLvbKAEWnr2AYPqgO5a9sntoxw4FY6LTnJLnWkazJckOKrngyRLcizENMDfDGOhO74jJns0bV7KXznnGF Ts6BNKVuCqoB jbb4MC91cGcZnLr9Lva94 sD9wTLV7rI 5yCYHLQKtNrdQzAqhWjbyLAIjZdSdihmc5 DYPsRcCIb2lkjHpotDT08paw3RoLXPmkQGO5yCBaCb zbvKvzcmShjjJbMjGFo1oht2KB3QsUpY Ll4itfv5v9CopPIkjSfYjzQvWuGi2XoCWmbZ0AMwpySZQRpbQVsqsNtDOb7BKEIhDGUbjhfviEyMkiQXLZAOklgdzFK0ydoqhj2bttLbK mQKrjjlQitcWcfl58OWbfvqHM4Ng5T8bmQdg7DA3CqOuCgFG41cl4OswkQXlsydkkExPVTFRhUMA8Hs3qlvqdMsfiyBHBVnY9Sts6KgBrB8CGTH22vXudQBttDtqxiulXEsXfw6BQm6JY t14wm7N7OpenbM2vor0mzGgFIeQWxBMbuYOjpkd 9eSAEI 1nhx KJoOo8tl6Jp 5ayXkjjP nnn8aOaILmmTtULDsEL6RTwY3v98nrueyADTHV2phzmdIRYwCvP0a9PvKpzuuPIw6ZYE8pKHcubP8Qk5Cu2cuFI1aNwLtpVeQkcGPFQwantYJQzv6lUdPdOKhT4gavZs BjmdGmaG uAL3xXk7wJeqN2PQC b4Fxnu 70mFBpu98kGdiMoD9ZuMJOMKOrUFuxnYjbf1UjqrTNXewLheqFujfyQkfmsiMcrOk5O65Gw6NojtjDq5CuT9DqMeuIbA6 k7rNw1HX6zA1X1nAiBA96UZz8826AfbccDeEi0bq3iJizGI1k5mo6ubAcrExKFGkmy2QD sEpIO9bpQkJmzoUQm7fuLH8yN gawtKFdqThGtB6s5bwbHWPDfxxc3XN6ADycI8jFgVCJT5TxIqcqFDGTjWRezzI8irUZaVuGD8Z6h5w PvhJ8lIa78KFjoCFVjjVpW I3Vi55boOpb5Vij5p3lVRxmj5lVjoBjcqN vsAZn7cQeQQTvmiZqYFg xadfgxJ gvYxnjz4dUZ4GEOPpzpKBvSEDJ6UJ4NsoBbL6cEUtjBQHK ZPCgdnUIGmx9aC a2EwGTzVEKPz0km76JnmqetE1LaTxNzvKnLAM9kK2BwoWq4NtjBQbauyfZZzyIYbaM4V6oj i3rj51Rli5ht pi N444GIW8ev4TySwqPJwc0sr1ik2gu5 xVUafBueYLOc1aJ4Wv9ioGNrlvWhL1PEhy8oX kQt8x5obnXdzZdwl nvrBijFno 9s4npc5Rls hssEPpaAPzpZmrNMhCYj7184zgG8Tux2geWy4Ut4ZiyjFgdbFgUS6ob7t5empyADIOAM9QBMd iiFpvBd6 2P8hmCBrAhSTfyWtEzgLYpZXonYsHDkYTQW2iVwvYd9LTR fXkGC5Cyo VM0PLqt xagNyZ NR7oxzSbj 7vp3oYp8kpEBlihdh6sQGqfjKxiomuH1ufSuOcxZsJ9av4AxYK6hQmsDnTd39izJ2rU2gBftQxBPeSDukbBZG 75ZccCHLyBNpr2mdf3qYwBUrwqdHbsGwzKay 8yMGkwOH0jNd 9O5DS3EnxK9mZzUmXlK oMv8JYvLog62eMf4JIJdRnY0BM9C6IgYZAy8HbnSZoDXYoyV7 p9x9x9fQPMg6D V0R9Ax6sx6I9U V3F xVMAQ5AebT MdD YOG29m4bkBIEIePvp AzERPZSG67WRDiWyuVifNd5iqaIuKaHkNo Fd0jXM80Lo zCPJRc6EG41O fEITOr3af qK NXqBnnwBpMANv6EkiNbDfU0iJWi53gJKFftPDohZz3ksZnBjwVkoxPEIayKSLyOe5Lnk50f9GXJEDg7CHNjkXjgNZXKEYmgxFfBJJtvm2 cdYI uaiXgUZhOHuN5WDnIvAYgeqYrtBNKeR U7zKI0MhgjF5U61MObiMNXtV4B2s8nXnuZmL7wcUlGr7G29cp6MVluoFZuH3X8OlPc 8Lr4rfwBsQW6wdvOoYFhvy9uHnqf24gPcBsLkSzQWwOcB9GU0fEizMnE8rV0L siLcvyBfPo xPcxpNOWwYeIqppYbgkpsSaeefLoTufeceeuHBWbFNkCJuHBA1e9MkCZmeBQGe0r3cIbtfQFzJ sf2 JEDuHBfMz3bzgQWojpmvyxicLv2uhB8 Fa NDivBekQqJuHBRiM0rQeMevy3GWIMUHAOcnxkYcvOLjpFxm OfWEFOy FYFpUeS3426b ymULARnHIIuug ujaTIVvpaYyETCJBvlyQ7UMbm0pTPgtJlyoj1eGgEfMG8sRXgTIC85Vzo5J0AB9PeSJ23JFgM25xhdf7cmgWoEkZbHBTjjFVKC8nWWAoc46EBZzZ73X9VOSpo3F7TTL8k aDrV95PsDrDrhw 0kMS SeTsnubE3OoP8HZrDhoBkjhF 7pk Z7xe R3n ZNcw 9firphLu y2Kkao RaZ RpgkNGnQxl37a GhyESmaozdOKSLBUNd93jU59A5Ma321 gmrFD1nhTDo3g0tw5XTak3Ep MiVGnUPX6r5AC GGgDhxro7eQZ4XtyXceS9GK pvj XOlQ6T7O93DC0NtOpM6lJLrlJhkyWMKGF3k 7aT3KuGw7aFtGWbWFhcFFGaS30QFGUzghxubnp5SA5SYdgWYfcdeuRJ5bl07Bouq F7zZY YSF xI ILnQphlMguYQq RktRnob6Fn BJ1X E92NjrIW5CXHDMLqcYuJMhnqTUmZ6ojIO4 rTM gQCAiMBCd0DoBhzH0omIrgpYPCrwbEL7Nm2fRT0Fy0yOo7CMaB dIAbCZKc3wQGDeU92cKYF4aT7Vd0ZFjYlN KwQKhuDAM7ntJAjK8CoB9DD NITvu4 ahdnRazrAwihBF4jFJuwSMxxqMEmYPS0ntHEZijj32mw7bYQnbgJfo7 kjW2mQJHHlHEREVsju1uYMb4GYN WTasBmqSaggaQetIHlVz MqHmvroP2gp4SRt409mwOR 5Bs3C8rLJVzQ o3hPXTTDNDWAyfZdbWpj5hb208qK3fdXOa7npGkYK riNZOo79 JVvv9RpUwA0jAVh2gwT81r9xamGr0LD Z37DTRl9JE3x6s viJBobxapeCuH9pTnrORdi7zg1dkFw TFQdBEQdfN1I63HX02n1TAmHamoYF7TCDV4ts vvT5cdSGRtI1o 1VJCGfv8EWMNl5L69UU l9JF4AQ5wiJY2i4wbt q 5RHHq63gHmjj26zS2bRYMYfhhLMbAW 1ekH9o6tuY ysqoX5VvI471yDrZoUsE1DjBcmXLZOmXKZvAm6mxVYym3apEyz4d6IXlKAsabAmfPH11ZAzS1emvoMqh4 hRGPMCwPdW2xplJTnIYegzvW2cgelDqa8GPUMGn35V4iWlIE2cMkaylKnVXgWxmO jvlKrc4NQKdJEhm8aa6Rch7OHNy4GhI5GABzg8ibaeDuF5IoSJZhNaDApbdzBmYTWShzjhoaLfqj35LpetiNOB7abyEBlGDObumqaywBwHT NmAQGWcU qffIFnosWbz8DlY41GMH3ZmhnsS2V 4gPd219WwJrB o N2Yq28Km9D3i6BKn8 Fo7jVzzLeh3ooGPIa54uHjbelw8a4zFZMgifTJakvBB pxkz7qwcTKfWxVaduCbGhtWwLjqBOb8Yoh5rtW9NbuzYHH9Mi z2S Pcha4o3l8VDhdfZySwOFJMbvjwjJsMb0YPIMJBIi2a Y5CIolExpc TgnuumogzAGYhXKnpXH6R5Ip1CcSbKVHT1VOHV9mtRdhSJ03DNhPXohK8TndfUT2d5pK3VQJkqokv4mW091qutASUsM7y k XrpfWI GxeqeEfQqssRuHJeaxDDud9DtEyhvrbunEOuzz4h3tLrzXsflSR6S3Odoy39Zd kPYkK9se58voJW156DRrBsI F8OgOlxVDz SKCUmf9aL9lTUx7 4 k1tvRkU7Q6C5LNOfjVzbf3374 nLSwfFPDfht25L2 eJlFLrlJskciNBYsfkSmPDDDP1VROJlTmyoUY72BM01LwpJaFdkrVzvI36D0m01 wip5Nmj5hY3yt2 DQ64FRpNa5z7OORXo wqi XnhJZhR8Uh6tNUh9HMT7082pp1Ky aa21pAxyOdns3Xh1E3v 8jzUuB74yh67NxCogQDSSWelIxhiAxDvoTO8zy7Lij MsXWGSo4ojND64AJLpLPImy OnE1wwZ33akj2bGgsf yBznxyxWJgRddRcduLdm6WCl8f ZGcNnQvEtq4rmgGyV zoMTyYPyCMSWWzjEFhO3rCfJX5Xvus7mSN7LTpX7JX2 WKxX4x2gV irhnrIrhP34Weq DxeRT03Vpx8rCViyQ83qGGTgIJ725OSTVOLOJbSBAa09Tm m78tzWSeuxEip99scA6dgG0Y8maPlfqNJSwCp5B pJoEHCbk6mFMPcgNzEe2aT278HQTw0qmhEcsA5KmK1mTAWT28qhK3iRgLYOxBjeTLYLOfxEf7JtQId VBsqwAC2ST6flglpUoEGlBBuQWzrjw2llAzYOKl GDFyW4I HKO0Sxse0YgKTrfm46QmJUPgWAKXCD6EhkEFhFObhjA OyTVAsWOZxgJtsBN3FBpbzxX1YzuipUBIDbgzMeaym0AtJ1oOUup2RmYz1YpjyX3yOIg cCsLjjNfWnrBksLLhBptXcrt0jGQOA48i r9Js2vkEeRrf DudmH8zA42 1 FDPyaXGbo2dmHwoq7QNgqwjN9CSi8sQVUOcFoHzyHELcZoZKyJNg1BNhRDINdeXMv2WsrfGXmST7M CsZC6dOyI7t8zn2blY0a9NLonU7eOkXwsPr2PaERLcFT1I17 3McuTxlppmy5bomleKLnnLNeypSvsFB887Nk8GLPhav4HCf tfEx2AK UDe2tfEyhX8uHhzvq4oyRiv49WKMtfEuQWVav4XOc ILjrUtZahT37 SQ6rgcKi7pK 2cfiev49wICyQW7BHK7sfE lGyxQWhGk8bTfHw7voIqdCLIauQWh6nB5NuHp8krCjvyQvdjLuHpY8Lpsf LPc kuHpQJmqGY72ajxx8EkGb9jirlrEtTtQGYUeB99aLmvcv90N80YNI UMoPRzFWa9t4kfJk8jTF9J7k0Ik8F3rcbvyApm9PcFko3xQWNgOl mZNBlv4jOc MZJd7d4yn4tsf TkYqLk8uiJuQWVnWNczGsf SuHFxGlg0LpnYPKk87rfMzJuHpp0FFbKRiv43hzQrfEggdrQW drwd dC5gsfEwKpiv4pmjVMphu8xuLvR i4v pvX688C2xuHxaDV5xIkCHRK4wfQ1QGBLMCJfApU JCKcbD5w12ptZTk4v5w9tRCRqT1nwR7PVWJU2IV1Vdu2CX4ia2EielW3RUbwJgwjNcECyyS5u1zLjwlJ9h3VHL2QVxDVzYQZ8QS6wIEDPAy1LA8WNr TI7pqaxxLe5NPz1f6QS6 PvwDhh4mDbGD2zrgwXlyX9OWN904RtKx3CcVoA4h1cYJRU46Ymht0JMPsQILo7HWg1tw8GS5Tr7g5yoGE28G5zX0lKndANi2jVV3m59zDvEFln18ceSk49nXGtEYtMWCWSnQHQ51AO2d26QUrPuH KRsXVIuUzQy6zMukbqQY0c5ibz6U4 sPgWZXEJSYo HYMza5SkNspRsU0mt08DVmhAEyDTmsmDHyVCe6BMe05Vkb9sJGUv vbb9HN4ut0XroPL bom5BNksRbdhOJvFDzEkxDzq 3HBff6yUlJAn7BFb7ayV0kt9gVTBF7R fBdJQVuTvMVQfEv8yzQf1Q6Uev96tTq6u5vVQ59jwXjHs0e7Q6AT65emM rS4eOl9cPymoVM1 1y8FzB8pQuLh1NUM3XBQodRWvzQU0Sqmq7vbt1roOwOdnMP6X0Z7AHO RQL0vA2fDXH1umtZ9KJSzglMvlpz O qrZLg3 nmT5WE7C3gBFBz7T1yM6alApwa9V9LzK3DAoPvEz0d4ksOjuSY 7FowzDBwWip3MklRcMmLSwZlN5nts tDvs LcPpgNNvbP 9F6tEKwV HZoP J5s6h8QK xX5sK46SiZMLREyeJVsZihHdROQGb5OuNQygBHvY pDJCeIzQlNrkrE9jm4VDRyWA0NPEom aNWqjdV2p j5UwbpXgyI1YMpWlu BM06N NMO13bgpM1x078DXsUmGYZ8J4A0tjRLfJ3tJBDbRZHYj7wRBexIxyGCZvQyVT g8KiNSRw AGaawUOXO5kmg8KRNgYWq3slVIn KrdL2BlsnxpMm4k2ZSOTXooqhj6ewhpBOGDGXb6nrYuAGGUT5Dgc4qzpbd8t aan6QraGgada0Wfda0RfJ8t7yafKfeVwmmqXqafdfuEGF2ZmNAIoJ2E7hU1OHZD BpvblfZrNuG VNrabWy WJs6fht3uXBq707 FMnTjPAQzR9U VY6wh8hHefn2qXC0qm3G8rDglmtOXd8YKGOiF1WMGJGKTVnY3xfpQUiz7zUMzkAxP8KPkKcWR4rOK33hJ9 HYbLmViuYPv1oFaXsoGle0yOnloizT3ttXpTE0YQyvomXcSpo5vSSo5LLGLnSuYuP 0lik2AwQxetLJlWhbJeRIFeoTSyJsRzMoRYP0SkiNTm4Xl6WSIgci Mp4824ARTzGBaEy zhNNeWWJpAK6Kfe s8OVsI 5I vZnxR2ysvEfLhYyfn9Vs1cXKGbL9HEErRgJlfBkUE7 S ADT5FXGDvd265EeOK5GyAJFeTXTqFC0vSbyVsUqgnDPXa0f7p SyNK9 bHLkzAOE7MuFJf 05Ponwt2Nud1xmQ Cod8NaA0PHgDc7ZaVZXn6erNyYtCIDKbJ p7Zeooe02N MKc7e8EL 55IlFVAyy7HD6E5N5Vg08CQYHzU5p0HpXM7eyoS0g7oT6eorT4jGNS0sl g2iVsdSv3oXgriQLL245KIYwYTj2lfJVICb2NK kH3xzog1ZZtfCSVQb2bwcWMHhj19yJbVXQ67IGlHUi6ePy2nYrzR i0sOp6stoR 4vpSdVuM lyHNPiNqB9WM2zSN63r65S t7SdKrhLfXV2Uy8YWBbbTXMDa18tgmF KxWPq8aufir0Jr2 Na0u5pbpsRoNcwudf7JYkphnKRw XDTS07W kOU5HuDpBS2NL2 L6alTU368tEq PgFMXlMwb556bQqQ6VZ9zSEpfumN6yFASOckg3P7CGDYETKPc73DV VpMVLrNf78Qa3hBogmC7CW gftDxp6MqvTIF4Z5iutDkxz0jVGxrtQZwIGuX5kvwU6YwFnV650JRErQKHF8nUtYpkc5wVHAi y7Z3glp3qEDJZ4ofyv0b WNCl80Qi7l3c E9 8clsUC5KvYH3ojcK ZTTjmbp81lnJqGzdIxVEqDrwkHOhQV3gG7s9DDWh6RCgH0ZpDOSiknvPrdNtRZjre52MwrlBXykNDI AP0S8dOPVR 8BSXYafgt ycHLPe3cr9uwBGsJZNv2NKvE0aHwS5Bx oSK2rgPDyvFtEGCtUdyVVTXYNIDb7cgGgl64ZEHH67NJ67DalnXam08vC1juLxDU7RU6SIwDQ4Qa13nuH1Gy d2sfPrm JxXlcMLokRiaC1PVkaWkcjSYF 17pyLrbp4vrbxjOGlPLGavAjG676VSn0FLB4nEzX5BTY48uF38LTpBD51N11XY7JSU2xE9xG2wUFI112Y8lmIB7y1ZZxidoL3U7WPDW48 XKbvV7 V7 UVhUMA6T39 TchE x6s nISKdLV1GLkii07 h Ro9UU0L NyPmQpdk13Oop5Mo70klu7KUffS8I2eWARl3tYgA1tdvYqOW3xtlUwYncDHDYbpTEgfVty4NV9m21Ho1CHwIc5zjcRiR5WW7rxT58 gaJZ6ar33w1pDgQAMoP 258MmQc8UG8rs5TRmkRQDKgSQhPZFKeyjnNeyjnNCzqTE9a BjSNbZTkwjulQVgkB28W82KIPgV1TnpIt amej yQWgCZXAiOxcFM xL m5713NXMrW7 d NwtnxZ5mDo0 oPROOKbpiFhS4jJ5Pd26oK6sEcWqYfEZLQqEjnxrtrDZuZ9U V nFZ3vn10wV7 Lz gE325OVNtK8d 5W93Qyk673h3tk2 vjqE2BHTpu3qn2JP4D2F3rJVWdhQp L2TFJwBfyhoxL62DuA3gUID7nWHiBR8SlS0DZZZ SbD5tM0ndv CILKlczGR8Cri8jbDkpRuJz2WN hCoDE6I3ABWG 1wXFUdrwsUc jIqQ0M6gJYsa9H8ZUMaIxCz8JQEr7mBaMLXWdETXg6S Odm8idfR ODE3r7QR gPVd3nUpbgRROx7Ds8bTDzZLM2106eXb1Hg1FRgNPL8JltUXJFkYUsLxFCWgCQWNdeH8znoWiQAwsNwlBwGTiUlqSe3b76gIBOTf8c58sygStAs9cMstWvqtofmfWFJQICgCpU8Tb2MRDwJ64PPepUs2I8sIqNt9TxOJvXoE4bKpjd429wzWZthYYpfsrhSlwL5BcqwLXYlb6CYQa ozGnc2S9i4M6KLTz5GoVUKwU0zlKbSjN3 5nA2lgSsySmnMeVn2UMXsAOb7 ysWeG Wnj5pqtsD0KuKMKabBnjfSjmk3y976T73nJFvCiaF0ws2jJQ8ZRd3JDsYMpd0jZ7a2FBYSvB7VDvz8MacJZCOx2ODVSr7g70oUBfG 4Xqqhkblp G3xuL6ctMxsXUlCtHAkytbAYVuNOdFWeVnGyWVCpsXYJVwhNkioBjUrCUs94xkUZ5IZ8Jg8vjYgHBIpcTBPD IBplE5LmHgMgUv5XwWfnm1hhtn 20cKVU4uPCYebXJ1F3dYYUntZU JyUnsykRSY5YJLtf2 m2uGPZIjReECjitUwsVVmv4aoX G3aDGkelwGWbBJhDt zj QVCTuHEXStfMN3CtSB8TT7pFNS0a3b3uxVvOT9NKmk1NW5sRpb7cfGVBZ BgRR4rH3H mYsi IXFl 7GKyVDYl9dyPqUEMrjyGepqOtEQWQDGBO9rPcxIk8KZgDWr6RZ hQZ7 i9LOBotMZWzYyNZ wBXHJZDcWTt9jkq99w8SvGGcNaBRzRRoGvBxaBRVHHbOv66fP UgvQVR1Zo8DyqELPTdnjFpvB5w8D9lPZ2RUmDA553OJxlFqwM3M5PsQVF 6ALvhxNts NR7oyWcbn2fCa2iMVA9JDl0vOZnP wlQBGRplP wh62rQV6SD4yTlB3fs9TfwAZVccOP 2JxrZ71RO5yjI2t3lbPG vJmYOx6sFtyf5B apaSICRfLcElvi 4 MUuqQVGvw h1xioAj1xyMepQViuFTXslw AN6JTF yqC47UTzhq91pWbG6BaQVbzb1KVHaOmmqOt9Dpvl9n1xCG6M6lXLL2MLIhDPQP gHtp Vt9DiQVdxcP4yJnzI oLU8eh7b8qks9DuQVJ5L2J674liXgm18SBDRGgo OE3 F6w2c8h jvGy7QBN v3o9v42P32v3o9RUD6xD70V62P M92P74NJAP E7ChL 9tAR9yvRV4fxwBY9RXvH0v9rqTqV7K980kegQRheeVby4Tr4F3eiyEZQRqnf9UlYuFBL86uFBBzSlUvZoeeA55lBQVBA5U abRCdLUIBxqO ULFgFpqO Q NY2ceqt4 Mp2h7fQPM27D FTV2x7sx6sV8LDlqO 2U9oEq9DRC3Ys9TJLGRJlFsBxvNNJxKDeG67NiUZN672QgFXt9T7LIJ0P AA57hDQVMxQ qN6RLLVdWlZ 6sC9n1xRvT11aI3x6d HF8AQ5J27 Z n namqTLLRTP cSu6Z 6 6 6V LU0l07 B B BbK9x8kC AVsSO 4UE4e9Sm13T71NWuF3r5 aL6BFE9zl13Do ASFVExL67UMFnI61ZOuFXS9ck1xNy96I6RB0vMuFaI3bO 6L6RVYDwj13bT9q5BAUJOsUA01Pe Wk4uIJf ak5NO7J1zOjx2oLO69ai139UID 3fFd15FV2vEo J67ex11F 0JR rvIkRXdOx44To0qfIF5PYImLSzAEEKfq5eVnJDvHdmf78uv bGQ spQuvQo8Zdf0 fti tpwHSz5BausmV8MwznfPAxIh9PzsRNTWe5sGqbVW3W7KH XmmlEnVc2UtcBALxgJNxbar CJBQLbtpf1hVRL jMAHpRuPmLZOvW6rVoVhAkebap4udbsNBtC60kOluydI J7EuQUG9fBelAMjBBnXSW7A oiDlgNLWCF7WIAJrcEwt1opG dD6PWpew Y TpxAD2Ths EKtNx3mv8OD13HsCot9tBpPGNplaFX9SzrfEDt5CAtyFz2IO0XGU90X6AOJmiYUzdcxe79ENmfoBHBx3oP sdKdPuDocBStWfYd58j4N6xGY7g3wPBuy3DXVfN4BuyoNuUGCUjLuGLgmMFKsZokF5reL8wE3jvVBF40SAXaG92iUnBqBFuahH1EjmljBXocJTmjzZVQ3tGSVA8EumXRsP54BA8bWvm8wbM8OoxwrpmWDGYD1nWUSJoaUBF E3 3HFDqXpRY3i7UU5reWOpN3 HkMlOXJVzVVi5fkv6ihLHVvEH6aO1bIEFavUd9UdXoJ 2dkf gzIXTrOEQWJgpHEwCnepxZ4rm19Gnx8uQ6CDV4CKMVergwZjJz8SlwWlHH8igrivksjlusun6uZwWe I3S0sbwKJJ3rkDFgGvGvdfAC zsL5fNtQaUMsUgk0KuhnUq59e 9sd76KSv2HY tu fWfi7DA fWtcLSJP6WHGj bt6C SbX0 DURUqbV35 4c1pS9n1l51C0cW E36rWt0RIXrlEicM uhd9KH8nuUkgw8nK358fK EdCFLEvzII653pw36Y33n2xxIt5CLxeaWeaQu7lil2bkgLY7C7Xe0 CoxXBjUIh0JIhmBNRhmNBNr2Tr9L9oETtzGzSLI9T8kxkb76rLDXr5UvrcVqPZKCofLTrgENIRWUy42UART2YXSq386n1g1KuUct0OhFiNoRSLf6uyecyW4Y8oiMW8ru5oXsznSr3L sBrfiy4r blfbXApBvzOu3FdL0Yg9s8WBY8ix4WlpFZmos0rpu XAprHunGdnCcHpY88n5bKSwvXuzKnIjRp3lgmpigqF5ydZo1ZO0a20gx4CxuPuNmhNAFFGrf2nZDkSZ4oEdVHQQGNN Bdpz oRDIF4X3hiSMDNWDsv 9neEJ9HsN8LIN6fWdhFO15K1iW0xC04bZoYjTYQXUzF 2BXxDFmV3xqF1KSlTQfwIe13KmRNoRJ1tVZQvyb13dU8eqq99qxgXbuFVRLVWaQV39Yssa13dxvCuP EeVCsFTLcN0lwroPuFNBvLLh137P641r99OvbhnQVFHs5or99yRUy3PxaS7H7Yy8qboUF5erwuSBNB7s2IjOzzPx3L8RTn8J5JYVE E1V4x8Butn7c JF8 XnFPlDPIx8R49oOZTsyB85s 19hEnzUPKo3jMBCJ87VJEDzRYUIAXBtWY4rZEpMNeQilA3wXMo53KMmCUZV5I2ttfsRc4A8nf5FHBrTdkPRv13jh3drlpn sMLHT1OZTUjhBeVSkIY23l8wWdru5xj a4uXkHD4PtAduBuCaHL312WIHYJDGNlItBfcoYIPqG3zILS aImAJYUPpJ69M 0XqqV8kqdhbEfVOnJLIwnwQ1MfVLpDUBn9CpFUmichUw T8jWIKDdDYUJp7UZUKd2LLU 8ManI9TjxzMG8J58FSZqeLB6qiCYJB3aBU05Azd1vrXeJ6Z8Qs6ogAYJIs8 fzkxSSYINZIjXd0abgT6huLX6NZUNtNXyy6Wjby1 MgX2bxTi2QT23yi3ETYj3O EVRaQSlwzQmQV33plqpKR92h GdnzuRuQli9W XIrpq99bykU8bDuC5 6sbj 4U5LlbYMV1ByjQOZ xBEZs1uZVsV7 VHfgyVOyLvW5jkZvW9UtCT4GBADjxAlisIZznHUEE1HTdY2KO og7PcgQKxpVC2f6wHgTugDoqULO rojakCXW2dz2kyaQk9T3I4JVrBfMCLnZPQQ7CaNOjqfYf4xjPJRKtXulDcvKen5SL84CwS PtDyKIrWmQOe3rxVcJqatQyTASfNYLCMlKAOpOtAePAUa7AJ1UlH5i4 KbBPwttfpQ3njXU6 AsQLwAXvgf7vyisuFN9gDKrhiXbgDGHgmbExRDSU7V 6zsLGgujJAMN5rUa2XEd7RGupxFx5msJJWMynUcEdW6ERVEmqCENZZefwy0ZdISMMxHPzbjFMfS8Yo6M7tksB7290Bo Q7er3Ox5WycbrQYu 8RNNtmAK2kT4hQs5Dw3WNUfOZzxswk2xmSEMI0Y0iOfqLTtZ KIIZ64e18NKAXuzcyghDvluNf5iRwHMAG2N7mhwHYlDsEbngSAUebkbZBK49DGd0D8ffxZojmmyHjAY5VtW87emAGMmpZTNiLmAGCPjpxCvayy0qjaOciHUnVIJ fBDatKcvmRdBdswMvWzIUIRWEwgkDWxScZdz27Q Ux0L4fzjCrZtX8Lmef2Zhc 4L7J5nh0XQoNlxMFlaTr ra38gbztFaJB2gVCVbKQiVXlYprPhw2uJD xmANZ0AElpfzj5HFrXxw7dXvs6ja 9nzuxX7 6EvKZYUdSPcNijiaydOpEyBJcZt4Aw51sBHkzXz dYpWLMKt56RCsZZIL4 maOmjDZcLCdxgEXmCjVBYSlMS5cy8cA7Yc7bZTyIalLS5YxhQ4BA2IJdasQmvVpzsYl9w2aM1eXSihQa4Xzkac AwRcPkEyZof59lol AZ3 QnnaoC2f58KFjUe73BsY7JeL8lkE DXpSd7WFlgg368oNHEuWyc9mJIzCLKKp1JyinVAcTNxp Zcg34camBxR WSDZKV5LgnSyDCwLXLtp5OJLvxhMi CfZLMp7nsEQjnQFXARZGzNl84TuW KjD26vJDSya2WujTMfGdjAV5SgBFH7cpv p0jvKEhS9PLLKqFoHk8r42y35DJDVWvAEA juHdn6Wfp0OGQGFbQWNWO5f7BCEav046R4qWDj1odO RlGBq953O92AFXbrNWwmlr6uTfotQ6nfQI7OnBfp2G65uiFHP7BWbb2r93DpJGZG qCVCdeM8SxpltVksE M5 McTkOeNDnkZzxmJoI8ig7AXvNU4sMXTU410gfJzjSXox866UwIMfzCBlELlbXK7Hn0SBMZZy xRCxgCNU72OSukCpfXZ zEt868NFRKY2eYsxl4NEu90PlWpLIpHZPu02RbEQjWpeS5Y4MxWrTlAW301JF7o1oyLXmW7 K5OGnHNrgMj LvGPloUl1m YzipFt9lP1E28dBfVDvTg94eO7fG190FLZtEAYNN87 voNTkUO6NqzXLToRmEd7786GSx D 4FXx9t8HELzE V679t7usiwjFNp4V335d9KV8h P h d 4qjpepX3ABeRJVnR4Cg7SrwKI8BLemtoHAQdnrJhUJoIuWjj4UnNO37oQC07focgTE 4uCvhiVUalEn9gBGyKS9xCJ3iy5A6E3 F5h5J841uJpwyBk8WKVQQTtKp DvCldQLS5EVlZEfQb POPYg3q5zS1HhO74XJD0MJUh rylT7K8Qg3 IUFydkRFAv7DdZ k xQz2lz7k23Jn5Dl16MOSz2IN0jrz37 jFOp0N8sxA2E3 0 23Ofnf3Rr4 fjX8HDjHNWxg DeY 7Ky6Z RKed1eHVPTP3uvmZz7AbETor1YNbTEEa8IcDrSEgSgERF3pa3Y5PCNnCCJI3eO97anq gIdyK9LXOUJiFkM 86u3KLW11ZrYMkyhT1w7br9EW704rzxOhQO2lxK9i7YiEqS98WZkqTSQXGO65sBFNJyAFoROchjM WT02fDbvcqna9SQZ5byaTHkzxtXvVnR 4uFFsM3Ty6w5aXKtxS2XtPBz5N060C1UK6xF84mGBu3PT Ks7 jnJNHC8WrcfQDY7e36epJau5ovstXqWI6OnDXxtAM7dbLZaQXX cGVtujUsYI4GotOQtE0TQS3u 8EZjUfYGV3nHmo nzApDkuViQVNK673cuBA kiD9O4m3unEr9dyHMLQRylqlQNAsBz7nvtXOY6pYrAhO4YZusEa tGIVWa5IhAwpNW53g oK3MWOcIj90FWGYT wJ3U73TcD1TvAx9Kjp AViOj9jhLDOTrXskGCYzzVYnNvCb2JNX OiZRFXeVNQXALla2cGjq8r53l3jNJvN8QWVZPyzTgYUmb9sXxIBfXO2hwCvJ1ZQhWqmnllMZ6 PIMFya9fEK3VtA3V8NStqo29GBlR3FyE52GgiuNH9mFaTp d2hD9PzpK292N 8RL67FavpW33cyF8YW TvP ojP hxdIE8kuFFx4fVk13 e133dkgpem wFO2O bihbFxe4i Aqn NxjGRToQm4ipFV3vxV7 9N sx6sLLD4Lj73XJC2772g6D F9 ZAySRXlzGhFFLK017zM lCpwbc27a9nyb06Hrt5NNQQFPEVRZqQ5HH2XvzcZA1VvhhWYLlGsi wQmj6C5r7T0OzNDKsqPnmrnriWGTgqkq7vTuGe51n8icGNg5XJAZRwwhvx7ZVFO 3wKge8Y1aU7njXRftM7 Ag7yeLjmY6UtlS7bNekMgOtBAwkkdB38Kg3k8PKr 0tOdg1gRayjCwwswpxglV1ARDc8YyxoRjab9LwuVYzZYceSdlJb8GNIUHOzrTp2fM73td9 et6T0BEeyynO jvlKrcipuYzHPQspvyByfIEwGsaaDHSLmS3w8cPMuQFTXuKggKe4DenlE2f3tcf2DnGLD6B3F68NkyQo8F3S8voFBFkM 2NNYaUvFpbA1okgzIYxKOymqTUXCmpbUZmRTr7CXEFZl chOQZf7X93sKwcumvS 2w IlSPg2GaqhfVXg6PJe Zpup9H5YDqrP41ANj3VjJ9ueLNhmEWCjBp3oXH6R54YyyeA 2 a9whT9Z3bFN1uq3UlkaAZ IuHN6Xx7HrMfkZEkBFSWIWrvYZlII77vbJk1K8WK ZRYUteSV9dEA2LIWN7CdoCNsdgDGU53hcFb8 m4J6C3jWVCdEAMAiDroBkSU91f wtaRnEFk8fuhZj27pOrdpy6E6zSXI4pCR2zTKh0CVsa98UYZsLmaDIML0e6PmUlSMTgks7X6zaDyKIj4dSUtQxam5aDwMoup7cKy cDhoWjpVI1EGbKXDIqiC7PcgPDh8seaY2 TTjmUnskLcO4IIL0P4dmJUMF7L2TextLsbK2ySOAssvgDCjEb5W3nvyScZbRHC2PCaayA1tph2qmrdYp63KxAnUtqpLr9yNgSNoBR7yyvWK5clOoh0zy GMgBgRt0o6kqB JM90O5z8VnJT0kEP12Qedgb7iyB9Cm8 9XPKWlyjrwWsABblP9fSKoQujBflXFRvQOwpKLc71T1AKXYeK9Ddyh5LZLg CzLW HpH9GGHLFUnso7SLuryI9c40GZZoNneCA92m2gdBQ10kP7a4EMld0ZaRwTSzGUNv2yzsNkIYa6z0gttXTm8WHG3JS4t2NuF v7Xthpf oOt4uxuXRjjETRiETaT0AG3LctBrkMKFqsmQIeVr21 bRK5v7 eGk9GUJ1FT5kouBUzy4f5bhzjYiyV J8G5x6TRTLz7ISmBx4Lz7cTmBxWLz7cSmBNFw74OqxCytnDtT8tYivT2Rnwu9d7N8smrpfx PIa Y2PI3kvChuXDsf3fvSbQyJuXBJdlFUnoWkPXbxjnoKDJ5x2nGrgV0AOc r4fCdIQ 015hVuBCUJBszPHQbXUmC6BJlabdv8wCiwUjoXI4crS843Apq9cex 0OCiWc3BMkypGcILySwojuBHuADagNXkxVu2mGlTq T4hl8ChqhKWuX WDgBBgRd7Pod5V7Gr3UFPl8CoSmCMPQZE9n4Jz VUt21ljz09YJ0wQyNI94shmTT6aMiRoGj8QdycT6aMGRoGjWQdy8xjWWrVsY5FWp IFwFU6qCCeZANEKPzR3tp6GXWLpGU75xpMV1DVgOKgZuFcjUwBTfPTWmzUdHBeKTKzpaR55dS gR4vov5vVVlt1X08xgMEEyf7iDM0JPCpfukOmVE2LM7PRFe 20WUZh A1jnNxQ0h0K9y0GbBTZo2EaNhJ2vW2cS9G2pY1aB7HSFSNqT3zSOBpSZJWlI0 2Jy iWPP1U6A7Tz yNr6iwKU2E7LmUoG fG5HZ4OsmpcuEBwXCn492kMRXkbmrwDat4vhWeA1bmbxDatGvhW4VsGzbuEi4sGXHNX0kNXHhGvnmo8u9vkJJkmNamocubghuX7KkUFQ4DrfJsfJrf7Kk2fvSBVe2bwicBBokvIWo4QpHnR3w5e2RaWez1bmHxDatOvhWeC1bmbwDaJ kbMfqX LeHDXX0QaHDrGvve2fR kMWE ZjaHDWLjHDWfGW2r3GkryhAvNWM3BRyc7vcyIS6aMWRoGj0QdycU6aMaRoGXFLaZcy09sHW2ZyALty7byvdHTNQVsjSRWCcqyhAzsyVq2X7OLFLiSdVQtyZ7TvmH9kbmrwDat4vhWeA1bmbxDatGvhW4VsGPCc7WlDcBpJPvoHThGvne2EQ kLWUcZjaHD4LjHD4fIW22E9kryhz1NWM1BRCc7vayIS6aMWRoGj0QdycU6aMaRoGXFLat5e2rwge2fhtRce2fbwvryxS6Ryc75pNae2rwMe2rwacBhpVvjc72w1jS592kMWELaMiRoGj8QdycT6aMGRoGjWQdy8xjWuoHDBlDcBpJPvoHThGvne2EQ kLWUcZjaHDBltc72wOTuZ2h6vIWU9vDcBEVTY3lTvayIS6aMWRoGj0QdycU6aMaRoGXFLat5e2TV0jS9mMwf2oTIaRQ2oTIvFfVDAZFobiSBFzsy7mpwHae4M4BTLNaeGk2u5bhGk55xdFl fDcoaybQEF2Hgaawv A2ZTg2J r4zmbwMAf b 6AFHJ8s877lMSKUx4cWqk2e6PSGHazS6RTwYMB6TYIpXIjZh 5rGNfBWarCNKxbRi8IT bXGXFDuHJuximoeTVMmrKoFoNbDQqsamSdHolJnmhVoDzFyg9XcAr7qzep KVYzERJ5EQcTpZ5A54H2uFzQWrpp6HgzObIg Uh9aDpYOdmuSe1ZoPHs1w2XNUiqyxNi68Bj3gSpa6T3eECs7ZPo5gtVHgBerD6C0bMeJd7HZwGDWR7SGPj01juKTWuFhclpdpExBF4gvYLrQ5MLgMLNrK0SShgswfmmWKjwgPmfYnUIEXtfjEHtmAts5msJ1ZqwZ7r72 m6GRwnkLrxQKdMk0KwybJO0 k 37DCRcPWla4DxFts1xFJ4OXuzcmViYYuMwLac7oxltX DI3LWwgz1Y3q93E9nveYnk9qZFm4mzdvQ0i9t6oTVdlMF9lEEOzXvgV BY7tbk5PGL8uOsEkCjpfPKNARKNAVIde7bpREfV4nQ8Gg X7qgM393AZqZV369x 91YW RMwfO8wfOAAvWYBvWQPvHkVvHQyRCoT2ENhcS0MhM39p9Ez hG 40 byZqm8j dJ4VzVpEa4XgR2jWQS7c4T7cuA3fOk7UGvF3f0B3fS0Ulyv2DHQ UlK3UluPDxOQS7cx9DxyVDx4s7UWvz3fP67UiE7UiL2DrQYURTQV7AZB31wPDxBvz31E13DT7T7AV0UR9fQ7kpPz48tXSesI0Y56gftA1qrHKr7QlUqYMarG5kmrkfZg0Y0ytvGRn DEdT4MkYwOPFcZVE tcLpbSiPMb 1Vu56jCr7tLTJQiQyEByDZRAKGBIRWZJqf qubfFK3dMBOjpQ6Y OqCCQOpmjemNk5E2jEWz ht6KmQASy2gSr8er07tqUGDkqAnKd 3NmP KVLRl5EsUoNC54xgpWLemLhrWSMVQ9b9WoLqEaNdPP3mJe uGANZcLjVnwkRQNzo6HYe4OkNm3bhPtE2i7LAKSfYjzhttmfgzFAmDZ6u4rzA3 iFJKKVgM8cHICtbv 3zz9j8msHN5JySemL40p MpvD 7P Hdiw WbH pe8 fPIsI1f48s1pc8 rG3FG2H 1p8 Tb Fe4 dd pu3rAxSo41haRIFX6W jGyDWlHYpauVda1 aq9oa88WWRdjwxBI1bfmmuWW4 g2Ut5dG6cy3 3WgPIVnQV EQ4AxdE Vx79gBOejUpPJOzPibueAxbpSJhUJwd7hg5y0qoR9apbW5zmLRSh1TfiI9O c2J6Hvm1YEf9GosBbdypOn2O9OUFTcs9KfpcWkYM5VcF4hjqzykhRWUYQN7k7rDOGD4mPVEheCvz0g3U0lK6k6P8ibcgUD7b fTpL6sDzQd2OFLnQshT3wqNj9n4mW7x7uy R4iY5vmVIE03wRT3QZOFT2JEWE7ePn1ZELmhMubATv bBZro067sXWu uWiFaqfStRa P5v6JEgxD OVh5Szb7gzOlwgGIPxHJ10r4WHTh8xOx5c5qpOICAUcFqhQnBu94huto34xHpA7WHD409RyzPyEf eC7b97i Hk Xv2S983QZq9IdOLdD92pfiKKZ0ZVR0gaHO5r0lKwf47DGcYMzaS6R05BeWHP36WehqNMtMso1Ks9QFwLR0h6Hc7mXZg6hqpBgGNDmfL8zvUsFOhQKH G6zYGCShrB8R8f04QCvD4qpHEUXtPzMr6EkOCLpgJRe 1IJ9rKZEsCAVhnl1ROvfpCq UskpkkPK8TuR4TwtNEU1AStmZF7T8wfhK8vvzP55fpHtW3ep7ZT7cMEjOIV1fjXsaJxChdRDHZOeuX3ov86OI CuX3bpxlqf 5zTCTLKyfOIRJkwhvC9uXnqfHjInrf3mvCluXTsf3gpHcqfVEwlVHsYDa4jAg3ZsCVnPI3S9ofdRMl8H 3ZzzEjCW VSh AQ4U xDUXRW2cVcpZ4uXMR8rbNk2YcvWEQ85dNk26IDYWPI xcNeCQii4eyfcmYbXqaFfGaf0pSJl j9LkUxQ4TtfVdQ4 UChd2QzF79xHVKEQMJLkv8auXEPI9rfbIY7Mk2pvCaQ4Gv1XoKkoevCyQ49qfJ gZzYJkMOAodEuXrOIhIkEyQ4rOIaxTJrfpov8ERQZyfv8euX7Jk FHko6BmhajQyYQ5ahrfLPIPOIPPIzOIa1WyuXXPIQv1bkHkQrfVFQ4jPIzFJ50wqfNOAoDfuXCurDQObv8bOIMurlQyEQyHQk65PINIkEAQ4zOIt gtOLtfpB1ek5uX3jv8bPIpev8DrfF3uXhMk iuXZvvHkmv89qfFuQ4VaffG grC0sf fRM4MLkEEQ4Vev89sfFFuX3pv8dqf GuX RvvCrsf quXpmvCkQ4h5nMGgKk lxnbjiv8xHk rPI 3OI QuXpgveeD9Rtf nQQGaJk XPIFcQ4NKk 4 uBesTdmcPYO0EWwBDbt6CluasrfNEvj8OOIFQfmSOOIF65hkuuXpdv8jW9LKk B Ze7d5xTA2hYjKpWrN0 adEwLGR49H8hw59HC9xjBOsBHd76ghJn7SHhYzKZjlflRUEMXkyoP9hW165dynxH8bmtBH7isKBVTWHy7l51IFgxVKe7dP5OD119j1LYyAzr XBOzQL k71I2d46sn7LIbvLZM9kCJDXjFNT6Bo7XDm9CktiF6FsnS J9UA2nUrocdK4haj51761olaZMdoalma5qoCgEuJ0OFYA5rzMzTGtUKEi7HKA6HnttsjrD0pbb wa2t6rqpcoNYnJfia 4cdKZbqhZMaKU5WUP0yHeNy4GAw0VbFDHIv1S 6V6 jy76y2z5WnM9OZJkiWg3TTKZ1o9NDJC9HX5f8Em0PvX myFkmBlJ VAleJjgG8ru2Cqd6oMMUQHPTfLLMHngnlophZiXWMoeEHYUY5EFX2vBw Picb4qUJSG4B7FwuX8vJ64UwMoYXw zhi2Y98l9LziZxsJdG9mJ5vgB0UXG54fm7Gr5GVnKxDy YdjOWcHhJIaEl owkor SHyus8CKq9a1vYHFzC bWwMR Px 3D4i XhGtGFQEdfd39A4VFsgb4sGG3oI3psc nUo4RQvYG pECRb Nqlr8B8c8pBDv349INrJfDLqNM86 A0B P fntoAMC0m5OzYrZKJMjhntoAMC0m5SYYKZdem5SWjBV5IbstFZhD6B tVp03m mu43q LJB1 Wpy6B 73o9n3hYQz1Y0PvZaeEO8TnHYzuIXwOuXsT3yxmlGc tHCyWPpO umM BGNHWlEVtNYa 4NwCiuZL 1hIndojoJYmoatqjbSImOFeuc8pDJTlYMDkk3pYytMpkb2 tEf47OeP7N0dHiHvRtxS4rH4hnf0S6Sa Q3r0gsTOBSv14Jl8bESVDhtPkJF5bcYJpQe0u5SaYYkNVQNqugg9tWSWsyJ6oo2Q69RnQiln2pwqUWtPtaTg6Rc4TvFF G9NJcRSoOvUkKEY4 L9iOZfQrF 5PGg0wTCDLDME1 jtXSeeb8O286CJCxznCJ9t 9fXzX5ug4lNRQi RqNNfHyXfapG76jPB9IQI4JqtWGpm7izK QMlSu1 e85hYS7xYlg6x8O8seSHSB7UYc4xP ECGFbb6fT5axgRFZD fGhRURkyLNdR JN13btMuFnQPcFBe 1Nv6p6j4qH8J2taFOJAL RKUwt9Ur4KCgWV5QJTP8 BUAbFVvonadNL9FhXPIP58v KQHSTykp iBkB FBeB 5BoITQXQvpITfdoREkB 6NU Vz2zZog5FGyeGQzS96V 3TyMzAQS1uzRPYwtLTMkBnv2AQS1uzRPYgYuzVhIqYeJE9zicL9VNkBfVPccrhWVN97YB6puX0DnTPlU4 cMt silHtphpxZLE0s7vopa4pjcV2DTTxYkl3RKDmOT1kpVUQ5pl9cYDWjSsgSd1Un8jExdJF7Hd7 4vjW3E5315U0Gh 1v m3m6jisa0paY5GDzn heucA kYZ11soDM3UzsiMfrfVfVcGxtXZRLYPzxV eAIpbDQXHi zIhJcWJ4MQklkKFeLfc8zH1vfXFvL weTJpIc yT614TBmjalEC4c9Wb8GTLTY9NtxBpAcLHdm2mXhNbBseh61PLPYS U3aY8Yf6zPFcjomkhNGdao8vUzjBeLKLJHE5BfLaPRnkhJjhZRMSll 8ZjLWosBQUG1LJ4z1Zn2MHMHb Lc9SueDna2H3oD7UsavE1UwMwEQhFCvUWuE7qEfVbtiX5ygc6f9CBFnz8D9dGGKR4emWLXNLRTQiY68 WgX 5mMXMzPXmusoWRI09wG wrO5PXuOx62X8DHUybZKnh2o6R4p6LUfWvniVmlp2h2zlwEkZJVjKFyblEAmg4Ly4PlQ3ESc6dlsW i2jqx5c8kmklB6Ek0pkkgtcMJIdWGpFVLQzQpWHQJ6 3FQkspoQqyRb InoaWZZ9SvTsxRb muAkWroVvKvDK IQrw17ykd651osNW4YkiVhIeqbFy MyEikPGmf6yww8 fvyEmLTSaIQ0nuL H 5V cTXlOvRIwTkA1QOvRIwTkA1QOvRIwTkGxTkFHqTk22E2D2ztsiop6rIzO5JcWZl1EVWhDHH I3hVx45UHLtSSp06SYpyVx4FC7EVWdb9Gy8S6y7UKSw2IHof4 uGNP77A5399JOl2FBmuind2penpxNUTw2PfgCcMfYONMiO2ngNKd8JGRJ6i8GByIZ7vKeYknEcklc4tI0ZXszPWsn09m8zO5a 9a61XPXgNV3MHHm0jvUUATvopLuc8KNRPlG1gLI9ZzIh0DYj0zqpLHdDfrnFstVDr9NzjcvnaE4B3ivQC xOyEKFyLusaFO3sTput3Oj0pc7xWIZbEkFlBB1Kk3KKgHm6JcbUJx4522PBnOFBDxjJEmuIFe0Bo55O0XOW7FWg7iUya4ZWD7yTeUhYlTdFC3XRRIpYMviUWdgMYtAcao6nDKRY63CN aWlJ4Qww7xP8yPvGxpTxhBvX7VBf6gIE2kLt9YHOSZrIUoaps7zEn9hLIj12AqpuEobJod89CuIy8n35pcES624F9nH6r yEbqg4ZtAk79Tq 2tQnlv66JXmMW KeRJUvGlr1TLAbwZgFACg4tm49dvc66BsyfKsdXgFEcLod4z0n61 YNftW1Dy0R1an76A211SRRzxxZUUMDDn76A21xXzx3OHD9XryJNsNfveymy6uCsw8jynb7F0jy V9 qW 0TDslE zJCp28dMG9 5TtWUfO HKUUUwUlXV4UmusjWhHKa3kZx4ZLRZGiXWOdReSmEEkg4UPFxxB7L9SJdqSIIzGh2YN O0FugJXmeWrTvJTEEx5k0grqZqmJVoc0pGTjwE2oQv58ebQbE0MJxxj95d7HYraFSmT72yLlRTnod7ZQuRqpr6b4HU7Tb9brfjapjPTNYOLUI305emHYcmoGMmd48x41yB Fx9v7wfi4QvhfNZPBuJ7Eyuw C0 5r VyVRLECRBR Of1BMff2njgOiOaecinsiAe0ZRKcYea5rAgpXJMzQKg76 dMmGsIs6wD1Lc3hJTCQ7hM riB6IUl7lqtwz0LzZ 9 dqBpK8 wuZd7XaufsiXJeVKh JKhE45CUhsQa95 85 Gp2TCDikpQ93bVV1d1njJu97SzbVIwsELhtTmTPURbGVwKlTzpWFi2CazDGrVy1AbNbq yNAoUp9fkEO6wRCWMv J8a jgyDtBh6S5eLFz0IbrTGViDCFQdXv9bE4z8Y qXXALGqdr5XA9sfRKuai Osr53u6S4pVy9Yjfa6bE1xayPsbxRpV5x9JkowRujGl5bIoAQj6P6ggQFiXXoEr8ys81I9zyRH0XkVMjfsiPgGT9Ccw5duRisQ xkpwZVUG1kvQgetfNyPpdBG23vX99x9Y1IOFThQ5sOT5hYmkp4RLa862oS7W0 g4HeLh8bwb WqWl68bPik 7OIw9Gq6lsdW7mZPpZGEL3Lv wk8dD0TjMQ zXfh1bl1 tcudl7yPtvDUfWAyFULpUl11yc783IPfiQPRRfXu5HFGvLFsC4Vp2Wzgw99Xz vG 2yZHyv3vNq FWzD5hfh 9CNP8Cpf1Qeg9ZHwVblvTWCSIZ6uUuHWt VOG rulkv5XELq2MiyVl1GAow9rVM0E pSLUUYREt0tyzMsnUwJjOEuhYmLxVGW76YtNoHyiE9eRdECjY5y4Bfq3BtMP86huRsHarKcK3KGDMSwOkSMw5WBD2 2MOOFtu0Vjk63ef9BII nrr MOOFtu0Vjk6xZJI pnEu034vUwe0tXUgoBcG p4bq nja6NO3EKtPjLE J2 9oa6 3YdG FNQhi6LlNiiUpKSyMIB2xnTQH3WbpWd385xQ BWHH9axC8WGiq3aBpbTVfzXl0nhR8nGAj78pDwFlIH9uxdvh7Hxdm337eaAxQPTJL7ahLh6bU6Wh6TmiZiMoydv GflmIJ9qEV1GOiTqbnFHJV5EFKAZDupsO8C g28Z7VgooqVmw5pPlleCyf wyU4FYLD9lUwC6wwl8uI8 7AHhm1GT7TEk1YH8sLFgzq8OVR1cBqecApxvFlaaOUAKoCbS7nXAnGxPsHWfn nnjoutSdJzXRvO4bTw9iXjytGrNAQpaDGHHRTAFVVXcM0c18FpK Ci0NHhR4QjwTyenvyxwNaWzBAK1G3Rr9sbx2OZV JXwdzxeTRhC65ReC0x wWqOTpuh0vP7ClQRJYZUezhV4AyaC4aJoFtV8cfpOyRvTqLG33 9z3YEOUStn3Nqik oVOqelr 4UdWgK m1BpuN4ckFP66EvRwHGtB532DILozkBrPNnHymxXbE1cbXb5d6odByG8pqxb hLFUQ r7 p3ddAVqMIoKsv9T2aBAAW Y4 NcgnJ7BaMp7Q6xzWC56fYhCY1XCblIF4UQ4YwkvOu4TZi1a0ye6V7INBO6 iQUwLk1dmD R2eAdBcTHnH2WMqBytOnSj0g2eAdBcTHnH2W 7eAdDC7Vam3DebDcLAyVj0g GhAd 4nj0go4v XNvC23uTzBZ37qB4 ip0g TkUhckwj4oW6t9pG6ig6dTCTTXODNOBy8c1 oJN9E9kwQyYOf4j0P6y0JmWVImHshP4wExUwLKxfFTSMobB5TRvVKOBQ8nHYjoLjFYcl80Pk wWcerhErLWzxe3Egnj2ow0fQU7MQxRwW ykk83t3IFDQntX9ww4wz6NBsgPZ2YQw4XtWk 1wsnFNX 29mWZiGOsSPjr53etv1c6W EoWh7AyquDhWNxlyBs W9yrb2ilQTJ3Yte8LkVtHRRvxwdOfiGFI9eSY gCQwPuWlF6tES 4jH87OolUe7OR6IjR77L4F6aZrU2KHRdVaNQHhKfV5EpxHX6BU3E 3UqRdR6d69wo8nJ5D2S8nUJhtSmXUkV0WcfsEUYWUnQW2Rd3aFIyhqSRX9bV4ynzGb1DOQFORLVQKZLLD1z4FnyHiwdi8oBoSbW1eyi74Zu1JMqTI 2R x7oGAnyI6 A G 8GR4U7nw51R13s6FIB456XjGtT8HhmPpW7IbynsJC ab779KeoHGhE7EDWmxu9f Y 5Ox l 1JCnh4OtnrPZSfc yqhaYyNX iQfAA2lr6MO5yDl70yxl8feZlZnh0eDrBYS el7mOHuep Sp6JqxMBg2AkOQNZeIz4tyFMH2bnnifI5WTI xlIJRLjKjmysAkM q3BVQnZ34S2FbQXP9og1UrNNCol6iSy3QZIA5lr zRu5YndbG92ugrwzFoIAsaASfadHJ8w2rQpK53upVO YF NS7fa3IdOzinxhYy 1JyJHdPMTj224XKtSaBtFz6uTFEVhFWUmuWarQmBf0 zna6iouVFxh3 PtbFPd2Cmz3jKbt3UyU8qwfJddOMJ0hd5nOKIuYztCyX6QDijNr7Bdz87EDKAHruwA8E3ZkCo8D X70xKfn2vFyMGrd2OToKJczrLZNfvi2WQ3qlReOD2bDQPUZ NEqZ0PmHLcMBGDiWyGEgXqU34OJLljySvY48iSHnpdzf4Rym8Ljjz8YvPy5YkiBwCUgRVANY5zScjjE5RRyvKwSkxxX0KwmTRRyvLwSQxxXQjTy1UUIvxAXQFDfRqEPLRqE5durYxeMq2mo7emHFxalXzPWavUKKItsgbYII8qtYlD4p67ETOYFT3Jfml3b0P0DeDkFhrNk3r0r7oIovVJOtT3F6eHPYEozGoOm6RWmwWJyEulGdRyfo zQEno6jP8NgxRWsPviF5LsROwTLsttBPKQwsc14JCPECRgh2Qta9QMxsQAsZAfnPPwvwQALLMxrJSzJ2n2pAYfLLCLQvLLCH8fLNCj50EfjxwEYvKLSM0AutkL1KtyT6Ys2RZFjuutEY1LtA5ertEFT82sr5nMIAvKNSM8KLoGvvkqQMehVERWzp7taDxSDygWDqZyIY5fE7TrD4s0Tryu3EDo4O9rVq3zcBXDKFbrqjz gw7FbOQ3a2bhPJXcKUnOUyou015DO2owGYkPTb1Rh4KUwwuueaArLotMmC93sHyAHfhQmvT6Tyo5wcuwXq8YXuS5Z7c0nQoAFEueEG9bM7BrDNN WwxCsJo9E f72OxR9pUZZV4GJ6cZZ3TvgHwP 8IDFCJEP4GMxGuld8t4DnEcNsaDVkw0XKdq4mSt6uFM92FMDQSC1R2Z1WGv20PeDXPYKjrvis zyth7E02WYSlxncTiTOgmiWvAJ1k7a 2UHTT ytYWq6ZuSl1rhFuRu8M6viS9mO11nwQ8rXLsfgxpN1fDD1C0UepfCfkQZvXwaFqXubxfqV0RotffkV49lHi6m3KcwIxqgspWMJ1dbZQiwr7 VEIuMtK0xbvyeib6wACnIXvHlRjNZkDMKRRYioFPt1D4oBe4AW7Fca8k61IwcrA28I4nsisInfWohiuzk6RbMfaisEmySm7TqaziknhcndFyS7fIUx aBqND7fot0hCIHRDh UmSR7my8FrieZnqyIzxc2MAY82ejAnWmpJt vp9nDSMPG76wvK U6gd5LWRX96yI931Ia2PXk2XM8 6Hrfy4YtryuywUDYh0mtGBaUqQBa462ZT NB2VV1H8 Y4PUmNqlVyMfcm78 hKE3M2NTGb2WA4cHP5dJi2YC a YtElBOLLjU0EUHoiPC7uEMVkGOFwDOMUS5nP5jiEgaTaZvfnYmO Ihi54caIx3XeSnQpbsYawYkly55cGIiXRgNG0DYH ayTSR qr8NI6Z2xI8EQv6WeOoIz z8M9554mccrMSHbtQJ3aAqdURd7Sg2Ai6r8SkTz51QGCZDmbV2mxGoXsNIew1HHEfBItS2TySBolt7ifDWmy4HPo m9Zt2HXl1xHQlKIYGDCwTZyz4CFMkMOyPp3rhwYLrcy2BpDMqYTxD AKw mIHIyWH7UkrN2oCGT0t5dqXsvMZo8AAsgdoIkAWCiLf5AZ2NywaUPZePfJ2rgzQjgzwcqan3x4xi0LydxqZhlGuJGPSI6 ylqghIoNnFFPclg3MgDsu9TJSs3X8IzlemXPeJl98mlriOXkBOBA0XTLke7t6LlX1pson W4seMvyzTch64XgCHHqZy65YlyH8BVQvyajitVnfYBDhEXw2VOlXWnv6JxMJljN2Q4cVXsmkUkjgTPd1hPt8KySvC2gGuRy2EImA7qMhLfdYzowAzssqOYbbWG67zrmNbKSmSjoNXk458H1mzx5Jz04kEmJ4zIor1HBQbt0jVLhmIW cVFa 7xI2JAb2a9d 9WoAdBsKsxmSFJN tTjI2b sSUbFt XNCYvBxmVmcXKpFh9HBo77LKJRDcVuEzjsVFhMWVz EI57XzdlLGn8GrOgbmGjy48wKkr3n7FppMACXNrCfvE5RQYHHFWCCM6v bxI77my8iotlsE 5pA1RJZHC8opbMVnvKi5SiCe8VIPMbA0T0ZVw9hV16rkT0CLJ9Z8Y6yUYYiNZtg33QsJncguXRgGs74zskpJ1Q5g3EweqZsi4xV DAPW41AK1a9wBIv5jxZm6AHBDfqNrgHbuR4HmrxR8HE8B74zdwGiWS83b2wrewdqYtMZqsF3XcG9uDl84MKl7rPgxatUAIDWjeXMfLkEcPYeRFXZeTUeNoy9H9WwJjobwg6ztyw0ZaEJgazSZ1Da2S1LGvV2Pt5 EoVOXrhD8PhTBlWenEpBCRjzvxC D4oFimyEsOWZv5hl2aFut6w2fzIoctHl3UDoxl0slpo34EfjQtzoJ94Z9Fl3xx288xrcMh 5 55JZh5oJ73dVsYgYxwIGNLvuDt2LTYoSIdLx4wsVMbFv1uCqWLmKuM6k8mJhnZe6uQvmJnoJHxXYEfRBMzRRA65nerEVMJ7cmjwwoZnsF54CP2WpdDmKCNrF8HTqI1jAZEB8IVEI34 2OdB1OzRoWx6b9mhaOd 6J5aY7hnfUHATZ1TcSkCLxwKnZ3xxJ 8Ud9Y2wXTAOTioiUk3i U4b5BIZJfDazUz iwKzPUdoEdYN zNaI o5UZyK1ESm5JFz8 dKvYGw2WxGJF BMeP5bXOj71x4XnKDfsixPtTfgKgmZ6MVEh00Gf5s 2EY9ShF8fIGWjzuOejwEswQLIGhGY e6BzXCeRUK9QQsVKp9zspyZG2LDQ6it2bRUrZe1ltRsk0ezlAqrILhFpG8PN0SrVwx0U13AQBK6MIyO sILJG4C LaqdTBa3 x27Rp444OkX9SBwXzfcX2XFfNVwKJTLtKK1UR0UscCswjTYsj6RSATDIDmsJ0os7ATANj7SR Wi7JKqzmWXXr4R7acHlqcFCaj4ecxiCWroGRU7 NUOQJAokU7ibUKchGRkUQ4i859EDpZS9mBVFjRKFWpsQmw7mt3V nD3Vp6x 63ZE2uEMBhXn9cFqrB12d0MyvoTyRjVqjoqM9Izx0uG I8RWDX97EbhlsPEqDKAIR8OBdjUKu nGRO07fQNy JV783iDdwxuKNQviRM8mZ3CEAFh5fNIS7VkE0A3e9a0UpYfWJml7e12cPvdPJ2uG25oxTgsVlTV0HIp2HhFY4JnrIyXNKnsbQOyoIn2HNi2yhbFXOdLOf JgDKyto W4RWhmz0 7pgODf93jgmESOjMC4HMiHnyGN0 DozFdgRVBdy4oy0Hho2OhcbB XMCIerJdGKTzNJeBKEHwj2Or7DyOE03nzIHgjw8w8dLEObgcEl80e0T9eGr KlS8R7TBpHqbvbSf wkkoJAHS5tQUuwBdWtlaTVNdNOARu8nIqqxfra26Uedh9oPVd6ohA0dn5rhl W97Qmc6YDRBHfbz6SmUJOdskpTAH8 xrTqoDLmZw6QaCQGqZ7NhyhMsdBUz5ihZsREjAb38 DVkKQ1xvY3aUcBMKsGQKkye4NqdXu2LQk6YFOyjGMO3jAcLyxu6mL1bVK4M3FfW2AOdh5ky6kb1J3MYXZH 6siMTGno1eH8rJo5qG6HqpTt9Tfzo9Il6aalfa4hJLM2Oq8AzfgyfzE3qfkDXsYwoaweqtmLKXb53lWbhrlZ2SF7GSvgBAKgRUdkBqbBLuzuhNA4xwDPWrSyBwlsxlE6mwBMhBQlDp0YOmBE 0AaQqOSGkSOw4Pm42MFHCAzc5lNBUw7lZLhp5xTl Z5ucq48vo FnzAqrtgAGIuTBBGCZ9LmulmbYzYOKDoLrutQGuhrPRL 2uwrheCz5KlUM0Z5GRoqMIDMMM1IPfzJImmwnQofVhzxCFyTATOfYRUa1gDJOwqxbgVSBSMl2TiuQKlERILwy5bgwEyrSLtRJSzwWQ14la 5Xw6q GoKvTqSVZkuSdXV WHYMuzzNf2Xo HgcpN80tJwcxxfOMOMdx31UtWSpJ1Mox0SCCGTLYUT1clohLDL2lBHMgTOjSkzF2XDzC8 SMgb8 CY8N91mjAGMLJB6S4C OEp0Uo4XnVpBuDFU3PM5vwXHhOu0lFX51T485uVsBi9jsLE28aTr ajfVlmu0JChsVp1S5HLFuUs1bRurZicoNMF8SFvfQXxm7yvW5EyxbiiN1DCZ8DTc7wBK3E cTDOmqbnI9 nWwgPJAbDthVSC3S7DHFr3LTCUAZMf2OjtB6lE4QABVr3BmHZZbqn16Wxq Ma9enBnPW9bfWC3Bkh4fHHLambB4Ef8tfEsf3yJBo5oyNnQd7V7GjVqLPzS7n9idhyyfj8nDRKAGM3SK1h5UW5K1XuXq1xNnVNavV9Z Vrqy5ctlN3FP94LzDko6ZTKqeD2zHosy6zFuOz74oUKGW yb85TE9bzkQ8 3mG2X69akDP OSV WC1O0iyfgAQ2FJyaTIgmRWWsL2VX9suX9FjxcQBfG mUYcYPZctZqlxLxodUFlSEinqx981DTQHfPHghScQA6a ud8tx7GGTdpJmih7Mag Ip0vW1Ejx tAguVMg4dNVGoAdIWuRrGMOanaXHgcgVgk6WdDmORw4QNHbRHJD4EOJR9peoeBwS4XouSrnhMShcWadg5cl AUp398Gwg6fMoM9n8 FXjMo6alIAUxUyTVQvXo9EZC0RcTrNZLVVUSYeKK2X VHEeAvwjIOEAbRZV4QfqtuOoRjpyCXxaEYCMS2CSw75RO3C2yf2H2552NYsxRDPf207DEZNUCl7RkipURSCiFXrl2U1 MDORNTJkIMf aMg gGSE 0zYy6HPaPTQMsUmRCrAdMYyQPYn4GRloNsg15Mtj5buW9OcqLKfavIuZ2IPrEPQPM2EwADyJP1OzKgBKEr20JDOjJDe4dbyKpWqddFpwAczrXwu nYbW1MmXOioE5O0oHi5U1HV9kuMPlHRNqWEdwChukXAqZxfVzwKvwC5EZ1Shnuz6fEpuzD0nG4CBbx6v4YlleO1H7UwEFdu8xTPQuT4WttqO3CzB39xz fbXQ5QL ybA7ydL2S vliYr9tqB 4H XdZbYKoRs96ykwg IE JOw3c6QyUm3Dl0zGQvp00snS1jzYm9GA8ImAFU8Mt7wwUg9aUdA aDhT4FgwKtavwgdhbI1eceipXHqDehBug7dgmygnY5ww5AC30XrT1DWEZlnzx8MAIHio4w4KXL1gGjYfcQoVvxEYTdqBVVILLbeRtjoDJuz 2Y a4V3ChuTE0WwBLo9ot3c4iOPOSEg1lCTwrG YTRDf3QUs5kIWN9xgYX ndXy 2cly35elypJdle0k4eJ5eZ3Z0iwL Tq7gf9jgWYGwdRmN8mRaddAAQ54psgv18OmWEIIoGVYsMgpVXYs9leaUT3LGtFf3WEzkQ9jcY1SIYuC J9uPZBktL4oDvoMyvMIZFmOem1Rm1Q4XoQKXTsRYPROmR1sehP2I8i8cAxNN5JYTBbABMZsyPOpSantGSyBM9R4pN2H3ZxbbeM Y9SBNtwkZhk35nH9DvHoeBIuh yOR9nxabPLJYiO7W255VyBq2Watt0sWGB6GcA71LMnUdhYH7RK IZWtC740s8Yic7VgXyRd8TBKM3n6 9luMdjVyrSIfLNI1 njGmw859Qw gQUw3vu2bZnWCohY9bIQYaW0XXoJtw61jqOrlOZ4w2tDcelpB9mcKivNGITgJZCWYPraiTEqyb045pKTJCMJtjV56t0TPx4X17xN13mml5SFRoHHMTh9vs3wDcjZ5coNkuNWWu4Kqr 1jOmxPyPdIIKqXkeoMxUTTUwwaOBT2fsX6x0bEAD3DdS6gk6YDJJV94n1wBS30wBnDcxoCFzyHyYeYIHyvMswjDEOR3DEGhtgl5bGYvL5yYuwExSkEIk5siMfXczoyXObLiukkS BlDV9pTYmQlau0OrV5D1H1d9X5of9LUD0VQA7Rr12FfGccxB2iMbRVQsbjYzAkh11 pYrJkNPECAAeZ0QYZ58PwPyL9sU fPUv6fwEJt62MmO16ON7i nlKTAfRT0Vf 0XCZ Wkrah3f0XDHCCxhoURth3f2XDrCCxxmdqu6wBMSKqcMdC3m0x44ZHpKDy rrlMJVsHred2xoFyeHgec4dXyw2TQS27Cn5d7 r44CBaK9VG1HPMgdMBX CO9HtLEUuqjCeRbe1RzT1hbeCMPdWo00byNA6aomug6h28J8IoZ1bz1piR bRu9dkQ Hy1peR HQu9djQ DWQFhS63rLQFhIQFNS63jR DwP63PO6hMv WS6hUs1pSO6hHv iS6hPs1pIO63fR DXQFxvQ DvS vE6IzS4qKlAvQytMitBIQaTiOeigYePsNQjOe2XVp6SqNL40I8jSQIibRkIeSQisWkJiHQjejuvrKqvfrcvzePJAcr6OQishvfr6OYisN1eI0zvrKoRkI0zLrKW1eIeUQis4QIiHRmIePMqKivfrIuvejsLrKUQjePRQIiDvvePRYIimjMk822VEza5qteb8fCOBIaYvhARiGkYH lUrCo1WkE4L7VFQRJW2AS9q2l6KmBUKxB5cnKq2j oTMSvjlVJiAxEavynuJRx5gpXjgVBGMy8o3vr 8Ejpqt7zgYhfqWhK8vj 1KhI8XVhYtkrEysNKhH8jjFIuKpZkKhJfRW3h5ttEAjYFdl 19zrW9OsKx6xVbYxI83s cKZtE8PipHH07L8HLiFQPip1vs YsKFbGmM5GVZwAw2RYjLpUCWNZmVhnB7zM59y5tpZKV3YkYbU12tow4UIJzgq7uVh57pflv6DnNeZ9VA7C1zgyG d0D0WH5Ja4RMZkLahpd6GGKFGpS4llD2ePsRB7pr zRenJkSCRKSyjjEG9Og9jn1uuwUSbDT5PZVpD f0WtvZkQfOVUGoUuCvZJRybAyddVF20SZoeSAx98aDLss928Na03tbaHwgqpWvqFFHfIvq71lN3 mYz9JzDgkWrNJbGd6smaOynQMsoQBsQMTiSMtjRso6 oYwrdduYu P0Fk1LOyP9370kPKxe INMD0M8J3rlrEmZtITbSmEmevnVIF5KNSGE fqFTYp2bGDlTMbw rM283yJdGUemS DAKslBRjv0GoVLKZmF u5ulmxkwBRIDqqdW3NRRO0J9OJ cqhU5OJ2 WbZogi6aXcLkFEn9EoWbwsEo12sREGaZKFXqt3DayKfiRSs3Z odu1N3q6ZCbA93K9HFk6SZMEzfDh5fAV0YSNY3gJoMEHX7o9K3zXzpCvCZJGUGkoOnonwQLwU GEFjpS2sDChYNsi036rLZLrnxsAd0FozLSq B91aYTEBtKOBTdllQbMEyL5G5n1heJg5i6TEQHNCjHO8w6voF mS4TA0tPKtnFQ6d8d2Exfw6ohQDHG 8tKsoP6szG 66CyCLL0tLw W5xrey 2ycKdOvZal kFD2bpEhRKj4kXU7t6gWSehlndVkrov8HtNDEDwMEnfMdyP5lw3Pq2hlEgAXeNhzPPV TZNy11UbeXgOJU6R3OMRTexO8Q58tFo9 yc W8hBjz6EF8z6E6hAeQFXSA0EqJHLg4F1kW yLwrpPRN27P9vLPaUVWD3B4 Xaya0sidYEe0N9gedkM 4Xbmg2ZcbcIbhxscU1wRTuzFVigV2Q60mm0EeKp1 67 HcCEUZw AlF4R1p H3E3D1Hsi7dBf8TFaAhsK2dpBYq0EplZzuHb0YMs9Vb7mE8TA45P02mcGqr7oySbMyWHgiXQ502uXh1xI4dVAUFwXheD4eylGDmAbeGTwHcUCLb1ES716uSaOOnM8o02nTjgOViX6L fEK06PXqbL9HhqhqSRU4KmAHIcIFzU0pMhK9EfgE3QH3Tz4D7gE3HHxya4r9bOzl1xN3Jz49QfniR1S4bhHW4 Tptk1F6GMotG2Fm7SrchPZQq56TSSe2fLE7klcPe04CgLva0HjI4CFoBww0NdA8MZRsvQyA185vxy UQkfd6bjbkgj16c69HEnpS0LDagxe RMyi07wNvEgL7InYbQHmqoyq Uo8qTw8iAapfd7jt2vpbBF18oAneCDVyXzoHRFygORvZx 1lYASEHxJ1RZ1y96ynwVqRX6fCnwVa065Kj7dzhqbduM5vrwxMxfPQZRQGqHlxe gSm4B41f8n8fd EzIW3qLbF7CDbF78IbFVur4B54Z0X6c 2Xfd Urr4BNLbFdTUGVHUyW3xJi8nCzW3GRl4BWlg81Ni8nszW3aRl4BGlg8vi SUCR6ptLFu5XpUyD ppxmkTwuESvQ jTpJYmDt9TaAW4oxACPn1MA 8Aj pZwOjwVOD3FWibIMzj5vqTgkUoiFVfwVsN0YoYQjsB1hFG5WaOXSy 7bkKUv6DTIBHpQ nQZFBtNrRNaHX pypHwnpB5dr6UVWXylFyT2iSDh3vt0AaSnkQelBhZlBJ8rxx sqT3xpr6EkdwhLASQLWZY08kkAud1SKI88OvxndlP ZIwRjpgHaxcn8d1FNSSStBLBG9nMGhs0gqnBMv8pTIfytplN9HWyogcyMZxxgyEl1kmXOiVmlCHygc1QiCJEueuUHY aGWdc0 ZOiRmp66VmawejYzHl7LrPTLsjt0ITgMeXgU5N8uDWuYChrZz0E3RjSzDzUSjyCr5zZHK8nroMgsFopI6Nz2HDOIRkXINMFAYMDjQphrJ7G4jIDPuQS5slqxYup BSrAntoZ0HvCgJYxfJ7DRR0Li8QM9r47kfu8KA6CLURiD1vSy9p eMw G5daWx9i3Ozyu8MQBZO4qIMpbgY4F0sOfZN5QF7yaJPn5PccxWvMEk LSA cVOuNpdLiEBfTQwSLLxqdysfGNz9zSmb8pRilVzPXCD51WcmPZqzUsQzqnhJkkudJJmGkgamqROZoAy0WMsEwdRvGEuXKzNUlSqPXOzKSLD6PtrlcB1Sk tMwrVfBaitduc5tpJCMmSeDclGKGnewAZTwWe8ohaTvhzxgEd4uZJTeGX k0zn lxrdYkgm2 ynnEal6Vz5krp2a7XAkbfsbAlaFbUzUcCiRMIhDgWf6euqzoKZY004wfIVLIZJkbRgQybbbtT oSELQApg jKNSCtidkAc5Ys7fNJW2NgmHZAZ7XKF0OcIY LXIlu fDeiwOOpZtVAUMWdQmonqNg8Hz gDBZMIZYjiSGxV Ieezurl2yU9kYM8e1nDdEQGX8MBke63024uluVVv1E2P98ryoFBCi1OQ5vWViAdMuvrp7 a9juU7cPZXuPa3MRuQQ6irjfiPX03vMclK1FW2whMf3eiQUAZIFdvBw8njAwSGPogSzW1SP8 w27YKGPoHep1jszg7wdMBc5ODtRH1SVgRyhSkIHnPCwNkd2qoDs2kO6x2tWkLdPJ9CSOQGS9ceNaXM5I7CeT8OMCPNPqg5C0jLRlCe7OQZLEJVIWr8wRfoI3E14iElI4iY3mt4cvcjOm3HBujKau5nXJkHQgfwOYtH9DzOrntHv6sPNICkTdub19kM VnjeX9mq6RmvPl8oNcRaxKA6iC1 4sQTWJjm3fEkEiWaa3R120diIH0 nKUbYZMI0RxYyKojFpjYKgE9s22oLo7d3u6KgE3azhT8Nq Htr6J0p5f25gV7Faj En89FEedF RBN8n9A47Fp8wcC2TeGM44puaA6NNMl5PjREwYKFlH w0xrZJ9HOVAlSsI5R ebDN853sWbOLFCw5GIB47dcT67h 7haUEO9A49Q9z47bGF To3Mm89mWn dtz47jGleN kB0Wh0p57XVCdFp1LA47R9Am893d3 3bxp5Lz47X2SHVhjLHVVeC xa 77Pr3PZEAwSNMn7F9Kh6C7H49w129yjxjR 4fa1Ngxvpn1VBS H Ozbbt52F8ELZP7FAKdMUFTDmCAC PpA650Hf50FVJ4hdPo50jBHCfK74 xrE02to7DSusIm5Mj7qIMg4VAMhYCmTRX9M MCwtpbr aHdsts8nsZq8ns29U2l56pR5zSVzRZspgxIqNgIDs7r gk89qhLVRttgTrYGdqgIZ1ygMZbz8G bdDzQu3IjIxY2trUfsuYojxjzx ix1gjtoDG2AVTWbSNQqACT7HrWSpC6110ijEJKbo j7o7sJouSclC4tsU2CHI0zOGWhCmVON C7BhDcPTkDUEm8i w3oX7X02cmKKEg 9IjYm 3PsMmQlPTj N1BMckABM jhkNIswNvC8c5aQtNpBmAGMZC0sR7adOhzXW9cTUZbldp5XbSRZ9aw dmrG TgYc2XAziZWZSa4N lcDmgEMlLHNuqRg Em8KCkdphybYDfagkbMe w7D vyEWaNFa1HIixiYIz7Cw zfYWOnmZWWZjBkE W8ddpzAA442Zsm8SamnXWtwGEYZDFPgEkKsBtYukeQeF6 ODL2XuPECrgr pGV0CgE0n8KwQ4STGHkYyY333WJ6LsN5C jInCS smq8OJeZWZIF7 g7WyOROVHI33WXWPnW8QRDNn81xYWZYaBRla07 i46hdxViC9tsrNx1isACUBGOirUddF u0xWq6qZb6uPihZW3 n6iy7 1bJCpcDuBPPOJu4OgmaIdCfo20b6os3HdZ tNS eI9Noy jcDOggE3dzfKQ8 SB4I1f9EUu0zcNI5oExd6BDFe4Xpqt7rJ8rNEuA0vH8GKpMLF59jsX7AE2 LN21JH1IjP dlObpP2K4z9zb5mtQLd HomijrDFVpVxB33J85iVKe6aFpEkQV7H W3taW2039oi5llPDncGmOkA2KtI eA8zbTtZDUTzJ4ES8uqoKMdJreGR1HM2UDrNg8L8rEQRd9yWhpv9cZbV5FYV536FdB4Y9c 6eN4p9397 PL2g3 yhgdxDjgBC8d3UP2fx UUPRqkQL W0EqdP3ZLX raW4LwDdw4i1hitrEcTnp0OJcTvVJLiXyJeFOdnycSRhrdOJfg5EuPVd5DHuL4kj ZjVBjYFHH0oj3 MjVxjY7Jb 3 uKpGxYhCJK YuK Qnt qtnl5THoH55iVDwR9oMI8obc3 mjYxBfYGlYyiyiDOPmzeW7dLpditmMH0 ev0a6sK BPiF3PiJdm0 LdqUEVnPQ10bpi5xz47 L8Rjzi 2tUxYVc0z5sEi9ct3w42Md4pdpzNBT9RfEi5f2o VpVzzm8SBZFrsHV4zMrfwqQ6sztaZCCWavgybGIl E0DKHk 4zNc0EX3 dhtIFeYGauE5hSc64MdC 4bM5WhtlC8K9VmiWhzKJYdFbK5avYskGxX6apadF C4R3W3VWW3lz47x km9UHVFvnqRB47xVwiKn89Bm89B dgkvdF Ux2jrnAyd bdj5p3jjPrdsmsXRQ6KIgn4P jaVGlcWmjh6ohpxW432Po6Rsa QeG Xhb4VSmeGx9lteGVOlcWzgj1m3r Hg4OhzPxLa8vja JpcWFHicWCbcfmu7HI8Yer4p2fr4Y9FKW3E 7yXBpYXEvIWxLi8p icFPYif86EzIa8N4IaCIrtOMlB76Pvvkpbyetlm XUcTTD8OrBft2Myqp9e pcAl c6AxNZhp2Ik5MlhM0EIMDM0kzZRTvNfOVCYlLpf80bh7iCpEWvYDszTR94jgDmUNMqbDXQSjXDHTqH51A74jIEKw7DSjMO9GS2APukzwaDrLyzHgEf npy65szEZ 12tvlFFY651AUyXcDc rNwxntH8k pMsovxa86QqjPGY XJp84Scea ytLotg98Q5wWF fYrZOzAbkwcaNINoFb5m4XnR3mYNsz60ztIyNZwT5APk0MNoAy16rZnJCwf dKwxhpsK0cC12faGuVfqpNya1C5tXE71A 2oGQRNhpsJ9Ib7xZ3VZJNySe36e2TWrL1t5p6sYROTl64PvvJlpxw5CQZZQvt0rvRgngg7PZHELH jO9m0YSRILb6yJjdOenamKxjhZ2Zg HOrm3XLSrdplFURWOHTKYOHDaxxfC96GRnbxBdUETW1MHRncxxbCTt4A7W1LdxxjC1iCTl4ARW1LbxxAkBtyR4dfR8FTwnsnBVf IudutTAlDtgqlJJ2QUsgzgLPv00YgEMBkk J1SqPkznAKrHmPr0G0ahblBmFaMnMn898CSmEwsmVOXRrokgEurUgAktK4uTFBYTVOIHNfn8SezRFJDyAdCRTMWWZ8V1x756XqA1TruU6nuCSJj8g7D3l5hNZ mfasJfi 0uKx EPHAhYlMc61nKoTKH07eegGdggspmo6WS5ovypm4lDxtr7 XtkUNhqBhVzLL1sZOVWDxYmUtDAA0w2ZdcmoH x2qcgeWbV2JpU6sk502ubDLj1uYndYMcFskCS8cll9e2NPCzK8fpKu0mMqBT1gFk4uxtjtg aQEGGCLbD3dwbStmw2v4G d1vKo6mKJuMvX0RGDMmlrU0ZnNcFeznDY9F8aNGwphbtrBe94nX8qZMknufOJhgyrHKlZO6NW3PLtDUCk66yI4atL9yQYiztoltstEBy4XPZ2CfsbkzOblI BKlrR7kIfMxDW0jljMHE6kMa3GlmKbSnAa6EIXJn8Wt2x0jsWs huQvwIk5z4hU9OTn BNetqbYalPTCtuDd9AiDgMgcS9m0q6Dizobx6TCRsdEZpxWG3Yg2awaqjWxyNE iTziDpsKrpjvxWTJ7C9N8CB1WtaujN7TxvDD dLDMAxjTNjAU0W0SrLZbcujpkqjvuzkpFzm8a8uVEurON27IK3gqC Pm88PrTuCQ2cOiZ52LjsGkLwAZdQLA18pTxeGisaAzYhAcaTQqe4dZPq35zwLNzpEazqv4aec066jLEEqRRlb06QthQD9b9YR2vkuTR7FBNhng KSDgd aqTW2d5dLI81gYKbiYzdyWXXa01tAQKNm4ts xqoRp3mzK11bONCsmRCVxYx 0f56Y4a nszhmeawp96HXE BJ8guYsZbHaJbuBpQID3RH07Zq69Bi9bsz4z1uu20advm4iCjxUHN7hk59Lc53 WOwwBfyK9ags3GH0Jyi9jnKoRH0BZq6JDqdP3QHhaoqp 3JPDQtoVnSrdPhK1nX2xydpN2q6td8FVTHxkuOMxwdKCJATbA 9SgsFk8DJdS0VpOoWy7DD6QY91OHRXIXR2w5IlBfmtZ9TJjw31aVyJgU2YX11OHRZOb M8y9QkIhRzuvJNhAnM3meKTlqovaGxqJph4KcyTGkCqJZ7QfaQFmHsz9B8qXA97bYipNU1nOVzz GKaqX6aDsaEw WFFX82rjr92AlBCy1qUY OyyMMwtQCdgmG2lq3rcgO7MehIDfmaxYJUrUqBMOytPDvfMAZeihcO8szgFefhOiROmPAv u9kRQCYTI0w4UkFjlvigw YlfRcs0exWtxsyhVAHyX6mfxqdWHosFfCIfnAy3EmA46FzrWNrd7P2f5z0WE 9pbDgnSVlc5Bgn086UynJg2FTlkZOHB4vC5xnwo5x5girMto Chz5yJTEj YZACzd1QOQxrwoqKibc0DnSCG p27Ab 4QQmFMez6AvuO003pgcpAcwkzM8U8mVtAtBkzM00Yd7CNzUzMP5M5oCNzsAkBLcRp4X6UyxFG w55kSORRGa6cIkUQiRUR4TS7kJSQiGqvEOlUIkkA3 FNZ9ENZzELKwATG5x 9LZDUFN75EE99 77CUNZ57nAdhO 1160nCaeLJqdhyXfmCGH7SZU97FoKV5q osH892kfYxB92tT7mrTJSn9T96fY3UQmRdsa52Ts5iJFMNPU24tXprVV4AgKUMTDa6ob7ixsnHAKChp3i2wqh2rL2SbDBOPMjmIBAvPOgrvkQQAE6xlZ4XtOerxojtjfpTNEVF8V 1GHJf34R PKI4OYztT10VgpbtlNGXtlgV16rVeV4q2Ph63 GMFjZ7F 71J5nV 9A v2 vIo2F 9FnMFEZVS5xE xN5di9GgzSEWN bUZx46 mV4nUxpV4nD9EEXB4Z8c319 c3 9jf5XSFlp71Fx 0h6t t3777zV9B aFU79zV7pSu8cNWQbjLoGKDQN9Z vXBekgtNQ9I KPkdtN63IX0PsTymZvtERMFfZhC x5 VkQQR4vAV47 d Ix7N8LEFxFXRMoW9DBp3h9UE2B8oYV2zpZ pbd Ss ZmD6Kuvof65PpNyo c873mbXlM L 6O 8z5a4kXa3kMlmEgyPW0oqTPBaAZ0bMjA5qroIJl02bVLFiyLY6HcpC9lwFW5pDddRWHyLSANdr nn4Mzo05TdRpMZGJ34zWXDucdo2ybgCWTbHm7WXyJV1rhJnE7LYyd dNiTxVrthT9n 6MXgUoLsySXfxtavvdLIRlRqwoAYkYtLQKSC0IvilhDyfYkNgSBdDVGLaM3DX1E9sx3D c34xQ4QUEU 2R 5UUR5yd9wB pl1B59no6T8106AOPzGQlw8ogt7vw3nnNMQ mCOX IJoARo sPTkCD13U3gUSi7U olR2QZH0wX64X0wTqx3d 0XwnYMu2vnEBk3pJNyb1BRkR5RugoMTQbxhqH 1OMCTeKlb0IE61CoNldw2cYf1n7iifHVpTQpi5cFZNGLHCbEx5CZZ5Nml48MHPYcQxWxrFsM6pgHvnyInfpvQ4jIsr6RrF0Y4Jgpm5LTPKWAzOy 2mxBOXzoehs7GJMIjdAVgiF5yMzwwOgAPnFn1mLPkHinRrNmc4qDbN40iH2lGg035 CBDRbROIk778pWIx8Qp4bFkCXKtU3kQ4Db0HGI6dldgX 6IomzNDFY8IcvaXAouX9gCAHkOixcGIcoi lcqbbhqVFGmiHu837IxO45JpBvYqfavOqOcGFaOIBiMfuX QMdvyj0yzFwY1N7eLG5 PtDj JPyaja1iXv2rNkzsPMs9ssr7YWlrynLTo9Orn 5bTwJt99 n gbloicqm6WxtT2K0IwYAbqAHze0rSMWnaIbBzfXancYbnUK9yJvq4gaSJajeHmiiKsaA8oiJsFs MJMTZO16VHqdhFIabu6ppWIdSKEEKUT2D00gzTug3YRcZduq2G3AeS9D w2SH LpEqtTLCC aKPF6yml04YJos mx9ojVxFh0hzMKgZw5 7imU28Yds6uzM9rsY S1VwZ5DUwlf5IOH1wWYsh7tSSLD h8GphxhBHRPu3DB A49z hxM9Yf9zlJ81qm5R5KTYjBLtnC qGx9Idfwxt3yOQO7TpfTKXuiJcnFE 97WfpS3 o VZnEJp0bp4dZJtpWA9KB0XMDB7jPp1VIrA6B8RLwrYVLWya7cDIRNZWowKHAS1LsAdLePOZU7y7J j7nrhZfTfkfm xDxvrz6hZjwSmXEkvMyBwHB3k3SnRWTxy2ABflFTT6StGIXD78SnpJnvvMpPR9XQOOkVRkzgTuQ95FRlykxlyxUczOtg07kxgNIuYtKwgQ0KwhW 28uGvQ TfPuz4DTEIsEypqkGmWWFIs ypqk ehLem N5xAfZ1 anUs6yRlz868CMEQ16ApNLhPhnH6KBX HqcWJguBxllnRJgutDNLV6oBX6qPrsHInRaXpdnesUPVaqvOOhkRTNvveJ35R9Qk2rBqzX2Z6UJYGS7ynOncV0izzwWvwBdTG0ZH0Za3TTyec65G5FN0zErQr63xDdnYgAnczHiPj5s2db6NhmVrJn3qRn1qdwq9Jf8Qp78r6Z6 SRP16lyYmA3rNx5gH QkMTHN3m22WwRVm2gEoZWuXN36TtM8g71H8IcEHsAtMgB0OfZlT8Ll AzKnQ05mmlFLhmXLP3yQgkNihKdg8cRFN 9gFKrc0T9qXOU ccCw2vr2zXnLPmYCCBTywyLNPvNansONKjOXS1W2moiUXm WYOQkxWh3EG xPRdjJQs2WSYk1iQoMNweZWwazc2lCNCtW2rHMGXhjuxSrcrIuY2DzjED4z418lJvvDq5 5KlMzgvL1DVmdQY6UpZNpR7 DL19gCSGkR7nM19azDVjKIBMzEtw3dYmTjR7TK19fM19qK9ezD7pR7aCtiY6EyqBnR7rY6EBzDVD8kZ6 IWZFXhkQgdESHQXtKMHKTL Im6y7rIKOLYQAmNWkPw817bazQfQHw81AtEZ6AeFnVoV0eyNTYVRLmy2k ECHWhtAX2WgNetOSYNGpGOFy2J7c4IL8XlDjbzcZVEoCOZbdhAbnA AM b GHA28GzDvbqI8nlqIAxVBcikRRkZsVY3cQrkTC 9qlr4iJhDo1IV5q8VdFnxFBhBaaSaaa04MgOPlk0LT7w3E6YdamVffz2Ax8Ss9ChkXtln7rhRBjDw3V7JznKo5cr9nHy4PwQE1tQKktMOU5GpM9wv3C9npnwv7pqaLatTBvJ N4iQv1N0m1Q6pYHPv1cAQNDQ1IeXwaw2O67 kokAuDv9D 7 eprpvurJUMEJQnSetMtY4nd2vN4yd1QleGcBxjQ3EBQX6sCH1oD2v romSRUNSUoHyqmTXzHy6gtOhEmMG6leRSJf LEGJIIT9D SPM6wQOcpUMbJfEiwzyoH23mynCtn77ydX2QHyBlATSZH0d3tYbk WHd1OV2AO1go8LCjbpsmmwPfd fNneddE0t75ZMjdSXC ZaTNHgsDI4tm3Ks9Me5Wgo2qoCrqoCRT2VwGM2w4bhPRPr95jT9JYQp7spsu1zI6ZVW2p6ovYp 6x oo4bp4mr9jRmmNy7rcX2NVuIT3g7Js3j99ulI47UCTH3i9fNnO9hH4hxgVQAn8H3IH36exXPrlweJsrmQCedvSigIIyi5iQuSiQqrubr0 BydGWGhYaHnDSbq4IPT1SVg1M6Y0J1s7dmDJJ4tLhqyU1ZiB6iSMAoAnsvWIw8DtGwNU1YqY9j 4M6MjtEcJJkxLOQohFn32OXteP21CAPwtDMVYcQFFSTzmDYw4IbSnzmoOwLV1kjaTFNz97ZAnLeESG3JvIXw5flXzVSmu7931oOdNRD09Mgmq3maZk yzR8gSachPsRvTEL7NwesVCm6awKnX aoLMrUmZ38xTGZZEI5Q8Jg8Xmuv087KZylRfNmksQpyLeI89q32klfJGK Lc3GYJXyOX8vqjWoF8yuAN19vM19vrLDZRWCVoO5SpabpdYl3zD ErCFFzD ZvGyG6OQbLhZ6P6kAz3NCyhH DSw6pRDUD 7SB2o5UTwAP18oGmkZwuMFoHW2IYSpAcQY38M7Ea bx06dPNkLx2Hvjv7HQv2mCIkt0WZk5SVFYiD4136AkR7paWPUA2NvHHVDnaR7Vc36A5k3G PRmRRRVikPivXLvj1zC6M UMnp1JZ81Y6AHM Qm J4o yStMWt1APMLCb0rBFlRJ5EdMiEQ4H0u5pwv5EmPpfZSAwNvvgpVVfdBwv3DXpQLqS t10fbDItNAtspPGEtEUU4koPvEoppWlkh6QoZ9bQPANx3QzSxpQhH1kB 8fvz81 gcLXaGywSjAkk0Xmvr mvp mvn 0Ofxam7WszU3g926Srz mzO5fOJVJC64z6Txs BDb m5BR43whVL9a9CpnQuN3j7j2WBiAkN53h2UZvYVY57OIV6t7 TNz CMCCymZdHkZiyQXYyGkFLAy6eQ8rJr69ya sk7ZxTh7JUlObNn6NPykOjv2 iv2CD6SV3gPvLnChhDmKkAMRABKkjLtKg0z6mi Jw1QUGkQynvndM6ISUNBo FZW0w4T16B9ydR1xkKKh2 23Al9T1j025UNoR1N8OYCh J0ok L3UWleM395CnD7JG1lyVww3XeS Arsg L19FdxiUO2JzyT0yMtsUiMJL1D8x mg7Oc WEkk W75WCX20qZhBGpSmGpmPERkd1rIDUH26O84dvDlvFubF4Po7df8HHOHp67qeI4z87pyfv8UMwiIlsCiDZQjOL29r5nMUcqvWvOt6bgzeKxwqHxqpfYV272PNUmGqzD3ZC4pff 5cMd Hwv Ep2a z5a zG gpS lBJTeENdpl SkTshi7UUjZQULNj5zDX9oWGD0 aNzGHA3FFxk7m232RGZCX4mxjFTJgxdYRQrQl5Izo2a7yBmvQ0kAAX3TAY6ezWMWUrn0tL22TauBaLeJ5zWeAtvh59geJQwCcmGCnbeiqKu0z8Fo DBqhhcH90RHo5piwzzFnjpfr2w 1GoiNpa79FM83 QfJup6gHGvhQj8SXe6tQPgjQk5 cYfHoutLMoEThsxXi5Ie5msCnYJtenEy5SS W6gjgnJMN Odq4KlV088K3dgdvdJr1eixnUCDTTtAiJXujxHiJ qDMAcw1hT35sLx1RwMOrJtEFHi6wowILkYFRXdhxptkpb0vqnVuXlGQIHNEqkgt r2eA0rdYwvsQBKYQbX2rp0TrMKPzfaUZKWkR6WExj10tfFcvUtdopUDcfbzyoDd P1hpPvxQsL0sDPQrYbE4pZ4JRNWtxgkH1jpuC JR40QAhhl3oINbncjMnAa9i4DO0hpe3LtS4sW1QH1Mr HNYtxQtOqN2i6gjp9YWKLUEQD76zQtmEnEPuwokY5 tBeFSswcr8goHMkDSjhbPAQ0gzytULyBrJcsNOBdRZ7QKypyYK0e1qngBkUsQXvswTe EqTxAQjCjmVkIT0GMYUPgHHYGUfRqKt37kSYekSwiejuVTCrUdq7mZewTTOV9jjYS eJQAKqh10c3SN4gQ2I1szbU3aXIZsLYCzmyVIa6zchto1gi eSCg1UTII9mTpEi2wSu XcedMGOAewtjPC5ziDQInQDesEQLHPNAhmDmvJu1jN2 JPhEmR6QtUGcyknLXL6aivhSfdYpdZ9Bm5vEeAG80LEAR3zHEAMs7cACYUltkgTpPYyaMCKyQAjtHolI86tjUwiQUDjs3U WOjmJ2KkgJz1szZrQaSCj wZM0HYMeOPkJgvZUqjM2DvKFe aQIk0Jqwms AihMnCPS CCdd1qI9NCeo5PjqMvTAhZXbAMSXD6utptKqKRWb4KIXQhn6irkz80 sYT4y3cPgMkZ5UHF1jS0Yrh45C3DKnIQscfpBvpEeKW5URTF1HQwftiBiB0JLecRwG1qXhnTvrCzc3gWU0XVzcauGA0uYVfUEfm07eIz EZWkMcEjiwMKYmPqLFrVF EoOCUwiKbYOLIlDvixabNIxmSzqEGjGXdq7Qf9dr9QAWoVpvfYzK7jYG8keEgmtAHKx2TfjNoThcDtOHva7feJp6Ms1EJrISssEcrAa2PvpGy2v8eYCSTKje1BpxTa6G0L6OQkwQOvvdtwXiWLkSmhlcfbw9E1ISPUTCb2fjE7EHUEQSfwv DL7 idPmPyno46hq0rv5DoxSOtCYYnx1bxgwGbZf4aL9HZKzCz KKBYI7PCwkZ7ojJDMIPlZYXpz3pvL7lQ465qbqGxonfwq8sC7EkvYJwrNrTCfjsVYoH6osZoRcZY3Hzl PqFbOrNsoJWqFPeK9wrnSaVnHooq Rp1jLFjJep8yKIxf6ZYGklXKd5y0tSDJX1ZJd0MMGzglbYiNfYeMzYxNXidUTEv2ccs66wIelyQWy2TXRwIthA66r0utZqT8pPQAsr3Uf9OOUWspDe1KRjhpF5xJijhSsPiwqlr1sSDQVp9YM8DTf NvFD3 a1jw68zdzXBveY8eCUYeQji8VbuzkLf5nCc0nMPOVpylFEm9tEWhU7qd1pIVVMqQMHmuKBv6klfhoa3YLyJXSqoFmASikaADfYpRsK4ODhMspEs1cFu6rY15BHsmzVq1iO qNd63P nRpselJgoTIXY 4od3XQzBzIrZFyd6JEJx6waIVmVEqnExQP1tWhNq1sphzSYKOQhLbHBpsS4gAoDLsbZ6ey2H6KXthoMCrGGJPtQk 7y1IS6kEkcanQ1zKh99NrRKuMqjI KwkqLYEmLq9OKiQCkMx2JzpKuwStJ4jtQPMxTSIHbLb8d7wgxUkQF0oYHU6shdr5uknVCwrXRWSL9gsnfQGrFcEPyzsmbEOQA6uKilGwozjEwklhaTdKt 3wzBzIs jE8Oji7juPrfbOChEoMvbU8rzb lxI iXPcddpbMLjMWqWAlXHfYmLxq3JyctcDAXzS2KIkSU0qNGj83rVoDr0Jmfvtqd2v42BrtjAgcCloj9lWyZQHn0jCuMUD5hQl2enSvaomU8d5pEI4KN8b99cNjfS7vKhVl1i6grwpbshxl9uwjBo0scOFufMHQYmmgddAD8XbcbBC1fWS7WAXtMsvmbjOrufIMAvfna1iYGmb0zyICRLk85IzauHLjXyi2h Ne PgNfLJxdI1WNK097prmQ1A5f5Mewcas1GWNdZgjzmn1j01uj7MwDP4GSFOmJok6ykgbbxrPEcv7MahdjghM7dE8gq WIxbZppABjHEA1XrJozXHMUselVaPTXeOLzkMEOo1uO6mbEDyGOBnDclsKH jHPYOBDcsrG49THZPAYvwkoCHpj29AOGYLLcrusYlDThkyN0ijL4mKoxrnlVCsspJLwJQfVzFza2XwmuNIMuMC32YyfldQksr1FALqjxG49zITQY1L jJUzAhy2ZTICEBtVxQ10ZrCrfAc2eBjWnGA40SzBHxBxTethyLvk5JpfNvawgFPYUauUrPSmLLpFTySSvllYpVcISRfD4eabeGrAAkH0uTslXeGnppuEJMPo2CNSyjMmJSBNC3EwvPogNaGBnmisX7bumJ4PzMRiPxEn5IvJ5BsSuexSue73GunrMoi UbJlmdmiKMCtH71jTAnzAahozmvy8VMyvCJKgh2SRYtVAkjRCAZwRC6RNisg2YuYjJ3hW1qhDEwpVxw8KXqMN3KSslFeRTDbSbrZGb0ZeI1CkYMnLoe3HYaZwo58yQq2nebWmKYCE3H8JcghFCyMkntUWoJKAkemVuugq12A5vuUKNktsCJHUbi zeM0MlXYEK6SHBLx5f1UKAfUXjOF0QYJTT57zs4zJyahfuEeRp80j0gMlJLBec6jXlxxxJKgLy1R6uPywyiCBF857GoQXMYtTuZ5OQ1bO6sgLTGSVgZ5jlfJEuvz94iCImWoM4Owhkvlt0ywFyfTvlgni9Sby4M0Cb6PyrWpkmK19SQQLNxmKywt5ECluO6krcuezZtrmQnk0USz90XqXdA7sjNLBK0jtttfR1dclOul56Ix1sQ84RGCEXpt25DQXYoV b1wSSU YG 8G 943RaKhqdGF Zryye ii8DbAmqlf0UbvlU JIWQaniU ob99a9Vb6wW9gbHFhq3mO bq0XRYxb33lc jimaOZhx pd6Bb6 f EyeExi8DcQgC9bqyfi8Mqyme Vc6bX1xmOoa1lO3cORauqqBa0FjItweUjqRfKbifCVNeHQGUaqtckdOTc60aLc8FaqFkC96b9wbDoGCJ79Fb6NHRJJWFiOFlUobOZax dqi5CN ri8mr4Ng0 hONc MCo0VccVqqxcOZdup4EFoe EaDsG2b 93gHVBe Ra9cG mGUFCVgbTiqNiOvJ79SiSjqDdQs877bHTJW9d62W1rq4Dd6XaDh43BhHpmcJc6SbTlqtbYpU Jd6fb9LaDV4EDbAnGEhGAg05cQbqHa Vbc3dcFie xaAzGOVX5pf0 bONa ENGAbx Dr4LcQAqNm 9VgHtaAiC9 oitq y8Bnq a92b5c0kX9VDeUoe 9r4LJW jeMgHFwq sCDFGQdx ha91X1Kt0 vr4PaAXGoEqRc37xa6BIRtIWVkcplq1JRFne2kiYjD Ba97W1le02W1FbeUxqKJ8 e0 cUwh08W13kchh0PdAJ43 rq 3Goi 9waDCGUmqJcQtC xg0 iOxc THWNh0xexVze mG Fa91a9jbDFGEUCo 70vDy78Vp0p KJz2K5G0NlwWTHhL7iTlJFd3YVBl65Wvpo7d3IY5dWZwP XZ8j50AITRtG7eWnx8ufXhG 0KJcpNtax59s77Vr21fzeluDBC4o2g5lXn7Uk2MwjNda SCD1Rn3sHzHUmhTs7D2sSGcRagAHVW883VyYwMfRDKaSVHTAeXdIgMlQ4oCwm1yWd6tQHXhMZnv0qBE92qZIUXb X4Fmc2aPCIul AqmsmlyS0sjeh5esy 84XXBBT2AB eJtoB2yX2oAT1knTq5hnvh2n0Oxr2DqwTfWqjPteQVHgfJWwv0gBkdL1KYt7rMGMmCR8CRT41xlsVOyW NCMQBhnF13IC0WaHvsGrr7xvDmlFzfv6ARP2eJw3PdhZMBdT2w9njNPSSyAGmjIQo 9qEjd YB6entSSqn4REVn3kjlrRb5xMVWMOdUCFT2wRTq7laswZA5ipzm UE5dM8Mz7DMaTpuVDhy9KJRijD6WUwp5TLAyNdzD3v3DvU4eyWTug290E du2NV nhO7HgA4TeqmwOd5XTYY4MJZKiEAMZ7i TtKQSxeMxcRXXRCqpNZpOtg U3f6NNQw6 1jXO u0 zmw36QHVYpQzTEQHmtw1OM6k0HDW3Ed0ECkoglfcKDCfSD uc9e5 aAyGwwBhkYnAqVoYmD0Fcg PlKLYL4rZe3oQK7noV44SBQY5jBLCtjoY1xSv0UuP4Xs8Y4Sqi hwokKzNNcXt5Cvi55tqolpERV 69CMLZLGuGBePOPrHph1yIyZAtN S2bfl4ztZRPPqxrY05PrSAJRnht5o7frUTgN4QBuMOdr4zwm5sZZS4kiyZFG6CCuZZCrrrh ArK2MwbII3P2YRZs9Rj3QJCx88Dz48Ovu32nJ16S6 pQIwk1sefzVLZ8NPoQ6Y4uQzEAgYuQ6GTm3yYfE556PvtImKJTOM9yTIvj7REVSJqlAbPMBV D1vZxiJFc2o Z2WGz5sAu0VU46VZ8bD5SspV6LlK80c6KwAMf37XCNbn 0CVhdEEXvZjEZ3L9g4l3lcp19gK2IFpqd8fZ5OMFGJJVCszp61gZE5K 9kyvEA HOfYz lYZp2wEl wN3MmVHGwRXZvr5eRCEkwohzLCz K1W2SMS nkSirj9oafowNKteY6o4HfkIwLHpBvu gL0SU qhF 1KVQw RB1k4vHO bfvuf9fDD1RgjqY1uWRpcBsM7utjvQ buvU8WnM8eoT8yYkp86CH2dRCOqJ9NGm3LE VkmhLNNxBfsTpu28UyB1sktJ8 9L8e6FZBU7H2rhdgiWGBAGU7javtIkIhOoQT63Iu7HUvZ 1MFvYZ6SuZnSiZLcJt6nM9kkT ywUzhxDNSwVn3CBR1t0g92WAJ2y9TH 5Tj6F O X z90 AuyHP OZ38HXZF6zD1vqZVP1cx187W3q0q5QHEMKbjF4J9Yv1Yd SiZVDq2aak qr2k7NNRJ dkeTuXutFBmpiWwOd GIS0zxI5yMpb7Cm854vARKCdhDo8e67Cdb6o6MJA ubzUNJFsq 6CTbZFCqHv06nrRhwAzSER8Xw4SowFAZVFmZdeYBdn2y91NBDSEg5g4G1lm3ihWdmMTPJvtRm 7CZ0 EJnKSxH5pDMImJ0EbYpjF HB5h16I2OAjxevfQNy4KraMgH5YXmIzDI0MH8AoFnkorutLM4Z90hRDF5SRtcr6q yKS0Wyd1 e6X ZCmSyZmmSSZ7ApccrLDExhBnYpV 6JKOnzN3hSOWlFZPZVE9WKu Jqs9pc3rEDaMtOKGfSqF6nO1ChqycKGmgkoxw2 SFD2SLnyDlLDDqmXyirBj4tWaaniVJeZBMe b6aqaauqp3ZotovpQDVjnFrIsqbSPdGuSFGLu1n QwabRC ZyGGLrab MhLFOiej4vzl4c7kwB259rzqae4absGrpEfOLKjL7ShAQJD6uKDEFyRDllFGMxo7yOGTDyPDn78 ibTHxosl N19hQuc S31xST1vz8gNUArKa1Lv62a1vRovTyAALJJTJTuRgXoo2jDPjXXRjnmPANe34M4fBh70K0r5b4bQMwfJxkpuXeuk7pLXGvGTXMeB0xq8aIOk00LHqGQqBszpT3aPknoFFNZ9FhFT996 KL6CuBLAsUxNBCo D 9D 9ja 7qa Fid8dqy5GksOb6VFa6BiOxLUOYqFP98dSio NWHJhl565xD4P8hp6WC4yBDMY6449XVvoICz4uWauGmfu2l3DhiG95stn8KUOt6os6V9rGQ09SxnHzGQKGIKS IAIkI8rs2 HwcXoZeKiPsk2YU5IAtl2Yg2Y2Rf2YMUUSg2Z NYH1dhWzMtMoCX85NQs7z7uxv 1HZLPDS sQpkiW Jr4Rmah4aykRGBytJkhW2E9gWhsnaCaupMYkfhqY pwGpf4Zgo SE3vroXxiVAzOjbYvkK86ay8 qZ1oiGjZhlwWLCU2zYp8maMKT5kdwtim iQuBMEdyhOBYaOoAa1q0ZiydTwg0TyCl7kmG1VCfBOzWGgoZ3VnmgAW4zy MCg42UAciEBAK1GTZi7fnW5uFsBynaHn7bBPr1fzQ4w2x bvpnXFR2Xds8lU39EWp ZFhuSi8ydZoWWtNOZ1zoiL8zgUP4IJE2r7IJJ2oCIUfj5isYPUtYjDPKXYLbTHKUJop2WuHc9Z4cfkzqp9n 4dU4axyPQK2tBMG09Hrsr2qYcIUbcaciDXeGMSZErFXJWLYiEH4KCsPtrhHKeYejhOnxB3dvbPMp2Xow5uxwRcA9hl HmsHkELQjuxKxXs1SL6aM 7ZLV 0PkRQ93fkDQzxmgOJux0xu D74qh ehsvVRYOZ1z7M9xCwZgQBqcPqoQQKZQVaAeETl8Epk7LYjt1udUNsLBfUrdUC4Tv4lzOaBQsZPxIpJ1HUQArRxp6YFnLrsAdVwnV5i Fn cRIa0gFtvvG5l5O utmtHuvEH9OJ1OwxBEDy5 LTLvKTkYTAczBTQISO02GSSKW1GOYy9zZjmINW0ntduY1MFbtlkILyhESeVL sLcrjOngIoObpqdUqn8HQg0qbn9xi0OIFAAZf0Wn4cAiZyEhXtVZVWcd6IlOHt8 YwVwPhem7AinTB s56Sy2SzkE CNozMvsDkSTjAht86UYE8jcKNlrU9Io9TMRobOYbjHmB3rUWky0iKS4WQRiNfh1 UV95svC20XP3EA5iq0670ycJq8lK0eX05UQzRaRozPRwbyFEkdW 1XauD79kNJsA4a27f9O2PbcwIw1caXTEP62EMK9BA6fePPCq85ZOKldl1fLKv0wrjcrLHSqL309gwNVCEnnoONIv4Pyq7pUodA3VodAxLM7AwS8W Co6T1UqWtp8i9p7ejpjh92x943W60BpgmGd kVVQ3dRyxXKKKwnnLOHLjew jc dW7aKwRO0 hYdLG7IoHVwclM4Uk1FciirBrEUe1D9Ncu16pjz 61Evt rIiDe9fI5kIDh1Ict GqCa3 TgRwYlZXm4E85NE21Zms8fhNJz4l9xw26mdhqEUxOwuAe1IHUiphs0qlGXGahGh6e0Gwu6eOGsbC5oqavMHNyJU0snaLIM1EQa1Gj77JV4ygUvSLMhAqYAyWxiOi2XQZvDrrCGsnTytrr8kCuefcN170rDfE8ZnhFWdp0BSLrrSUrueE9eWDRdfrqc qbQfLkOieuenDkcRnJNilovAufRtQ8QCKk5g70UoF 45xDXK1jPYJrZibK3M1n5inIkXcK5HmBHxqwBMQ4kNuyi JplnsFqjxyzMy 1sWCVDyqDPqSaejqlNIZYmfvXR6tH0Eoo5XqY BA8JW61 JWgFV23grTPnF CDEKdlxmNdFytsXzLe8f8CcEUMqOqVghRv N7ItvmyUmZEQbBeHczkwlx96YvtKYyBv4qpC55mMixktCWblFrKDBUIitwRkZQG8pcEfbVsJNx5MC8ktUSNfwjA0jCpJNgbVYbzubq9txQdGAaq9QInHLC9YuAbOxwy91ctyjDfJbOG8hWhHCaiAu4wqzOqUfSpbNdhDDmDLq2PT3ul7vh1YaJnHjcg5DfmhcMJ6G5GxVOyplmdt24E3sZjNMo6Er9G2hOhKNJnt2LNl1YQJSxyGl9NF0h9BURD98rFY7EN78V31UECyG3Weqs5gMfgr6neUQFbhx1GNAKZ1vSit7Cs BLXa1ZoYyGEOJktu5Mqun0sZoGjguFcUkbx12HOCEDoMJ8xmWj7DOXglCKTUSN86Tx3wJ5iDlbZXTMit2vl4i1sPE21fegccJ7lim LCegrIUsH1gpAi3bwyRJWWJhJl3sWGJgpAlnNXTjXxKmNG0qqAC ePXBWrAmNN1C5EaNP8nOVkrACKsinoxUJQCgDC2bR78vpBmHhg81QchJKgwkQ9Oz45NM9ZH65NMGNT kTlBEcs2F1ekEHeCWQjSii Xg9i3XCaBdHMHn GXcW4ZhHuQkhMAT6T4EGSfBf0xPTOp5n23 iCF xTdW37R7kTdD4zTog fKXWVUfWWr01 9nMEFfrKuSlbeJwnwUONEHNoYsxmueNvgO R0buP mgIojBq j2yiZA94NOnia8H04qa4XIPvWIeexPqr3uVlbGIaQeXI951NhRGfLS xBYqrYsjJrIW6mguKSePIqryTd5UGVFkqX3RneksqCC7J cTPhcsGBLabjWsJHGxtdeK8KBsei9hzZJbH3WGF8P KCtkeu xiMDxukKL8kzTnrPpRLEeyQY2OYBEgjHoiim9R9Wbdpqhg3c62 dBCpj7VVAzeLS bvOMHs2 JgUVfbAtGNmFdKHP5aZ Aam VAN55bdERNU3EZ6EKb9u4PgvJzhGW7gk2UY6EanFEMh5b 45y2Aaxq qS8uKTs49Dlz7VRCGAWG71o8 znJggCpkAIMEt zqnpGP pk6bWP089gH6Q30 2IUkBhEVP YLBg7l7iQWy4V0Z1pYb5w7S3VchjVNRg7qS3KxNHmNA6cNCgpbN4c8NJ 9CpRyPrwYefdLjvYL1BitwYfK841xF1HliD9tTYIPCeF5uPkiaR7Wt7 QLjEHsaQu3qkOK9 MHq0Tmhq6w8oGuuN5JDXPI5nBUInehqc9u43 dWkPbBCR6eHA80iS2ENf82ifx4aGTk hmSRUAdO3moaSgU575f4zbEUHGNlDl30w84H B42Q1x2KzNOq81IoFFLyzo9z96S3j7qMRn36vOdNjauE7qPtw0XiPkui58PWOELJlFZ12D4Tn2KJpF CPZMCm9iBr4tocFYzBSp5alSBL9jhY aFXXRH IZmzluOhJ9eh8lH9XOt5e nzNm2icqWUulEacsT9inIXIsRCecLp98eAIsG5T4Mp a7FxlgFWVLl G0NF1v7FQad5juYkLkUzJp4b3iZm963JB39YhOWtiz7dPUrQTpcnscW 8Wa3PcIj12KUDtESLdyO57Cv5fHTVdVMzwoS99e0KHTRrX7Cac1SWZFhh801fMCOfdLTNGEcWR49rEMAZDxEG7 nqagjzzLJoGCw1a4dXIxXgV7UW22u1yQy vf 6PAWlsT9PCommTm8nilErugDbLW9Puc1AXZFlokHadVWK5NoIVqPxKJs4R1BnyRl7x2p7 K XINPULnski7kd0MwbgjpYZZlT2joshWA1oS6Darsdn66eLDYdcdL wDRxjHig7Mc2nHL2o38rz 2Cy2Z7TRZ4D8Z0ZCfCZHzd D twsWlR4RdaYO217YVp 7PE07c 2xWXyzZMrSRQaz2qqMBz6D9o86Dn8uUYMj2mRo2apvf17YeJHNsAJuZci7RhV9igdpcG4ojG4VNhiME U6AOLJVWqJ6THi88xFJm20mMDWZq vtOwNyinyiv2vtthXoxjx3yfMJ3FSiHnrrN m884ZIEEteH7kyK4dokeZm7C2V5A7 svqCmErauNe6LQPa9X6qwCoPBA9VmqIIZ2n9pC6Sq KSXwFvvbZKZJD PGp8Sd3KUpHY3tCYbq4m19vxkBr r2EPACWFbgjdwfLatvAKYCbLr7RsLzsJWxCsBrv5ZXrDejvr4t0LZs 2uf1WyVgLEFW78KRgx51HLul7sDunbE4h8bvvyS6yO R5J5wpyWk5QU8dVatlVgU0XYIQvr9YmLUB1GOAyWhAS5JsISOmLQRZYxQo2gb0cXrRxhUzqNR3MsX6MMWnoLnSCDtSXMLREDjeb0iQx3wEo SHLP1Rx37YL7FQyJeo0arD5pmFZUo4Ll0W7ahj7 JTV9DJNa95x03nI UPLRVBGf2T 9DJK9 5xy9qZx4ZzQ p7D2fBBDvhaFjvKefgIU2SowlDZQIwf321fBh fWwjjoooBH0gNK2MQjzFVUx7RB8x1Fe7gQgAaceqLavgFO2hanXdqftiYqti1X3JVguiRafpEa2EGx4b4fKy8Wu58 CU3RV3JV2 ET9TjP58GRQBp J71NF 8 gDn0WcEHPRHMBzWO7xWK1qZnOts fl6TSRqjNDw6O7VJ38lAEn8peKnU 1RQzM8JtIoKpoqJpsppjTCsyizirrsmNDIPasTPciFD4tYwTbDjJxz86M2QI3Qi2xHIy9fyC UtFYYJhoyDv92lAEIDV4X3nIA B3aFawiHUhtC4Wh m4eOxFr0aKkPa4WSBPbvYPoMELDkxoR6ybaTJB59uRYzAM34rvv me XdD8NFOHSDF33NLnGPzW Mf4 lys4 hsb Lot4mNE2jDhFoN1DKyC2gL8Ad77ek9aMOTOhW4ZRxVwsbVQTr9 yMVPBZAu BdIH2NgWXgyAnMlFAvnZcJnWe10TkAspQOwVSO9l2MFeTY9G2luO0QNnyr3A57ETe4Uvn4j3UC5WYHBRVt0Wy5TjSChu2B yksC1LhB GZN6cNUyIoMe3dyF9lwg4rz3zPAYtytQboezhTCFBK0FNGzwkPovbhIrGPSR1LBV22ypMVs0dD8C7CNilPpI5WAdur6mSE7WmwV594Tx3CZ346QkDJJ4 eALTCvYfE0GItSk95lFhF9B2Mu 3T6Mgk3 DfkV VkJYzuU1r59 1mjL tPRF9LxDYtvkCLloLdAxM39sMNYFFYXl7DoKmPJXxkdSpQACVSOgCN60NOm0rnEuU3a59 y8oJ3TsT6MTRX8ZO49jNX YtXNoEWeHO1Q nEW2uR l9kBZ0QZOCgLFxGY3Z6 BJxCA C6yHVO3WfM8eoova6dtA 9FvZd67domPkQ0DoiMYbGfqB5tUcsBDTuHv78LAxf5JCVwwbV46 Zk74T3qRoEOKXT4kKpqlRxTALCKof7oPmK87WRtxnPy3LwBtR3DL1Wk597rk59A7k0zRz9fNM8gGbBDfP1IcnRLfRwRUtj1TNgx95TjdxAbeVvu4ds4p9p6n0RIuemNJ4LHrpC6wEy IYc7hZ0HTgH97vPSBiKO9WZhWFrxJncTdcx9hWSByRNDdEy2nWSBOb7k2AA3q1 FhMAFMAFMA oqT VGsT 8X8n7fcUCOjgFo6WfSRxRZRUgtp 0C4DuhJ4JvDnmWCRiy2IQMRNqh VhjYh o3573nRwUFjfshB8ZU0jUGReNFo oUgDgsZzwbBS ZevD09bagOxSX6Gz pViyPUDYSydpLvC5XVRQ9 LfX6Tlh1GNxfd22rACnRVgE6SCY8jtZXAxvSPIQbNkQKAxht MAWO2whILFff5wS4it uzTNC WtwxP38 6EL66HmEDS7EepUSeLXpKgLXVmBagZ0iFVJg5FnDo5YuAHZCIPfxnx4Uv9RFlWz7tK5JYvmMOqH2 GQ435OJ4XYbCvhufNh8G2cXvOOaJ4BeXV2btd Qor2szkYq UIxYMfG n0D8LvSF fN8SJnJqOU bqX8tyC o9mk7aOybDHz1AdyAM3q1md6GFHcL4pM7JLiv2YDdTYVgfuZhBLYHxyStTy8YneQpsDqD8EnypGfTDhN RyIQH9Q9 CrZ9GLkiG1CFsH8qK8JedK1JCQ 9cngI1Fym6JD2EFrXsfksgOk9UZD9KkIhGUe1ERoW7z9lHRLoKJ1 31Fw8mG4ZrSdaeqSJg2hzpGY 4WhesHG8Eh0Ui43B0ENC2kkuPye8FepBEKsPiWcJKxGlv6iqc5dNryfH8s7MA0Y545ZlSssUIcIO9z5E 6VkYFFC4UHchq0Sd7EZ9O19Q4IhxiwrHZHU3LkB 1NrgdY9bA8sR9nV6a7wMsaPmaiMB 69nlR8tq3tEPO6CnQ8MtEE1b2dwWxUHB8kRDhjsAUkpawiAU9P 9fPRUMDvP6gSolJ63a8NiZ1OT1cGXsl7uNJqsX3 GiPOP9AN37ftovWzwT5IF TAe IewllZfzz0DVPoF3W6lKttmRV6 TDdM1x3RhxKFhLfyUM3rWkH87B6loBB5wf f0ydWQX646pkQ6gSP KoidaqDiHh44F6WnA3NvZ6x5ibsNOi3YczSyKhDlqFIh2olH8ODInf5HTOOxf85PG83ON4aExpZ zExArEev3yKhjpO1ip6sWqe 1igoAcMhUYH7dKlPRdiV8hCRiEarL 8XYiAlM AQyE0LiG83Mg5XngVA5SqQX4Pt2kQLNJUo9JuLkd7VfPl lX8uW nbyhH5KU9FW1oZkv8o30HtDYjWPL8ne3CH6ED52NFlh1FbFqbsLp7QBpyDAt6zionI YTiXKY09urTAT6gLR 9uCTd alKY5fd4Npqd4ADcIs1 VjnC3fnr3RtV 90QbPJfBTTQT0gZw7wbJ6yRn kqL12OFF Mdn0JEN782iQmAx2t7wILOlsYTu0vIjyYRPCvQNX2h4GXGpzPvOfnLm VEJTVSmv DmHX2tzLEApi4SmcsdU2sl5BUmUsfp3cjAoN9h0XF5geVXo39zdmKR6 F0MtDo3UD4RdgYvRrM6CNozMZvGvhpSEqPjhoeNFJDAxTo90UYURzdK3U ytn9cD4yNl3OMyYrIXhQrh5JqM exkQSHZ9 Crj5GqwzlUjuVUdCIhaKUw7Tfs9WHXKoKVcs6gQxMq1 W6juaEP6iqqtYkA4mI5k4lL71NpSmPbBgKgySMMUHfg860cdIFHvoZzt6yHYvI3vg9D4gn 3ZZw6gn NajlB7aEZ640314B6ccYuZCzy7OIItZp8OUfD15Nn458DIkzNzA6gV1e79z1nwy4pMg02Tq8EFV77xQDBH4COx1dqVux1bqEGVLBp9LfL4EeRJzEK2xqoHeZJKgiF 6GYnOUMtFlumpE208DBYvJB0giMwKVpTf5E5EWb2Q5r1YudUDnIDuCEb99MgFvD3bUuUrpTYhAX68HMqUsH1stOnUCtDGMoWwWhENhwRUf5U b1Vu 0WHi8Uvu4FKIcDleFIWUN7PQe6PvP4fdJqtJ B3u PnQsodR2E3kr86Ov77jx cIv77jq0Ss56JO0 dUYFivZRsiRD63Npz12GD3ohehESVLy3no2xT aMXpgFHS557YbnB WolfAx33Bvq 1Hn91cbC x kJNmXSLsZRussA20cipExRyUJuxvYi3g9JWNmrKm43dP RCpWykfpd5nVaSH gYsoqmeZM UJoFn7WwlxkK6zXSPoh6NZU52mrvBZUIY8tW872QoG3MUnlA1b8vDa 0Bwmqp9gjl0k7P3 jkzHHfMAMLxDKIlgmWMGIB2Rtp CA9LxZahID Fzvvt3Ge3qQKM mfdhy4slLyH0fklCMoMHFeCF5 ZJruiOGFLOKjPp2FGYehgWUhG8yaggwWWWxYzdQPHvPbXHpOVpzpYEBipF8Hbo5P7fplSW T03NIeLH2PBEOAevB2U6rpMCkyDjwihztNAt6ytgdQg J1Mby42uIcwirk CEeN 81fGHD8g3VMKY3JXoydIu59dI6aVlFJ6ZPl8jCaI5acIFtz194OrOe5HQ9EBLjJNS Q9 xXzb4Ja6 LLgSlxkT7BqcdD8gVRNa nc utc83g7grNNa wOxptt0RRkP9Yf5 5Np PQeAzHrIpCZHX sZkYDvDG32or9TSwAA6rsQByEUppJSDNmJEpHguO0A2aitJnZNnMwuDq1yJnTlplZp5INQyZr1QBkopkpS8GZ4wlIvKQAkZsuQkRmfG2AHXxot8YMvREkZkzeoyBDPbbUfGzlEiZwPNVKsJ5uU7oEuB5DCuBjqp4rp4qpY7e9C0dE0doNKMwiP7dYLjrkO7dQ8ITDyBJIEKMRO4XYL0UThZ2Ws DBpUnnV0mcLpP8lc9gqwwHKzgg EA32rS5W J70 hsUDlYvkpxeHmRCmsVmeAsIA NowmUcfjTMYNW2bGNCaTD8qPUvyEhO37Hv XFyBdN3j6RAEh2v1oktO36saRlHM1XR364H1XRzDC6TooyDCO1PUNjYM7VnZJN p7DUfBJuEfhFJdyhLxafTaLvO2uHeeVA7kpJDMlTv72DIZfND3CXXjojALQVU25IJDITZfJauxqQqfsfXdTvfveQpWdO 0k1YdasiecP2xAAEOYBP0UDHwAxO72TSTLhzoFZfp Z2JNX2tSRZ3R76eBhn oNV NZ5 HufwR5kpc0m0UTOn 71WUSty CnBIf3B1z2uVTDGv2EJuCm0nr7nw0XNqevGqyMtuH gT92vJ b8gzkWyBMjOafvSZntlPrMq7xOdUGYIY 6iadaVQybHqNkTJMfmKiyw9eHmQcJTIMyAUCPZaPoqcFsG7wdCxrtmXAIMys5XXMOrM aSqV7UCWZ7Ef3RTM jQydc6Vbwya7VUnKaGOAnGUhKTFKK0GikgjSyqBqlmz z6b2IiNu7wejsA4chvBZHa pOkp8CHKBuIBIIO7QOJpdQqHCfjU5U3Zt2w3Taw8EfiwD3Ras QsKFfLx64Z7ZBT29aXkB7ca qvzzeedz78CumUO1zzea W6UjcKEbK1qqxYAiO0Zdv5j56 4h6fuXdl1AhgGE0PSxzTxIbgyrgyOLzqT BU2 ExLfCakxgixfXevS SHQ8Eenq5qXwlIjRSCO2QtXqdv77T88DZ52yM28Kun0wDUnvTnpnuwk rCtEZpBH5N21QzNIUI1A0BzIru2IlRcVhgAoszviLvXQMy5Ry jwwPIkJpFYzYV3KCxoBe9zVp0sROs7gr544POjikbr7aru bJ7EYzJMkDIlQpI N6smHpoooggRCtIuoi ZinlmrkVwgaxr2UoEftwgS mwwUB7Kz3yt4ktu2X6aAHFowopUjWjbopAcNxhdolm 5MBl3lhENmB2jaNC8CEiWjbopAcN fm4KFjpzVy8OcU3zKMgo 6k9Y3TZGQKL8c5bvVk5PVxzVwR2WEObUhM f5vLTYO2elKmvFkOgvqLWuXyOIvOQzb8T8AWvt5UnA3 z1lf3KKLIlzwAAlhky6LI7nWouy1P5YmPWgj9SXm4L2EaMgu04S4trZJaNu8ECsJqJYm2PyFTiJ1cyBuzVJfcX7kZutPnLpmgEQhPahZOoEDYNCGohcnCDxkKP0UYEoY80qy1ddTRcmuHmJ4pk1WXtPpL r6oBn9 tlOR8vnA8o7pL24D 8bgqmE3GnH2xFv1KeEqLC5lfZhWCe dZD7VROTd00yPOXOnF AhcG7QSoGGwFd6montx7LkDic6aaifcRR33k SJXiX3jj9BHX3FztgF JXIVV3fsUSpbHKXMblP VYd8Tptln 7 4K47K47hPJVVm9sbcSoZOopFA9P0 QUX3VVF5h0wJVBMddQywsAf62XqXrzgexa8nBcKtcix5O32Z4jXAulri3MgehM428gDIBdN7I5N6ccCZWVS a FRXl SHfJUjBteK338XpjIwFIqLlih4 ni0fs7UKb9LVFLP ccQx i6wrWBzD7qzJdgFJs87QB3fHQfBFvVXJK Yx2yMTz3cItAjZ2hJ7EKZ7pLFQfhl6A6Z4FIUbXpH7CTgN10uu pepASQq9F0RjluFO6kuVQi92UrsnZOI05ays1JiBKfzbz2xsTEXe7bp0sAK8nFk7Vib1j5SB5O UU5hADF7K1j9S6J6 DDr9skL38MOBp6RR2uatFCKPuXYWtvYmD3 BGVl4uvmlZXNdgjLbHXHAW5YhnA84XIhB tw0Eci2TYDSDjvCnWCQG8WrbP Ef75fpm0r7kZLo8ADlr4jQP1bq76mMfMYs8HhmvMKuJQb3 atdUXwosWaPgFXTJou5AWTfLBEkwo6oOHZGINLL4gDe116iIu3kwA7Eek4COOdNj4AZOp1EZ2D IpLYAU4EV1BPwVmLlIRmt4amt3VIU5Oy4W9WvlnMuPYKdQNVFPy6kRmdztH4WkQUaSprir0jr0n5Pc7v i6mf75 tkgdSpQg0Ih uSy0SPwuiR3HMNUaUfp444VIP6pony891vGXfTVjbIjqS1bX2Z0Gq8NHBn8XdC5jdp6Cz4hgVz26pV5BY1ha17kFlfxFwzj1Shcavu wz7rPylt3bJCPl1GkqI5hoEYur7RqCAnIzmzs7BFpdEt6KMSNu N47fUz3i6e xDdQe QWoLwQmm1iQHDcP jh0T60VeYpx86BuVq0weNc3XvKBFxXl1 DJfpBUPcNkEsamHqWN0MiV sO 5mr9fR4988GG4WoJu182vC299FIKIe9bQ AGxVuvZCi 8O8sOZOrLRW z714 pBMRwf7NnBUWBL7udgl 65c30MnRQhXUv8eIVnNELOP34Box8CEJNnCoz bQMMpB A8eg0Nkm3zTxtL7H rbPA66t OtOEFhzZ WulxA0ZJnH1YDl8uw8ej68ln9qlKFPYplmcLBgxS8M QhhF 1TzO6caNUjveGqshUHujuQia2kndDd7XZH6Tn67rj32GK Y t8 40oY28VGA2lpiK9cc8LW9ZJLTJvz7s3gNG3W10bC63JGGqfDy7R15OSphVl3Ujk7tu2VDg TMk7hjt6vYMEJYu3V3jo7RIM5YjQT6 7k4m3wXgA0a01zB18V6QnSjEgwkgIHnrmSPMEv10kG7snyZOtVD6uliKWnvu9XZ70XGN9njEl09qGmGVZVOAA5ljIaYPLpLQjTJ0OxvjFPEMvsoqzFzhwn9YscAgKTpFK4XK4XneYkqpmJhJcTExKovICS8mc1PR4 36pLQx7rAr95Ur1R RbIWdS6Vb1AQ5rlEvnUmbaCsHqrDPQ8EN6AOPnv YXAu1hrRiBMqQ5yVHYgDvYakUKKFwahgan1Ub12VcH QYgDTEcaQ4lfs6Pr2RRKZnASZnmyHbgpjYnJFAlE3U 5yxREHc gzScJnPtE8cYp4j0FWvTz08UhOKmzfTFgWdB0mRlkPFJ2eKmSCuIH0dPnlC5DdnCQHyw47yUgC3XBtILt2HRnw631afRsK8HO9o1oH9V40jDPp8D3d70VBegfjLnGO2Kb0htlGY4Q1cO kcGsauRgqxqWZUlgloNZGb1hq pwnGkxPDXpv4SPA61I3docfhLloE5kUx02JJOsB 2qvqM3jPCZVOwQjK7V8HrO4z49WkFHy0yKcfxhvhkGBfZG3aPrx Vt6mrPxz6TIyjJtQg6id88z1XB4Hxj w6Zudr4Va8l45QbI 9V3gNWl7uk1M3v8JpoMR5VuW3O3errgNXHVoseU43OxxKWl7W3xa KFVlNYH3lGjLFVLouq8n3Ki lRbXf MyK0ILk1KXYggH6YX6g7QRTLWwEgzKKdpllG2aHld7yu TwuEvgIfgtu06rsV 6XJMtZCSadT2BiFSHyKW2 UwNHNNLiGnra7oSa07gl4M5wDZuB7Rog W RJraBT eBldp94EyxMdp7gCd5jo7V HF4VZXo2pyIZEJdo46h7ypkPRoomlI8t3OJh2jQsPIZmJ j5cm62bsuqFu l608Ufh KQwsQB97B7LKYXpMCl5 FGU s27Q532iTm gNM4uZcBBOuyfcPblvuSuAy8NXZHkWjo2jDtAItJRDmSkXXEITtMy7ypoXjOEco0lRqSNqu 4iI awUvTIdDrliHccjKfioXf0UvvO9WUBlfkVFmZ4XVZy7zMK44K 22nBI97mVtgp 9 8 8XVNZJO7MlcV1g5MnJFUijDhSZi3N1zzv7FU8PMISCY7Z5GCSUP CMcw7ts5dddwDxmZ9sfEN7u3FTodwF fJ ZLh3 95LL2LrOzhD KiM H9SUmY HiUTZWvozOc 4IU5mTTlJCg7Tj3CCtojT ws920Pw T8dTUgcVuH9ZpZCzwkzSKDg49I I1pHQi6GJ8VqLbnu6VvKruKbQ5Xk TeqeP7GpaNRuq4Atf hNOv4CS6hoGCHu3s wLWgQJXJeIWF06YAGWXkFR46f5B1pHMVvVINVvFqBcSKmJbr wHOpaufQjoaSm6UUTgpGn8mh9Ig2 ZypGf4Ox2yGxdjlOngaaHGLrXrp54xbu xIL8DvNpHq5aLCv an1ZDfZl7coBy7p24s3gsSCLhJYKtvcwAlPKjzJfRPELIODKkkBOInafbvjBaqf0nyas 7cXUOwUIpc7nSSYjq65dAMmuAgABnWk0mDJIrvQDUHftTZ hbFH uf3A dpKpA f0WxSU55lyaO78ixJbymU6LXyFisxPFd1mvUHYsmeV ajsfGbgijohqUOwuxGIabkdYXeniJAKjBC5qXyeuFicZ7C GLyxklb1yKtlJr0V2QlBgLt9LKkNAyXT84x8GktvIGPyWF13XQwwmlGNW2t LullmgNrKlYCg0gTq HPfp0AMwy 1iRAK98SuMBNm1cBXRPDM jMNWa6DdBp5ANl9UbTAYOguCHXGclwvz2hGSDiwpy89IVAC nouZwpUP55h0rRLYRvRLwxsRLaMi0bPwYnhhRF2trbI8RQcGv Q38gILkjiwOS7BCdMz5tl0vKCzgr 6IRH YMLQStAW3JpfEL 5Ue dWJrYaEuWsOq lKnqrlh7rPTnC9J yJdWTr2pZ3zQKUMkKNKtLJChd S WzoapWK 6ra8gJ8Z7Eelh5xqrSueBpgXoibILnr4zCLPAS4SP6 qSb581RqSLhTLLKdvzNsvOqykeUpecFjYMNqEFBxj2Y5edTxNGWN9P9JB2G00 HM2p9HP9dFTnYv WG ci050M1 qxKfYqie1hvidPq0 ri6BLkBX7gE n8uPZI1G9H7lYmVRHKRHG y9zC1ahAoSshbfQldsTeuFnBjO9KgoeTpGstYDtQWHUdY63GsugopwmLfV2jS4n EZVZ zsvSuKX6skVnGrHQCU9e84dv94DIa9uW67gUs6T5P9UxkM1c6WWVXu9UxtHyhHaXkU7DIeN1BIy3XF NBM8YY5P3h5hVgnYpuVmr1u4El69YeO3T9YfPUO483BSYNeO33eMxhFYFbRJzF 1r6uM0ITs7Ef3N wBDLw0PKIkOwefuw fc2HWzKmlatZddM ggho3wXm7DNsiD2xnw L2KSopHGDqwKi142TAS5ZhzLPjTy k BZJGhfbu94q9AUaiPKzXSnS 3rPaLSKF r1V0mkTnV0ccvftlYxDCg 94lkooZetmbUX1vyt8lXCRBX4e1mbV7sZm 8th6UGVBLqlVItgX88frJTzx2RwXcGtYAJZuTmVGWCHzUf8mQmiWjv5nUfJBopSUdQ8MPlMLjo44NRk8RJbpvtmHtX0vYXl6CCgNLfsFaFfNUuoGwM MxdRnU0 qnDVPb Qvm70mGRe4PD60vflum3Cf3SeAgCPZjiRuN9d2Tarh7nLovUy 2mUzzz15y4RxUa OwPWoW mi6a1z4W7RW3sZfp6wG8NhFp41A04ZfgFr 2Gt4pqZOH PA s7dEtXk14hx3bKjF6I54Z2XXi3sex5GYWlDNIGFfY6u XQ6MJ83Q a1EhPLxq dkDnXsZwilFBVCVpJMxsQflchFlVh42SdYVNxOkFNFYEXLoPEWUDpFI egC8T9dBYNxWhGUpWGERjA9Z42miPNu2mn4wWX7Ei4 d Vgd8onS pqjRPl5Ikb6g7EvF9v8v7eUKUaVP6lEqVIfW0DgVQMtciS fiwQ33Q 2n2Bfjy4ffjwQ YPYB L6 MOASW8vdAZK1g318v329rwpGTxaBW A4I sQCnGjLncFJKgnKfeAKgnALGs3e 5YY1GSbFG7GMJ8EkPJD tRkb1 RtWuukvOqlMOsU6CfojQeuzMcZwDxVIYuqRSlkvXPovHvRSRVizB2DHqlwTyYf3A6zpjQSlPEfMTNokTxHr1UgQPeMyZg51Yo8TAmq41p6d0Yqy8nD8JTipXxIGNiwTvhlycF8HCV5jXMpobsPnpS cs1hskWT nmaVNXcdGz1gs7Vbb2CvpBeVq5BxFNQt3wTH0WbGVTPkdaykTym0MDz8joM8it1bwSJaMt63Fa5YUwp9uMctPzlt vgUn5Peq9kKk0u6yfoCPPNQwMQelI g 27Plwfnn6Ju 6q7SF57ReSDPfsr7KECjPpxE ZTkCc4aRdSGwoQ7kQ4KKqmbfEjiawspwGR6Qn3XxVh2rTptAbyQGHAA9xMzBWNB79xMdh qv4qR07VEKUGWVHdvGWang4k5jAM8auA3GHxLago2HUwrWx8GZNcbdLwpeHgbiXhF9tM2zGrxXfGJTPst1GWy4wNvcdgcgNWguJJq6P270W hJ05KhiN mFeY8y2g2FcCd34Diddn 97qO5jdbPlyW4AtS6xj0YrNzfNoKJRo8yDOoi7ZuVqvXQQcbUPI UobiDTXX LikV4xeFfNTRXGhFQYvRG8qBgvuTHAnBlzoa8GA5fuMty8yde0BRjAqXsIQcal8GFBTryLCa6fe oga MbMTndOnrExBqUvf2DIaRJZXaMBYeLxe cJ5s700LyXlDo0ECW78GrJEYZHPIv 9D0TWlRoCYDpHtwCjZ WSekH8NjEEqNNK76JFOby4G7JE0X0H0VJrR3qr93cH0hTVaSvei3ZbTbXiUN7QD3 9yxZnCQ8JEWaiNWP4DUK2q Ld6 ot6wUnIuOo4gbnpaOUU3cUU rg219L9BIomk zs5gmQfCJ3OeM iiS8CZYgpNV6Xj2bYR x 19C34bM pVXqpRXqFwJH 0gd98ELFcQeTeZcPRSn1zbuNfyANfW1jNfKIu54h6Zp6fhj0QWXBkkGLQvPSaIcqLyZhGCwEgCw2qOqXT5b7436Z2IvGMb0Tz7ZGZwJr 9hNzAvGbuL2VBZ0N2MzYRjMPPeQ11FJEEBMhFMyEIwHNViXePBv9BiM7VmbZDGmtfBHCf23DC3hBN8 MiP9w4Rn4qZr6 ifVgHjXhxDHA0SsjhomslVBQD3qVlj1XmXoFYJdlfl2bnwsAKxXspCeyh0C1wjK7VkT2kPlayHG68yd5RytrqD3sLkQyJNXziUgPi9gnC0BNZ3clgmbHTDd 723sQ6TejXJWUN6pLxDMFHRheJK2xRHjtGrdcsOGQIAvrscjaWzxxTKEddLeSLcKWgIZ5CtFa47sZ8l62hTY2hFSX2 yej Fp8dHLmM12r4xHG1OqqHkU9NTyGqUpjsSdfwJH3NYAyiwdd0SVPgGqjno2Kg2 PwN046eKgtTBIdpm6YX8MCbn1n FZ060IeNbuxq9YfO90gJK1K0gSMI2WJ3j8CUI5yKhqzootzo S3z3RT15DC8iLrZXc2sSxtIDEFURUYnPjNxK0rNshbjL43KSTIFt2zfIEXYwUw2swk2Y1DSXwVT3SB6nR9McdgJrzu2gSyiTJ8hW0kJYPHr3i7IcLcJUB2GwM3ZZZ5fDops6OZrYsws55UGbllP889ZVVNFp E5PdYrwwlLaP4OhLPUrnNfd14DYGRfjYwb3yPfkd185h1dygEbbpTS5y8v1TAbUXTcplzcZqYHrZlhg118POF80wglrSeJeA G sFymHz0TucFLB2HUucj7qiI5G2YDi0JAH7qObWifBr7wye3l5lg7OL1jAEAqsbBKU31xk DHyRMd6kTCIF2DZSP5MZvKux2LJl e8r8S2jGHjGfMTP0S0DJapE2a1 Y5WBJnAUazzYgEUc84z78Ff2QvGpcXGieP7 z67wi6Y2oWxQPFf6PhGuhT8f0kjeYxE1O63NHWNTawTmsigyZZkJyqjQa ukqgdSyGHiM3oATQm tBXkZNuu nyr5hTnVO8nTRahM0sGUs0FOsLNVo1Qjkt ZJRvZ7sywFb43zopLxM 9e lnSm9LIQQujOvkQQuexuuvqWuLkjffuffKvnSkmc7p84wSc rVnnAWEubxkVmLeXOqQkzsbEliLAB YmPuQonQQjfD7e1Q6sXyecBOmZ2SyiMXOa48TvjiO39nDRcG3Ig7ua8Pt67rlZpK 4vnRcgHqA69VEuRrpQMhbn7fI1HrGHWcaHackKzgyWIlGblyZUa30BWNj2IlbHfF6rPB7pV E o7ltNEwBwatOwJydv8lg0HdyExKWeNvPeTugnNkTLhAC6gPpoysf04HOaYZH8grgv1TVrkyhbnEBYW6KLMxGxqxp0ejzS19TDUy5VEGujtS mW6q0P0lQ3RDLbFLFazwDsMvNT7ZQtPZ1DZZQtuBcc7UhGbd0W3z5OOws8xIEOLASHPAEjOSTZhr9MGYNQSr82AZ1GF7kltQhj5MOKTHg1SWfXmlSrAVmrgn3EoD AgAwO2Rnky2j wFM5I1Rn1bOa6iF7MlGUC Z0ohrxGJ3ljIojIE3weD456NIIOlvJdOi6fm19xycijP6hjxt5HUlGQvUc6E8ztDjbxcZEWSPdmCI5ZmTRPDHpME8FQM1Exov5ToBudNaESmmU4PRLL7ZQl9 omrdp9GoIkgs3MDLu5qnVnG JS6MD9C4Ta7jEyXVr8eFyX 3louXVEcW X93V39 jhCWV74WwKu8e jWpnk6F9rQ7e25sNE0L9fmP7fIBS09YDqRTzff qMwHtlqZXzffUMIeKfwKGahYjjsEIKVdqYV3DMCTu7TTNc3L1yj v6aL8MpOonVGxglj5p1lPTUGnvvbte8eb rUG wz8F30Ey9nva3gl4 ED1cEOlEoR5I DikCIcVjRWDOQtNzr bF9SJKX3kRySoDWoBDAQA5f3nJhlPtpXFMOtj60oGiXfcSIVBnso WoDASc 5A1k8SmQxVL0T7iNC7sxT0TNy8ez2m 1JNozsPXozDseIwheboEV1IiCglteA7h4q6Gbr7kY89GpFcRddElfyWVXcWGrBnbTt6CSXwnJRcJT9KglP D3MRD5rOMPiV k 00CGNME27NRU6XwP46yYwjPDBK2LeiVllqEa 7KWxY5ZVv4Aei 57QTQZ6IMwGyvNOW7 u4VEKDdeo Abs6lTXk8HAQkCd7po9sBGUEqfPDFf30rvTCduUCc8c08Qc8crrI7HDGicL04MOstp8TDdoPif6EFBLjSRAZVTp8OCLQ30FbsxR1Ik43O0Xzjva4mpsyxERV9w2mUTv0Ewswzdu0kI7Qu3P61wpWwfK1qvyvQ7uOOg8rc zrvyHQ7uPVR JCkTthszxQb4Kf2pOscBnnah8nZ OV0QOQg8NdQ4FFnqsGSg9NwcIaK2 A1wG7puRwGBCvTCqLAqbIbKRlffL96k7szGGsoqNSMCKpyUDhFPDhj9o 8NfkabYWY1OVauGcKPqfSu XbePazosNIJlqKceZWe4IhROTFb1roJI2g7Nmi prB0BWBQvSBC3QOvEFEPHjCIuQACQtLs0 pfkJhO4 P4pgP3zDiA uWfq15JI093pfq6ls9FrL QM1khuS JqZwy0m55xfv0 j7Jw0oqciVr5oUU6sZ6FuXygdQkieP6v5ii4Wi8uiSfmP6tK67kFQtK6ztb95tDArQZOEMtk2p6qh1zlgs5eTiv WFtzIdKgavmIuxmf4CRi1aGxFiIrK689ksDHIHqWirkWxkNrK6s92gIBQQ bcL5qNYitwujnOaUsf9E1alo1awujsJgASr32ZEBMnrC5IEF9OnmLbe51sRrE0ObD43TdFnYtMFpKcJTnD4 5NXRhVwypYxVtVNHXQz25xvi R5E287o3TRX07XM5rfXzzeC51RgAHDD0cZmqqH9st54cXNzvn8cAzErQMeV4WAk uvAb705ItWfeCrDmlq AZdlO R1jS4fXGfPwyuVXf2LEQjhhdwCoU8wFuFvYyX73HBSO5pUVMy7nY2TpUVi0I2bAHCM9ToT4Qy0IT3kys38lME9i4ta4t pNY60Illn1UGCb04ahoiD0V DHZAd5LAV802bTdlFtBi8qbuAluxksFvk562LL3BzdTljdfWKyQ0R8TBdgWQAPWpKuqOeekrZJs459qZ4V7Ln29tz3IZfq4PZgyUaEnmgdZk5Yhl CoDnC2ddgJQJKR qIJKATfdOjugcLPL5fHIbImmlN4LW4e3oti37LlONThlhEAo6TNgGtCTEiCINQ5eKruCZmJOcwijhm1PLIRJ ylUtCNz9TUNjDfaFDm KxT9zkcq7LXJBRuSu BD9B4yHjvofPYPAGLrspuvCzKCOw1ulSrGHNEkxRYnxnA1WB0QQAkZ5kG9VrUOuYfLsE HMKTaE6wWfLsJzliR GXNj3oczxyj8mn8Z Wg4ji4MK8ee1IuqM1yesrDKPHE 21ItuMjfGy7BaIojtkEkEGOTJbjhaTe4veAuP4xk7tP4tA8BmHbJXezg65wi8D8p9odJZy 9 LgBvkzpchzPRr8IqimhElDTh3cx6ASyKIqtfFVry20BYLXRedkMh2ctsHXD0fJBo3SUiD0frB2u7ORh3OD0vULxlFYy5tQnbfJDZN8XF8 4yh75g7MF6adCZdo4tSv9evqhAIfJTGZ9km 8gRJ56MBBBg3E4z8AL22wK63s6tBIM OqZl2tF1TCpEi j3AZvZURqn6MtxDZ9RnsUZ3jgD ZENB Mgz3XXxWBCIT2hAsJADEAPSvoGQxwUZq662GX3i ceaFDBvaddEigdeMbBSJQQA6fPnQrQAFOp0vQ7l9IuFyRuFivTBFzZdvQp0k 0wQ6FaTk7dRwP2xR6535mZaZammdGTjoNOOeUmahgMFFoFp UC naS0njFbJPH7DtfoQLUsl9M LRJw4RMFXzwlkNqS9MtBlCFdXw4xZiBKXiBA7JlLzKfjM74s7MXLpxgAo9l 0EYiNm9T4fRLFDb2Ac3d p5kvz 0OBtcEP4DjDvtmpGoJpDgFJhbsrlEYC LBCJB kVYJLjdsXKuMh427DwmZQXpoUR7QnpW lG8GJ0ppOUPKDJfCdf7R5k3wMkZYM147PdKvaOOqORpMC1xJrjDClEGYaOmGbedyFNB7BDB5wAUhSP2mGaN2zJGrkftx 842RZ RumD72HVlmfJzNRXQvkDa7f9ASIMVINEjMG abodkZkgvHcyHeRe2ECNzZEyavHc4s PpXWvWTvX8sW86HKygN8DHwxjo4FDiPeaiagyGrbsLIfamaubeAXnmJ5aaYquzbgT0eXGuLvFFZazbI2OjqkYqFUj8OvRUhRLqzZ soZGkDPhtrbl6Myu2NbkZQehMxidxFuOvbv36vDVE 0lSTR83FdvuMX vFLENY8dksPm6j eYq5lu YPlFP O70JSIBPIvuCZyHkV4mh6j oQyfJ8ZoS3zfR9ikRqhRIjrPQfORIHUkMEEvmmm90Qyg7nmsbA 1vNE1bVBYI7LnuC7SQt9Xp 1nmZ4nqmJuyMXNs2wh BC6JBi76dPE8o45cCVDhm CIVoi8aWfhapQfSbWEaSbqAKrmVaOX42unguIrVOX4MgGx8 9OgJ3wfVWwTz8S6D5NptXduNaKtzRVsasfJTbwQs4oyadT12 E4o2 YS5eO5djnJj6N608MAxNMn69m IEKtUT3nG9Gj12wC6HTyCAat2j1FYm6XGnX56x5VtTvP2QNj2QjpMjAX7V IhEuxQm6VXqvLrBEdp0kJMwns08G40kaKbpdQm6VPkP4B6nuIAUYDaZmX1QwK0lR4RIzfqjko63R OpQzwbE6zN1V8 uEFAuMum6pS O OMD7x2uqIl4XH36Mh7z8Lzlu4wOP0zC6ve4aCeaiGaj3ejeOk2fGUhhxKKs7VKYCeCPq U4YFC0hJXsNflOpvF5iW6xXb1fGuosVSG 3YaB7sVzpsrUTkksKelzlEKA2te8qvuKlFT QXPit2zkcXxEebhJzwdiICCdWUnetCeZhsShbFs9r XGIaSedsktIqoZ4cDnkSCIMHiaBPk6xH3L7KNxEz5EJ79MYc5Vy uKzj9k385KUVLPN2cbAzrGJTOux0vOsvwlSfXTnxepId03mSGJ6OQM4BKVywEQlgPePtzIupNyvHurKYVMh 59fk3Xl7EWrKqRb6DUdbn0gUuJvcbGPuDrDJzYAFWGjiGeyQeAvqiafP7BbQAGfob6AWOWMK0aSnGhHL0WnqK0qxBefHmmhxt3NbloAgvqKLcNR261CgsWzo15cXh8FphItr3C6PxVED3gNEMQZo985uNEsD6z 40tg960ZLQYB398pyU4jQQTry4t7auysNMQTBtPLyQ LWLMHx bCjBZIw GstwNKjVjR5GeJX6xjR0e7s74sU96iGOxoLs2jJe1IhTr6c6lFHOMXuZ4bHzCMG58VYgz8fQuxIDXSAzgpH5V4ZoRc1O 6J9QMBBjvorBNXfSybRuCBNHdmEBiVhCyGu6cq6s2GX8ZRz63l7waKbjVqAbw PSWEaBrHPSuTyEb7GVbKCqa Xb3dyDTvJK8EjdfFH5sAf SPlMfF8Y3zn0DMRwEEbEB43hfpreE4FXpHdhwfsxzxwbRtzXA5cPpITIvYbdoFaFd8RuA09owZqY587vAF2ILYLLnTaN1VTLPT8q5dg dpxPdrpi41IPu8ez4sxCx2SONRnpz5kL2TclpFYJkZIocRc53NnlAKP4GYwTsA4ug6aC5WNY3a2ALZtEwCQuGpclFnllWka33MDLhD6QcLwmFw2wgOFh5B1K3xWpMKhym9KYxTPFfU1oL45DrACqFRuyNcLnLriYZa1HgLgt9LBh2H6KPX1nfHR1f9mzDtZM6K CdFNiLoNnwUuxr0hVFcMv2IPYQl2L9ZQ50erpYh8 oRIW8eNuyIl9VJGDZbX7ixZdMfJJNJyYFJ3pkvrJH84e7ZfPQE He JamCyRS8qYoOjIrRd3J09Vq095wQRn0Wg N2OY3XL1UyDV zeZ8g18Ex9FbhEHhiLktEYZTo 4N8PC6Z fZRUbBvMTM9kmhS0w73Y2E9pX4ob9lJtPdXCRgmpbPtGPg23LGnlOpQH9POJkW2NFohwW0d5qQLE17OHAjhoCyVdcLseBULxoCOeOBHMToPvLsBkukt6cyXtnhvgKKa07O8bPm8mEy8W42tdXrizvBWMEVqiHj8ocZXMzV4GihBK3uporsRE7PfLv1I0QgJHgrgcjjti8uGyJWwqJeqTw408c5lUBKI5k1KIoLVbnPmYg 1 MIVv2T8wwC50PZ28AArXe f2MdhoVcpvldEL6dHX6cRfzwYGSvHHDvGyRcf78X0b9IT9yB6KJ0nB b26zefpq7FrDukPSKslT8qQ1wkpaqAmvFB2c8SAFLD0ydQlS701N4FHrV o JT6RxiVG2Ebd PCO834oCqIxPKln6uq Dou8 bb8WC7Wm94O9 K6x xQZ4P2xt2 EXrN6oI2rFPZ5p4MZx27egCo fux MjTXVsE f2CZOQBwEVwIZX58Jm0mNVB3E09C m0P8Pt5 cYu W110P81i9hUQQ0FWuJ0EGKYdJUDQRDKjCYniN1dYz8aKze0eEGkq4CqGGFqnqFOryrvAe8Mlgx8dYT32zuNxdMV0x40UbuO7I4Ytq bcYySTO6NsD9o1c0yBlLF2GDBPuFnhZDDTuT8BhD39DTG2MUrgAkxZR8yjVsoWYyjpb950JH6dUplCPcfyZiyb2OuEPZw Cp9c5EPZyVry1IwXwITkXKXgZSABYENE3KTfjQJ0i7 1qIQ5gcuhXGHHdpW0Yjen5gaCS00NBaoKBi3Z yYJE9cGBQN PUb4fe3aGVW Li3aqsyaSBaazgDj7NvS68XMCaU68MMYvFQgqtMzuvd4b PEnwIgIAlx4NdvuhCA8dhXalna wi 1Rt6fqFYIhHsjdIkygIwEEt6d2dwRmmnpsjaiiquBGkrblPAj4bxk7dwHn4d2XRpqFW OpItfAv7x 6IYkUUPZ7 iNhMa D5Zy9CM dTpYrx6 5Xs3JNPALo05inPXQ3ZD3Kb2msXnc7TlB2slFrUJr6HXVt3gQJrk2rzklKVSlD3rzkBPDDtk87rJ2jfLmqxN 5Ut9ISE zxmzLcpy OAJfw5InwiGF3bnew4QkWclYMwhU2BS1PM9uZ bUzF 0yz3nqmBBFCSKUlQT5 QxKBSSyvb OTnEQ0 lEtWV1kHpoH3s332cb02cp65Anml9j1nlAKDBtZNd2UE863LtjZAWGx0UUfpRrg7WGcn2ms4lImI0wks0rWrTytZKGyG3qr2of81v1BRwBARFC toice0ktBqx53EWXhb2kTZzEVpgCaFcsxMJEfnSxiMziJkdsoquIw9PhcNGqhiKHe9qeDO4lbFRMVOrEtNPehCGH h1E0bWnA lfhXREewZFWJelcJoKa7YKJ y7ihGPU0N VGJmE TMAp4aDoeGkFytCyc5GqPqSJFd 7Jo2Ire3 qWWILK8YhWze98Nc0bXu9FnXR9j ArmaYAMyz3Eh9fdS4rw IGH5 DZhZ5 Zop7o7ujKON uo7lAQx0eWXghOuOjkp LVZW40y9m6X2IkxNoj zv04 S31wOnY5vyStwFJ2AJ92LSlLIWzlyrDx01XsH2a6QT8n5v38L6wnJgn6sS8OXZijFPzBydTDZdTq7win0CPqAluwk5HaPVSpeOuYJTAP5bbTnKannWMsPq7BbkD Nr3gjn3KTSS1 BALxBjl 9DoN VVZ5iekEPJlD4M751 27TJ8HIVDppz7X 3AeSwzSXerR4ApBBZyoTOeA9AAoB7hOq22ngU8lvJWxniubnJKcsfFh1AqZFNGOxI6FbGkDcOIFPaOo7xHu7a1FyvG6Vvda1f7na1vpI5WJ9FC LwTK8a1q9 a1Arv1bo1MzR2oFXPN Xsrq0 si6XgDxkAmAsNlSH8q0Wxa2DitRLeGf2DGIZfyAbCleTAbZId06dbL B A6VjydTggtIKUnNrEiBe9dzJv9YBeVmgHjcBxmMxQoeDVY 6rxshIUN5dI7l5Jzg0i09mBe6AbZ6cAye6MrNJq3Os3maelEycmBjjDTOKwnZ339pHgbngS6WUtZyQ2i6wrgrhze9li9Jo4G9Gy O 36fJGMkJIM3Cd65b8daX6d02H87QxR6K9nnibGohOF0xrNZAUysc0Z6E7DwBPTYBoxyPZAU7 o6BHBawc4x5F quTc6RwHFFuokdEikqWumxbuvdOQg0ZU7jTQRzGXra6cuSPiiP21vYK5P52nCgcwQKRrLmlrCpcJB6D5YxKo5UW RSfzkCR8PtRZsn2u6k HH0wI0hKmx LKovlMzB9nvlg9n60ka4uWNC2m7qJ K71r3XiYrSDXy FKxrTJ5 CglCStl2SNzUdLheUvxD I8X8uZfmQiKTzhVvxcG5RmYZcaNvg5BacS34aOracI5aRgs9q4M d0J7Icc0oJVjpe9TDNNJZqIIPsPIgB5uaR2rNPboiQY mvuODWlAnS6dhkfap2zW69UsRottkwvWyAkGvvSztfFN QI aqd9B6BjyNnHFJEaaR WwnM2duWyAqWTUaRVAdGvrJP9Escb sZ8FNep5u43bVWu43f 7J KtH 9Mc QtH tIFZPW vtI 3Ne pmf JWV6nXFb8i3e NkQKaZ08HtJtMJGJlobDY48vEtMbgfFIQXU5r71JDllU 0WBSBM42lrE0cE4wMqEgJTbmg8Cf8mg88gcmgkOS3PLqfAZ4Sxhu Xh8wsd0ZZLmmKjHNEaqMiUHFaB4yHL4J4Y zeVGTgkOsbXL9ts4kohUoIbJYEyPgAGB5 BuKnnvVAz 0xXS0QNxXpn6JDnqTK5Ig1Y 4faelfG8jVpKg5o8mm8SipjKFHNCHNmHN9rS13hNTRipW4jp4zmg6QL SNO8 7gvPhg7luJEWVjmNHTtwArxllp9WoYspW4udfzegCBKCfOiY1 Qm KN6QFAg5NhpWc4fksVMH2HJmsHI6BUWDXY0Jkub wvgJdw7oOm 2oxEoFn8aEz6BuzCkrppaEeYVdOlKSpSweJRSP3LTSMFZrvOwKVzpWRdAy bkcz9x tXl yMyztzGoFbdb48rtYtpXZIfGEdrrNMZiu5pIISeXPOlDlG4tS1v7O5N z8qqtsLBoJqXhAHp4gLZnCvkbH0r nzevlT2nHcV7ZAB0SH rmb84kAyFH9fpyi3HN3GNv9f9zGkcf3v0qUI7AJnwnGpVn uH8TwWy 8oVbFR7jy01J4lKGKOqYf 0DQTXdNFyGEi85a94Jg9xOzvx9eCn3UIeF1Glg3xmFRhjE019hyv xnFEBRgvGpH4 bVpZ8g4kMWNWp6mztsbe9KIL zZxKLKcO0u1hVoX uvFS CeP5Q pcrKnP4tKK hQW3d4rcFhGh1WxUH 3IYGb0kl 8W 6jQQOu5YeFhc nT1pUNTjzHBEwpJz1uN0wR6PfG8AIpuQAAD6GwZYq2 dDDsASw E4Fd4joqNt2BTo1HWhmNztZBO2HaJnO1DyscA4hgCZnBJhgb7Zo6S5ibsHpRrWRyZVfA3gTJnb3STxUyzLkwjzIvReXnUy7m16xU1DBNPoVA7UZekjrPOCUD6SKiovZNLodpL0jjGL8hqnlbSSQ7QkvI7kz0B6ul8JzE4EZVFvXhQk9bAJVvM4Cc3TroIJddsX2F2CuZnB9uYb5KhKpN82MuUyw57gKnbiFCWlWAUcZtL3GDwMq7WAvSHkv9cQCcvcJvnewMfqP0JpsIJo7z6jNoSomb36POvgaQHQXB SYyVeQOaurb9KIcCDqYIHxVuk KkmRD2vUIcyTHz1YcoS3B9b9LqtmIzct17uhZ2rMyezIXliMyeCWEWZeJm2BhrbC5yBzEdT5JAHVeY4JiJp2Vy8XrETZiJp TKy7OiLwLH2nMTv2ULfU3m zDA7Op SZ2roTy2UzTKv B6LnpdNHfjYH2R9i7h1vz3 AQn7 vIT8MlUmRxl2yKhm T7f2psZ934h FqEwwwpl35zY y3Aa3PY4OW76YPY8KlQU7gh7RPtlhhxsS dcsSvQ1jJfInR0ME4D l6RPhGeiF0phrGOVME4 qhyUCX9zqD8WGopY7jn3KkdfaxLSi15EuGlz8ROtUeCjCj7NkXbRD7LdTYY3wADet7q 6i6LdYOfS706cAAqgn2tJgKrObzK6HLxdalRn2cS7WKcqY2u aT1iSwnBmYbXosEqir ZenI7SRM fWWuE4J10A2Cf68K79v9KHGnnQQ EDg6xUQ6F87P2Q t62DQO TyN0lL8O2e9gJ 1x0MGoTAZIzuBcIUNU reltet740VxF25kkpILSVOnb7rxX cyoCAtBq2pbbzrq2EcK1Lp pxrheUooDy5HSj77GSV4zkKftBziVrXC54meSqgkwUboWlRlpHZKLMcLN85be26Eh49KCbsNbtHQBP6VYtMXQgAEpa Q9TT3t Lby Vy5NhxOh lFDyB5o8DXRm8KnJ7hEQPF2AGFEep8cVVrLX Xawaahr1U93YeqkeRt04y5FKVUo5taVaaUKNOJ7H6gPsErWVQ9Q 6T HgbCh2JFFedY5bdY20UIEOJS o5KTKNbjvF24dgosWE3p7sQ6ypwDQJvTXI1J yVT3Sq nQk gKs7dGkKLPnkKvziV1hjy3tJsKXGPHW Ihp7IXcwAj6Q5M0H tIfJW7owKOR2N7rg7Ibt47 ZqA0Rxt ycjopYKp6zCeEp1poc1YKcjclbnxwqhn0fepzKq8KGkBU98L3wXOUKAoOFYhQpJbpY3PQPLRE1hxxKoAKz R1A6 H JGPl0OVSKkxMV ykcY4uBmfbNirq6h4Kkcq3aBdGDbnOeSpL0YDzoYZJUlteAxBBcLps BcLi77jVJJOnQOOHzLRuMNA4z q5NeqsxTTdvpFDXvB7o4vNbq1cuUvLrFtyysqW02fLu1PD09g3X5conBwnjhO6BVv2Tx2RFzW0p97TQtMbfGFRTVZBupsOQIo CsIoNjuwQ8NyEvxh4S5OZdRZqZT41URbclpnga4wTHFLS THrJfsWVE0yaKfe9wmymiUTqE WlRuAh2Puh5 bdExQ45Dz zgGJgJLLlr4srcHzzt5HJ7jB04p VmC369UEEZ4hOFPz8DIzYKz12m oq9IpQx8Vy0l WZ1dIluOFDVOV6VVRs5ZMejlaswGYl9Y1Zmag2VAEbIDxFTCcumjD92J95KKS kLcSy4GN4om16L S31wSTX1zAnu1YMYPPPkkYk2j2mk IKJVWH3z6M6qjrjkfzrlsADXkUMusJiPff5yYHsKQBSBlcs9JBTXcSilqRtqrrrlqlGbYdBCBAkW28srsNnyrYaNlTXXjzx3TnlwuGcSTOPN ZCHdhoKCOYiffP5HjIXC4zUC p N RLBkTM E3 ZWUi4gN18D7XRxJ18nwZFZ2A aU2ynFJAPJHJ420Uy IkwSNY95lUS1WrwygLjvV5xnTEzCoDiXCC7XTNglk ngEgZG TgBlo9Ox mS7LOl4E NyQcm1M6MEJt6ZQ mCsshESA3GHBWW38XWpPJbk09zkYmCHfQndpZ6odF9SywaMuSXkMfAIHBuml2Yumlw7CL2G h9mpXWt4nBU64kn6pFViC06srj9wpkANYir0TD0dWKjdntsAYdCallgRqGtvFoR5XRGZYVsTcIlp5Ede71yP5nKoc3z8by6l1a 73BDQp9xyZn71TxRoAe2lN5PmiRgHs26lz1BIu9oZzMC Ew jQnzn7AkzD1glORkAPDxAmwq1us8jYOFw1Q BU0zvM3lGLL3PAlJcaysf9Rwe46gecxhUD4Um8hqErxSs4FoZ3pc0UdpC7qa6YtQ5FemInu9HqRaH8O6kcjHmec3o k6fcjQMqiRbr9AfB43Ci5B4pWjUDKiN7t K3JqLn8R2I7AYQ85uyv XIKXXSN2vXelrPlXl7AAnU3TBVUnkapgYNwhRT9xvR5EVTt3B HwmXy5PdvBgiZ6ub4rBTe VgqnBNnfN5RlXprmpfr0oKhQ8rYUPBIzJTk297NWMD0tkec7hIZ0BWE4xVSwDQqRMdUg7rO 1IZ mXEUVyMYk039rxi46DNcn h1XiWXsRQf lAmofC7rL eKSUyyCQI5OYUbPTKIMk0qFjfDwvVXKw3GmP8oxQydP038muz7gU AVDuoO Pc7puxhXInv6 RQ2suRxl6uyevVjDYp5NLAXyjtNmD8kN4l9vFvlQeqQL O6C18GsQ4bvE0JOfm16rpX0zDAjMoRo2PQ4MNQUnOYYcmpOtvD4Q2PQipILYFXkP4aOXa0tQLsWEiYBYZNKnhMZ8laQo8n5i NQy7rhssGALBpsqel8DDvXzwDvpMzq8K4NE1p41qUwUwaT8P6AFCdybxS2hOvfLVw5 kw7d4kiUwj6xuArx 1QrRm3GQFGu1OYA Z Cuq dKEhIQGiO rzpe5Quha0DUS3uc3CG2c3qD9paLpK qLaR HGcl B2fvObR HO2HsQF8IQP bOVG41 7NG 9NsOU2hO3HGMj ezkZXR bVQoifq r4Nh56FOmf5f1crqxJsT8QRcQQuwBVcR bVMcFuNnFToe0cbPmbVIfckGOqZJ8GchiLpe0lzGRpX8XxH0FGe9FMjaTqQWOHiD3LPjpszhKkpinUvBdb0lvsCyRk7ST8bOxzTcF yUdINVYL0kiGaI4pODS3Tk GEktYrTS5z57c57cQHCVSP5fiaLgmKgiT8yqf4GxtNdkulXKm0coZ8WPRhSleyBkhHRLVkwpjCGey3ocpJvV5hqVR85Oohs3HztoFYzphCFMmh8FJcP6hVSnKIpifOUgO1ZZx6eqx Bb w5 KJmdduIUzW3uGulOD trVpP3XcVeefNon5zXVmuSXOOvZCSGx1QuYKCaFv2BUQ2JflZWWASB1ARV9s6G0DT3EeyIdxS7FBS voI2z lnZ 32DhCeFb2Bvkp tznXmJwmw8yzR92Mw6ZOIEO5xuheX0YZUQeXWz gcIx4m ZuxqcN5FoA05m siHgCM fLlWGZ8lBisWqKW6zTk8x2Wceoi7Fjr5YeSpEYLYpdZ8bZwNYy4YBWAyaQktaB8Z2AeF7yRvr5biHfP5TekFmtq60AJvNaEtd7FAWNxd5ZYkraN23edoE8voZ5RJ9plS1J0ARXiT3XG0AqAxxiTxG0JVuJoWkJmvp1M0wCdubdUnbLRL7FI88uVLbxuS93cxdVanRbI5Dk8fAFJtn8WRv3g5NRr 5UHVMCGWPBMZpx0bKpUMVi2hbGJmXveayrBTuNDVVsvnWHiGQgiu9aVc2cGO3qujGthkvGLk5UNjbUyccvrqCf39k4teaSVEoMSXsgpbty4FHx6OujgK 0gaj I QscXeH7csiMu4VtH lC2tk83PkZgH8NQLhXI0p3YHT0n pquaXK90J4yP6joL4jovp9aVcBfxKeBOutULVZM5utoXgGutoXMYAemySrxAVvGdvu3gkUOwrrCrDYLdp 4E8Z07mzvwLFB HB8stYEzt1jXZrJvibQ534YrcF5cxS XhwfcnWKVoFtqb0UH3UGhrU7rFYOqvjxSWLiVWHd1UCCDjN4CrX1MCXY8BZRHLBanuAGnQhOBU3EYZi53Yk2HIKFmn AL5dtv5SRQknWxxb3nwHHZ5Bcshwp5Wv0YTxE1YDtyWDn4UgCx9M7 pQG72ZfgH0B LZpZmPuWD3oX9UowLqQDMwqA1LhhvV99 SQzvpxRfw17bHjyjcNQxazGweQ6hgL Ms9yIxa0aeo GOHpC4bm nezFnECbzqdRxAtSRgoTjQlsjrvrkqUtO7iLOQJuACBx AA12L9nr457E5Wlpt860UeFQn1vZeKKiBgvZedPpRbTmSOY2rEhWoYL6xpVwD6vy6ArnPNSP69cRSGDFdeP2e9lUHmnoJUkO0KK2nAPhgT0JnWr NDVQUoD1sTXgG2VQtTXlP0eEHgpS7qlgym Kvn1gRfPg deVB2bPYw01 eArxe 6NdZ4xobUXbkzxaHgdsu827rBZhlgay5cghaBgGQ0SqW2mOuR7cBraiQ WMFOLNgxGJBKYBKg6mFnihxgprBmCfPGGwy44NG1AoUYSiUcko6HJ vj6jq7mC4Hq4PRACC0vw4mkNMli15Z8Oi4nRNM4leviPdqCrGsQEwh8nuqlD2xsY0 NBMIJ5siPd uwJc OoB z Zcu62jUShotlXzAz2MVj9 NUVGHpAVbdh2Q9ZAjCQKZcz31jJrLkht2mlAbNqx0DpDOrovPZIjt2fZLkMW3AP7iXsVWrdMovXEO3Z0 8XFI2oRLbPYUyY0GNn5hM9k9LooRLtLzz0VD8yZMpV4LPRPJ4BC tG8Sw8xGovMCjxIYsVzHeJG C2Z0rgnyPZjBEASRQ5 YhU0xIU8 trnlt2KGdzX3YvocOBJttNGk2sOtr8wmsWidhw6cmrSCjS4B5yfLUfdeu4w05zTek2CjJLMXseQfPPYXingLDo5tNC2YEe290H7DqP3M9LjlDo4zKkgtcAlL o0nxWfPsBjZ8w6h o FnBBS3lV0yeWAVD28TErotfEdoZVBcoZVh64Trh3gD8BrhFa64drh o0X7GoUf649rh3eD8wjyFam1IZetZLeK3QOaC06t7 zWXknOtMqCBb2Yfugd0ndlFLZ08ytVUAvzKZucehoi7lWzkjbw2mAiJJwIyHN UydmGaXsML2e082057ku SMagoWOCYzIABy hIQ5g9iLQRrcX2rc2hhjiStotlYU7TXzknC9YG 25IceU2d847VP7PPMiUFotz5mLJDxfz3JzfCZT9 CMYJwb6c7e4VCMI90DavOSEoF rSpRZzVaITZ2kR MXRiIi8yogNPJtCzRCe3nsQJWcNenh4eVshDG2h2 bA98JrWoVj2D9yWVIJ4lrWMe9kTY5aCMhFpO30Vo43CPKVeTK6m2S61LBxqu0HMtOBt67oxgAQSXqO9U hEmwRVEVjJprY45eGo86rFfPtUnx4 S1mXWDju0cPFl46mBSCmjeAkahui1KHBcoZ xrHSG w4QYz o4lYv6V3tw2fGZ8 JWiZz pGgvoZ r5JNucgYr8arRo4HVt9k2abXDQ3p sx6An10HKK6HJUaCpiSTce8TGqUwEkCdiukgbA5I42qi04ENwfhXZr8GW6daYB3yTcydSKKZvX7R7Ksg49lwgquWCW7ZlG74iSGMwFOqdKSa1CaoOtoIUO33CjZrNkwXiufyo38ijqXyo3SzYNw8 bU8hew78Pr3qHqd2 tWrCOMbMDq2xcjPMJOheSscmA M8OtHeudToZ7dTiIbjtUs3XJuKEfoIhH Eoa syXxg wsM2YbO5ioYdGExFuE2oXd V3MakL4aSx YhvgmfpGLJkrpuCM FRcSKhrmJDpKojTPavWz 3ldo4O6WbLWR ufd0hRTbsgUcEPIEzcVfvzc zK7a9YLRG2rpmvVd YR83YNKvqLXZZFgdGrtOatcpDIOtyeuiSrabWIsi0BHHdIqiS1dkKFWPOMFMj837uyrtGGir8sjzAepYZhgwZhJPkd2a4u0pB1aC842RlHqbwoWHVyjy pijjbT7 6cC ZvmqFS2gOYeiHXnAU3HxAc9oAR3HloDYppRwJrvDjsDixAKsxp1srvaQ4LtWWtatGbjyAbGsW8cEyccbOgm5TldMiiPzSjds2 iPgX CZvXsAQax8n3C50z4IhB20l4Y wx4YL0D4Y7OgCHY3a JmzKbxPOdTaxov uP0r4c32FZ6avCOrOIkd0hRTb6Z9qLT FQ7qL3vnOIVrjxWEVHd4J2VgGkxVVuuXYQZIwS5XUEjA5t2YkAXCCDhV8BvdVCk 0JrvKjUpYX0aE5 BO0muzbtfOVyghUSzvNWmTAAR7Yr l6oM53PgMXtQXOg1BFRm7ilPbmZvK2 u92IKkBC IkHkUD61r1eV0G7qcnyU841wnhmxAE7wTUTQG7A09T1AlR2bQXaW8Gu1bW1A uLbGf2CLgbWpJG7Dh GCe9hL9vIkGGf3YyczY 2Qzxaa0IXYyKlgmJfVaqBmQUM7y79kdmRy NdC9mbhzOzgMX6KH6gwAS mZfNIh4IyhQGSpgHoj dQ8Bo1jvSm9QBzvXQLRQ7I ULAI c51vMrNifDX8dPfTX7LsF3RpPxp2CPxAy16DTLD1YD8R0D4Y7RgCj8q9mv4rhif98w1aCHZ8FvpSKiPx3EDrwtlj2alTD310sIU0bljQCYsycQMMjg8IEGt8rtmr0MAQnIgZcIeAzLU1klhE7kTCye Xdn0cfg235hOMwo86Nmw2fYTQvNQcyIlNoD7rV0a6lxtfxCTfrXLJR kU8b1wXLjC1xQlmNTKZf0bEbNyjzAa9wwLihNoS70QEHCA3a5GqoE0FKZhwBKZWUSp8Gmlgl7ePaKd2l51g5ifXd7M 7lt SmGx1dZelBolbOsrtL1sKWNM316xj cJezPXycmoBm2tWURapE R10l3ut8b9KOpZP2g7zO3Fcgg6Cp6Xp YXIN5yjZCC8qhCE8aZpUh3PaG8HWyYQ7wDBTkvGwv6wDL1E1k xQOQRYzkbhXH59so4mA2NCN8Ewpb253bgOsDleMenvOdUw3vIYCTotZGpWHAHXkz798dhKYLvF1Xl7G77rtV9IoPm7uW96Th4Xx5o 4Vrtn1e2n7HipM1J5qAsNDNyNRl6PDy9f nZU3oVVRXIDSFWSrcEQr8pqe8eBRq8cC5JGLhqVxvCZktPpJEZmjxRDkf75fA2ELfItz1N4HYfehtjO qbvUy1k MDfizAgYNmDxh7y4pAR0hTx6Jok9rNOpkvEcQOGlNlFkgOQm0LSRJW g hqJYGu D27Rngj546WUzxtkOXeoIuwKIKhjBo0hVzUB39Mp2VfpjUFm7hh3VYo7YduhpTBVZ0Z2n3E6Uz39SFCKh Y0wmsq HirXrousGowo2oeKMw2jrFyzDjoiwooEGIfY8Ja7eYefKJjbWcbbjab259Ev1Dx9hZSFiryyaU4UDNPQx9Qx9QQE1RE1RELrnf7XLam6hXp3Ms7kfUkKVxfenYIURIdg8lLEoa lDHjYepkdeRUIw2iyxmIbiwtvLTuoP1eVShXAAlf9tCBIx2JynTTUjWeoP1LFPpI1MJUIYpgvxqX7s9XhbZkSy0EiDx XZRpzAY3619eR9WTU5 Pl5tcnuCCK3wXXpAMCLmoMnuK2ZSHSbfVUZuxPHSUsM OhaEgiAogN1vIsUtG4OQCwhPNUPMBNHzltxvjvqyUSrTOafGgjh59Ku1AaTBxfBnJTzG2bIIJHiGijaNk26AQxtYW0vYX10kgW acTGDvSpqABtZArGkTaG40ojnhjzPAGEZmaXpjHzea9vOeHMBvtDtBLAu2ojaohA5Dn1QHU3Nogln8kvm45qBzRuxbwFKvhDgReYaIGsMGIHEFAneGjrRIWZHfzL7PiJ9oCUqxQbrwxvzB7dWszzsYWzW79LaQwv2PJGimGY2SjwtY6MDbLDcEAGFhkKq70NKLnoim4gM F3JX4QABUNKm6qIGGbnBjDzyScdQouiEjdyNOSwgS0N6lY4zpaXmDcdNxpPsDxE1hGlOEdJUGrPAo6A7aYeeWya0I0iYouL3vrIX yIZyfWr1e0AZlP ImfeJXo dyocfwOP6ifkxjxZowHjm48Oxxowhat fHxcWHUM3CRqyQpXXPHkJRPbo4pXYeQxudKfE8kPuhRuVXwXlLyVNQwnSAOXfQGiyodHTiO iyzDyWliwbgGkXZkeyb4JdjRtkjqd1lYseALGiMD9yQrGeuk0wwYsgiqq FrucJhJtagq7eBk ixyowCO9hM7n2OZ4xGPrcLDWr9bfj56rKvl7kPRGZ8nnuK2Y0KVib9P4lqjJlLG5HT69S1CDvmcvapSclbVn5V0wMnRQ6jZc yOLzbnOyqGlsPRz4TiIaOsjdFDnD9obDNQGelt6RN2xNJ6MnnWiJ1ZC90bjAOOaR1v3uqrKyZvdI yxjY02O56lMtmrpzyrtxugEe4feulMJFpyeWtm9G gkvjrShkhEg 6ViMOGAnIjhSaF0CewYnAwcJZJq 5eklOVdvO89OhbTBUFQ7oQcSS Yq7cjss0iKWjX2lu0ezZNcNi2PfD4IGM3CfVthBhuXYWBBiXYWFFzjKL gkILL3 N8YGXJEOLO3FQ2PUCMc5BFRV4BdBPTQA2ZEgNZMJmxaAmHIPjdcDUwNNhM2EE4ByCBJI1J3C p03XFlVyCDmsmDKctElVYAZV8svISHdyl0sAxSqFsdbsSd s7CfTKJzH4wVX2Wk6Yvvun1borcbAWUgvdJgTcXWBNw1mhVxiQR3TT ekm4fkUbYEUKMBI12yXkZUXIalzTYRUrLjEIedAGnCs4zsYXfL pqDnJAzba6d6pHgRH5E9bsTDbTaqni2sbxzX9Gm5IVfpKRVrFs7Iw1cxTYjRtUO8F8ND7Ei B3Uf2afzkrymssDmQksCNzxUsL5xzJkZT8LzVKuy0nS8 Ao4t6KHvvOjHPMvmz2R1bKd00etVHzthfAb7C5Kckg9YMeuOlEXG37eEnWXdljbSKaSr4Wr6cXWYip0HsrOrwzIaKgYdDuWBuu2HXiaOTJLUMB2m9dRgHflxoXrai4aJQq rgC0Htyp8jeZiD1C1Xb7tTXSMooAwy8lDGzvC5gJkBUoJaOcPsJcpqoO3xgyBctmmanYeJVKHQVkulKvGSDan566WOKAzmbcrByO56I0QiPngwnD7tYSPl83GjaXSWqItiIm5dR5 yymxYT OwGH0L4kSk QS3gVTSvK3jSD7I tfmEVcBczrgTLLvEyE ktS6AprMCDSGDOE7qu 07hgfLCizns3rsP1TOMAyPFmYhNQLugBSq5jMgFm56OCrEFHoEv Y6VKtuEUNQAxbkeBamzjf2xJ YcgMLraLa YXlNoUafkz KVYZj Hl86h9hXp FPqXApF4BiQ k aWvwqoSu4UgPe7PKsAzn6Yt PBDZ236Fh2Ro5T 52S9T l8oHXqRs1bsy1vvCuCPWxfcoOnsMlErEbAN mTEXwVK3nU eF0fPUVwVbDEf8ZI67m3JUZPo1JEQtnzR5 HTUH3TYn0la2SENp1 w63 7XFp51G9g1tR Duk P0Vzhw pG9ue VODQhyE dLhpRkb L4HE5BR1NUD67Moqj8OOM5Tluk3mx6A1oy P1ATr703B7u5AN6CbhAv67Io3Ij7T17o3JUXPo1d8x9x DBj36NMUyxNF1ZGJ6i3Nr48PE4wvvB9FBt6cG9kd7DgvJ 9x88stkxDNTTXH4Vo8T1D1GvBoW6JaFE6dmKBOvvAwixl zwDTDux7jSl7mlEklF2 t TFu8uwU TgQ4qfkniDgP9uBt2n906EJEQvlEE627DHcfg5hJdRID6sSZDcVlNVxRLipozU6uu TQUSJJFGtPCpXp7Pt8qMqhw1oV8TrNwfEMrJ0lDeEENqvR727aQW e2PnP8HWtCIFcvZ82LT1gDB79M8YlSmDivBvyGsduC0GtP62OJtJDWK4zBHhs1DbJqV0VfWXpf EPE6q9WB 2y O1Y1RdZDO4qWRKfprQ rUdzv9FhCS2feSOop8WH9bO2 VjL7H bu5 BXLoY5ux ok4 8iDZ9 PEDFf8JODFhELpnA2OpjvfAxDKcSs93pOGJbOy6bs4JijSTjuuB6yYDPwJTY2SieEIjdlyeCEAWs9tl7kNnt0XUXuYYXsUk7DhnrSg61XtiJbWYPGvAjQrWXcO6qnE1rahvJoyfh wriQDvkvIEFmLdq1vIRoiZYcc4ajUGVoaNZc0uHHrIAhLdOYWsVpA9wmlzhPTKJDIGy0z3 qjo2TVFsz7yKhvE oxrSXup0 7c0zXbr6KYdijBjEbcrWamjtWq7UQIZHsXLnuACG0meWjs4m8GBOreHirlMqmQwHWlVWhlcN1EVOih78EdGaeJmcELDEMEdYKLVLCnTGu4qgbN8zpxeNJDUSHrAoeRq6OL4yHgEQQDK0CDeQTZhfZI6lXBGDwZigaJxXJ3phHZSm Z5PM65ze55XbL5omSWeDLnFFs9xmxhu1 WuKbF7frnn cw3 QLxy5YBuP8Ato7CLNF25wRDV k9qwROiBjMNV1l0Q0DYedkOsXYGGY3rL5pdWQlNJ0pOogOtyr esO7NBZwFE7csROTVIERpBVT otdQQSUkgyp J3mq9bU6c4LaUfgfTBTzR5XV89e0QyU7S1392zb0RfGfphE1PwyIfxHuzONhdee xyDp d0hp2cZGgfVC7EwSDpl16pdwv8LTgNUfk1brvp5e1QTSHZt6x6NCrqdy5Ne3rutq7ZNSYt3u2wzJzAQRFzvnxfRBVMMtvGfRSHTPl9alKcwA72qfrkkOcY5qhQ5phwCQ9T8 6KVCk64gFy89kAUlD59wAYfxA7NO17 V8oO1ZgguxbuA5LQPSvZTxWCBv07CsLAUp17CrR36uNQ xjRNpAbRVHA7C 7qkXJoEMw 3TEKqCeZqCek8GqFKXBQGQc58KOM1UfhWC7TrBJDtRPd5acMg112MDqeMB9uze29qWUgSLBOmo auKnN3PEtpPr0bz z8Hdey7OB6kUwKh6HffQazL5Qc2peaNSIa3wZfknA cJfyJwys c00jE2dn6yflfk7jLDX9 J7aEIRPa9YQCqhn Wdfg0kQY1m3thpHfpygUWqHRTPTbL7mQtwT9t5b1iJm6WHGcxbzpz9D8K0aewH8rHXeMxd8mqZGvvK1B8P8SHBWsX0265wznUPRIW 4G7V99OO5kWgcTQQvJ27MIH8w60gP2Da N7dfFUfj02Rmqcx33dg8XNLPvtlCPKWo7dZgd1u2hYQqFsvwBI1MFQvwEL1xzJLwFXPNFIfwE2kI2wGVYeoUbkYgZELmvOnfUcI mdmaHSRkkPMblTQfnABENkWUfJ5lrh19 XHHzJpQzYjjEdtQMs1vXPhzjL60QzXAP8DIZCwKc5 mzHCW1mZh6vVOHSR6a11nnTXIlDowboVeOnn y4GFJvPbJ1L11GvvbKoVdjjBbt5Ak1YM5bFmwoRzdBEbTfx6Wt7eNm5HeKlH80iLDgeEycmqUlV1tPaTZDveZkD859dWN2hWKbyqljezfT4WLWYE afX0cHhmeU55dKQP5ookvbr5yxuwkZ KYGdcYe6rXpj7xnVZ8gZBa6gyuferr8NP2ykvzDDfJTvw0SMYaZ7e67tqCh OljrbCjAoOWVs f6l6eKoyImKtgH2eQpST1H6l675FUioDexrmttDxnR4YBhynwoEa6LTaK4GbVY CWqDFBifTtLde2GtyPHeasO33hmYJlizDcdi8MkUSbNCb1MqlkNnKjV4gqUuFsGEXEms6HQkhz36r70dkumBulyW7OMcMGf5alo9AjB0t oaTQsi9iAv7WfMIXmDiVgY7h3Iyi89Hzb1iqyJdmaA3aSndK11KjvplrvjuTqdJfxBWwgIg8VSuGU88 jtFPJM6LrGwkqDIVoubsoZsO6cagYDUc5bnDlMBGbYCMmjILUGAMfpXNvm b0xuAWaIfqQuwyrdojaFnh7Sm8HNEDPOcWHjE2fdWxUUqlgKfkrlTdZ37WKBFdMZo6LqtAWb6xbhfqIHrS9jVys5E 8duOlMxp2KhooViIYowIzbPk8PsJpHLfiQGoVGms9JEalJMZ9twtGZ lVwrBwSITjm40XeewwRgp9vmDCNcK MTmmIDabGrtgpW60JiwuPaEAAsN59WTtDpQGQRp6jt1vMKwA u4Pd zybuxk0xYpm4ZIVS1OHIO4RzQpnSBk6yGrlfrNqmA6OBU T9d6KjJ8n2 cluEPzlVXIlpD5eFG oITGJ1INVFVmi85eoWxunW1RK5yxp nEwrho9BXE hR8tuzTLxcgcSWYRTw5PZe2sC8LPRQB6OSL82oHBStHjpHU Kqoz9x6pSRJDOv8QLNQ8kRnXKluEJLxP8sriaVTQLGvo9u0VBl8g6CBzWJRehSnbqGBPKpJEO5slHcRxa7DyJjNywIhvjPJMKTVJDj4bLUGEqtdxzndqtmGM8 YsnBGBU0jlH7epKtHMNRsdcHDcBZtaWWvFSQVJRdWrgToq491EfwwxLpEQJYSdikCVbWFwasafWm uy0TuzgBZgW4GjmQHnXJavjqzWMOECyhc1YEiR0iOIISbOJeJ5eAYYuYgR7Oa7I3b06agfmvtBByD2fLTYI1uUUIBupegIpuYGPSDqhZkAv3PPvO MJipizv3HLDpskVNqtaAYWQAZj7qerUJwBjs7kepf7q94OhdsjP1Q76 h66rIN KwvDlV3 oM9qUrt4zwIRMiUt53xwIj6OQIh6OQ3V3MA0TmkYx6GVgfsZ1qwAQQRTotbwCdS40pBtDyS60KjzYDK3Yvy3c6K5AquBG8laV97Ovl2g4Izrm0yyHp8RGm8mlw32P3XZ1IcDgHHoloHALr9jTlnMxdb5l6ls4xpsEJKWM0qZRDzzMPZejdkJomW8WCMPeOJChgnm XJeawqOI1vrRC7QeUTEOcJfS yHjB6cJLkm u6WQlDrYBNeX1P0p cfsSpGu J99SDC7A5oX7xlHRTgEis0te4xWsnIdYCu0Tu6qu vkPTfH gbDOvPf8yI Eh0VhyxIb0ksBYEJdRXENcY 6GKOAA0eqVhvzVBfo7WU8d4eVxW9Y lg6qSwi4qS tADPhU1FYMINJ1D267TzR2QEViSL7X6Et4IY6ielIFG7oK WqELa5umKdXWCeMeo1PZJbHy9fYoXS27T8EQEEhbZ ywTUn 8s20MVy1MBXMb vFGzS5sV2S11SU35WNlB8Grbf9a519l9yODjM8PmTnwLosGpEQNzSx13K 9ot70xcl4PtUGqQ1mTBNEHpEQDR2o9Ihg8RcQ1PxNG z eIWF3jd ACK mpIiWFSyaVCTdmiaB Teb8Jorv5A4Xw3V0u2AUst2Sov59MYqeSF2aWa11CveG7PfH7odGBreo7deG0weY7jaYhxX2rM5Arcq3meZsO vanrWgU8oWc4bW7icFUjUwtBfOXJNIq stYV1jRzlB4OZ3oG0vk44EvSW98 5Ch cx0OgVW sh cxY2RW do fEqxvEH sh cpKFH Lfl8hps8iOFPfKXJfLnM51sfAKymyNwZz7MAokeWFL ZHgjgd4P0BYa8x5pZhq67FP aaEPyWx2yByJk0DKvAz7TIuMxdkZ9hRmtOxvLCYdDzNDcxIVCgOe3xSsmP81KLTLM10SMtKc8IqbYeRalHhQ5wGubfALqSnfIW RGs9ajXPQkBxd0u6snnIszVauKhmwrUmAAyOatPTlmhr2is98VoXEVzu0JZSETTtKzblrcD04JpHzJiTIVC2e7swKFbT8hJiwMF5hmrg8Qk1TvCuXJWnkd zr5bXlGj7bPyViO zte9R3ylBGIMu30Sre0 CqbEO4SvzG01n3g9q2kvbLX1XIzZnz6T86bQTV5R6BvPnBDFpv9wNTDpJ3o1B1o9STt9MWcP tuHA4oMOPRPK3UpLW1AA9U9ka8CcalHB5i2zkkvRjnkhqsR39wekQHqrVxszgj0swsWe6iv4T8l2o1BaJ7qx frLRQg6lspDtnB0v6GEbDt5AiMNUDpLV0lbJhPL a9aWdXaF uUXk8dMa Y3Ns H5jbKXTqeKoqmKC5PzRLlXkoqpcwmpCZVHqB408QvIPtMeDnrNATvxOFwt h2o1VXL Iqzt97GLODQF3SFIV037uTt9pTxaPTt9pRxcLl06AT7fuQ4ntjupxkOESlZwxhktiK9hgfrlIlDDzvTQQsmfYXlWjBZua269RHf 3KAYyHEdRFUSxQPJlzmnpgGMH0uqAMn4yWb074TADnGct9Bb44LwALPKWlds7uV9hRDQFBGm 6W gQms6B HBN6BPsy Bde Vhq83GZBQO420IOY5BN63hvq672o1nafXU7wZ X XWbNfCayU700o9JOYJpjbHQMl96boG4neD3VxfDpyY9TS Oj4uD8xiM09t6QD TtpqyhaoWvtpSN6LeJjnl3o9P98Zx07z991xVqJZH90TSngDze9zO29SpiZ4faUWZb fH 8m 3TCVDimZqHvgqRt1XEIRzp 8Y5A 4OZ0ozVShRfw4MjvR7nvuvv7JhFAeFoxwn9j zd UsXD5xpF9L8M7lK6vQ2UNsNJIBrFRtJ 8N27LM7t9 4BJ 8R3l05RqVCJ31JCkSVXskPiyd0DxyiFTZTUVeGPH8 bb5gQJDhym8ZrdKAN653KR8 lGjKkX4Kd6zpc7a4 A9gTt9IqJ66Tt9R7VDdURW1DNMBrrhYFHnXDryLRdTl2V0v2wU6bBq Ec0R9Qq98ZRI9W QwNPRfSHzTnSHfr206SjTJg06lBiV1w2k7QbqHCPBNCgVNV1 HuT pUjB8qR CGf9viwvIpulm04ZD V2U3BPDp 8a8PWqq1 1FIzo4AtFGZ8njhERDQ XahRDQpxk upySMFehkt60wpucvb7p4R2tqpaSkYN16NRBaxmymX93j2Kpz oat9Z36Rs Dx7EEwv2lZ3 kVBlQ 8ByQ n3 VvZt4Te17C T8omIq2bCwfxMT csgHmBUpHOD9yLUZo1Qh2P gymGOxllpWcxUozmrg0HSTMC96A7t QDhmmyn8X4c4piJguiWn5wm9KDrRnhXUhoxjtMKVxsD9kfr1kZFhUOhjCYV9sAvj 0otczLGJ4WtkB0wEUJ3nFc zhLd0v2furgQ8ZlgkROutOz3eqNPHreJyZtoo8uVh581X7qJd9r7Iz1Xs05rHSrkqJToSx5Wr2Rq3Q6bt689ckg ty0CQqXbxdD8bMDM1eTZSuM KYuS0WdMVGuH8Lgk qdjn4qfkm8ysfkn6qJviFMCO3SmEHs4 aSuOFn875hF4bP n W5PFH1IBMOwERRCTt4W5J8i1OdykL WgKKjSfyY0TbjCg8HmDRy J10eaCOFiFU3VUxGshLdTN7Ug xDtphCiQtlCK91JqcJzscc8cUOK3jCbH4EJjtSqKjZuxxhrAWb7IhVFCuYhT4TusyP qsUMZp9vOSUA3Y7kfj3IsyMTpG sxt35l0F0wuSt6x8GGyieXyYhoq0AoWDhsIlHviXC2nYjtL4DCokUd9D0D2cKkDSRVeSQFOQmyT4yCZKfFg4JLXKqgIUZL7qyKI1C8epccKJuDK43I4 o2IF7YeSFmufXFgm dOFH7NPa 8 yyiswSFhf5FOAVCKwp4KRAs3e8ECuj54OoYrxvK0XxdOJHPKJKW PlpXAZTXulV sRTX6Rm9e oTfRBRBrdJ AEi1ajmsjcehNrbrkAhchkhXycZYlo5eRTXclp7gLF8YiNDPzMFH1kVkYCty7q1uCOGqsG84Xe2rvhpLDwB4kEL Qr99H5Dwb2XNIDwpisqughu8aBCvfa8ID05O7y1ZUgJmpQVzJZxGUsRDncGGYGJpm7NO7H6OnC5NadBosdF62WOdZzJPy7qQVG1Im9ZKMAHYRp 6ln ABm98D4WMLo8j78GafELkr74LlTxChhpCzmkfm8lIho9e1EQMoUk1wuZq9eBdSF0wYv3PMTP18gZyBA4QAnqxnEd ozVHRkEOeM61oaF1AVJZqYupdcI0zO1rB9lSjDKZKH7EUwp57LOnucqmlHuT opO1d3vaTSvQQ5OzA0l7mQBN6VB7u 9AN6lQ2o1d8GKLhjduMQ1sF67enV9VgD67VYPB9n7T1RzD NXFfJZiSEWz4Y79EX6dEU6TEakAulesQ3GdBGDAcEn7ToDmOdzsNeYpKr8SEOy5lqLb1yS3j wVb7r0 np9PO3lF xk E gwsXWPhpiaH Ft16F d26BKY6 IbCyBPXzKV9zcM8YzAwpyCAhHb1HkOI kTt9L5Swb w70 sOLDHwGvMKXs4NEzod4 NhdW6 tUuoHAHiZbykiVb5rF9xF PwEPnwfVfZehm9FFaoIn0o9 qOPExmE6RDhs Jl6m17rs9i0Nq1OF11 wplY7 TvfQJqZKL3hge pc x9ITwn93Flt7Ak28zMBYUbUVgsa SPeoda8QVEB bjU5oXOSiYfO5Nc3Ps879jTyL WRsJVTcjOsyjrmDqydT1l BDib8fKgoFsrXGkkvta6 LYYr15GIfYdU9QIhb2cE8vGciGSzYFMAzYnoRz5HUo61HE0sNrlJstaTv8ymrmNsu1pYM5moJFgNy0uFsHWIVBpfDzmXULKxrty12e6wZgg4qXURm0sXou0NNHBkcJJhjLewekdVYle8Xzirxt8gZH7ERjDlEty3WmKNl 9VLRY9svMyL5jTrOpH3ggBxfJSachLUOuxEInMcd1mtHXzAkgW1mG77Ihk5aAgok2UzrQQpPNXGUCM4vioxOvMzW6y6dzW2p94YY9jTvCV3enmaOO1w4FjxDfJjjyWfDRdyTcaib1w0CKuE6MY6DsDczmQU9jb0v4QX2SoIAtOoS3td IxLqiVd3qpFKwKHu4phE4CZ3f9enJHgRNd5nH6U4JyW mWa7YIf94OJDH6syKrKl3mco3B IAVfCKd2qxu2kKgIq6xIUB66E HmHqesZvyxN9I0wulvOuFszUKmuKkk2wkgUzUopiLo0WmiYxeVFUU2MnCmBkK9i8SreurXfp fPknncayuEnqLNUx 9VISq JXYV4GyqGuR51Kn9ZB4888ka5TO52npRJQqrhHrAfhCye1vbnLWqOFvLaa4exHceaY26kUsKTpdaXJ8gMQcdMJH5LTh76YMtZV9 dtrF0NzWrO6CNdSvKRQ6JTcdxIHUrhcZwxEBjq8KIJaadsam0GJaamrZQQAg1mfyxfgEigaLgXNF1W0ueGH5aGuWS2AnSL10fYM1MhAiyRuzwFYvRiK1O8SWswExf7Tqhsri X45pkK 8W6HstBwDhNOmJqHPHXyv3ie R8bkOrLN4Aq3KTCaIhJvXJmmogyAz7DuvKTDfYNvXJmyEi jxDo CkMNncyeAeqeRwha0WC0JSSLuGn0jBdu4zDKwaMakahNwZJWrUIMqECsSiM3IY7rEJJztHrkfZZPYIytDc7Q7jFqqMfye6O4fJnI yfaurgbm6WiqpgWIgxAbmiEearj24NXyObesPuZwwxi bJHH1TScHbgvo2G0iqqox0UVjRpbh0bziBSHX 7jCL1p70YxtwaxdYglwiFEK9pJTcfSAfYFyV8Xo21m1LMwEBXEMbhHdan7FrsqSoiysaIr5qq9Wxw GQ2yauoi X45piMp6vPq36QHazO8CqkLNjdsfyzAoc89Hk4vjizSog5HTnfXqrpmqZQvTH5S 5wIfBrWsJY4M0eWEZaKxIpRPqHrq2i65ChiBhWKknsEX8VSP9oWE6SI2RelILuAeoZVWOOKXfXRZHash2lZI0y Qq7rRQq J4LpwPlJ8DPkAcm sCbFaed5n1sitV20OytEfqowtL6aibqmQxRAuuotfyx ndX0gTGx el1cDXlHCl6LloDBnv8QVfmSP0yEfESbzl6OOi24hROy2Zk3ylTyJYfJUlPJeg lXL3uOinUD1MGgbRaAigufdM3R5n2OuSjEh1M1eYTGx5r2JGRTkasrpqWXTCpewi7sE4hzaRRxtUHWcBdMFqVShlqKwtr6ZBWXyi7DsYf9muf7GhKlveOGbf7GVoENOXWT01tHEqFIwmiQ HOsojK1Ptaub VPDQVw7u ATt9SFmm4i9U4dA2VkZTAYKqbRPuh71RfS3X lQOFzf25Vi3 IfbirhS vw6WCAiyRG33nd5qDFOahQlv7uV1RoTsvTgY6oZ06Aw3L3xqVdCgndnhvYjYqhR7xekdZxet9wV9uQGihY9YC4Uj4TJ3efjkDjVmEZEB3t5XTUhkltd9dKYyRORSRmOpfdiR7LYd6mKmmn6xzFCIrnocEvkVLmnG6 n6zxp3gCvlqEKl1ci A8Uxb oNC7N2Gb6GFQYUmVl8nSol6DKKQOhaRe5OOxVp6s0aGrX5pCxaonCvXid2peDfq4xVjWi F 7H 8TbgjVr rMYSHfO0e61H02faQ4R16SRAJw5djhG Ela DLFQ8dKVaw1Jph20RdB4GccCmpYBBy6RutRAy Tu26Kow4EwnH5ntTY6snXqcCoOdYdpV1lrX9QDL1BDTF06ubL8tbzeVjglll6ZI2IgX6eWJ OEU yfmdgz4XD nYUg64P7PbDc0XXGVzA4Q1be8KY2EHXoC7OqEYOFgMtIkzvGPiJUSkYDLQZg2q76M8vukvynzht0VL3chGqzYciDso4gC2XZZyzwjJh C1QRPu7cUha8xd0jMFCOb27d26VaO7mwdW9HtkoF55jNK KRJEhh7oUrBUPoklI8uZaVC9nvXXXv97p9gh XxHyteoPEzpa8Cm1FtcqIPBnIF4i7cSa02f8dhzxGcczxGfeYUWAY1KNr2OoWMOirg5R9 dLy12kG6nmVnf96036hjqBwuwFDvFxN9gui5JnDXH1yyoRByQN17rGbAkeVf8wwFereXQM30AOJAZQmO3G9KkkwyJYJ2r5icvSsOMNqB4TzvDdznJo1eK5dvyqLCt4hjGgVgWJCuBatAUpG1jWlveLsK2XDVwOApsljKy1x BYKRItehbDwz09VROu1eQgbmGcHCqSaKjUIqiYh ip03rRh574TpCRB2dgExj7U9ZSumpClsc0HKfyShEaRmscXbsxRHMBuazjgb49cDi34xJaGkOIsiqOecdunVfEskI55VQegZ84XXPQjeQNOhhmV8n15MGm X9JXeawG1j81Mgkd7vPWliWZmKwMZSFM KQIzDUIdnuU4peJhRcYTCrqSMxxXildd0rSviSbc9XDM8zgya236GL8O2pc5ZwLd6GxL93c8 wK 3sx9iAAwkes GHzNdxh4IchFRGTx KxekuYwjLxS41sPHZNpxhSvR3N4M9LWX5crxXDnIatYAZe a NfQNsYcY4G5JPrMjQ4tYJ8u j0z7dZB5jyGymNUA45 gM9SfzqjhoUcBX7yg9glzFsjB 7e9tPJNf07WLi dS74hy3XpWUJFGDh a7o b2D8dS74hy3XJLDhrfi6V RCf2MvO7magerhkpSLf GCxcU4gOCX6ZtohTwe 4JSlw2dPiHCjGRE1GNvX3d2f79iExavBTm5QtVazFXF37e zOEP7h29T6JRTVST4f 7vUJw 0957gQ8lVj7TZjuSf5pEZw BcUyN8Bh4pqn8feKElESbXGG6pLiiyVip rcXyF2ZZdlk7lClaBN6LVX0kUWcXoy4eWLD54s6c8XJpj09Wl0nWR 3 NpsyRjsm1KzFRdXL5dSUJymdm8lir2O40pS0gjJlas2Zt74iH9W7tHc7lRIeJ ZExRXgxfNTZUMAupsTcIGEbOQhD4s9gFHDx7eCIIjkj4usuOH6nL02OO417UU7g7yBTRDUusaA5dWPasuv1 p dvvIsvfsvuqF6tvurfQvQ z tdNpjKkQfOTP3G2 hkvOoVZLZzUFMZ61ogWwq869mZ7mZ7zU8EBEEH xr 4mFiKYPyzCBMJOcJXcfbcSdYkU8iGfOhbsRRzzMfeTeaSrTJwHjW0 opNHZibmMtEk82skmogLjkv3APPOF7aaEjQsdrvYIBeKm5nX24GWvVDOjy6OrBc6h1RCsC oyifLjkzrlKOkgKCM NAWdolVd9MHnDNdRqGOqdbUJKMRnZPQin79lOIe GIsyQ2wLWVmcYNFh5ZhyKgrFEOHcUv aMNRlPA1jDqNwL6Ku7kDE7wtXIpLaxgBukqPT OuLbJYIwxb1NhmX mqk6kfu5pNmiBdtyJBLIclL18IfkdzkyW5QSp0pO1 573qNa3Qdk2vyDcP7BK4W 0ZJh8s9llmd99ZCDkp70Z7mhRWQkh70Z7c 6KLpJe Qah 62PGi Qh7ITSibMwuVlFNYoIw PNPOSlM0cQbeNInGchmaU9P4 3QrH0ad J42YD97qZ2msM1ZV5eA4AF36Ot9IzRbwiH89VuZ1Nbhy3kx5hPcv5KLft0bO wQiSBKK4LrsU1QxU1ctPXo6ehgko1Sv5tvRQMV6OqRFmJp4O4goXNFu8401ID0aIudbc3UfYOrGctvdYOAeR8Bm YwzjbhIqiTMYjYQiKwo6nX0AmOOAV9kygB8eMX3nAD4GshvQ9wus7bnRrMEanZoXnt0Q685H Fq8v2vyzUPRqtJPNgFA3snhCHPYHLQuhECIl3oPc6WQf8RTmybTO iBms6S63KbQ a4B6IB3OtvpU0rcdP5WEjzO3PSxQefa34H9IKjNth1APPp98s4OnvwufNO5 jHjE6RYqWLJ SmgICxyIJe0OTBnoIowuz0OC0OTEKqF3HdnfPLLtpL7fR NKA6Kg7Qeq4AE6oSJwXou4DzxGgNQh3FlAuBCOfQnNM0JavrzMox MpnUyrK h36WJkOfsk0KsyAgBRc93EE1DuaTFgzu7l9dYp6okoI9Lwbf2wA6 ChzJZ 14nHv6UcN WoXq lXcdpI8o0gsSyr8 bi0FG0nZvhi8A4N4uaioV2 MrWq093 bcZ KlCd3lBggwUx4oifqqA6aVZhLTBb8k6sNzl76dVGve5t6nFHsKIeBui0y7iZ3C2QJpB5fAvRk2IqfmQpD0EOjzDSydsI7x50PPFCCXOnKuK2U3iAZiA2aLJamDca1itwko9a7cjwWiHkkIl6WRgGHd0Qvd0HZnnjyjRowOAXXbSfUchMeAiXVe6pYGG6aPg6sp8h62GyJiUjLgeTzVh6UU7do HvUT9Ig d3XiPkr1zGMYiwXLOZSem19i4yYScjogXHfMTn85ciq95thXagKyA00P4SsAWlMMqxvxsdWCr1CP3Hy7dheD7RXS16lHba4UTDx6WJprG GsbX kxTkwZR5LuHCTvhBDwSG0K4SUgqx4dKcRd6fey5e1UXc8i9DqWTPd8euRovfDneH K0skMs9gPiRaDiHzwdij6ZkN2Mr 8sQfbgRZSYqQ6 X1N5nbE9JCPA2HAdxOaztBB6yRWUGnIaFhsZb OTRx0AwkdxyZjqMi BbFG67kFdLBv0vvxg8QKGEl8r6NlErknEsYOvJ05rjD3s3UGtIuDf46fxfzev0C2SrAtJtDnpqPrnY1g3qToZvukkkVo2FuRR8jLI1dwV7yQ1mNtzA5LKbjKTiXDOCzfUdS2Ybeqqlyym3Ah89rwPWTVVm95RCrnvgxgCvv6jC1SGAnjLrDqBhjgDNlOXKIMGSRvOp56u Yz9SV05FoDJmsuufWD7hJGQeQjVslxnNDiRKjUuK0sEDddH41vp1YtsuydW127FSMbv3 vlBzOm KahCo0J80bIC8DjpNrzo zBYgwzfdeWDddGKSzwyxaPXSB4snMEq0GocLMDBhDOOK3nUuYOWcmV NhBQjfJISsH y7wy2bRmBCh1eS2SzflyGWChJ9YIVEjwMrTXfTNJzMpZUn4FRGR6sWSSb0vMYLpfmxC7WId8NkK3CYxuP3Dkp3teT2YNHPY6 Dbl83TSYFI6wLUJ6SQlHwcSL8dnAccjzQEBlT6h6U3Mn4RHXC2zdJ5Q3gSFgDINtNMZQ7GZR74ZSD5CBxs1eNVZaOvYrPI7wXGXniaHW2 Dw0Q8QNfn GlqYa uWBfTF0ClUl7EJtvUWv86rH Ax07BRobSRoBXAbVGF 9e81Qz3ApV3nPunI1Xgft1jaroXSF My3314ualMOGCFIjX7zldiliVvzGVXFNXcwoOSvqyOOcnNGNobzjILY3EuP8YzWFJ4UJo5Cxbhqd3KbfUaXsmkScc1VpfSGirFsfTNMHd96kY7PtMVotAyhKn0r5dtVmIPxoXuiROz5f1jJOlYrQz H80dVUQGAwoJqu1207560DgZki aZNYkhl wQQgVSCYvCyZm1KC bpK O10WYycKAybiQcT2z2m GrMLStFxuuswZCTGMFYXrGC xxGe466d3yMy47XcVmcDIuzLcMyWbojVBfJyUwAvvaCXflDSI48rJ2UgJNSpbBoR 4s6d2Ijsh7RLk 0XYls7RRbYjAshnjWAbpAw5 0oNhK5n2Hl5yJOypZNxSvCc2OOhnBBqtXgFJWmpr7hesvUHEprDNttWlF1H9 57b 7WEpApH9EGEWfbsyW9orpT Tzc7D 9S5ZI vP2xkS3d1dQ2H9 Ld88c79lLzZNb9GVA9qVVD92p0K4eY7ZGtAfK8xXYxpoJlu8MRuGLPfUoLSDqLBJlfleL8k4YrbrzfcsAk4gIsDexWdYjcp7nSjDuTqCMPqZtlA9Pdh3JEUWR8XB oz0vQyq6KKveG0Mq8iUiDeh69BmoWi9E646X2m34cgYVtgiXlGZcdHEHOxiExe Nxb N FHg9tZA0HvZci02t3ayK4baQjj9IdEL8jbcGRtZlh0goeZtq9Q3PhO7 E9qFanww 6y9Hrw4610uLJBltDrs O4vJYhfNRh UcHxr6aC5LcOJqzh4UYf8I5gB1AtfpM5hY64tBlUVRKKsK7a4bWYxvy2xpmZ3fweCPWSVzMWS H6Hz JtgM9p9rcZ ViGhq2 m67 lHz RHzFRGrYhM9VJE Fdv23omZJeM9Fmwy2 jQeVrgg5GpltnAtaKIrws1bcbe8TckMpMyqZ9WTFeyr YHzF6WS W2 iV2xGWM wt2 rd92w7hlt7xSaoDEqt8WKmvdn70eM5Zogoz18QzAVVFYchPqL9mDJJu9U IHEpv92ZuNK8NZEo0UcF jb0QfNZTFTxU2M20M y00acghB7p4MRGtyixtgCU25 XaIll34CURLa9T40k E O40h0BsrDHhf9 8nMKK5CG8FC77 a3s7 9 AFt9em cbJnw7 ZuKZhA UBoF73Bh3s739a35UU49a Sm6dFp4NN o31R8jHFUgefVIWmpaQui6DflS5wln1qJIoBTYmh unA1yQzRj8OTl9iHgo073HA0c0gTN7CxVkgsD9ZqBKpb8lVFp5xVU2kxS97TfCL7rQsAl9WrJVx7QUk nTPBkQwOVDswfPF61ft97tCXqVFo6JVyO3pl07fMm07zr lJ MFn6fK3ZGMy H JFzO3Vk07NcGszHqVxk07xe6909GEBWdUTlFpyqkgJvW7qgEn MZuUz55Wjd N9Po0c1AwgJCxCGK5NcW OVo68A 4httF pxDgK0sGA2tRbVyNA wT8NbaFwRqgBCj6aCJfNs Fbkw4EnAWc3weKHLd9FZeJ6VxlK6891a9VOfcHEFhgID69GWUS G6gGTZR 4Pd2ob ICwdm67qf9EpVyzPUIv97KklZwhCnfoBIiEhvdIFA561kxv8geX90PQbqNMuexSbIDUgIyNYaZssOYzNKQKmGIN2rWZuGENUICNCVxsdIA6kAAkrE9OOPBiOPeP0JCMUHAMrz VKHktfyYecroxbktHvlIusMmwsYuBGkMBGkMBGkMBGkMBGkMBGkMBGkMBGkMPhvmJ9METfzA80IxQ3CYGnyCStIeYaC23EqRbrFCFZ3eYQ19fG9Rb7sjqQtdQqhXXdjwkYXpWXr1NjrcIaiYqJFncClIE9nnOXdR nqQCIK7ajaeo jIMkFcIunEIxT0gvtT7SbvG46Lr4GbjUIq6UwTr15 Cl6FA0Y2b8xQvnF0lIQvqeUkRjX5KsmvqkXXhZa0Nl4YkQaBhL8mn nrGNzQA8PDsz8JqCevMJnQn frVmkH9Pl79rFXfxtWtWPY89EE9pMQaf3JJ08SyEz35lKhrjtmgN9wgCI8Eo7 r7wFM AmGVU fZpuLn5aoLoorhs4tUgzmAc634xUknk9UnWXZB0YFUgZcmb8TCatUHgIu C6Vb YocIsuUju8VIrB O0a50EL fimLOKHNuNK27KrJFko2In5sem2M9C1H06fGIT9awa17HGeZ1NP9pMh7AFEayAFP6cOsRaK0 Ys4y7bjOp74zPWrlgiAZ43tO3dZbgTEpYKHElJE4 ty27NafTGPzvXIwVlaDkfSOfNlZd9EmWSspE7TZbfkF8BP9nDrakuioskm7tMfJ1jaoNaGJcnfUx0d83e4YQVIrVtnX4h8qJF89COsLOUOQK uiFP9o xy3tS dD89oX p84tS DZ8O1LoZT92RiCvPd3C0Y yrlNkqVq5 AJ3 ZifWKLQuBoq2COHlTyTf0flIX37Pck1zVnBG2yOrzAipFg6LEI2sO vd8P5e e4igf4owaUogpavIoF8EZalutSwr3GEPtIgbnuEk6yY9HyRarURAvQdICnG HrkrCQATQpar5gFqnLbiQPG ScviuVpcNFmFKeZK946FesWyh9GTxK GTk aKIv0huu6bdpc9bBd aOLCnkZnzz4JIiYXmfz605NLWw0eVGZ403g50ggCNaEzCJQh4Aoo4ygBfjYuFIDGb007pXXYzpo5moUpXXwLcyoU9z4FBINwWU74eZBnhyf9yFG45s NUCJ5KfN6nuACe0wWlo9OLwAQ izK8I5ZL80hMaj4Xa8H7tpmNfhognmhLmC9gCxWyHAaYjblsnxKeJ4gCK0a 6HEpSmxQKc1f9H7IowTo2NPJmKw yzImqeGTgbDBO yi7XPfhkEstuOXhEbgq0ExX87LPJPh0BI dZ3LitOPAIrS8Greh7OlB0nIH0KG Gjxy11v47qC0ZCzyqDmJOJVSwr9qqRzuAPXXsMNAc9zTr1ejyY4uR21rYCeSJcDQQygpd7bzqjGcW3QDpzDbAMTENiY4k52s iGN4QsNOTDW3Lc5U9hKcArHrxc276u96eK411xfjHuV5s 1ucTEsppEpVOoLUotf eDNr6yjAbTQZn0eKZ3STjJPHIwPhiQLhVRqA3ONNV42okjcrU2QDU0FmOtXFP8I4yPwBjA fbX83Qobjvnc0TvSqo7YfB3ynARFAKQYQvDyeRLbR54sWptgmqmVqNkKxLH5BKJrvQSAvALXEFhjGz15pzFfb3ynIUbfxRX y uA4LkPcPCYgWwM6rYOi2dO1d9Z6ftlwWrFTpNjKaRhRNkgRQ8LordYciRoCFMfMIeyisWrpCMJ 92y9zq5p7eTOirXhdNmn9Tt0H1CE5kHOwRPXXOUzj6iqkEXQFFv6bGD93SbMqUiHvDOfDSSgBN8Qgl6uN k1ieoPRhMggTvv2oVxApQ2uQainyxIjiFLSL4kj3Dz2td IqP46dmjDdSiDDewK2HaikD66LbievtgrrqqTBSLjt 5MmRJXRIVlB3ytGj7ycTjhxyaJ3tRtb6MoeWj7qyZM4RyRtXBzQ I1GiwDMiTyWNBsmBnVInwS6v6mwKZ22YS1KCYksDU1J4VmO6Sc0IZ3SwIw8rRLEO10R7ynNoWkoP36njA1MvdR10nSstAToZk1QmDxRXKgtt0nS6IRwBjfwzX1D2TkfidI6IWSo9qANCCsKs4 qVrXJZNnLQuEUXbe9PvFbQ vpaJF0yxxKZHuaev0V5Am7Af Q1zyTXhIXGTKUV6DCigav82n5agv2LzGibDycrhnvKlmUijSEovCHeIflhIhR0VKsFklkX9m0qo8bhdn0qe5FuqvhygxeCdWNJxGh2F HkeNanCmjxXK4BjaL0rYCV4yqZNmWbPW7Vmk knCeXDrMh Hq2Q2C1o5zHzRv4GcaxM8Azs7PCbRt1g Ok5Uf6MEath wZ5D eH9BEfYb5YGxLGuiJ64ubG7vPETkZ4x Rby5b6 kIELuz 5Q2YVS 01on2qLTa7jCYYZuZVfepVvlViMhxz MnrV8e4r7944R04q7EA0RcqeBP4Mv NuSydp66VazQQsECmN1KmH02A UH3ua7Pf9I7Ck0etiCwBHNfjzpc0 IkZgWt1hWGNkyWnJ6 f6JRf0mil7GnJfDtxloN8YqOd FzVR GJRQR769wSO8eemgJTXytwVbBKS1hRKxBJn2wwwALxzKLesRngJD1UR0tAxlPDxVFyzxcngkPvTPPfti8zPthAMwAdjW4eAbYuiHz6KottNChAk5ggsDcb7mbO0P zdF4Ep3pEF E7BLeGHQfK8Q37 99CpNZ9CpNF3Q1NaTSF2lwDlqZ7u2yZSA8gJf80Wf80Wf80Wp680WpJ56H XPcD9KYUyXBdNVTP7cUL4fPUL4C3Y0ZjluVGFhUGFhUGFh XVFh6WY 5hhquWYOYoBipLnml95nrbzO29W6gHBU1kAFdJdlAQr 7tp0Ep5i5LDrgkA8DVNyr7zpXIhcon8gncKQaau0CAvi4UDUf5jRg xTHRYA1 4Fd binnF06S4TuaDL bpvnuyR8VfIrX g4x3 jXsFH79Yf4phh43qh TXkpGe6LwdwQjo4k vGGEeqNogAW95xdfA6gCZKSqbFlkQMDoSY5r9DigOusXNYzwowUv0wrp GRfMjRaMe Wmmj0iCeAdiaLFb03JuDpIaygXk fOTAOAacCTQbWap3RhS0PLSwxgG8WBeW3qa7fTxnPwlLvP RNjduvve6nsdy3hAPsOxxIHpFCe9JbDF3Le6 mnhZ KOyb4F1o4a6NYxpafL ofw5Ejfedr Oq5hfWarNZ ywQ1NiabqfZOBx3NzVtFIBz6PouRrZhFM0y5nUscnrS2 hwg8ztXA n3XtV4AQ5QrpCAKkP306AG fhh2GUcabB8odG9DBYu8aFVPr9tbQWtXg iJmpWEJ1 786Kp 8fbP MOqYh5ZwdGLMe9S0GfwAxONteXWNhIy4F06q G3gT31TOeVDcJXomeyWSqe2Aue gLlQoCX8Qto5ezZnD20MJQ4xoD Lcjq9ejhPKXKzikJr3h60Oh6YWY3FcS0 it20inwQ 1GLV1eqKgR8JzrAm6xKg9GKw ajqFnjrKgJ LPr 6ve4r MAlppBaE4idefIGpMVMT7ZCO9vU S5JmDxPIHg7ex JzHtlhvWuprj4uyi tBS zJS jIPRtqTRuqJ8JlwIO5TvTtjpQzXntRdVQuUsjT46AoEBfVVUI7OdUvVLYlF5jNmoCRbA5ICG8QPgr8YgCTLSVonEsqMA9Kx5Mx24yf1jdyeDQQmNa3fCjg3DTJurrK6dkIAZtPK0PD7vONvx1AiyBo4LOIB1EfZh69M0G7yD26y2ktwczNHLfDFyfH9lItXaIHhRA E9NLc9R5tT oS5 SInxZWrF5SL6YbOj0FZXB3ZnwR1N0HaY6b3EM CYgSAW6LQPNA5OvAMlJqvMMWPsC UFnp0TQYEvLO05KmrSqYeXfRHuvufmw4fp5uPYz6WbyGRpy82kSZZkXlRYtarSpbWApSrXiZQjIiIjcBf18gz28q 0RsCU1TRujppqw6iNvD6gpPlPsoDr6ivdcNeHP38BXEpKll2h3sWvO498EEtXBscDfc8btyVgd8OHQPBH hhQizJxvZSMqrim1GnNhLJ8Y2U90n8c vMon3wVDVfSyN9fzBovKBS6lYnQxKB0PImYCQiJyTifBn3vvTTIYw 0 J0o1C 67loRYKBA R1nhxTuowRaEv9E7TwvUtYr8jt3nhlbD1uOxc2KBAYwHYMaamj0plnfkU7g9o53o9YEBSKJOE4ogDusB5WAJshEa4iAPFDFQJMj5HPxXnfpmyGpIyJCJpoGJ3VLm6D5O59L DDwhrBh42DeQl1rYmvYjlg6iGa7nPdVDalzM c5qU6Kk5MrDWY5gvSjwVsztXb YoKPbfV0yo0OmDOhzV85mZCiXS3ylTMUlCOpWm8NZr6dZ netmuh0q7XLZpkSdYDy95I6i8cqr 8ouKt4oma 2pYoQmYvOSKA IvHRikUUMOzJ0MyFz7UGV1Mgxyv4WnQ 05EXFimKGN GaT60AjISyEyvRCkLlB5PsPwOE 0rXYPQN wQ7OACwI94gc2uWwTgPk8J6rLW2GwSIkOfw7p46d2QHR8vsZsKu7O6NwzuV4RBxSzs DlS457eku2Drxy2R4VXjdbZFL2yirHdsRd2CdBawRtt BxX8rEPXwGcp0jcjc1JIjl3SJGKF7l8VVr254WM 0oCo6 ccrzxlbWNqFmau xCIC8cWCxCGO at3nZPWS8B3w1leM16w2KIvNsUTnf2WZO7gbsPPhsO3aUrBjCZHdV2qwEdK8qrC8n0DDVfBVRAnmP4atl6TmpTZiTOM6C8V3ML5iUcWqB0XnlPRaWCBt8MnOcDiX E8CDZqA2SGnw6qoDrb MAsJ1tX0zkzL41HbOnAt7Zpk24i4UK0Xm oKi T 3wOwMRKVC6NzXQEM08 4H42NUsXLDS7llbO1HAYRIYR9051 E9Z8XSEU4IL5HnmFmpW8D z7CGZYu9yRsoSfjZqKRtOiB h7ofg2j5OJMbyWNCsd661kZT3oEYjlRAYZ803SqirYnCxywIFhzY0BI cbAF7 BFrpr42NOZEJU TT 6j WD1t0UcoqVDC7rhC4UI2H23hm6EI23Wr7RJD3ljb0Kgp2Gr7i W92ZqX5H5Goq3oq 9iEw1DHp6bu5UXBZnOY1TD0WjD9cgDTEob8S6smcjU4sBm4u5s1jlYJ0m2dxxU9zANCMvtZCPj2NLrDvTTjmrzAs xqJwbL1oPfG9LIFsJoUZUa47JIaDNgtaFAa E9luig iwzKZ6kEDkfcFjRCHMQ AWD3RJvU0Z5q388bdzy3dWLAwqho8d7R8CXxYA0IlG2G3UchTfzlpvwW5SV94lf C kt26nHmy 4mJy5QqwiYqJ7JzJiAKrH5xPFu67WaBk75MMa 3m AbBoq5obhpZDaImzQTFS 44SD7eYsVr 40D4LgpvinrMMZPhVw v8otleoJRNna1KBJatQowjlzKKyNhR1nKHvJp1CBJT21s2oKiFnyVs8ixwRvl52vFS3rfnS7Z 3PZow OzG4FKD3AhI0MMgUDBC258NoZOLGLeHD 15gBSIQLC 9MDFFl0jUfya31NWGv1cWm1cWm1NoHzkFjC3UB6ydPk94EtXc2qPRRFfXqeTx7oWsPNeoSK4WQBULmNLRTDJJIt4CIhBrW50yeK1DofA7rXMBV tHVKj 0i8LayvOO8ZLAu1Xm17T60Au6vXXk4CW6VWm9fHZ02byU5llaytVBZBW3nZayJQsZn2c64 kywxiOR7kWjpEXGo w9xgRj3cDUjkBkNqhUfT0AyAF1up3srQLiBLKJBUXECi6WoySNi3ThJn9e81jX7LwgwnCJnwcopW5ruMp7S0I1Wp13bFkdIfCmGpRkR3q2VdRMDddURSPRQcZxvDMW6ZEgjYMHI8vSxxDxMgHpIYClqwNl2ekuq9BG GUg1QEg yEhbPb5oYBqpIHuZHDSLcq3azwTpwLkq fiQZLGp1 iFO7iKRH3Ptd hH5gm jsvn51b ncnv OQz7l4fWHTl5qeO6WgzR3fqw0p7aYHDyX8ZrNKHWmWyvinX6EwCmmC9X2wCK5HdayoP51Svtz6sYmP1JlPXbb7UKsJAkyO8DW9C5LSbdjAk9MmNOLY2LYYBRl6Dd2pMz0JQTAS3OlfJpTVOh2ySkTZOpS1yLS3ODBo68t4d1Ehf6koeN4SybpufnJJ3RyC 8aQQZfWFNpGpoNGQ48c855g47ZpOcNJGpopbFDUc 68f855mmhpVHzZ5omNp H5NZHOINhrvEUe G3XSG Hp5H4h ioZ5WHZXOsNNH7fwf3PVbopAI93UfP ZzgrFYlyUscsTXWXhcV9Cv5NjfyxnIZ83dyBaPqYPpaqH0OWRfpaNEjCJoygabQAstJo4tsBHaRvNrHsHD O5ccxtW Jc59ggfTlslr7RBGvegVk9TjgWCNW0FkYEBhzobgDUpqc ygZtZ0CLwN2PUPgfG8RKbvT 4o9kGj51HHXex9WolD zxptSWZSutRlhBY9wJXciUwlVKtHaVl51PQ24k5M8UBQxi8QNo2OhYWUUSKIUbKjMQPT jQs11BCCydg59RltXysO9oYl OtxC FB00z 7B3Gdh2 Ego6bI2x8H3FFD3tVKnp7ItaqybvuTrtH3c5 hvTyP9S EGiaZiCHtHlqA1O5hKHC8W39qIRve0Gb E8QttAnLo7oep iEaMu2tCqbBrVTgI3s8RgNL1zNe2Kjif9uhgy0M6CXHrzRU6jlzzAQKL6n3itmAUPZ6uOsYMrlNL6eBgN34vtzbuKVFYxIEImflvSE4zn4LtXnE5mGOsilWOlldUK2mgqNXntdujQfGRpute aqb1GJx1L0QqhbX0MrHNFKkDF Kn idpBQxXXXWYUtg71tJ Q3aeAfACUEB0lhu1Poz30O2SETq6IvDn0GxfRM8DyirtsVpGLsBdDewMhNPrs9SYPfdGtdvDjslHghy3L WwoVxZ4LarpulWDBj4MVOW54XnBOtEFTbleAWrT5wguFCY yk iyh2nvY8qS4DmXrCWHeS2jQWyPBa0H1S5YIF Rd6St ZQr3ZzHENZsDoRQBqeFRJ5Sw sFOBzL0R0 3emoh2jTvPww9w3DjSWq8Ad4aJGXf vnSbl5RbhqOidDq7LOOKAXcJO1dAwzVS8CGyoPuTpvOUs1 CqR65FnQRkLNN 8415xfMRchLvX37U3LaCYcBvNJQjAWbPdiLmWneT57g9Nl5cWeoZsW1UNa4A7N8ZDq zVXA SWNFdnPaWewBpXA DFr4Z eU2bdGoR0soH0soPeU2HqVfPWWs32sAfx7bpHuRAH0JUJ1uOvIInKFsr jj5NcTr BYpPi KSnJXmBEa4j6m3K5kBcXJn8ydjo14MXOjkMFMkzHMtXU5tsn 2gsT0bulqO8GmxOEdLtZfwF4MBBtnASkBEChEwk ZAEZCiiqep4glllfJLsOrwyFsggiJcKbHKTsli 8hU29tghpuA6eIDmHu50PPOljfzkrFzYF8fVgSY9LgD43g13rPGakdpqNz5amx 4Pw7iTU2rAZtKaLdAMRQgRGM53jHa3mXkVkPD8DXx6xfR8tbSaD1Oxqc9 gqVw24AhjIFQLl19kbaNZAWkVo0nXgQKhKK1zqFtf0FmR4Fgf0xbRSz0FQew jXY DO KeO OaNh9vb4PSvsI ZqF9eO7dlTc0dTi0xtc9a7naKpcj doqGwBUn09Fn4ARhY5dNg9ixl6rtJEPwbKwf9ixfd2vrYuS elnbw5NayVkwA89kfR9 Rhh C6abWs5qFlSYtqMagRq 7p q90vuS0rPOZkA1h94WCW2Wspn59FR83t80zks44m5KSRPiI8TGmtOcAYOHWibzAChC8CbHTjr0SPyjkEzt2 t gdML8DivtcmfH4ThU2JkQQgeSw uLhjnpgZpzUYe2VqLLvf8C8CbhxTew6zUFTkcl9ujq E51X2eJvLWwN0gi6xTiAxPlSC0T9kdW4dUo6RWkLXkKY9PjJfptbEiGtk50Ks A4 PGZzlJWkSaAJljGXLvne00z2 KnEKeqUy64tlKsnflcA5n3fttDC9ulkpAJl I3qlnfStEJFaIGP8lMvMu0qM KxPRCzVXsb1AR0M lBewy4T vlA 0ZNdMKmwWK6Dmcv25jzg 1tZqpvAoXkNrmKP1l I0z ryYulctpfmD Fj8XCQphmDgY8knjKHUIGCWGPulwI9sICnyOPiasZtWDjuU7obIPifxPmJLrD0wkDYcjZMndHTiPnIv hzJGyLNJ00Xk 1jGfauaUflfg9IObhdxxTjW1vtAo8MsXx46i BD1faa7wYsRlb47HL2bHQx6BKgwGnrAkY3E3VC5IQJpzUPPmvtRbbU7eR8HOKyLgrNJSiidw51eaA7rxh632n6gcekx qBFhO3h9EO3luBHrF4kxh69OlvXsxcw6uB2HKfjm 35hMqK0yT FSF4Z16vw2SLSCoAwk6vwUjtzjG9KUKTZsjU2FxdPKWG4Cpl855dyVW3XoCkluW0nyn1CdAvIz0 9rtptiuGdDMBTCYjGfQBoCrTVhXW3BlCXc8VNFvIhkiA7eU 5UTKfGL6awqHwTchqGrRcMVPWam6q5VU0LkLV42APLPtoEUMZKRLmhRZX29E7QViT0kfPOuqRrbfsb9fiT9B4pKQxXnIQhc2yiUJH4pgI9yiwKBtb04GONHUsgGimIKmdOFSHNeY2toCauSXWkHtZHp4E0brygactHsyz92pGq2BjaAzPr7cl 8OvGUw0kxd66QJiQuAkgs siyrxbA3bakuu pXU7pE8 3xVr7ooAqfusu7asjhD5mixgRSrYSqcyUO7ZuCRB6492 qQBn5MMPrKQejXxbA5DTy6yyAanTok6q46wQ5rjiiYppWl4vrtMQTiHJezlyPdHofr icvjkmw 1Gbn8L OKrU7mbDCeFzplmiIVuYkS2umJL4a6mpRhpFJ0WqAF7Lbu4xl6BtKBhAT59wM9tMGIq4Vaf4UJ1 78 KpFWQJ1 pC5WN fIuCS01JEmj0tlH lrNsd3Wjz 7jrLP 87b93Fs03iXmxn8Khp IhixXIzsnPAqovAfvAGPWGeRQi1JU2cl6cONVvOX9Ds8QcwuAI rNMWLJl9pw7 MTcFItQNhIPiqaQS RIk7p2UIxJezr4vIIDCoD2pAzOFWQ5uEVAcBKDaT2VmbQFsRCfOjqVwc0VEfYx9TJMibS2Iqm9ZstPXiKAVUea30cYpCDxjJE8Sbq Qy7AOlCHAQPMLGEtGiBOPgn3w7CWU6 wAaDUeOLU0RKOGhAG1BGD5o3bJv57J acdKLr4yGoRvUPFa69wYMqFijBVhr ZL8eflNQ5indCOxgLdZIq3664e2mU9UsrZXhohPNX1TCnA5iFCtl LVOGwgx3k ulXlHK0jIxGMR7ZSXcB54JnWE7nBUSa5Sz6uczVjgQ46wmqJF2accEc1pH6LYnKdw6wjHP0Omj Iegx3kTr6 gPNjkwMmYQs2fWLirfP11IXYlIJL9xkRjaaDpv8GLFrb6EYaWBKgl3crp vdZp CaelteoSfS8nLVrW4hLjA1D4HaePNgOnjHT72 Xvlq0FS4HJoYKzYxuD4HkNLIaJKbCS8 WY9HLhal1omA linH4PHbWUpZEow5dS5OLo0whPE2Kcw qlcwAILRnT YsS8ks7 YX2Q2LJy5LCVlBojSEHfKoSGKE3DiVFCDRIUds5BHlgawHqw0nWk9nzpw6ZFTIftg5id8QNGVEKS6JUA8QG1GK1Pgw1 6KLirGouKwjlnXY9ti4FY75arhmEpD2rVy5BN oTfxe2avLqHzwmvXpqxqGsKrQ1MI7eJuAv0 tckTy2vc5zTOtAw6aB55CLUIOt 3 6Hp9u90tPgAGbJ2rx KMkGl0ur9hn13hUtnUYZAIMkXCwdfGHUjM8u YeMLDFMU2Ybp4qJCSTEWBFRZ f UOKZsCrjhq2GytMuLBu0j6MiXm1JL CKXTLg7LQVg6h0YJTRdCQAUWfUW7sPbjeGyP1qMdasWnxy0CdpzUC5tJEN8rmbGT9BcaBnbBT7oZeQXYvilf4AF3ecY4 ea eDRmFj0BHLFiuE6EAAJbVsewOar VLSg4TorGB2ck 1ut7 Kbhsn3KJPwOPoYs2AEMrtwmy9r3VrlAMQmnInmbQEQNiFgIiKgdsVvt6zuNanqfnl43utfvtwyK0S755GJQslsQzdogrHA1ISIjygw5mD6mevTbZjB8aaH8y2Rj0AeApH3A4NFomqwFiWMiaivjUv2dfRJb3x37V3qnynmbPTk6jttJktRH9NwHVJGS9f5wAfJaS Dd8rcrkO Iwwg7kzPHGM2t49aytWKTBqdXnrhPHBwVyeTk3V9u06twIuyUPDyJHuX bJtnxZyI94agHdoT4s8hpcPTyPqedYblqjtHC0k4yJbjZjwA AVlCWMaxXvKq455lOc3kwbNktXsuQHXkKBksJotrRN8gFgF90Yz7Irnyi2TJg0HRalVCVexppcfat1wujMcilJSysEmhHmZ5JflJdMiDH1lgxVmNO29KkANZxurwdhmxU910CHSGkULsteIO7gDpcfmMTs84Bva0kzLuTsaHZdwtnTFHl8 OyZSyQW3VVnj0 R6IN5IQ NzxcwKFVo0pobChy9tPp5FN 7FIqU gC3xz6UWIOm4PzhjrWaOvGLcrKLxURXk0rBBEVz6Ai6UfKACv1acx5s7zxwzw332vdcN sjQzx1uZU5gfJDPLrKsFEqLKNAvWNUI1 Bgb elawAdNPZo6RZO9gSZogkU29vhCR2PliVF0loZnJLts2trGvMpu8KfgxfUdzP7rIZr64qOhxUi1VUksTj5bV BVP9Cl9C0J13Trnf3YjkTEILHR7gtdQRSkAfLFXLlQ2r2rsNRWaQfG1zKD5LpOvZwkQrwf2seFy7sqYoiRxZ2Ly5Xi7ICc426BCIw8PrBk vps5ILYnLP6xggSiAQILZiHo8LH6JPuE3Nr9K9DWJ3XEMQ74Hnzhtk9HbL1yAZHLjkBRBltS8XblLt31WXQdTfslzYq9oi12MOoG71SPqRCry5C1b3WGYzjKLYLt kjn2Yq CSCbSCrSCPaOR7YqdpyRnt pDdH 5qx kKVKsODFfuT4atFsQNJgAWUWYJMywFT1zuNoyV1WgjieJhexx9cf glFCng d3O reznYe6yno7p5Uta9RI7oeXYC Jfx8ICBANMU1 1tN1fa65AeFbOaEUALxh6 J3 6JXnUUpqXvwsoCVloYw2Xow2EmdK0sBU0A3vsorjYj7hC1U2R2Dd5kjBVry5qYzxoE5YHzgY9dLkGA5ICk9WLyyhyxyKGgiC4qakksGAVKME9AsnWD XHRambfhi6haUo9UI6y0IyuuC4AbY97J3BM3mCMHKYk1WsIZmV3V3x E E E 0JBVod9T2nXPyJmOslXj4QE4H3b7RW fQ3Ne9a1xvVrz6yGqJaOl2OS28Z0hX txoBIcseYDFcitK3y7wnAscEncaoVAHcbWLSSKThB8cjVMmSJYbjvAt07T79 N6U4QxRwbmJPGXZZT5WHUT5gByyVyRTC nxc3vDM LOJONQXebkQJBdiiwBnYeP9ofGstbKNDrfmGPVj85AVvAvWm2PdezuKdHvBAXg1YiMPd3X ewVQ7P DBVDsKf1g8mH4ewk9n5p7UqDHvEEJMuSxinC8B0vZSmb3XMy8XhB8U CqptezznmBOrVvtR5mRyePRqfRtKfNFuDnTyZakUNSZgsPhcfIZu3KIqh9zgEjKmMG 4nRa4 c65UVdANV81cV8R61RquLPTAS3k6WUQrcbLxWOkBza6WPJgOUGXsJ3uyNQ6n9WbXj1w1QOvYqHVxRwnB0QjNGoKi rUntj88eSt7ZerjBj1yp 12RY hhb3Gn6OxcWm3ygJTxbOzSgCF8z0BQ7RsaVWQpEwm4Z42NXG9a044lH jSq7QJvl7YgxK3WPcOSEFjS98gondRsY3hwl5YwV Mr56hQ8P71VKohqxWLSKq8TZxFzD7M7nISuKPLXFiVUzLqEVd 3UVpJlPMa2io1cbdOjRBBci512dbgEJdgGZsVv5MkEJGWaQ yBfdyZnQBzBuWO26 bn1x7dahxuTLQJWBoCnJFfifzeVX1hqCRL7SzyggSsd5ZPo6Hb8lWcgVjXW5ZzGNJkEx2SsGex9BYMrnVfE1UaxKXBfoHWeQXuhQBgmFeEzWjg9ezuh8Wc4jor6OZU7r2rJ1 FvoC0f3nEVbG6rKPFUQxV7kIJlUwpQS8u2X6r5C3zl v8fxCUPpQa47IVw 4NuLItKNph7r8 GH VgpKqjojos3hmKVVhJ9a8p6Fsq9JXdhjMOQpLmFfoytfFn7x2sgiwugiFEpAFfp2yoK6MvXHto WPP7ZaN 7SPzdkSVv1GwT02r3rdytQsnGpj6oZ611SGV6E6EV2ferd2dpGrPYYns EuktPygWXGLQ9zfqlWR7Pdc51TgKnf9ji71U043KgtyxAaDNO 2T9IGdlM8mWxa d CvLoUAQCtTuU o86ZZzoeAnWqOG9tY6wlza8uVL12gjv8hj1qcPeY yzC7SBPBV5Sw25P6QIG6nE1eopKxVlflfx4T68 dXOg41ytdJgKy3TbuwMnAZYvLD8Q6Ol7jaOcJ0613BA6Ej cWR4OORZ7Yig2bylMFPVbN39hd9qZy S3nm6MLH4Qys y3bNDXljbtOviJHLxVGlEWaEhKAKzZt4GmGRz6WRWWGkyuX29cC dfURtXmzJAv6Y9SuMW66cdandQsKdKW0Qs5syK5VuWtaxUqzHdH8Q0NPucj38r79TQfxu6 iKFCBhErXGKNasD1Nezv2OBivmZyDney6QkEINatFlthh28UXnh4EJbAJj6XCbWE6QVVDwXjNDhsK3 o0qQ jyX2pEQ4P0jBySIYFNYNZC4 AsQIE5rNdVs 5p 5ZL SJF2jo7Po7Pp7zqXhZ2rJqGIzETwogRvUMvDJIOro8oSVWCOVbzYnOKMz1i3jrLIaqp4mTZ05qVHuvy4VLaQZq 2f7m0Ba 5n7m0Vf88h5h15G 7s05G3OyNd kj6K4lw0fiDo4VrrV X2Uvh o8ASSIgl 6wLB507Y1zO3PpaMUTrDD0QnE5ojE12VY 7YU gqrhJM7XhP9INLuSs8gmbkhzxlV5n3pBOe34OOfI8nbi9TsDSYKrEOy0g FH3lTAJ JvB8OOlOTg9xSBQTgZHJ4jOW HjiR74 scFg4bBaj CBLeVU0gr jA dVp0is ofB Js3EU1rT34j4FvfaXMXbANgBwKSrduQ5vB 3vfTuJ7QzB92Fu0yBM9wBFQxCPnw3C n cnqdT4NLgTRc0WXkQOmNt0 VPQ0YMxRZWzBN 4Dg6LlED51 RIgEXJ8e DmLhKCPcKBthnkkbwApTnSbkfOBdm8NIDBGFkvijC6Yjooc7ufeva0RviOH1FOxMR TMNjGJsiaQnzxpsBFkZ KMgFQLY3zOr eQwlFNH lA pNFIp1Po1ybmN1XjZzL9wG5 CV99I 3FeA 8FG3xj3raT7LJK4gN2vBu3FUDBuZYXCBKpaZnaEckd9nHcOSN4LMSELxy5Rswt4C 4D BpG1V8x lzLIiubfPoLq05KlCFotuNtpDFQZPX9sDxk6CQ9sDsE0odbRrpbRyP7bvS0CZkuMyiQp6P8R iJdGkeI0JtKkpQoGHNB KU2YNS9rM7h kx sA7BF7JvB0T MyHUMoz2Z4PRP7bqnjvzH6yCOT7m0oaE9PF l08Lw8LQnz9fj1yznmP gu rpq7YfrfVDJtXwe0Z3z4jXfL1tHwpqMJUVgPeAUyfL9VOmgwZ2qV2wRvxFlJo3991jX9KGs11VyNHNQB7w7 URb ixeG1dy15929GVOQsmC8Red3etwFOUcfvrC6WveHuL9 0crgTXpz6yIs1Y eNoJ Y35K oFD kgO6v4CJyi1x1idY0l9GeHBVgmPt4op2hPTbraaGJG0UmXm9AxyVMaJ lxRLdfvRz3Fzsoo0ps6Wy7KarwtYYkgBIWzxeBnAmbT0LNCT5bwmGP ZJ0jVGbkgda2HfEf8Vq5pkKeVaZ6lHr0RvXGRwXiHf5cEmfrSO2kO0SJw0i9vSLAGmQOUWuIlGbHYXf2OgvGdQvPC8M51ufaAVJJqcDUSTH9MMKYzfsvvcqoY E55x88RnZKxyYZlIboaUf634NrH4rqdUXfMy5DFi0i1GF566lee5LbUJiMYilD60z0gloAmCeMHn6OXg KN50JfRO657Kkq2vK3uVXbWlVfZf1YkrGL kkjq5K1LWLOOrbW4VsxKboNOqwheP3G3OGnJ0tksTOWflUCy08YOrPTtvCPZMFsSmIhkSCUfwW dlNl 8lnZ8tlERpp 4a3W m8Pb7C9ghnKtClpUl3YDs8iV7YROvqVUJ2I622w7qSTWgjvNpYVaa2CFfPTlF82 jpC7N9bEy04M6Kyo4XddpEyFMXSKT5fkc8OCpDs8yJHSgSu7 y0WNidvQtIS7H8UqgbLW2sagmcVNoMhF9hjrJhjk2hOahE7f6K4e7VXJgvH4F35UFaKHfxJRA4Pv4h Zhnhk6LkzBSTjSrb5yVXJfs5iezLP2N8NEmSQNv7ySNup7TQu5QPV46tpXzQD12F8enoEVBS12sF3dhWKTi SqdQ gNhDf4tJEttIXEO2pY3 HG1 o7 XHz28tP7ywU9VOOcR FVBISyNRoQMA8sapk thTZxdVga7NYipyqFcOhW3vGUmaxqQCkEk937MOQu8G3ZkH38OwxAAHswepuSURpqx22WOolbqsI5CI GfFoj2py nzCzD32imvB7BzqV c62B6Gn hN vOqQkdP3wajQGaO ky1oFbIIlRY nnRtEtVdAnVEQTxJ4jQclMn6ivCu5O1QboW4bf7s7j U7V9vV5YOT5qWOZq5 n7m0pmFbR6WMRjnTrBy 6sJz3 YM1QAuBR8lxfUg3utz20y8P03c7TOxQ Wsh1hpXLjbHIeaRBut2V4oPxVZuTp0zONfA7xStI9NVa3rM 6tUvj42GLn6m0CIM4TjymndxO1CXEMIwPjKhQh8utx1YYHJbcKLfjwZq8jk0fSJoMLQPv8wogvu6jVgHCHAacD4F7zmwxVvTMDs8G5lu1SUHCW Q8Al7F FdkodO0MCUBqPrvCGFyL9MuBW3D8NT tqRN83Jb83F4oj bOajo5PHgOtI Gei8 pGW 0ZHxqg1zdnkAOB30SmI9IwfUTfgBVRVb8annJT762WwdyanRTXxQfmrIXIa8MBJJtBjMaM2A8PtwWOjwphyMG3uvBpn9gnG gTZBGLwMtbhCSZnmoF6aumFSoh4xh6J 69W0Zpy Ioo0Yll7Jy ph2 3sV EkD9rO500sueuVtg4AcQIFIbdCoSgueOOlJDgGi437NIDdfq DpCx9b277 z7N7hx 51wIczoy34XLpah0cKnmrXnAXZvALSSRyyJZ4FDaSjIfSyPEDcGVqVai0dEb3EqeGDmfW Aay GfmQVbq2ro BF1g3N4v8mH2sWsfmD8DVFFW7 dapOEpWkW2XnRJb0d v93TXdHRj4Tz2uml7sdb7hVjaDpcyTFlAVDbUeeQqv9TLJrGotfrq1GGKhzSg33uCjuB8Gio3VcAV78WBGn4duay8ZDdSlQda37L cJd5oD4ru46twzBDG rLaNQClBDZ6LS2bZCzylyNFY5xCQLUCbnG 8VWLNdyT X1 1kVo8FyEvretdECnkeBuvh2XP1WYXSKjWUlTpbUFhstMIOgR3a UdRDd7w1PaFcq1fUpH9Emwr2FnBfI855oJg2Bcsm4aYzffSJgFmr3xzB9VBJ04c5xQfSqc7CXlrclLWXwLRk8lK6yGZI564QnoSSn9rzaBNX7MwKFCP71TQyWbSWoggnWM jWMVMf0wWbKMu osBdoNHa0J2OkY0o38Oq7 aXiygHIpXvnFn8H6QHFx6ubTzm0RCvR60Y2lplqLOQKMIJbCEBfHS5fN1G9Is4b4YtCW1euHIc1nIPzPnGUswT5mQ1y9w14tm3cO3B2aWSOZJjYRmxbWjUUrgf00aqArul51T4bsIFhAXf78FVsiuMhpCPeF gSVFrXP4egdcAUqzqcFOV24fGYGbgGZRJw2EP9W47Yw6AJKjT2z1gFIXhBImWFgB8mJno83t0 QKnzRHT2TGDu Eao2VFvx8 Rd8i1uI07Y7dAfJOXwHyjSMmX1QTn5WNGykaJuR8Hc44xEKbZL0wEiZV2kyuKHXKpa6vDTM56F 9Tp2GPdrCMgsXzAzxY5Pg PBVjS6Fou83 guypaJVlj CcbX3jrTBXXsJ8ZF 5wPtIpF7 a oQ4dlKCPQ8V FvKejokv 3eaXfG6GEhDILgR9FjIInHRlfIY7 1tam9EHTl1S6fR3yI8J1 V1E8XE6tF6tobQtappJE4pA1UcVz3goZ8t3EXNGD60JGY xOsbN 3vqXOBvcvxm9hwa1NaQVGF0lJARWnK6SomrIHxkEMC5QT ZRIrsk rlCkNImjZ9J3iDTF99TVHyrxswVoCdY2NeDwrPFlGIY892nX BxHxYsS0lW3kmhfI1tvlPxEf1Ef4C9j LfN8c5wB5fMCLCRrba4jNzMUIQYJokqHBhV7ceAGbDB9AMOY4jtgmIW6laOnqRpeLtA5QHhxsn21OCRMga5hxiLHUUE6ElmPGdM85UWsxkSHdPXCK4D3JP47iKgsthBO8tAsLUxgI2G j9c1F0M Nr7KOCeqjhmAORbArmyEB2dwkq65QXthWR7eDMaTw3MhnjOCH3WQetpE3QSheTjUp5VPiQxoXDYxl 4zHJWA xJrmQ2FmuPDtb8I YsbYFCaN9OPcmij7zMrhNU78ZN4liVoSzxMYLI1safRXpzQKYCjCL94lHoNH5gvr5i9PeF68xyYLfIHvMr3M2t1rOOqfU a wPzY5XJS8lUC8IFED5j3UF29SC8Z7UKmerYF855NXpTxGp9cEFQgZFP8lm7Mup0Lbs3UP8n4NfCak gZUh bhIbn57j21skNUlS0fxCMcIzMtCcS4RUAmUx9Yy0nK PphTMUPk6L1x5k9ee QO4YT3ovv15U7J6grpFh Y0F4asd8M4F4aXuZVsUpCqOKU7O4AjflVYD9yybCwKRxxY7cXkljRrzt4fHNwgFc1OI7dQe28DWIxLd70fSqYcqBZP2NJF6D SZzOxRz1P0T7IgSrTTBzg01qIfeQe9dPG0OQ72HkLDF0qC9Zwn MBZwMD1eBg3ab yVgcW1hGP3GMveaypkFUVT7ALfyNSLEnrhVKUngKuzkLJeK0z6O7NrcUW7ZRSmVWhDx S49tWSwBGrqxTSau9zdB1A9UA0svw0vqLr3oqnfReHd5l6Inhe vy5ufnODRAiOprwRaE3mV1DHPppSPDbZsfA2Q0iPGFmnDGpkuRrhl7jtLozYrhD1vt 5XBUSLqcKKxTjUNJ8lKgirp tJS deaYpX8qqNr6iCuj6bXVHlR0YHdAMRJ16kxPl6oWRfSeHntgFqerYe0s4ZMe8bjCTKiyCv0c08 56MWMaGR7U OwB3QlpKhDLoG1GS4P j7oNVQm6H3qLK i3o0eNlkaS87n jtzeUnZ508PsnOWZ4dxbwoZovRMnTQJ1FnGTn7MJqdcrgwnd38USCKwf3uTDgpq7qY7rPvONJVrCz7jyJkEMzrr8GlBjINfC9iEApFpX8OKrYlxKJHjcmgiHlPmgMSvtlmkz8HByqmgfFV2FhLW C3Qc9lYLdUdTGB1Ghd3rwyLa7o uDuaMNAi6t0FlYp3qfzzgDo4EmbOnGYdI 4iEmKSb7xRQE4kVxBKPZYItIYXiixeYIoQsR8mAIIjLfKYLlv7lI6sVFzz3ywZAgJWmeVQamxHd1 zKGvO0J0jvOhlmO8T1nR5QAjKHAYsn69FDnbzAnCeRXg2TgAiUelk6sHLvYGiC7yqX xkpqBqb8vYkn6MWlaSjv7sI79H1fb 8vYq9y0oxmf2fSVrqqJdMlDx3u3FLwLb9vc1eHfKH5IeDuKrmzuGLPionqI4cfhMBJXcelKrnsrM6jJ47SffL f5bkM1RSRiIYWbgg6fFw4kKYzcel0 fxxfltijQzLps2uTrfFc5q6w74ebJPh2sfmhy0eDouoexeAtt oddjzTIPxqwEM70VsoWn0HLspMc m tMu80f9pSrAeydH7AIELk U aX6qwZ6og2bhuz0 Yk2E01shk8yVyWhijdVd6jKWVOWMKcATVwiiATScz529CEmDewwPIkPyQm880P TdbQtO JvqJjHNE4bzWPhCm63kE8wyIBZKu1k4oMGtNvD2EfR8BuAe48CybyBpAX450z0k5X0KP0YfbM9SShPQ2tODgkSAjaj8z6DajztVx3aD5c41JmgMPTvk xs9dRd q9Jnv ixI0IIG7SrupTJPDMK82CtCPtKP8fDBS z0GJWBK0fv307yzLI9LYGLmyXgpyXAqfRzGInrifdbyGIDQGfd7yDxSthYqabys5ARGWLCPrz bX4tUA6nCO95N8ZO zm4a X0zdQ2kFLYZ14ClO8DYJ5eiKksPlPpSLmA6023g6L3CepgMtlkvvolp1fwOqHwZcpJwZ26zmWrsAP468gx E8j1OI9ziKGr89PNrzG7J4BCWBuLk9zeLN7X4FJjOFIwpLaGQs56PXWCvM jVNsTLfaXBb1B7gC yzglT7sRQPNkYYvWerwIBlp6wkxOIyHq7l7nXFTq4lXU7mLssMDkf9V6EcMT6BDN289wpAy2Eit8DXMgVfVbFDSu0 q AJ YjgqYyyHhzDFL6S5HUQttdB37RRi jL5fIe7v8mwvXuzea9I1ThqWYPjT4H601m09aOJcNwMXVw6VjnvtlBE8thC dfAtHY2MnAosQLQFrYXgbguv2abhBYKu6En2 kzWL3 h kNTCb4dASoqW5g5KeEuJhlaXQReKPT0cc5uuNGEH3E2qoWxELGWWwPQmiR7bUwxq v0cCrfTaCzoG9L89UNWcQiGOts77IvTW9pEg7Bg6kkSyDslLTp OyNMWm653PWEulb2OOWmllEEoo2KDVm2To8s2l1j6An2Q VB0Qq1QLPeHPaBq2ROcEfF4eQMNRVZgNoRud7s8u2pjfYMJTzgy0yXbli4FnI70njszW0nvvllv 6XhDaKBBdC6AexP1NrlfgoIerMiyzkGI4u8CKZnwMtDYUDUaFPl1uUcfmv2SMbkPcgJI hdJntvfYkgp OLhcZTXv iibgwlh 0O3HkqPj6lT 5fBNkzNe1lY5ugmsqN g3pN4NgVZWxQy7x9aTFT TDg 1R2z4V2 B hO9x qTFJ93z4QWF 3FO2V5HA 6hsA1cd cqPELIDg RWwytNH 6Dg v7mCR7VZWfk2 Tk6l8e wvVX0c3i7j GaX0WgpclebYivAk wP9a Ekz544lFRWorMb6ezpzqRUyQzNCMw13WWQEGqy4z ucDLMc9FPpOeWi1gK5eopCLPMj4iqOxCSVpI3GTQIjlf0zWe 71d regBro24GfXGq0Z40B 5qxjRZWPlEtVMgtYkdGJT5z75N9qUwCHWKmc8MubFdf fB f QOxWP4MBjEShseWchE02 vTZNuXt36K8mSRJrXjXd1zOnKP7IojEseX5ijA Op498F7HeHpXM7NTJB0l1qTuFyouyYbhrrGG0mr71Ypb5zBZERRwWU2eN8529zpJjhsQvrwmB s34ZjSO6JUp0KQBCFLTSQH51l0eTzHAxPiHwGwp l2zyoOwVENeFSQTFpYp3UVojos7 QTF oh8rOyximK efvIOH7U d7fzeg 0p1jp1tn jjDASN2uTQ4amV2VOyenr6NA1GZIs6UN0HJANUhyykCC8GxLwy6cCXtRiFKTLblRqsfWcVPPbDZUScQVDBofmqx1fsK3tjJipqTwDSRWYEu844xjJWqZ4NNaEUK5gZ7vHtDfHhl5Pcfy8VYsZSKMWp35yFqqZoW95s1Gnc4m1AW5qUoZ1QSHKjpQmdPRsPHja3qOe7WzjVwyaYF4EmjjeqnOdT4sROLBM5xrBQClS0LbqM0R21S0ROegg8 GPZuiGxa5RG U8igzWosZJfJEz0pQzRALWiv3NqNouJAjWiCv3fr0K6cD CvUTUcVY4wg9A1yFvMqgdzsaNZHdjKwQMBk irn0RriRs7 t7 0QTF7IQ2JMcjsmC8Ejmw8 tkoET1TlEl0yc3rVggeVl2 txue1E ZuIuVCK9LJ4VCe8vgSE x3PSrDmq3wC8Mg1lEZM7yuV5ERdOcfVoMS22Bl96fVozcHn2Ub8UAg7I22xXBsVJ8U IJJFQZWNUy7 hypWVHYP4f4OrYL 4T38bkXs2ek5B TFYZ0UwcBX QNTi8FKlBFUZPvWq3b2nCknY9i1o35Gs G31 ZJ3z4FFSCK7HFKPbw Hv46BOTSbMsbrB Nl3tQuUpybOegKseNXQvPMCjEhLs8AxaDhIzbwMX J4dux5JdDLvQAOTOrzBRMML1Umgge5EZbE4VPArFSPTSHBKRnNU92gi3Ya1TzqooaadiFouZ p8DuRYJmBnmAkoTnB7PWg8Q2O59dCMSTHnvH3FpFTrHw2iTrTcnrt0DDQ6JQDbut0ZbCLqDRN5GQv5yrufyZoSFAwZDjjaeCC XGX9Y103OfWakUPNhWh0xz eZyvUjShz YB2cjLxOgQAJfqQ3ux F6AQL XNXAlZ66AxYOU1wWUPkOwqkuvhoYrBYTk1YPk1eh9uQv6rPsJbI5c1nBqtr0BAyIjUr7G96hg61xaZ9 OrFVIPn0CfkBIwEQa 59FE1IFKvSnQCcRT1X5dedaqu4PWJvWxxxPClRdmiBIyclRx2CDZYYPpOsLvR0Nm0knF9Y6nGk2uPAB4Bfo0QXZDYQCx 8FGpSiCKAuVU2LmRblz0SeMGFa2G2Pz1GZrpimhnh6jK4C0KykACl2edz8ZFQAzp CyiiyYkVuRk4afwRNSMHXvb4pLvnYDMi76HQ5F 59n6xWYUI20v1rxXOgUjaqUbcZaHkdCaTcW2zWE29b9Szm0wIIHyfOaJg3PE372hAhUF8c61bkTw2BHiEZAB50Se0JO5Zh8FXpsQbMksboh03KMzyuomQkeS9VFKSJED4KI6gqhPrZQoYEW7Ct1cEINZEVDnzpW6sw2WYPfTb4sM8VMZqVsPwnzcnVZFTVz0iQ6Z2cnR866TAQLxSv4U 5 uR5rZrYHawdagJ2gyvdQfL0f2aOfhCO8q4qHI890QmsN3HeskpC h3NVcVK9EnQAJFFuCjZg990cnHDz PLsfo9mgBBb3qeXn3aVr66mrvOQDtMTRPxyPJSJjeZbrkKlW76B6DY6ivFBl2J5GEunu59Os1gvquIW 4P3 Z ia8CTQDIMWqWAtnIDXYnTbwdYBOxgNtV7 OtRw671xPNtVv9GD6pa7Zw2BufDEk43mvWxsfiPM0UC1rl0Qrdm blplaDqDIEOvRAUD0d8Vz 2MVujhd4CcBTx0O2g6iI5SyKVbM5Ncv6lvLN9 QpAHRG71GdgR30eDooGMLUdX3202sQNh6R6dLjFR6gLXJJQqMaJJdHRLxFBDbj6FYB5BTn3wuMGgk f03XzhlGljYM kdBgSW iFGRyh UpJpIK0oEKUlSRePOmQwUMikDn5BG7PD42R34RfqAcQ3RNdYxKtd47vzvI16H LNrBSWcEYHxAFE7mzB NedLnFYVgMROUxoKirPxhPjeZ2YogdXTH3Qeqo4ef17T7X 2XepocgqydQatb HQA5Lyxw1Ue9me8Clo9sxCXvYLFTClgQ5FJ2Ol5xgIiWQLM 2wWz9Bufits3kbDUfGzp0 wAH3TQRl04Ntw H1ch Xuo3HBxXycXmEuHFRyJQyXgzT9MvcepJ5a7Bom5fRefEvIdXHD7oLXAxJ K3UX7xHYhH56PJis0j0HfryXTpeAGjqv3VEObKDZtEvpMQleHHe3IcRurw0zYTWKVa65a9vPNEUjxCXClminGSkxC5zMCLCXvhaMNpNcudtj24wfAAkuTxdy8LRAuEtP6Ur xRmNlIIisqidPSr8zuyLzwlttoZjMblnzSw0VYvVcLjiG KV0rqg zxh1C5uCrdAHfAgDWLqjS4Mc DQK9DWDTpgh9AuWgouphf91iPRrdd8u32HF0idvhIXqxg4Ipjo4jMbLrw foTRJqqLyHq6psXgekaa001XByuVr5t4iebBmTexarOG3RhMnBk lPIAralvUDXRanIhmsh YcswNIQABrrlOBNWiuGEGi4Q71dYO2aP7VOPR6mrqsUQqBGaeFsJcmpNsYyyR9ImEOhcYaCUMqGDJOIyq 8U3ZKVsrrqAwnHbkzyEwLW0VspaDKZZYwmU Xgsl S3q0v3HUZvgvccVUGpjpZ Sb8K1zFdErv6zde2jP9m4VRsZevOTEVcx5bd66cIS9vDCqQWOvCiPitPkV RUDfBPfeZhaqmGHvEpt8ImYZZPUrEqQPyhS3ddsLnuXehKHPKwTYt9x1dE0iIve80Y cqkN51FXYE1ySMytI8N9FfL0de S QO3UsXV6VQPsTW939SMxlz S3A6EhjSI2Yc x1GHEySH5 84 IrJ4yXVB 29L6lUnyiFqRFG7a0ZSKsFY4DOmGV2VAz9EGyCT yfVVY3ckSMV2VQzkFGhJdet6Fy2sfGx9 AYpBFqtU3aje6X9UsHFKDVRxShx3h91 N63aqSmsYCbJ4aQ3qVF2FF7DPLpexC5o8LxUtFbM7OxI5xfxKj4nBRiWqdn7HDNct1x9cJRYbT2DXz5GcaFCx2xvUVVBW0d 8sV5HPxew xTK ctWiCzZfVSkxA5uOirILPJcxC6PZLdJylj7x uMhflE lU8kdsLMDY5xyWl AFHloFUv6 A5Xcfm27D LlIRXkn16baplQe HQuLvbrebZ3YDN5zuKTLWeVC1fGiHqfuk6U5RgLaAmH OQnbQkHsSgt2kue0LYv6UTLPJwkbfR18OcKkc57kJbVJK6yoRDmNuPplhoshrLYxMGeys3Bzp2v Vrgb0XgSpdZWUQ sr3jXNIyYggAsKeBeBxdYyYZCBK0RIizxfc47bi6ZZokhA2yPN0VIIx8GRpF4J35cHhXSQgReKesnIkz8POV ngQ33PsUbnp1PK5XcdXzuf JJgi9dss01oCEtYKSpL4sFKcbd5IfHEHJOHGlFmkKn6zSQNhosX8G767RA7JRNaKPIFwXPNccDqseFxRxDrJk 7GXj6ofHw5oTeVKRuf7evf3xeDD8KWfvJEkMlfzW5BXktY xKwXt3ko R66ucuxNuCKM8Z8wLRkJTPuCLKpiLceR7GgHdAZlePMGWqKs1ymcNMwnAiZGJkNOerLek FD1IInQXwnAUxxNZtKwZOfNfde95G8PF pmKd32XRLoAksIUh TSdWdYAkU8M3Wk27l2 AVpmHXi0OD0PXwBTr xCxDXgfvrH3zwwqMjvjRwOaAYK9HkfvszbmWMq0SuQSvL20cBvAmDPWwNnDT7MUBvytksQVut0eWhaFXeLhmke BXsI fvEWNmM7tMRjOXG2qcPrJgFde9EoN78327UmenHhgO7DN5S37m375Eo35 99H2UbNc4G J5i4LTk6KqTSCToicvXA6FA1wNfuGNc qRKNZBLetc2tH2dqhlWVuiIEXvbr9USBNbRihQHi c7M08EjqGC UdVtvQWrR3low3wdl7M42Zvncv3Q8TJGScTQw0LHpPY7VB1kCB1IC3SA5sRBPEj7TuMcPvlsS0Q5z2APAN yPifBlFlGNvGDng7fzhNR ghr vPWb8nFTx8bsfBaIs0bko cuus9Kjao4Is1sgpG 5LvAmuZaWZimMZxGbkTg8DHXoEt9R0mPl8SOUleQQKBaPknfbsPmQADeZ0hWykI9uPv3RyoJaNyyQP cfwPrHxwckybkmgbJgFFbkbPlneYrO3gYZ4yVgsMye3xIaDg0heXN4LFof30mgZ4OuJCT86iLT FasEilj Ybzjzu0fdndjNoz3DN0HKKD1rrqKg K1duL85bfumi9i7IGpIEK9WB39OHeu9K54X Jz3FMbaOZuLqiksiThc4RAJBGQJy62aXKCuUjjulVj7 s92CTZUox24MBEEGKSRDzKVH2GeJWDrmGoj6HwUcN49xrUJpf99XLMhb AfrlDTOAl8fap7VwSJGQZdit j4AFfiYlFnp6dY1 CBwM2 Erfk1Pa kFEXpRnx7cDCxPFeschCjH IGKfWQnRZaIt5WV52e MlQOatJZQvVN8vq07Jm6oW 4FGUK XRJuQo1xeucdC3gRV7 sddw5Mf4MJpRZyxwTPKqwMQtIBuFm l9P2ubFwm8JqtEmcvHyZrCRWTfQDrSIDArBmlC opp6YfpNBNhDf5GB6 Q4F7ss719wV8WJFGbMAWc9vllBb7l7X1UtxmFLvIKL9aPiLKmk76VMRRr21IY1FOn WyXZ649vukvc38pf n7gRRt216L9pCTiK8Lm6efQoAHdp4MtU9TVd2IJz94e WlUzbIljBrXpL0MoUn9Sdxlo7h5ARHR1bxB15i0BkUQlc1AGFmHTQTRbMs6V096xn7QLphabtXuPYv5CCj 4qVNOZ1a4loHH3lKyOdDWjr5hRYgWb7jgAp9p8OPZ8yz2v 7v6XOHDQT3cJ04w42 ca0W35ki6INrlJR3jOVMxsBU yVUnPBqgCThiUfBnVIoBRS5jyToraa5nFduhpGyzj28MloHJo Y3yojALb821jxRNCSVjhcD5lWnpxoUPyOO57joEFXHyiP5hko iXrDFqLtcnVV1VysLXEPi9JB UIJZsORB36CJVBjG8Ja2hHCWtWojPaviq84AjiK4z7sx9y YERNDxp5ep3 2Xtmz 7NaunchzjLypE5Ncr3zjIIvY7b6uqibWD1oTxBb kKsdfq1cPocPS8b3CcI5oRqYrlnnQpMsgXhrMSdN4dU6ZI W3PRYEXxXjgRcSorfVvC6tI6f7l3ZJ 0VZrJer7oaDP9kDO326rmzl9zxcFY6qS9f5MNw4loULWfn3CbaUIcV2 IWe3BLJhjYLqy9 d2eOP jBemdit3p3DFgqtLHoGtxr8eA4KDVjj8bsAWJvnMhccoa7Nrif0D5vTpI yhQq1PXESiOcaruweNkeG6Q8f8wk4oOe by8Rhoh7QhrxZdZSbXBqaghXHKWsagzZ0SUoS2JtXjvx8wux8wvx82OIdeWEWxNQZ2WNQHEVx4UAIKJxzKej Fw qNXOPRmCW1V3RcyOCr6vMxYnbXdnl5QWLdtdj G50asRWw6u4A KnOOcb7deGs2cUVtBohY5WOVIX H5zOt9ex1kX FgIGKHlc6v srXqAKIrhWKaz56RSC7dDWxWQhr4GLaNjIzua1UztSFtmjFBC97KTy5TfwUvFWsJvQA6Ifkdmko73TrUOqmTf386yGuVLKroarOMh7VKk0NmsTfSrCytIpxaQsyqJ4p YM5Fp"
# ##############################
# LANGUAGE MODELS FOR ENGLISH
# ##############################
@pytest.fixture
def unigram_model_for_english():
return np.sort(
np.array(
[
("a", log(0.01)),
("l", log(0.02)),
("t", log(0.03)),
("e", log(0.04)),
("r", log(0.05)),
# unknown unigrams
# ("w", 0.0),
],
dtype=[("ngram", "U1"), ("frequency", "f2")],
)
)
@pytest.fixture
def bigram_model_for_english():
return np.sort(
np.array(
[
("al", log(0.11)),
("lt", log(0.12)),
("te", log(0.13)),
("er", log(0.14)),
# unknown bigrams
# ("aq", 0.0),
# ("wx", 0.0),
],
dtype=[("ngram", "U2"), ("frequency", "f2")],
)
)
@pytest.fixture
def trigram_model_for_english():
return np.sort(
np.array(
[
("alt", log(0.19)),
("lte", log(0.2)),
("ter", log(0.21)),
# unknown trigrams
# ("aqu", 0.0),
# ("tez", 0.0),
# ("wxy", 0.0),
],
dtype=[("ngram", "U3"), ("frequency", "f2")],
)
)
@pytest.fixture
def quadrigram_model_for_english():
return np.sort(
np.array(
[
("alte", log(0.25)),
("lter", log(0.26)),
# unknown quadrigrams
# ("aqua", 0.0),
# ("wxyz", 0.0),
],
dtype=[("ngram", "U4"), ("frequency", "f2")],
)
)
@pytest.fixture
def fivegram_model_for_english():
return np.sort(
np.array(
[
("alter", log(0.29)),
# unknown fivegrams
# ("aquas", 0.0),
],
dtype=[("ngram", "U5"), ("frequency", "f2")],
)
)
# ##############################
# LANGUAGE MODELS FOR GERMAN
# ##############################
@pytest.fixture
def unigram_model_for_german():
return np.sort(
np.array(
[
("a", log(0.06)),
("l", log(0.07)),
("t", log(0.08)),
("e", log(0.09)),
("r", log(0.1)),
# unknown unigrams
# ("w", 0.0),
],
dtype=[("ngram", "U1"), ("frequency", "f2")],
)
)
@pytest.fixture
def bigram_model_for_german():
return np.sort(
np.array(
[
("al", log(0.15)),
("lt", log(0.16)),
("te", log(0.17)),
("er", log(0.18)),
# unknown bigrams
# ("wx", 0.0),
],
dtype=[("ngram", "U2"), ("frequency", "f2")],
)
)
@pytest.fixture
def trigram_model_for_german():
return np.sort(
np.array(
[
("alt", log(0.22)),
("lte", log(0.23)),
("ter", log(0.24)),
# unknown trigrams
# ("wxy", 0.0),
],
dtype=[("ngram", "U3"), ("frequency", "f2")],
)
)
@pytest.fixture
def quadrigram_model_for_german():
return np.sort(
np.array(
[
("alte", log(0.27)),
("lter", log(0.28)),
# unknown quadrigrams
# ("wxyz", 0.0),
],
dtype=[("ngram", "U4"), ("frequency", "f2")],
)
)
@pytest.fixture
def fivegram_model_for_german():
return np.sort(
np.array(
[
("alter", log(0.3)),
],
dtype=[("ngram", "U5"), ("frequency", "f2")],
)
)
# ##############################
# NGRAM MODELS
# ##############################
@pytest.fixture
def unigram_models(unigram_model_for_english, unigram_model_for_german):
return {
Language.ENGLISH: unigram_model_for_english,
Language.GERMAN: unigram_model_for_german,
}
@pytest.fixture
def bigram_models(bigram_model_for_english, bigram_model_for_german):
return {
Language.ENGLISH: bigram_model_for_english,
Language.GERMAN: bigram_model_for_german,
}
@pytest.fixture
def trigram_models(trigram_model_for_english, trigram_model_for_german):
return {
Language.ENGLISH: trigram_model_for_english,
Language.GERMAN: trigram_model_for_german,
}
@pytest.fixture
def quadrigram_models(quadrigram_model_for_english, quadrigram_model_for_german):
return {
Language.ENGLISH: quadrigram_model_for_english,
Language.GERMAN: quadrigram_model_for_german,
}
@pytest.fixture
def fivegram_models(fivegram_model_for_english, fivegram_model_for_german):
return {
Language.ENGLISH: fivegram_model_for_english,
Language.GERMAN: fivegram_model_for_german,
}
# ##############################
# DETECTORS
# ##############################
@pytest.fixture
def customized_detector_for_english_and_german(
unigram_models, bigram_models, trigram_models, quadrigram_models, fivegram_models
):
languages = frozenset([Language.ENGLISH, Language.GERMAN])
return LanguageDetector(
_languages=languages,
_minimum_relative_distance=0.0,
_is_low_accuracy_mode_enabled=False,
_languages_with_unique_characters=_collect_languages_with_unique_characters(
languages
),
_one_language_alphabets=_collect_one_language_alphabets(languages),
_unigram_language_models=unigram_models,
_bigram_language_models=bigram_models,
_trigram_language_models=trigram_models,
_quadrigram_language_models=quadrigram_models,
_fivegram_language_models=fivegram_models,
_cache={},
)
detector_for_english_and_german = (
LanguageDetectorBuilder.from_languages(Language.ENGLISH, Language.GERMAN)
.with_preloaded_language_models()
.build()
)
detector_for_all_languages = (
LanguageDetectorBuilder.from_all_languages()
.with_preloaded_language_models()
.build()
)
@pytest.mark.parametrize(
"text,expected_words",
[
pytest.param("this is a sentence", ["this", "is", "a", "sentence"]),
pytest.param("sentence", ["sentence"]),
pytest.param(
"上海大学是一个好大学 this is a sentence",
[
"上",
"海",
"大",
"学",
"是",
"一",
"个",
"好",
"大",
"学",
"this",
"is",
"a",
"sentence",
],
),
pytest.param(
"Weltweit gibt es ungefähr 6.000 Sprachen.",
["weltweit", "gibt", "es", "ungefähr", "sprachen"],
),
],
)
def test_text_is_split_into_words_correctly(text, expected_words):
assert _split_text_into_words(text) == expected_words
@pytest.mark.parametrize(
"word,expected_language",
[
# words with unique characters
pytest.param("məhərrəm", Language.AZERBAIJANI),
pytest.param("substituïts", Language.CATALAN),
pytest.param("rozdělit", Language.CZECH),
pytest.param("tvořen", Language.CZECH),
pytest.param("subjektů", Language.CZECH),
pytest.param("nesufiĉecon", Language.ESPERANTO),
pytest.param("intermiksiĝis", Language.ESPERANTO),
pytest.param("monaĥinoj", Language.ESPERANTO),
pytest.param("kreitaĵoj", Language.ESPERANTO),
pytest.param("ŝpinante", Language.ESPERANTO),
pytest.param("apenaŭ", Language.ESPERANTO),
pytest.param("groß", Language.GERMAN),
pytest.param("σχέδια", Language.GREEK),
pytest.param("fekvő", Language.HUNGARIAN),
pytest.param("meggyűrűzni", Language.HUNGARIAN),
pytest.param("ヴェダイヤモンド", Language.JAPANESE),
pytest.param("әлем", Language.KAZAKH),
pytest.param("шаруашылығы", Language.KAZAKH),
pytest.param("ақын", Language.KAZAKH),
pytest.param("оның", Language.KAZAKH),
pytest.param("шұрайлы", Language.KAZAKH),
pytest.param("teoloģiska", Language.LATVIAN),
pytest.param("blaķene", Language.LATVIAN),
pytest.param("ceļojumiem", Language.LATVIAN),
pytest.param("numuriņu", Language.LATVIAN),
pytest.param("mergelės", Language.LITHUANIAN),
pytest.param("įrengus", Language.LITHUANIAN),
pytest.param("slegiamų", Language.LITHUANIAN),
pytest.param("припаѓа", Language.MACEDONIAN),
pytest.param("ѕидови", Language.MACEDONIAN),
pytest.param("ќерка", Language.MACEDONIAN),
pytest.param("џамиите", Language.MACEDONIAN),
pytest.param("मिळते", Language.MARATHI),
pytest.param("үндсэн", Language.MONGOLIAN),
pytest.param("дөхөж", Language.MONGOLIAN),
pytest.param("zmieniły", Language.POLISH),
pytest.param("państwowych", Language.POLISH),
pytest.param("mniejszości", Language.POLISH),
pytest.param("groźne", Language.POLISH),
pytest.param("ialomiţa", Language.ROMANIAN),
pytest.param("наслеђивања", Language.SERBIAN),
pytest.param("неисквареношћу", Language.SERBIAN),
pytest.param("podĺa", Language.SLOVAK),
pytest.param("pohľade", Language.SLOVAK),
pytest.param("mŕtvych", Language.SLOVAK),
pytest.param("ґрунтовому", Language.UKRAINIAN),
pytest.param("пропонує", Language.UKRAINIAN),
pytest.param("пристрої", Language.UKRAINIAN),
pytest.param("cằm", Language.VIETNAMESE),
pytest.param("thần", Language.VIETNAMESE),
pytest.param("chẳng", Language.VIETNAMESE),
pytest.param("quẩy", Language.VIETNAMESE),
pytest.param("sẵn", Language.VIETNAMESE),
pytest.param("nhẫn", Language.VIETNAMESE),
pytest.param("dắt", Language.VIETNAMESE),
pytest.param("chất", Language.VIETNAMESE),
pytest.param("đạp", Language.VIETNAMESE),
pytest.param("mặn", Language.VIETNAMESE),
pytest.param("hậu", Language.VIETNAMESE),
pytest.param("hiền", Language.VIETNAMESE),
pytest.param("lẻn", Language.VIETNAMESE),
pytest.param("biểu", Language.VIETNAMESE),
pytest.param("kẽm", Language.VIETNAMESE),
pytest.param("diễm", Language.VIETNAMESE),
pytest.param("phế", Language.VIETNAMESE),
pytest.param("việc", Language.VIETNAMESE),
pytest.param("chỉnh", Language.VIETNAMESE),
pytest.param("trĩ", Language.VIETNAMESE),
pytest.param("ravị", Language.VIETNAMESE),
pytest.param("thơ", Language.VIETNAMESE),
pytest.param("nguồn", Language.VIETNAMESE),
pytest.param("thờ", Language.VIETNAMESE),
pytest.param("sỏi", Language.VIETNAMESE),
pytest.param("tổng", Language.VIETNAMESE),
pytest.param("nhở", Language.VIETNAMESE),
pytest.param("mỗi", Language.VIETNAMESE),
pytest.param("bỡi", Language.VIETNAMESE),
pytest.param("tốt", Language.VIETNAMESE),
pytest.param("giới", Language.VIETNAMESE),
pytest.param("một", Language.VIETNAMESE),
pytest.param("hợp", Language.VIETNAMESE),
pytest.param("hưng", Language.VIETNAMESE),
pytest.param("từng", Language.VIETNAMESE),
pytest.param("của", Language.VIETNAMESE),
pytest.param("sử", Language.VIETNAMESE),
pytest.param("cũng", Language.VIETNAMESE),
pytest.param("những", Language.VIETNAMESE),
pytest.param("chức", Language.VIETNAMESE),
pytest.param("dụng", Language.VIETNAMESE),
pytest.param("thực", Language.VIETNAMESE),
pytest.param("kỳ", Language.VIETNAMESE),
pytest.param("kỷ", Language.VIETNAMESE),
pytest.param("mỹ", Language.VIETNAMESE),
pytest.param("mỵ", Language.VIETNAMESE),
pytest.param("aṣiwèrè", Language.YORUBA),
pytest.param("ṣaaju", Language.YORUBA),
pytest.param("والموضوع", None),
pytest.param("сопротивление", None),
pytest.param("house", None),
# words with unique alphabet
pytest.param("ունենա", Language.ARMENIAN),
pytest.param("জানাতে", Language.BENGALI),
pytest.param("გარეუბან", Language.GEORGIAN),
pytest.param("σταμάτησε", Language.GREEK),
pytest.param("ઉપકરણોની", Language.GUJARATI),
pytest.param("בתחרויות", Language.HEBREW),
pytest.param("びさ", Language.JAPANESE),
pytest.param("대결구도가", Language.KOREAN),
pytest.param("ਮੋਟਰਸਾਈਕਲਾਂ", Language.PUNJABI),
pytest.param("துன்பங்களை", Language.TAMIL),
pytest.param("కృష్ణదేవరాయలు", Language.TELUGU),
pytest.param("ในทางหลวงหมายเลข", Language.THAI),
],
)
def test_language_detection_with_rules(word, expected_language):
detected_language = detector_for_all_languages._detect_language_with_rules([word])
assert detected_language == expected_language
@pytest.mark.parametrize(
"word,expected_languages",
[
pytest.param("والموضوع", [Language.ARABIC, Language.PERSIAN, Language.URDU]),
pytest.param(
"сопротивление",
[
Language.BELARUSIAN,
Language.BULGARIAN,
Language.KAZAKH,
Language.MACEDONIAN,
Language.MONGOLIAN,
Language.RUSSIAN,
Language.SERBIAN,
Language.UKRAINIAN,
],
),
pytest.param(
"раскрывае",
[
Language.BELARUSIAN,
Language.KAZAKH,
Language.MONGOLIAN,
Language.RUSSIAN,
],
),
pytest.param(
"этот",
[
Language.BELARUSIAN,
Language.KAZAKH,
Language.MONGOLIAN,
Language.RUSSIAN,
],
),
pytest.param(
"огнём",
[
Language.BELARUSIAN,
Language.KAZAKH,
Language.MONGOLIAN,
Language.RUSSIAN,
],
),
pytest.param(
"плаваща",
[Language.BULGARIAN, Language.KAZAKH, Language.MONGOLIAN, Language.RUSSIAN],
),
pytest.param(
"довършат",
[Language.BULGARIAN, Language.KAZAKH, Language.MONGOLIAN, Language.RUSSIAN],
),
pytest.param(
"павінен", [Language.BELARUSIAN, Language.KAZAKH, Language.UKRAINIAN]
),
pytest.param("затоплување", [Language.MACEDONIAN, Language.SERBIAN]),
pytest.param("ректасцензија", [Language.MACEDONIAN, Language.SERBIAN]),
pytest.param("набљудувач", [Language.MACEDONIAN, Language.SERBIAN]),
pytest.param("aizklātā", [Language.LATVIAN, Language.MAORI, Language.YORUBA]),
pytest.param("sistēmas", [Language.LATVIAN, Language.MAORI, Language.YORUBA]),
pytest.param("palīdzi", [Language.LATVIAN, Language.MAORI, Language.YORUBA]),
pytest.param("nhẹn", [Language.VIETNAMESE, Language.YORUBA]),
pytest.param("chọn", [Language.VIETNAMESE, Language.YORUBA]),
pytest.param(
"prihvaćanju", [Language.BOSNIAN, Language.CROATIAN, Language.POLISH]
),
pytest.param(
"nađete", [Language.BOSNIAN, Language.CROATIAN, Language.VIETNAMESE]
),
pytest.param("visão", [Language.PORTUGUESE, Language.VIETNAMESE]),
pytest.param("wystąpią", [Language.LITHUANIAN, Language.POLISH]),
pytest.param("budowę", [Language.LITHUANIAN, Language.POLISH]),
pytest.param(
"nebūsime",
[Language.LATVIAN, Language.LITHUANIAN, Language.MAORI, Language.YORUBA],
),
pytest.param(
"afişate", [Language.AZERBAIJANI, Language.ROMANIAN, Language.TURKISH]
),
pytest.param("kradzieżami", [Language.POLISH, Language.ROMANIAN]),
pytest.param("înviat", [Language.FRENCH, Language.ROMANIAN]),
pytest.param(
"venerdì", [Language.ITALIAN, Language.VIETNAMESE, Language.YORUBA]
),
pytest.param("años", [Language.BASQUE, Language.SPANISH]),
pytest.param("rozohňuje", [Language.CZECH, Language.SLOVAK]),
pytest.param("rtuť", [Language.CZECH, Language.SLOVAK]),
pytest.param("pregătire", [Language.ROMANIAN, Language.VIETNAMESE]),
pytest.param("jeďte", [Language.CZECH, Language.ROMANIAN, Language.SLOVAK]),
pytest.param("minjaverðir", [Language.ICELANDIC, Language.TURKISH]),
pytest.param("þagnarskyldu", [Language.ICELANDIC, Language.TURKISH]),
pytest.param("nebûtu", [Language.FRENCH, Language.HUNGARIAN]),
pytest.param(
"hashemidëve",
[Language.AFRIKAANS, Language.ALBANIAN, Language.DUTCH, Language.FRENCH],
),
pytest.param(
"forêt",
[
Language.AFRIKAANS,
Language.FRENCH,
Language.PORTUGUESE,
Language.VIETNAMESE,
],
),
pytest.param(
"succèdent",
[Language.FRENCH, Language.ITALIAN, Language.VIETNAMESE, Language.YORUBA],
),
pytest.param(
"où",
[Language.FRENCH, Language.ITALIAN, Language.VIETNAMESE, Language.YORUBA],
),
pytest.param(
"tõeliseks",
[
Language.ESTONIAN,
Language.HUNGARIAN,
Language.PORTUGUESE,
Language.VIETNAMESE,
],
),
pytest.param(
"viòiem",
[Language.CATALAN, Language.ITALIAN, Language.VIETNAMESE, Language.YORUBA],
),
pytest.param(
"contrôle",
[
Language.FRENCH,
Language.PORTUGUESE,
Language.SLOVAK,
Language.VIETNAMESE,
],
),
pytest.param("direktør", [Language.BOKMAL, Language.DANISH, Language.NYNORSK]),
pytest.param(
"vývoj",
[
Language.CZECH,
Language.ICELANDIC,
Language.SLOVAK,
Language.TURKISH,
Language.VIETNAMESE,
],
),
pytest.param(
"päralt",
[
Language.ESTONIAN,
Language.FINNISH,
Language.GERMAN,
Language.SLOVAK,
Language.SWEDISH,
],
),
pytest.param(
"labâk",
[
Language.FRENCH,
Language.PORTUGUESE,
Language.ROMANIAN,
Language.TURKISH,
Language.VIETNAMESE,
],
),
pytest.param(
"pràctiques",
[
Language.CATALAN,
Language.FRENCH,
Language.ITALIAN,
Language.PORTUGUESE,
Language.VIETNAMESE,
],
),
pytest.param(
"überrascht",
[
Language.AZERBAIJANI,
Language.CATALAN,
Language.ESTONIAN,
Language.GERMAN,
Language.HUNGARIAN,
Language.SPANISH,
Language.TURKISH,
],
),
pytest.param(
"indebærer",
[Language.BOKMAL, Language.DANISH, Language.ICELANDIC, Language.NYNORSK],
),
pytest.param(
"måned",
[Language.BOKMAL, Language.DANISH, Language.NYNORSK, Language.SWEDISH],
),
pytest.param(
"zaručen",
[
Language.BOSNIAN,
Language.CZECH,
Language.CROATIAN,
Language.LATVIAN,
Language.LITHUANIAN,
Language.SLOVAK,
Language.SLOVENE,
],
),
pytest.param(
"zkouškou",
[
Language.BOSNIAN,
Language.CZECH,
Language.CROATIAN,
Language.LATVIAN,
Language.LITHUANIAN,
Language.SLOVAK,
Language.SLOVENE,
],
),
pytest.param(
"navržen",
[
Language.BOSNIAN,
Language.CZECH,
Language.CROATIAN,
Language.LATVIAN,
Language.LITHUANIAN,
Language.SLOVAK,
Language.SLOVENE,
],
),
pytest.param(
"façonnage",
[
Language.ALBANIAN,
Language.AZERBAIJANI,
Language.BASQUE,
Language.CATALAN,
Language.GERMAN,
Language.FRENCH,
Language.PORTUGUESE,
Language.TURKISH,
],
),
pytest.param(
"höher",
[
Language.AZERBAIJANI,
Language.ESTONIAN,
Language.FINNISH,
Language.GERMAN,
Language.HUNGARIAN,
Language.ICELANDIC,
Language.SWEDISH,
Language.TURKISH,
],
),
pytest.param(
"catedráticos",
[
Language.CATALAN,
Language.CZECH,
Language.GERMAN,
Language.ICELANDIC,
Language.IRISH,
Language.HUNGARIAN,
Language.PORTUGUESE,
Language.SLOVAK,
Language.SPANISH,
Language.VIETNAMESE,
Language.YORUBA,
],
),
pytest.param(
"política",
[
Language.CATALAN,
Language.CZECH,
Language.GERMAN,
Language.ICELANDIC,
Language.IRISH,
Language.HUNGARIAN,
Language.PORTUGUESE,
Language.SLOVAK,
Language.SPANISH,
Language.VIETNAMESE,
Language.YORUBA,
],
),
pytest.param(
"música",
[
Language.CATALAN,
Language.CZECH,
Language.GERMAN,
Language.ICELANDIC,
Language.IRISH,
Language.HUNGARIAN,
Language.PORTUGUESE,
Language.SLOVAK,
Language.SPANISH,
Language.VIETNAMESE,
Language.YORUBA,
],
),
pytest.param(
"contradicció",
[
Language.CATALAN,
Language.GERMAN,
Language.HUNGARIAN,
Language.ICELANDIC,
Language.IRISH,
Language.POLISH,
Language.PORTUGUESE,
Language.SLOVAK,
Language.SPANISH,
Language.VIETNAMESE,
Language.YORUBA,
],
),
pytest.param(
"només",
[
Language.CATALAN,
Language.CZECH,
Language.FRENCH,
Language.GERMAN,
Language.HUNGARIAN,
Language.ICELANDIC,
Language.IRISH,
Language.ITALIAN,
Language.PORTUGUESE,
Language.SLOVAK,
Language.SPANISH,
Language.VIETNAMESE,
Language.YORUBA,
],
),
pytest.param(
"house",
[
Language.AFRIKAANS,
Language.ALBANIAN,
Language.AZERBAIJANI,
Language.BASQUE,
Language.BOKMAL,
Language.BOSNIAN,
Language.CATALAN,
Language.CROATIAN,
Language.CZECH,
Language.DANISH,
Language.DUTCH,
Language.ENGLISH,
Language.ESPERANTO,
Language.ESTONIAN,
Language.FINNISH,
Language.FRENCH,
Language.GANDA,
Language.GERMAN,
Language.HUNGARIAN,
Language.ICELANDIC,
Language.INDONESIAN,
Language.IRISH,
Language.ITALIAN,
Language.LATIN,
Language.LATVIAN,
Language.LITHUANIAN,
Language.MALAY,
Language.MAORI,
Language.NYNORSK,
Language.POLISH,
Language.PORTUGUESE,
Language.ROMANIAN,
Language.SHONA,
Language.SLOVAK,
Language.SLOVENE,
Language.SOMALI,
Language.SOTHO,
Language.SPANISH,
Language.SWAHILI,
Language.SWEDISH,
Language.TAGALOG,
Language.TSONGA,
Language.TSWANA,
Language.TURKISH,
Language.VIETNAMESE,
Language.WELSH,
Language.XHOSA,
Language.YORUBA,
Language.ZULU,
],
),
],
)
def test_language_filtering_with_rules(word, expected_languages):
filtered_languages = detector_for_all_languages._filter_languages_by_rules([word])
assert filtered_languages == frozenset(expected_languages)
@pytest.mark.parametrize("invalid_str", ["", " \n \t;", "3<856%)§"])
def test_strings_without_letters_return_no_language(invalid_str):
assert detector_for_all_languages.detect_language_of(invalid_str) is None
@pytest.mark.parametrize(
"language,ngram,expected_probability",
[
pytest.param(Language.ENGLISH, "a", f(log(0.01))),
pytest.param(Language.ENGLISH, "lt", f(log(0.12))),
pytest.param(Language.ENGLISH, "ter", f(log(0.21))),
pytest.param(Language.ENGLISH, "alte", f(log(0.25))),
pytest.param(Language.ENGLISH, "alter", f(log(0.29))),
pytest.param(Language.GERMAN, "t", f(log(0.08))),
pytest.param(Language.GERMAN, "er", f(log(0.18))),
pytest.param(Language.GERMAN, "alt", f(log(0.22))),
pytest.param(Language.GERMAN, "lter", f(log(0.28))),
pytest.param(Language.GERMAN, "alter", f(log(0.3))),
# unknown ngrams
pytest.param(Language.GERMAN, "xyz", None),
pytest.param(Language.ENGLISH, "ab", None),
],
)
def test_ngram_probability_lookup(
customized_detector_for_english_and_german, language, ngram, expected_probability
):
probability = customized_detector_for_english_and_german._look_up_ngram_probability(
language, ngram
)
assert probability == expected_probability
@pytest.mark.parametrize(
"ngram_model, expected_sum_of_probabilities",
[
pytest.param(
_TestDataLanguageModel([["a"], ["l"], ["t"], ["e"], ["r"]]),
f(log(0.01)) + f(log(0.02)) + f(log(0.03)) + f(log(0.04)) + f(log(0.05)),
),
pytest.param(
# back off unknown Trigram("tez") to known Bigram("te")
_TestDataLanguageModel(
[["alt", "al", "a"], ["lte", "lt", "l"], ["tez", "te", "t"]]
),
f(log(0.19)) + f(log(0.2)) + f(log(0.13)),
),
pytest.param(
# back off unknown Fivegram("aquas") to known Unigram("a")
_TestDataLanguageModel([["aquas", "aqua", "aqu", "aq", "a"]]),
f(log(0.01)),
),
],
)
def test_summation_of_ngram_probabilities(
customized_detector_for_english_and_german,
ngram_model,
expected_sum_of_probabilities,
):
sum_of_probabilities = (
customized_detector_for_english_and_german._compute_sum_of_ngram_probabilities(
Language.ENGLISH, ngram_model
)
)
assert isclose(sum_of_probabilities, expected_sum_of_probabilities, rel_tol=0.001)
@pytest.mark.parametrize(
"ngram_model,expected_probabilities",
[
pytest.param(
_TestDataLanguageModel([["a"], ["l"], ["t"], ["e"], ["r"]]),
{
Language.ENGLISH: f(log(0.01))
+ f(log(0.02))
+ f(log(0.03))
+ f(log(0.04))
+ f(log(0.05)),
Language.GERMAN: f(log(0.06))
+ f(log(0.07))
+ f(log(0.08))
+ f(log(0.09))
+ f(log(0.1)),
},
),
pytest.param(
_TestDataLanguageModel(
[
["alt", "al", "a"],
["lte", "lt", "l"],
["ter", "te", "t"],
["wxy", "wx", "w"],
]
),
{
Language.ENGLISH: f(log(0.19)) + f(log(0.2)) + f(log(0.21)),
Language.GERMAN: f(log(0.22)) + f(log(0.23)) + f(log(0.24)),
},
),
pytest.param(
_TestDataLanguageModel(
[
["alte", "alt", "al", "a"],
["lter", "lte", "lt", "l"],
["wxyz", "wxy", "wx", "w"],
]
),
{
Language.ENGLISH: f(log(0.25)) + f(log(0.26)),
Language.GERMAN: f(log(0.27)) + f(log(0.28)),
},
),
],
)
def test_computation_of_language_probabilities(
customized_detector_for_english_and_german, ngram_model, expected_probabilities
):
probabilities = (
customized_detector_for_english_and_german._compute_language_probabilities(
ngram_model, frozenset([Language.ENGLISH, Language.GERMAN])
)
)
for language, probability in probabilities.items():
expected_probability = expected_probabilities[language]
assert isclose(probability, expected_probability, rel_tol=0.001)
def test_detect_language(customized_detector_for_english_and_german):
assert (
customized_detector_for_english_and_german.detect_language_of("Alter")
== Language.GERMAN
)
def test_no_language_is_returned(customized_detector_for_english_and_german):
assert (
customized_detector_for_english_and_german.detect_language_of("проарплап")
is None
)
@pytest.mark.parametrize(
"text,expected_confidence_values",
[
pytest.param(
"groß",
[
ConfidenceValue(Language.GERMAN, 1.0),
ConfidenceValue(Language.ENGLISH, 0.0),
],
),
pytest.param(
"Alter",
[
ConfidenceValue(Language.GERMAN, 0.81),
ConfidenceValue(Language.ENGLISH, 0.19),
],
),
pytest.param(
"проарплап",
[
ConfidenceValue(Language.ENGLISH, 0.0),
ConfidenceValue(Language.GERMAN, 0.0),
],
),
],
)
def test_compute_language_confidence_values(
customized_detector_for_english_and_german, text, expected_confidence_values
):
confidence_values = (
customized_detector_for_english_and_german.compute_language_confidence_values(
text
)
)
assert len(confidence_values) == 2
first, second = confidence_values
expected_first, expected_second = expected_confidence_values
assert first.language == expected_first.language
assert round(first.value, 2) == expected_first.value
assert second.language == expected_second.language
assert round(second.value, 2) == expected_second.value
def test_compute_language_confidence_values_for_large_input_text(very_large_input_text):
confidence_values = (
detector_for_english_and_german.compute_language_confidence_values(
very_large_input_text
)
)
assert len(confidence_values) == 2
first, second = confidence_values
assert first == ConfidenceValue(Language.GERMAN, 1.0)
assert second == ConfidenceValue(Language.ENGLISH, 0.0)
@pytest.mark.parametrize(
"text,expected_confidence_for_german,expected_confidence_for_english",
[
pytest.param("groß", 1.0, 0.0),
pytest.param("Alter", 0.81, 0.19),
pytest.param("проарплап", 0.0, 0.0),
],
)
def test_compute_language_confidence(
customized_detector_for_english_and_german,
text,
expected_confidence_for_german,
expected_confidence_for_english,
):
confidence_for_german = (
customized_detector_for_english_and_german.compute_language_confidence(
text, Language.GERMAN
)
)
assert round(confidence_for_german, 2) == expected_confidence_for_german
confidence_for_english = (
customized_detector_for_english_and_german.compute_language_confidence(
text, Language.ENGLISH
)
)
assert round(confidence_for_english, 2) == expected_confidence_for_english
confidence_for_french = (
customized_detector_for_english_and_german.compute_language_confidence(
text, Language.FRENCH
)
)
assert confidence_for_french == 0.0
def test_compute_language_confidence_for_large_input_text(very_large_input_text):
confidence_for_german = detector_for_english_and_german.compute_language_confidence(
very_large_input_text, Language.GERMAN
)
assert confidence_for_german == 1.0
confidence_for_english = (
detector_for_english_and_german.compute_language_confidence(
very_large_input_text, Language.ENGLISH
)
)
assert confidence_for_english == 0.0
def test_detect_multiple_languages_for_empty_string():
assert detector_for_all_languages.detect_multiple_languages_of("") == []
def test_detect_multiple_languages_english():
sentence = "I'm really not sure whether multi-language detection is a good idea."
results = detector_for_all_languages.detect_multiple_languages_of(sentence)
assert len(results) == 1
result = results[0]
substring = sentence[result.start_index : result.end_index]
assert substring == sentence
assert result.language == Language.ENGLISH
def test_detect_multiple_languages_english_and_german():
sentence = (
" He turned around and asked: "
+ '"Entschuldigen Sie, sprechen Sie Deutsch?"'
)
results = detector_for_all_languages.detect_multiple_languages_of(sentence)
assert len(results) == 2
first_result = results[0]
first_substring = sentence[first_result.start_index : first_result.end_index]
assert first_substring == " He turned around and asked: "
assert first_result.language == Language.ENGLISH
second_result = results[1]
second_substring = sentence[second_result.start_index : second_result.end_index]
assert second_substring == '"Entschuldigen Sie, sprechen Sie Deutsch?"'
assert second_result.language == Language.GERMAN
def test_detect_multiple_languages_chinese_english():
sentence = "上海大学是一个好大学. It is such a great university."
results = detector_for_all_languages.detect_multiple_languages_of(sentence)
assert len(results) == 2
first_result = results[0]
first_substring = sentence[first_result.start_index : first_result.end_index]
assert first_substring == "上海大学是一个好大学. "
assert first_result.language == Language.CHINESE
second_result = results[1]
second_substring = sentence[second_result.start_index : second_result.end_index]
assert second_substring == "It is such a great university."
assert second_result.language == Language.ENGLISH
def test_detect_multiple_languages_french_german_english():
sentence = (
"Parlez-vous français? "
+ "Ich spreche Französisch nur ein bisschen. "
+ "A little bit is better than nothing."
)
results = detector_for_all_languages.detect_multiple_languages_of(sentence)
assert len(results) == 3
first_result = results[0]
first_substring = sentence[first_result.start_index : first_result.end_index]
assert first_substring == "Parlez-vous français? "
assert first_result.language == Language.FRENCH
second_result = results[1]
second_substring = sentence[second_result.start_index : second_result.end_index]
assert second_substring == "Ich spreche Französisch nur ein bisschen. "
assert second_result.language == Language.GERMAN
third_result = results[2]
third_substring = sentence[third_result.start_index : third_result.end_index]
assert third_substring == "A little bit is better than nothing."
assert third_result.language == Language.ENGLISH
@pytest.mark.parametrize(
"text,languages",
[
pytest.param(
"ام وی با نیکی میناج تیزر داشت؟؟؟؟؟؟ i vote for bts ( _ ) as the _ via ( _ )",
[Language.ENGLISH, Language.URDU],
),
pytest.param(
"Az elmúlt hétvégén 12-re emelkedett az elhunyt koronavírus-fertőzöttek száma Szlovákiában. Mindegyik szociális otthon dolgozóját letesztelik, Matovič szerint az ingázóknak még várniuk kellene a teszteléssel",
[Language.HUNGARIAN, Language.SLOVAK],
),
],
)
def test_deterministic_language_detection(text, languages):
detected_languages = set()
for i in range(0, 50):
language = detector_for_all_languages.detect_language_of(text)
detected_languages.add(language)
assert len(detected_languages) == 1
def test_low_accuracy_mode():
remove_language_models_from_detector()
assert_all_language_models_are_unloaded()
detector = (
LanguageDetectorBuilder.from_languages(Language.ENGLISH, Language.GERMAN)
.with_preloaded_language_models()
.with_low_accuracy_mode()
.build()
)
assert_only_trigram_language_models_are_loaded()
assert detector.detect_language_of("bed") == Language.ENGLISH
assert detector.detect_language_of("be") is None
assert detector.detect_language_of("b") is None
assert detector.detect_language_of("") is None
assert_only_trigram_language_models_are_loaded()
def test_two_detectors_share_same_language_models():
remove_language_models_from_detector()
assert_all_language_models_are_unloaded()
first_detector = (
LanguageDetectorBuilder.from_languages(Language.ENGLISH, Language.GERMAN)
.with_preloaded_language_models()
.with_low_accuracy_mode()
.build()
)
second_detector = (
LanguageDetectorBuilder.from_languages(Language.SWEDISH, Language.ENGLISH)
.with_preloaded_language_models()
.with_low_accuracy_mode()
.build()
)
assert len(first_detector._trigram_language_models) == 3
assert len(second_detector._trigram_language_models) == 3
assert (
first_detector._trigram_language_models
is second_detector._trigram_language_models
)
def assert_all_language_models_are_unloaded():
assert len(_UNIGRAM_MODELS) == 0
assert len(_BIGRAM_MODELS) == 0
assert len(_TRIGRAM_MODELS) == 0
assert len(_QUADRIGRAM_MODELS) == 0
assert len(_FIVEGRAM_MODELS) == 0
def assert_only_trigram_language_models_are_loaded():
assert len(_UNIGRAM_MODELS) == 0
assert len(_BIGRAM_MODELS) == 0
assert len(_TRIGRAM_MODELS) > 0
assert len(_QUADRIGRAM_MODELS) == 0
assert len(_FIVEGRAM_MODELS) == 0
def remove_language_models_from_detector():
_UNIGRAM_MODELS.clear()
_BIGRAM_MODELS.clear()
_TRIGRAM_MODELS.clear()
_QUADRIGRAM_MODELS.clear()
_FIVEGRAM_MODELS.clear()
| 167,876
| 129.440559
| 126,405
|
py
|
lingua-py
|
lingua-py-main/lingua/writer.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from pathlib import Path
from typing import Dict, List, Optional
import regex
from ._constant import MULTIPLE_WHITESPACE, NUMBERS, PUNCTUATION
from .language import Language
from ._model import _TrainingDataLanguageModel
class LanguageModelFilesWriter:
"""This class creates language model files and writes them to a directory."""
@classmethod
def create_and_write_language_model_files(
cls,
input_file_path: Path,
output_directory_path: Path,
language: Language,
char_class: str,
):
"""Create language model files for accuracy report generation and
write them to a directory.
Args:
input_file_path: The path to a txt file used for language
model creation. The assumed encoding of the txt file is UTF-8.
output_directory_path: The path to an existing directory where the
language model files are to be written.
language: The language for which to create language models.
char_class: A regex character class such as \\p{L} to restrict the
set of characters that the language models are built from.
Raises:
Exception: if the input file path is not absolute or does not point
to an existing txt file; if the input file's encoding is not
UTF-8; if the output directory path is not absolute or does not
point to an existing directory; if the character class cannot
be compiled to a valid regular expression
"""
check_input_file_path(input_file_path)
check_output_directory_path(output_directory_path)
unigram_model = cls._create_language_model(
input_file_path=input_file_path,
language=language,
ngram_length=1,
char_class=char_class,
lower_ngram_absolute_frequencies={},
)
bigram_model = cls._create_language_model(
input_file_path=input_file_path,
language=language,
ngram_length=2,
char_class=char_class,
lower_ngram_absolute_frequencies=unigram_model.absolute_frequencies,
)
trigram_model = cls._create_language_model(
input_file_path=input_file_path,
language=language,
ngram_length=3,
char_class=char_class,
lower_ngram_absolute_frequencies=bigram_model.absolute_frequencies,
)
quadrigram_model = cls._create_language_model(
input_file_path=input_file_path,
language=language,
ngram_length=4,
char_class=char_class,
lower_ngram_absolute_frequencies=trigram_model.absolute_frequencies,
)
fivegram_model = cls._create_language_model(
input_file_path=input_file_path,
language=language,
ngram_length=5,
char_class=char_class,
lower_ngram_absolute_frequencies=quadrigram_model.absolute_frequencies,
)
cls._write_compressed_language_model(
unigram_model, 1, output_directory_path, "unigrams.npz"
)
cls._write_compressed_language_model(
bigram_model, 2, output_directory_path, "bigrams.npz"
)
cls._write_compressed_language_model(
trigram_model, 3, output_directory_path, "trigrams.npz"
)
cls._write_compressed_language_model(
quadrigram_model, 4, output_directory_path, "quadrigrams.npz"
)
cls._write_compressed_language_model(
fivegram_model, 5, output_directory_path, "fivegrams.npz"
)
@classmethod
def _create_language_model(
cls,
input_file_path: Path,
language: Language,
ngram_length: int,
char_class: str,
lower_ngram_absolute_frequencies: Optional[Dict[str, int]],
) -> _TrainingDataLanguageModel:
with input_file_path.open() as input_file:
input_file_lines = [
line for line in input_file if not line.strip().isspace()
]
return _TrainingDataLanguageModel.from_text(
text=input_file_lines,
language=language,
ngram_length=ngram_length,
char_class=char_class,
lower_ngram_absolute_frequencies=lower_ngram_absolute_frequencies,
)
@classmethod
def _write_compressed_language_model(
cls,
model: _TrainingDataLanguageModel,
ngram_length: int,
output_directory_path: Path,
file_name: str,
):
file_path = output_directory_path / file_name
model.to_numpy_binary_file(file_path, ngram_length)
class TestDataFilesWriter:
"""This class creates test data files for accuracy report generation
and writes them to a directory.
"""
@classmethod
def create_and_write_test_data_files(
cls,
input_file_path: Path,
output_directory_path: Path,
char_class: str,
maximum_lines: int,
):
"""Create test data files for accuracy report generation and
write them to a directory.
Args:
input_file_path: The path to a txt file used for test data
creation. The assumed encoding of the txt file is UTF-8.
output_directory_path: The path to an existing directory where
the test data files are to be written.
char_class: A regex character class such as \\p{L} to restrict
the set of characters that the test data are built from.
maximum_lines: The maximum number of lines each test data file
should have.
Raises:
Exception: if the input file path is not absolute or does not point
to an existing txt file; if the input file's encoding is not
UTF-8; if the output directory path is not absolute or does not
point to an existing directory; if the character class cannot
be compiled to a valid regular expression
"""
check_input_file_path(input_file_path)
check_output_directory_path(output_directory_path)
cls._create_and_write_sentences_file(
input_file_path, output_directory_path, maximum_lines
)
single_words = cls._create_and_write_single_words_file(
input_file_path, output_directory_path, char_class, maximum_lines
)
cls._create_and_write_word_pairs_file(
single_words, output_directory_path, maximum_lines
)
@classmethod
def _create_and_write_sentences_file(
cls, input_file_path: Path, output_directory_path: Path, maximum_lines: int
):
sentences_file_path = output_directory_path / "sentences.txt"
if sentences_file_path.is_file():
sentences_file_path.unlink()
with input_file_path.open() as input_file:
with sentences_file_path.open(mode="w") as sentences_file:
line_counter = 0
for line in input_file:
normalized_whitespace = MULTIPLE_WHITESPACE.sub(" ", line.strip())
removed_quotes = normalized_whitespace.replace('"', "")
if line_counter < maximum_lines:
sentences_file.write(removed_quotes)
sentences_file.write("\n")
line_counter += 1
else:
break
@classmethod
def _create_and_write_single_words_file(
cls,
input_file_path: Path,
output_directory_path: Path,
char_class: str,
maximum_lines: int,
) -> List[str]:
single_words_file_path = output_directory_path / "single-words.txt"
word_regex = regex.compile(f"[{char_class}]{{5,}}")
words = []
if single_words_file_path.is_file():
single_words_file_path.unlink()
with input_file_path.open() as input_file:
with single_words_file_path.open(mode="w") as single_words_file:
line_counter = 0
for line in input_file:
removed_punctuation = PUNCTUATION.sub("", line)
removed_numbers = NUMBERS.sub("", removed_punctuation)
normalized_whitespace = MULTIPLE_WHITESPACE.sub(
" ", removed_numbers
)
removed_quotes = normalized_whitespace.replace('"', "")
single_words = [
word.strip().lower()
for word in removed_quotes.split(" ")
if word_regex.fullmatch(word) is not None
]
words.extend(single_words)
for word in words:
if line_counter < maximum_lines:
single_words_file.write(word)
single_words_file.write("\n")
line_counter += 1
else:
break
return words
@classmethod
def _create_and_write_word_pairs_file(
cls, words: List[str], output_directory_path: Path, maximum_lines: int
):
word_pairs_file_path = output_directory_path / "word-pairs.txt"
word_pairs = []
if word_pairs_file_path.is_file():
word_pairs_file_path.unlink()
for i in range(0, len(words) - 2 + 1, 2):
sublst = words[i : i + 2]
word_pairs.append(" ".join(sublst))
with word_pairs_file_path.open(mode="w") as word_pairs_file:
line_counter = 0
for word_pair in word_pairs:
if line_counter < maximum_lines:
word_pairs_file.write(word_pair)
word_pairs_file.write("\n")
line_counter += 1
else:
break
def check_input_file_path(input_file_path: Path):
if not input_file_path.is_absolute():
raise Exception(f"input file path '{input_file_path}' is not absolute")
if not input_file_path.exists():
raise Exception(f"Input file '{input_file_path}' does not exist")
if not input_file_path.is_file():
raise Exception(
f"Input file path '{input_file_path}' does not represent a regular file"
)
def check_output_directory_path(output_directory_path: Path):
if not output_directory_path.is_absolute():
raise Exception(
f"Output directory path '{output_directory_path}' is not absolute"
)
if not output_directory_path.exists():
raise Exception(
f"Output directory path '{output_directory_path}' does not exist"
)
if not output_directory_path.is_dir():
raise Exception(
f"Output directory path '{output_directory_path}' does not represent a directory"
)
| 11,667
| 37.76412
| 93
|
py
|
lingua-py
|
lingua-py-main/lingua/isocode.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from enum import Enum
class IsoCode639_1(Enum):
"""This enum specifies the ISO 639-1 code representations for the
supported languages.
ISO 639 is a standardized nomenclature used to classify languages.
"""
#: The ISO 639-1 code for Afrikaans
AF = 1, "Afrikaans"
#: The ISO 639-1 code for Arabic
AR = 2, "Arabic"
#: The ISO 639-1 code for Azerbaijani
AZ = 3, "Azerbaijani"
#: The ISO 639-1 code for Belarusian
BE = 4, "Belarusian"
#: The ISO 639-1 code for Bulgarian
BG = 5, "Bulgarian"
#: The ISO 639-1 code for Bengali
BN = 6, "Bengali"
#: The ISO 639-1 code for Bosnian
BS = 7, "Bosnian"
#: The ISO 639-1 code for Catalan
CA = 8, "Catalan"
#: The ISO 639-1 code for Czech
CS = 9, "Czech"
#: The ISO 639-1 code for Welsh
CY = 10, "Welsh"
#: The ISO 639-1 code for Danish
DA = 11, "Danish"
#: The ISO 639-1 code for German
DE = 12, "German"
#: The ISO 639-1 code for Greek
EL = 13, "Greek"
#: The ISO 639-1 code for English
EN = 14, "English"
#: The ISO 639-1 code for Esperanto
EO = 15, "Esperanto"
#: The ISO 639-1 code for Spanish
ES = 16, "Spanish"
#: The ISO 639-1 code for Estonian
ET = 17, "Estonian"
#: The ISO 639-1 code for Basque
EU = 18, "Basque"
#: The ISO 639-1 code for Persian
FA = 19, "Persian"
#: The ISO 639-1 code for Finnish
FI = 20, "Finnish"
#: The ISO 639-1 code for French
FR = 21, "French"
#: The ISO 639-1 code for Irish
GA = 22, "Irish"
#: The ISO 639-1 code for Gujarati
GU = 23, "Gujarati"
#: The ISO 639-1 code for Hebrew
HE = 24, "Hebrew"
#: The ISO 639-1 code for Hindi
HI = 25, "Hindi"
#: The ISO 639-1 code for Croatian
HR = 26, "Croatian"
#: The ISO 639-1 code for Hungarian
HU = 27, "Hungarian"
#: The ISO 639-1 code for Armenian
HY = 28, "Armenian"
#: The ISO 639-1 code for Indonesian
ID = 29, "Indonesian"
#: The ISO 639-1 code for Icelandic
IS = 30, "Icelandic"
#: The ISO 639-1 code for Italian
IT = 31, "Italian"
#: The ISO 639-1 code for Japanese
JA = 32, "Japanese"
#: The ISO 639-1 code for Georgian
KA = 33, "Georgian"
#: The ISO 639-1 code for Kazakh
KK = 34, "Kazakh"
#: The ISO 639-1 code for Korean
KO = 35, "Korean"
#: The ISO 639-1 code for Latin
LA = 36, "Latin"
#: The ISO 639-1 code for Ganda
LG = 37, "Ganda"
#: The ISO 639-1 code for Lithuanian
LT = 38, "Lithuanian"
#: The ISO 639-1 code for Latvian
LV = 39, "Latvian"
#: The ISO 639-1 code for Maori
MI = 40, "Maori"
#: The ISO 639-1 code for Macedonian
MK = 41, "Macedonian"
#: The ISO 639-1 code for Mongolian
MN = 42, "Mongolian"
#: The ISO 639-1 code for Marathi
MR = 43, "Marathi"
#: The ISO 639-1 code for Malay
MS = 44, "Malay"
#: The ISO 639-1 code for Norwegian Bokmal
NB = 45, "Norwegian Bokmal"
#: The ISO 639-1 code for Dutch
NL = 46, "Dutch"
#: The ISO 639-1 code for Norwegian Nynorsk
NN = 47, "Norwegian Nynorsk"
#: The ISO 639-1 code for Punjabi
PA = 48, "Punjabi"
#: The ISO 639-1 code for Polish
PL = 49, "Polish"
#: The ISO 639-1 code for Portuguese
PT = 50, "Portuguese"
#: The ISO 639-1 code for Romanian
RO = 51, "Romanian"
#: The ISO 639-1 code for Russian
RU = 52, "Russian"
#: The ISO 639-1 code for Slovak
SK = 53, "Slovak"
#: The ISO 639-1 code for Slovene
SL = 54, "Slovene"
#: The ISO 639-1 code for Shona
SN = 55, "Shona"
#: The ISO 639-1 code for Somali
SO = 56, "Somali"
#: The ISO 639-1 code for Albanian
SQ = 57, "Albanian"
#: The ISO 639-1 code for Serbian
SR = 58, "Serbian"
#: The ISO 639-1 code for Sotho
ST = 59, "Sotho"
#: The ISO 639-1 code for Swedish
SV = 60, "Swedish"
#: The ISO 639-1 code for Swahili
SW = 61, "Swahili"
#: The ISO 639-1 code for Tamil
TA = 62, "Tamil"
#: The ISO 639-1 code for Telugu
TE = 63, "Telugu"
#: The ISO 639-1 code for Thai
TH = 64, "Thai"
#: The ISO 639-1 code for Tagalog
TL = 65, "Tagalog"
#: The ISO 639-1 code for Tswana
TN = 66, "Tswana"
#: The ISO 639-1 code for Turkish
TR = 67, "Turkish"
#: The ISO 639-1 code for Tsonga
TS = 68, "Tsonga"
#: The ISO 639-1 code for Ukrainian
UK = 69, "Ukrainian"
#: The ISO 639-1 code for Urdu
UR = 70, "Urdu"
#: The ISO 639-1 code for Vietnamese
VI = 71, "Vietnamese"
#: The ISO 639-1 code for Xhosa
XH = 72, "Xhosa"
#: The ISO 639-1 code for Yoruba
YO = 73, "Yoruba"
#: The ISO 639-1 code for Chinese
ZH = 74, "Chinese"
#: The ISO 639-1 code for Zulu
ZU = 75, "Zulu"
def __new__(cls, *args, **kwargs):
obj = object.__new__(cls)
obj._value_ = args[0]
obj.__doc__ = " ".join(["The ISO 639-1 code for", args[1]])
return obj
def __repr__(self):
return str(self)
class IsoCode639_3(Enum):
"""This enum specifies the ISO 639-3 code representations for the
supported languages.
ISO 639 is a standardized nomenclature used to classify languages.
"""
#: The ISO 639-3 code for Afrikaans
AFR = 1, "Afrikaans"
#: The ISO 639-3 code for Arabic
ARA = 2, "Arabic"
#: The ISO 639-3 code for Azerbaijani
AZE = 3, "Azerbaijani"
#: The ISO 639-3 code for Belarusian
BEL = 4, "Belarusian"
#: The ISO 639-3 code for Bengali
BEN = 5, "Bengali"
#: The ISO 639-3 code for Bosnian
BOS = 6, "Bosnian"
#: The ISO 639-3 code for Bulgarian
BUL = 7, "Bulgarian"
#: The ISO 639-3 code for Catalan
CAT = 8, "Catalan"
#: The ISO 639-3 code for Czech
CES = 9, "Czech"
#: The ISO 639-3 code for Welsh
CYM = 10, "Welsh"
#: The ISO 639-3 code for Danish
DAN = 11, "Danish"
#: The ISO 639-3 code for German
DEU = 12, "German"
#: The ISO 639-3 code for Greek
ELL = 13, "Greek"
#: The ISO 639-3 code for English
ENG = 14, "English"
#: The ISO 639-3 code for Esperanto
EPO = 15, "Esperanto"
#: The ISO 639-3 code for Estonian
EST = 16, "Estonian"
#: The ISO 639-3 code for Basque
EUS = 17, "Basque"
#: The ISO 639-3 code for Persian
FAS = 18, "Persian"
#: The ISO 639-3 code for Finnish
FIN = 19, "Finnish"
#: The ISO 639-3 code for French
FRA = 20, "French"
#: The ISO 639-3 code for Irish
GLE = 21, "Irish"
#: The ISO 639-3 code for Gujarati
GUJ = 22, "Gujarati"
#: The ISO 639-3 code for Hebrew
HEB = 23, "Hebrew"
#: The ISO 639-3 code for Hindi
HIN = 24, "Hindi"
#: The ISO 639-3 code for Croatian
HRV = 25, "Croatian"
#: The ISO 639-3 code for Hungarian
HUN = 26, "Hungarian"
#: The ISO 639-3 code for Armenian
HYE = 27, "Armenian"
#: The ISO 639-3 code for Indonesian
IND = 28, "Indonesian"
#: The ISO 639-3 code for Icelandic
ISL = 29, "Icelandic"
#: The ISO 639-3 code for Italian
ITA = 30, "Italian"
#: The ISO 639-3 code for Japanese
JPN = 31, "Japanese"
#: The ISO 639-3 code for Georgian
KAT = 32, "Georgian"
#: The ISO 639-3 code for Kazakh
KAZ = 33, "Kazakh"
#: The ISO 639-3 code for Korean
KOR = 34, "Korean"
#: The ISO 639-3 code for Latin
LAT = 35, "Latin"
#: The ISO 639-3 code for Latvian
LAV = 36, "Latvian"
#: The ISO 639-3 code for Lithuanian
LIT = 37, "Lithuanian"
#: The ISO 639-3 code for Ganda
LUG = 38, "Ganda"
#: The ISO 639-3 code for Marathi
MAR = 39, "Marathi"
#: The ISO 639-3 code for Macedonian
MKD = 40, "Macedonian"
#: The ISO 639-3 code for Mongolian
MON = 41, "Mongolian"
#: The ISO 639-3 code for Maori
MRI = 42, "Maori"
#: The ISO 639-3 code for Malay
MSA = 43, "Malay"
#: The ISO 639-3 code for Dutch
NLD = 44, "Dutch"
#: The ISO 639-3 code for Norwegian Nynorsk
NNO = 45, "Norwegian Nynorsk"
#: The ISO 639-3 code for Norwegian Bokmal
NOB = 46, "Norwegian Bokmal"
#: The ISO 639-3 code for Punjabi
PAN = 47, "Punjabi"
#: The ISO 639-3 code for Polish
POL = 48, "Polish"
#: The ISO 639-3 code for Portuguese
POR = 49, "Portuguese"
#: The ISO 639-3 code for Romanian
RON = 50, "Romanian"
#: The ISO 639-3 code for Russian
RUS = 51, "Russian"
#: The ISO 639-3 code for Slovak
SLK = 52, "Slovak"
#: The ISO 639-3 code for Slovene
SLV = 53, "Slovene"
#: The ISO 639-3 code for Shona
SNA = 54, "Shona"
#: The ISO 639-3 code for Somali
SOM = 55, "Somali"
#: The ISO 639-3 code for Sotho
SOT = 56, "Sotho"
#: The ISO 639-3 code for Spanish
SPA = 57, "Spanish"
#: The ISO 639-3 code for Albanian
SQI = 58, "Albanian"
#: The ISO 639-3 code for Serbian
SRP = 59, "Serbian"
#: The ISO 639-3 code for Swahili
SWA = 60, "Swahili"
#: The ISO 639-3 code for Swedish
SWE = 61, "Swedish"
#: The ISO 639-3 code for Tamil
TAM = 62, "Tamil"
#: The ISO 639-3 code for Telugu
TEL = 63, "Telugu"
#: The ISO 639-3 code for Tagalog
TGL = 64, "Tagalog"
#: The ISO 639-3 code for Thai
THA = 65, "Thai"
#: The ISO 639-3 code for Tswana
TSN = 66, "Tswana"
#: The ISO 639-3 code for Tsonga
TSO = 67, "Tsonga"
#: The ISO 639-3 code for Turkish
TUR = 68, "Turkish"
#: The ISO 639-3 code for Ukrainian
UKR = 69, "Ukrainian"
#: The ISO 639-3 code for Urdu
URD = 70, "Urdu"
#: The ISO 639-3 code for Vietnamese
VIE = 71, "Vietnamese"
#: The ISO 639-3 code for Xhosa
XHO = 72, "Xhosa"
#: The ISO 639-3 code for Yoruba
YOR = 73, "Yoruba"
#: The ISO 639-3 code for Chinese
ZHO = 74, "Chinese"
#: The ISO 639-3 code for Zulu
ZUL = 75, "Zulu"
def __new__(cls, *args, **kwargs):
obj = object.__new__(cls)
obj._value_ = args[0]
obj.__doc__ = " ".join(["The ISO 639-3 code for", args[1]])
return obj
def __repr__(self):
return str(self)
| 10,920
| 20.798403
| 76
|
py
|
lingua-py
|
lingua-py-main/lingua/_constant.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import regex
from regex import Pattern
from typing import Dict, FrozenSet
from .language import Language
JAPANESE_CHARACTER_SET: Pattern = regex.compile(r"^[\p{Hiragana}\p{Katakana}\p{Han}]+$")
MULTIPLE_WHITESPACE: Pattern = regex.compile(r"\s+")
NUMBERS: Pattern = regex.compile(r"\p{N}")
PUNCTUATION: Pattern = regex.compile(r"\p{P}")
LETTERS: Pattern = regex.compile(r"\p{Han}|\p{Hangul}|\p{Hiragana}|\p{Katakana}|\p{L}+")
TOKENS_WITH_OPTIONAL_WHITESPACE = regex.compile(
r"\s*(?:\p{Han}|\p{Hangul}|\p{Hiragana}|\p{Katakana}|[\p{L}'-]+)[\p{N}\p{P}]*\s*"
)
TOKENS_WITHOUT_WHITESPACE = regex.compile(
r"\p{Han}|\p{Hangul}|\p{Hiragana}|\p{Katakana}|\p{L}+"
)
CHARS_TO_LANGUAGES_MAPPING: Dict[str, FrozenSet[Language]] = {
"Ãã": frozenset([Language.PORTUGUESE, Language.VIETNAMESE]),
"ĄąĘę": frozenset([Language.LITHUANIAN, Language.POLISH]),
"Żż": frozenset([Language.POLISH, Language.ROMANIAN]),
"Îî": frozenset([Language.FRENCH, Language.ROMANIAN]),
"Ññ": frozenset([Language.BASQUE, Language.SPANISH]),
"ŇňŤť": frozenset([Language.CZECH, Language.SLOVAK]),
"Ăă": frozenset([Language.ROMANIAN, Language.VIETNAMESE]),
"İıĞğ": frozenset([Language.AZERBAIJANI, Language.TURKISH]),
"ЈјЉљЊњ": frozenset([Language.MACEDONIAN, Language.SERBIAN]),
"ẸẹỌọ": frozenset([Language.VIETNAMESE, Language.YORUBA]),
"ÐðÞþ": frozenset([Language.ICELANDIC, Language.TURKISH]),
"Ûû": frozenset([Language.FRENCH, Language.HUNGARIAN]),
"Ōō": frozenset([Language.MAORI, Language.YORUBA]),
"ĀāĒēĪī": frozenset([Language.LATVIAN, Language.MAORI, Language.YORUBA]),
"Şş": frozenset([Language.AZERBAIJANI, Language.ROMANIAN, Language.TURKISH]),
"Ďď": frozenset([Language.CZECH, Language.ROMANIAN, Language.SLOVAK]),
"Ćć": frozenset([Language.BOSNIAN, Language.CROATIAN, Language.POLISH]),
"Đđ": frozenset([Language.BOSNIAN, Language.CROATIAN, Language.VIETNAMESE]),
"Іі": frozenset([Language.BELARUSIAN, Language.KAZAKH, Language.UKRAINIAN]),
"Ìì": frozenset([Language.ITALIAN, Language.VIETNAMESE, Language.YORUBA]),
"Øø": frozenset([Language.BOKMAL, Language.DANISH, Language.NYNORSK]),
"Ūū": frozenset(
[Language.LATVIAN, Language.LITHUANIAN, Language.MAORI, Language.YORUBA]
),
"Ëë": frozenset(
[Language.AFRIKAANS, Language.ALBANIAN, Language.DUTCH, Language.FRENCH]
),
"ÈèÙù": frozenset(
[Language.FRENCH, Language.ITALIAN, Language.VIETNAMESE, Language.YORUBA]
),
"Êê": frozenset(
[Language.AFRIKAANS, Language.FRENCH, Language.PORTUGUESE, Language.VIETNAMESE]
),
"Õõ": frozenset(
[
Language.ESTONIAN,
Language.HUNGARIAN,
Language.PORTUGUESE,
Language.VIETNAMESE,
]
),
"Ôô": frozenset(
[Language.FRENCH, Language.PORTUGUESE, Language.SLOVAK, Language.VIETNAMESE]
),
"ЁёЫыЭэ": frozenset(
[Language.BELARUSIAN, Language.KAZAKH, Language.MONGOLIAN, Language.RUSSIAN]
),
"ЩщЪъ": frozenset(
[Language.BULGARIAN, Language.KAZAKH, Language.MONGOLIAN, Language.RUSSIAN]
),
"Òò": frozenset(
[Language.CATALAN, Language.ITALIAN, Language.VIETNAMESE, Language.YORUBA]
),
"Ææ": frozenset(
[Language.BOKMAL, Language.DANISH, Language.ICELANDIC, Language.NYNORSK]
),
"Åå": frozenset(
[Language.BOKMAL, Language.DANISH, Language.NYNORSK, Language.SWEDISH]
),
"Ââ": frozenset(
[
Language.FRENCH,
Language.PORTUGUESE,
Language.ROMANIAN,
Language.TURKISH,
Language.VIETNAMESE,
]
),
"Ýý": frozenset(
[
Language.CZECH,
Language.ICELANDIC,
Language.SLOVAK,
Language.TURKISH,
Language.VIETNAMESE,
]
),
"Ää": frozenset(
[
Language.ESTONIAN,
Language.FINNISH,
Language.GERMAN,
Language.SLOVAK,
Language.SWEDISH,
]
),
"Àà": frozenset(
[
Language.CATALAN,
Language.FRENCH,
Language.ITALIAN,
Language.PORTUGUESE,
Language.VIETNAMESE,
]
),
"Üü": frozenset(
[
Language.AZERBAIJANI,
Language.CATALAN,
Language.ESTONIAN,
Language.GERMAN,
Language.HUNGARIAN,
Language.SPANISH,
Language.TURKISH,
]
),
"ČčŠšŽž": frozenset(
[
Language.BOSNIAN,
Language.CZECH,
Language.CROATIAN,
Language.LATVIAN,
Language.LITHUANIAN,
Language.SLOVAK,
Language.SLOVENE,
]
),
"Çç": frozenset(
[
Language.ALBANIAN,
Language.AZERBAIJANI,
Language.BASQUE,
Language.CATALAN,
Language.FRENCH,
Language.GERMAN,
Language.PORTUGUESE,
Language.TURKISH,
]
),
"Öö": frozenset(
[
Language.AZERBAIJANI,
Language.ESTONIAN,
Language.FINNISH,
Language.GERMAN,
Language.HUNGARIAN,
Language.ICELANDIC,
Language.SWEDISH,
Language.TURKISH,
]
),
"Óó": frozenset(
[
Language.CATALAN,
Language.GERMAN,
Language.HUNGARIAN,
Language.ICELANDIC,
Language.IRISH,
Language.POLISH,
Language.PORTUGUESE,
Language.SLOVAK,
Language.SPANISH,
Language.VIETNAMESE,
Language.YORUBA,
]
),
"ÁáÍíÚú": frozenset(
[
Language.CATALAN,
Language.CZECH,
Language.GERMAN,
Language.ICELANDIC,
Language.IRISH,
Language.HUNGARIAN,
Language.PORTUGUESE,
Language.SLOVAK,
Language.SPANISH,
Language.VIETNAMESE,
Language.YORUBA,
]
),
"Éé": frozenset(
[
Language.CATALAN,
Language.CZECH,
Language.FRENCH,
Language.GERMAN,
Language.HUNGARIAN,
Language.ICELANDIC,
Language.IRISH,
Language.ITALIAN,
Language.PORTUGUESE,
Language.SLOVAK,
Language.SPANISH,
Language.VIETNAMESE,
Language.YORUBA,
]
),
}
| 7,191
| 31.107143
| 88
|
py
|
lingua-py
|
lingua-py-main/lingua/_ngram.py
|
#
# Copyright © 2022-present Peter M. Stahl pemistahl@gmail.com
#
# 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 expressed or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
class _NgramRange(object):
def __init__(self, start: str):
self.start = start
def __iter__(self):
return self
def __next__(self) -> str:
value = self.start
length = len(value)
if length == 0:
raise StopIteration()
result = self.start
new_value = value[: length - 1]
self.start = new_value
return result
def _get_ngram_name_by_length(ngram_length: int) -> str:
if ngram_length == 1:
return "unigram"
elif ngram_length == 2:
return "bigram"
elif ngram_length == 3:
return "trigram"
elif ngram_length == 4:
return "quadrigram"
elif ngram_length == 5:
return "fivegram"
else:
raise ValueError(f"ngram length {ngram_length} is not in range 1..6")
| 1,424
| 28.6875
| 77
|
py
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.