diff --git a/.gitignore b/.gitignore index 68bc17f..6ac860f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,16 @@ +# Project-specific +assets/train_assembly +assets/test_assembly +plan_sequence/generator/network/*.pt +*.sdf +*.obj +*.dae +*.zip + +.vscode +.DS_Store +__MACOSX + # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/README.md b/README.md index bbafe94..e1fb3b5 100644 --- a/README.md +++ b/README.md @@ -1 +1,199 @@ -# ASAP \ No newline at end of file +# ASAP + +This repository contains the official code and dataset of [ASAP: Automated Sequence Planning for Complex Robotic Assembly with Physical Feasibility (ICRA 2024)](http://asap.csail.mit.edu). + +

+ + + + +

+ +

+ + + +

+ +**Authors**: Yunsheng Tian, Karl D.D. Willis, Bassel Al Omari, Jieliang Luo, Pingchuan Ma, Yichen Li, Farhad Javid, Edward Gu, Joshua Jacob, Shinjiro Sueda, Hui Li, Sachin Chitta, Wojciech Matusik + +**Summary**: The automated assembly of complex products requires a system that can automatically plan a physically feasible sequence of actions for assembling many parts together. In this paper, we present ASAP, a physics-based planning approach for automatically generating such a sequence for general-shaped assemblies. ASAP accounts for gravity to design a sequence where each sub-assembly is physically stable with a limited number of parts being held and a support surface. We apply efficient tree search algorithms to reduce the combinatorial complexity of determining such an assembly sequence. The search can be guided by either geometric heuristics or graph neural networks trained on data with simulation labels. Finally, we show the superior performance of ASAP at generating physically realistic assembly sequence plans on a large dataset of hundreds of complex product assemblies. We further demonstrate the applicability of ASAP on both simulation and real-world robotic setups. + +## Installation + +### 1. Clone repository + +``` +git clone --recurse-submodules git@github.com:yunshengtian/RobotAssembly.git +``` + +### 2. Python environment + +``` +conda env create -f environment.yml +conda activate asap +``` + +or + +``` +pip install numpy networkx matplotlib scipy pyglet rtree sortedcontainers scipy tqdm trimesh torch torch_geometric torch_sparse torch_scatter seaborn ikpy pyquaternion +``` + +### 3. Python binding of simulation + +``` +cd simulation +python setup.py install +``` + +To test if the installation steps are successful, run: + +``` +python test_sim/test_simple_sim.py --model box/box_stack --steps 2000 +``` + +Then the simulation viewer should appear. [Here](https://github.com/yunshengtian/Assemble-Them-All?tab=readme-ov-file#simulation-viewer) are some tips on interacting with the viewer. +Additionally, press `V` for outputting the camera parameters (lookat and pos). + +We also provide a beam assembly under ``assets/beam_assembly`` folder. To visualize the simulation of that, run: + +``` +python test_sim/test_multi_sim.py --dir beam_assembly --id original --gravity 9.8 --steps 2000 --friction 0.5 --camera-pos 3.15 -1.24 1.6 --camera-lookat 2.59 -0.55 1.16 +``` + +### 4. Assembly dataset (optional) + +Install the training set and test set: + +| Training set (1906 assemblies) | Test Set (240 assemblies) | +| :--------------------------------------: | :------------------------------: | +| ![training_set](images/training_set.png) | ![test_set](images/test_set.png) | +| [Link (591MB)](https://people.csail.mit.edu/yunsheng/ASAP/dataset_2404/training_assembly.zip) | [Link (124MB)](https://people.csail.mit.edu/yunsheng/ASAP/dataset_2404/test_assembly.zip) | + +For point-based SDF collision check to work more accurately, we highly recommend subdividing the assembly meshes to have denser contact points by running ``assets/subdivide_batch.py``. For example, to subdivide the dataset saved in ``assets/test_assembly`` and export to ``assets/test_assembly_dense``: + +``` +python assets/subdivide_batch.py --source-dir assets/test_assembly --target-dir assets/test_assembly_dense --num-proc NUM_PROCESSES +``` + +## Experiments + +### Sequence planning + +Use the following command to run sequence planning on the beam assembly we provided: + +``` +python plan_sequence/run_seq_plan.py --dir beam_assembly --id original --planner dfs --generator heur-out --max-gripper 2 --base-part 6 --log-dir logs/beam_seq --early-term +``` + +Important arguments include (see the complete list in `plan_sequence/run_seq_plan.py`): + +- `dir`: assembly directory (relative to `assets/`) +- `id`: assembly id +- `planner`: name of the node selection algorithm (i.e., tree search planner) (see `plan_sequence/planner/__init__.py` for supported options) +- `generator`: name of the part selection algorithm (i.e., part generator) (see `plan_sequence/generator/__init__.py` for supported options) +- `seed`: random seed +- `budget`: maximum number of feasibility evaluation +- `max-gripper`: number of available grippers (for assembling and holding parts) +- `max-pose`: number of pose candidates to search from during pose selection +- `pose-reuse`: number of poses to be reused from the parent node for pose selection +- `early-term`: early termination once a feasible plan is found (rather than waiting for the whole tree to be fully expanded) +- `timeout`: timeout in seconds for the whole sequence planning +- `base-part`: id of the base part (if exists) as the first part that stays in place (reorientation will not be allowed then) +- `log-dir`: log directory for storing all the planning outputs +- `plan-grasp`: whether to plan gripper grasps +- `plan-arm`: whether to plan arm motions + +### Log folder structure + +If `log-dir` is specified in the above command, the log files will be saved in this directory: `{log-dir}/{planner}-{generator}/s{seed}/{id}/`. + +There are three files generated: +1. `setup.json` that stores the arguments used for experiments; +2. `stats.json` that stores the high-level planning results; +3. `tree.pkl` that stores the explored disassembly tree with all necessary information on edges/nodes. + +### Generating results from log + +We separate the planning and result generation for flexibility considerations. Suppose you have run the above command for planning, then use the following command to generate planned results: + +``` +python plan_sequence/play_logged_plan.py --log-dir logs/beam_seq/dfs-heur-out/s0/original/ --assembly-dir assets/beam_assembly/original --result-dir results/beam_seq/ --save-all --camera-pos 3.15 -1.24 1.6 --camera-lookat 2.59 -0.55 1.16 +``` + +Important arguments include (see the complete list in `plan_sequence/play_logged_plan.py`): + +- `log-dir`: input log directory +- `assembly-dir`: input assembly directory (absolute path) +- `result-dir`: output result directory +- `save-mesh`: whether to output meshes in the result folder (not necessarily needed, same as meshes in assembly dir) +- `save-pose`: whether to output (reoriented) pose of every assembly step +- `save-part`: whether to output parts to be held +- `save-record`: whether to output rendered videos +- `save-all`: whether to output everything above +- `reverse`: whether to reverse the rendering (to be assembly instead of disassembly) +- `show-fix`: whether to show fixed parts in rendering (in grey) +- `show-grasp`: whether to show gripper grasp in rendering +- `show-arm`: whether to show arm motion in rendering + +If `save-all` is specified, the results will be saved in `result-dir` with the following structure. +Assume there are `N` parts, `N-1` assembly steps, `T` time steps in each assembly step, +N part ids are `{p0}, {p1}, ... {pN-1}`, and N-1 ordered part ids following the disassembly order are `{p'0}, {p'1}, ..., {p'N-2}`: + +``` +mesh/ --- meshes of individual parts + ├── part{p0}.obj + ├── ... + └── part{pN-1}.obj +part_fix/ --- parts to be held in every assembly step + ├── 0_{p'0}.json + ├── ... + └── N-2_{p'N-2}.json +path/ --- geometric assembly paths in every time step in every assembly step (4x4 transformation matrices) + └── 0_{p'0}/ + └── 0/ + ├── part{p0}.npy + ├── ... + └── part{pN-1}.npy + ├── ... + └── {T-1}/ + ├── ... + └── N-2_{p'N-2}/ +pose/ --- global pose of the whole (sub)assembly in every assembly step (4x4 transformation matrix) + ├── 0_{p'0}.npy + ├── ... + └── N-2_{p'N-2}.npy +record/ --- (dis)assembly animations in every assembly step + ├── 0_{p'0}.gif + ├── ... + └── N-2_{p'N-2}.gif +``` + +After the animations are generated, you can use `plan_sequence/combine_animation.py` to concatenate all videos into a single one. + +### Batch sequence planning + +Use `plan_sequence/run_seq_plan_batch.py` to run batch sequence planning for all assemblies in the assembly directory (with similar arguments as shown above for the serial script). The log folders will be saved in this directory: `{log-dir}/g{max-gripper}/{planner}-{generator}/s{seed}/`. + +To check success rates quantitatively, run: +``` +python plan_sequence/check_success_rate_batch.py --log-dir {log-dir}/g{max-gripper} +``` + +## Contact + +Please feel free to contact yunsheng@csail.mit.edu or create a GitHub issue for any questions about the code or dataset. + +## Citation + +If you find our paper, code or dataset is useful, please consider citing: + +``` +@article{tian2023asap, + title={ASAP: Automated Sequence Planning for Complex Robotic Assembly with Physical Feasibility}, + author={Tian, Yunsheng and Willis, Karl DD and Omari, Bassel Al and Luo, Jieliang and Ma, Pingchuan and Li, Yichen and Javid, Farhad and Gu, Edward and Jacob, Joshua and Sueda, Shinjiro and others}, + journal={arXiv preprint arXiv:2309.16909}, + year={2023} +} +``` \ No newline at end of file diff --git a/assets/beam_assembly/original/config.json b/assets/beam_assembly/original/config.json new file mode 100644 index 0000000..6fa7c8d --- /dev/null +++ b/assets/beam_assembly/original/config.json @@ -0,0 +1,22 @@ +{ + "0": { + "initial_state": [6.8913, 8.6769, 0.762, 0, 0, 0], + "final_state": [12.245, 3.8152, 7.0889, 0, 0, 1.570796] + }, + "1": { + "initial_state": [6.8833, 13.2202, 0.762, 0, 0, 0], + "final_state": [21.135, 3.8152, 7.0889, 0, 0, 1.570796] + }, + "2": { + "initial_state": [17.0764, 8.7173, 0.635, -1.570796, 0, -1.570796], + "final_state": [12.2424, 3.8152, 3.8614, 0, 0, -1.570796] + }, + "3": { + "initial_state": [17.047, 13.1969, 0.635, -1.570796, 0, -1.570796], + "final_state": [21.1376, 3.8152, 3.8614, 0, 0, -1.570796] + }, + "6": { + "initial_state": [16.69, 3.8152, 0.635, 0, 0, 1.570796], + "final_state": [16.69, 3.8152, 0.6321, 0, 0, 1.570796] + } +} \ No newline at end of file diff --git a/assets/beam_assembly/original/id_map.json b/assets/beam_assembly/original/id_map.json new file mode 100644 index 0000000..d9343c5 --- /dev/null +++ b/assets/beam_assembly/original/id_map.json @@ -0,0 +1 @@ +{"0": "Table_Base - Feet-1.obj", "1": "Table_Base - Feet-2.obj", "2": "Table_Base - Upright-1.obj", "3": "Table_Base - Upright-2.obj", "4": "Table_Base - Supports-1.obj", "5": "Table_Base - Supports-2.obj", "6": "Table_Base - Top-1.obj"} \ No newline at end of file diff --git a/assets/beam_assembly/original/robot.json b/assets/beam_assembly/original/robot.json new file mode 100644 index 0000000..30955ac --- /dev/null +++ b/assets/beam_assembly/original/robot.json @@ -0,0 +1,34 @@ +{ + "arm": { + "base_pos": [-21.25, -30.0, 0.0], + "base_angle": 0.0, + "scale": 1.0, + "rest_q": [0.63879051, -0.41713369, 0.28274334, 0.65100781, 0.13089969, 1.0559242, 0.82030475] + }, + "gripper": { + "type": "robotiq-140", + "scale": 1.0 + }, + "grasp": { + "0": { + "antipodals": [[0.0, 0.635, 1.073], [0.0, -0.635, 1.073]], + "base_direction": [0.0, 0.0, 1.0] + }, + "1": { + "antipodals": [[0.0, 0.635, 1.073], [0.0, -0.635, 1.073]], + "base_direction": [0.0, 0.0, 1.0] + }, + "2": { + "antipodals": [[-0.635, -1.2, 1.905], [0.635, -1.2, 1.905]], + "base_direction": [0.0, -1.0, 0.0] + }, + "3": { + "antipodals": [[-0.635, -1.2, 1.905], [0.635, -1.2, 1.905]], + "base_direction": [0.0, -1.0, 0.0] + }, + "6": { + "antipodals": [[-0.889, 0.0, 1.2], [0.889, 0.0, 1.2]], + "base_direction": [0.0, 0.0, 1.0] + } + } +} \ No newline at end of file diff --git a/assets/box/box_stack.xml b/assets/box/box_stack.xml new file mode 100644 index 0000000..04046a2 --- /dev/null +++ b/assets/box/box_stack.xml @@ -0,0 +1,30 @@ + + \ No newline at end of file diff --git a/assets/color.py b/assets/color.py new file mode 100644 index 0000000..7457e0b --- /dev/null +++ b/assets/color.py @@ -0,0 +1,26 @@ +''' +Predefined colors for assembly meshes +''' + +import numpy as np + + +def get_color(part_ids, normalize=True): + color_map = {} + if len(part_ids) <= 2: + colors = np.array([ + [107, 166, 161, 255], + [209, 184, 148, 255], + ], dtype=int) + else: + colors = np.array([ + [210, 87, 89, 255], + [237, 204, 73, 255], + [60, 167, 221, 255], + [190, 126, 208, 255], + [108, 192, 90, 255], + ], dtype=int) + if normalize: colors = colors.astype(float) / 255.0 + for i, part_id in enumerate(part_ids): + color_map[part_id] = colors[i % len(colors)] + return color_map diff --git a/assets/load.py b/assets/load.py new file mode 100644 index 0000000..1728d80 --- /dev/null +++ b/assets/load.py @@ -0,0 +1,183 @@ +''' +Load assembly meshes and transform +''' +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np +import json +import trimesh +from scipy.spatial.transform import Rotation as R + +from assets.color import get_color +from assets.transform import get_transform_matrix, q_to_pos_quat + + +def load_config(obj_dir): + ''' + Load config from dir (initial/final states) + ''' + config_path = os.path.join(obj_dir, 'config.json') + if not os.path.exists(config_path): + return None + + with open(config_path, 'r') as fp: + config = json.load(fp) + + return config + + +def load_pos_quat_dict(obj_dir, transform='final'): + config = load_config(obj_dir) + pos_dict, quat_dict = {}, {} + part_ids = load_part_ids(obj_dir) + for part_id in part_ids: + if config is None or part_id not in config: + pos_dict[part_id], quat_dict[part_id] = np.array([0., 0., 0.]), np.array([1., 0., 0., 0.]) + else: + part_cfg = config[part_id] + if transform == 'final': + state = part_cfg['final_state'] + elif transform == 'initial': + state = part_cfg['initial_state'] if 'initial_state' in part_cfg else None + else: + raise Exception(f'Unknown transform type: {transform}') + if state is not None: + pos_dict[part_id], quat_dict[part_id] = q_to_pos_quat(state) + else: + pos_dict[part_id], quat_dict[part_id] = np.array([0., 0., 0.]), np.array([1., 0., 0., 0.]) + return pos_dict, quat_dict + + +def load_part_ids(obj_dir): + part_ids = [] + for obj_name in os.listdir(obj_dir): + if obj_name.endswith('.obj'): + part_id = obj_name.replace('.obj', '') + part_ids.append(part_id) + part_ids.sort() + return part_ids + + +def load_assembly(obj_dir, transform='final'): + ''' + Load the entire assembly from dir + transform: 'final', 'initial' or 'none' + ''' + obj_ids = load_part_ids(obj_dir) + obj_ids = sorted(obj_ids) + color_map = get_color(obj_ids, normalize=False) + + assembly = {} + config = load_config(obj_dir) + + for obj_id in obj_ids: + obj_name = f'{obj_id}.obj' + obj_path = os.path.join(obj_dir, obj_name) + mesh = trimesh.load_mesh(obj_path, process=False, maintain_order=True) + mesh.visual.face_colors = color_map[obj_id] + + assembly[obj_id] = { + 'mesh': mesh, + 'name': obj_name, + 'transform': transform, + } + + if config is not None and obj_id in config: + if transform == 'final': + mat = get_transform_matrix(config[obj_id]['final_state']) + mesh.apply_transform(mat) + elif transform == 'initial': + mat = get_transform_matrix(config[obj_id]['initial_state']) + mesh.apply_transform(mat) + elif transform == 'none': + pass + else: + raise Exception(f'Unknown transform type: {transform}') + + assembly[obj_id]['initial_state'] = config[obj_id]['initial_state'] if 'initial_state' in config[obj_id] else None + assembly[obj_id]['final_state'] = config[obj_id]['final_state'] + else: + assembly[obj_id]['initial_state'] = None + assembly[obj_id]['final_state'] = None + + return assembly + + +def load_assembly_all_transformed(obj_dir): + ''' + Load the entire assembly from dir with all transforms applied + ''' + obj_ids = load_part_ids(obj_dir) + obj_ids = sorted(obj_ids) + color_map = get_color(obj_ids, normalize=False) + + assembly = {} + config = load_config(obj_dir) + + for obj_id in obj_ids: + obj_name = f'{obj_id}.obj' + obj_path = os.path.join(obj_dir, obj_name) + mesh = trimesh.load_mesh(obj_path, process=False, maintain_order=True) + mesh.visual.face_colors = color_map[obj_id] + + mesh_none = mesh.copy() + mesh_final = mesh.copy() + mesh_initial = None + if config is not None and obj_id in config: + mat_final = get_transform_matrix(config[obj_id]['final_state']) + mat_initial = get_transform_matrix(config[obj_id]['initial_state']) if 'initial_state' in config[obj_id] else None + mesh_final.apply_transform(mat_final) + if mat_initial is not None: + mesh_initial = mesh.copy() + mesh_initial.apply_transform(mat_initial) + + assembly[obj_id] = { + 'name': obj_name, + 'mesh': mesh_none, + 'mesh_final': mesh_final, + 'mesh_initial': mesh_initial, + } + if config is not None and obj_id in config: + assembly[obj_id]['initial_state'] = config[obj_id]['initial_state'] if 'initial_state' in config[obj_id] else None + assembly[obj_id]['final_state'] = config[obj_id]['final_state'] + + return assembly + + +def load_paths(path_dir): + ''' + Load motion of assembly meshes at every time step + ''' + paths = {} + for step in os.listdir(path_dir): + obj_id = step.split('_')[1] + step_dir = os.path.join(path_dir, step) + if os.path.isdir(step_dir): + path = [] + frame_files = [] + for frame_file in os.listdir(step_dir): + if frame_file.endswith('.npy'): + frame_files.append(frame_file) + frame_files.sort(key=lambda x: int(x.replace('.npy', ''))) + for frame_file in frame_files: + frame_path = os.path.join(step_dir, frame_file) + frame_transform = np.load(frame_path) + path.append(frame_transform) + paths[obj_id] = path + return paths + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--dir', type=str, required=True) + args = parser.parse_args() + + assembly = load_assembly(args.dir) + meshes = [assembly[obj_id]['mesh'] for obj_id in assembly] + trimesh.Scene(meshes).show() diff --git a/assets/make_sdf.py b/assets/make_sdf.py new file mode 100644 index 0000000..47203bd --- /dev/null +++ b/assets/make_sdf.py @@ -0,0 +1,65 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import redmax_py as redmax +import json +from argparse import ArgumentParser + +from assets.load import load_pos_quat_dict, load_part_ids +from assets.save import clear_saved_sdfs + + +def arr_to_str(arr): + return ' '.join([str(x) for x in arr]) + + +def get_xml_string(assembly_dir, part_ids, sdf_dx): + pos_dict, quat_dict = load_pos_quat_dict(assembly_dir) + joint_type = 'fixed' + string = f''' + + +''' + return string + + +def make_sdf(asset_folder, assembly_dir, sdf_dx): + part_ids = load_part_ids(assembly_dir) + model_string = get_xml_string( + assembly_dir=assembly_dir, + part_ids=part_ids, + sdf_dx=sdf_dx, + ) + redmax.Simulation(model_string, asset_folder) + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--id', type=str, required=True, help='assembly id (e.g. 00000)') + parser.add_argument('--dir', type=str, default='multi_assembly', help='directory storing all assemblies') + parser.add_argument('--sdf-dx', type=float, default=0.05, help='grid resolution of SDF') + parser.add_argument('--clear', default=False, action='store_true') + args = parser.parse_args() + + asset_folder = os.path.join(project_base_dir, './assets') + assembly_dir = os.path.join(asset_folder, args.dir, args.id) + + if args.clear: + clear_saved_sdfs(assembly_dir) + else: + make_sdf(asset_folder, assembly_dir, args.sdf_dx) diff --git a/assets/make_sdf_batch.py b/assets/make_sdf_batch.py new file mode 100644 index 0000000..4b7c0ee --- /dev/null +++ b/assets/make_sdf_batch.py @@ -0,0 +1,35 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +from argparse import ArgumentParser +from make_sdf import make_sdf + +from utils.parallel import parallel_execute + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--dir', type=str, default='multi_assembly', help='directory storing all assemblies') + parser.add_argument('--sdf-dx', type=float, default=0.05, help='grid resolution of SDF') + parser.add_argument('--num-proc', type=int, default=8) + args = parser.parse_args() + + asset_folder = os.path.join(project_base_dir, './assets') + assemblies_dir = os.path.join(asset_folder, args.dir) + assembly_ids = [] + for assembly_id in os.listdir(assemblies_dir): + assembly_dir = os.path.join(assemblies_dir, assembly_id) + if os.path.isdir(assembly_dir): + assembly_ids.append(assembly_id) + assembly_ids.sort() + + worker_args = [] + for assembly_id in assembly_ids: + assembly_dir = os.path.join(assemblies_dir, assembly_id) + worker_args.append([asset_folder, assembly_dir, args.sdf_dx]) + + for _ in parallel_execute(make_sdf, worker_args, args.num_proc, show_progress=True): + pass diff --git a/assets/mesh_distance.py b/assets/mesh_distance.py new file mode 100644 index 0000000..0e54e0b --- /dev/null +++ b/assets/mesh_distance.py @@ -0,0 +1,94 @@ +''' +Compute the minimum distance between meshes at certain states +''' + +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np +from assets.transform import get_transform_matrix, transform_pts_by_matrix + + +def compute_all_mesh_distance(meshes, states, verbose=False): + ''' + Compute the minimum distance between meshes at certain states + ''' + assert len(meshes) == len(states) + + mats, inv_mats = [], [] + for i in range(len(meshes)): + mat = get_transform_matrix(states[i]) + mats.append(mat) + inv_mats.append(np.linalg.inv(mat)) + + d = np.inf + for i in range(len(meshes)): + for j in range(i + 1, len(meshes)): + v_i_trans = transform_pts_by_matrix(meshes[i].vertices.T, inv_mats[j].dot(mats[i])) + v_j_trans = transform_pts_by_matrix(meshes[j].vertices.T, inv_mats[i].dot(mats[j])) + d_ij = meshes[i].min_distance(v_j_trans.T) + d_ji = meshes[j].min_distance(v_i_trans.T) + d = np.min([d, d_ij, d_ji]) + if verbose: + print(f'mesh distance between {i} {j}:', min([d_ij, d_ji])) + if verbose: + print('mesh distance minimum:', d) + + return d + + +def compute_move_mesh_distance(move_mesh, still_meshes, state): + ''' + Compute the minimum distance between meshes at certain states + ''' + move_mat = get_transform_matrix(state) + move_inv_mat = np.linalg.inv(move_mat) + + v_m_trans = transform_pts_by_matrix(move_mesh.vertices.T, move_mat).T + + d = np.inf + for i in range(len(still_meshes)): + v_s_trans = transform_pts_by_matrix(still_meshes[i].vertices.T, move_inv_mat).T + d_ms = move_mesh.min_distance(v_s_trans) + d_sm = still_meshes[i].min_distance(v_m_trans) + d = np.min([d, d_ms, d_sm]) + + return d + + +def compute_move_mesh_distance_from_mat(move_mesh, still_meshes, move_mat): + + move_inv_mat = np.linalg.inv(move_mat) + + v_m_trans = transform_pts_by_matrix(move_mesh.vertices.T, move_mat).T + + d = np.inf + for i in range(len(still_meshes)): + v_s_trans = transform_pts_by_matrix(still_meshes[i].vertices.T, move_inv_mat).T + d_ms = move_mesh.min_distance(v_s_trans) + d_sm = still_meshes[i].min_distance(v_m_trans) + d = np.min([d, d_ms, d_sm]) + + return d + + +def compute_ground_distance(move_mesh, state): + + move_mat = get_transform_matrix(state) + v_m = transform_pts_by_matrix(move_mesh.vertices.T, move_mat) + + d = np.min(v_m[:, 2]) + + return d + + +def compute_ground_distance_from_mat(move_mesh, move_mat): + + v_m = transform_pts_by_matrix(move_mesh.vertices.T, move_mat) + + d = np.min(v_m[:, 2]) + + return d diff --git a/assets/obj_utils/concat_obj.py b/assets/obj_utils/concat_obj.py new file mode 100644 index 0000000..0c2959c --- /dev/null +++ b/assets/obj_utils/concat_obj.py @@ -0,0 +1,36 @@ +import trimesh +import os +from argparse import ArgumentParser + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--input-path', type=str, required=True) + parser.add_argument('--output-path', type=str, required=True) + parser.add_argument('--batch', action='store_true', default=False) + args = parser.parse_args() + + if args.batch: + for obj_file in os.listdir(args.input_path): + obj_file = obj_file.lower() + if not obj_file.endswith('.obj'): + continue + input_path = os.path.join(args.input_path, obj_file) + output_path = os.path.join(args.output_path, os.path.basename(obj_file)) + os.makedirs(args.output_path, exist_ok=True) + mesh = trimesh.load(input_path) + if type(mesh) == trimesh.Scene: + meshes = list(mesh.geometry.values()) + mesh = trimesh.util.concatenate(meshes) + else: + print('Not a scene, no need to concatenate.') + mesh.export(output_path) + else: + assert os.path.isfile(args.input_path) and args.input_path.endswith('.obj') + mesh = trimesh.load(args.input_path) + if type(mesh) == trimesh.Scene: + meshes = list(mesh.geometry.values()) + mesh = trimesh.util.concatenate(meshes) + else: + print('Not a scene, no need to concatenate.') + mesh.export(args.output_path) diff --git a/assets/obj_utils/convexify_obj.py b/assets/obj_utils/convexify_obj.py new file mode 100644 index 0000000..bde17d5 --- /dev/null +++ b/assets/obj_utils/convexify_obj.py @@ -0,0 +1,31 @@ +import numpy as np +import trimesh +import os +from argparse import ArgumentParser + + +def convexity_obj(input_path, output_path): + obj = trimesh.exchange.obj.export_obj(trimesh.load(input_path).convex_hull, header='') + with open(output_path, 'w') as fp: + fp.write(obj) + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--input-path', type=str, required=True) + parser.add_argument('--output-path', type=str, required=True) + parser.add_argument('--batch', default=False, action='store_true') + args = parser.parse_args() + + if args.batch: + os.makedirs(args.output_path, exist_ok=True) + for obj_file in os.listdir(args.input_path): + obj_file = obj_file.lower() + if not obj_file.lower().endswith('.obj'): + continue + input_path = os.path.join(args.input_path, obj_file) + output_path = os.path.join(args.output_path, obj_file) + convexity_obj(input_path, output_path) + else: + assert os.path.isfile(args.input_path) and args.input_path.endswith('.obj') + convexity_obj(args.input_path, args.output_path) diff --git a/assets/obj_utils/dae_to_obj.py b/assets/obj_utils/dae_to_obj.py new file mode 100644 index 0000000..88d6c61 --- /dev/null +++ b/assets/obj_utils/dae_to_obj.py @@ -0,0 +1,40 @@ +import numpy as np +import trimesh +import os +from argparse import ArgumentParser + + +def dae_to_obj(input_path, output_path, material): + if material: + mtl_path = output_path.replace('.obj', '.mtl') + obj, mtl = trimesh.exchange.obj.export_obj(trimesh.load(input_path), include_color=True, include_texture=True, return_texture=True, header='', mtl_name=mtl_path) + with open(output_path, 'w') as fp: + fp.write(obj) + for mtl_path, mtl_data in mtl.items(): + with open(mtl_path, 'wb') as fp: + fp.write(mtl_data) + else: + obj = trimesh.exchange.obj.export_obj(trimesh.load(input_path), header='') + with open(output_path, 'w') as fp: + fp.write(obj) + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--input-path', type=str, required=True) + parser.add_argument('--output-path', type=str, required=True) + parser.add_argument('--batch', default=False, action='store_true') + parser.add_argument('--material', default=False, action='store_true') + args = parser.parse_args() + + if args.batch: + for dae_file in os.listdir(args.input_path): + dae_file = dae_file.lower() + if not dae_file.lower().endswith('.dae'): + continue + input_path = os.path.join(args.input_path, dae_file) + output_path = os.path.join(args.output_path, os.path.basename(dae_file).replace('.dae', '.obj')) + dae_to_obj(input_path, output_path, args.material) + else: + assert os.path.isfile(args.input_path) and args.input_path.endswith('.dae') + dae_to_obj(args.input_path, args.output_path, args.material) diff --git a/assets/obj_utils/render_obj.py b/assets/obj_utils/render_obj.py new file mode 100644 index 0000000..4d98646 --- /dev/null +++ b/assets/obj_utils/render_obj.py @@ -0,0 +1,13 @@ +import trimesh +import os +from argparse import ArgumentParser + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--obj-path', type=str, required=True) + args = parser.parse_args() + + assert os.path.isfile(args.obj_path) and args.obj_path.endswith('.obj') + mesh = trimesh.load(args.obj_path) + mesh.show() diff --git a/assets/obj_utils/scale_obj.py b/assets/obj_utils/scale_obj.py new file mode 100644 index 0000000..301aa3f --- /dev/null +++ b/assets/obj_utils/scale_obj.py @@ -0,0 +1,31 @@ +import numpy as np +import trimesh +import os +from argparse import ArgumentParser + + +def scale_obj(input_path, output_path, scale): + mesh = trimesh.load(input_path) + mesh.apply_scale(scale) + mesh.export(output_path) + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--input-path', type=str, required=True) + parser.add_argument('--output-path', type=str, required=True) + parser.add_argument('--scale', type=float, required=True) + parser.add_argument('--batch', default=False, action='store_true') + args = parser.parse_args() + + if args.batch: + os.makedirs(args.output_path, exist_ok=True) + for obj_file in os.listdir(args.input_path): + obj_file = obj_file.lower() + if not obj_file.lower().endswith('.obj'): + continue + input_path = os.path.join(args.input_path, obj_file) + output_path = os.path.join(args.output_path, obj_file) + scale_obj(input_path, output_path, args.scale) + else: + assert os.path.isfile(args.input_path) and args.input_path.endswith('.obj') + scale_obj(args.input_path, args.output_path, args.scale) diff --git a/assets/obj_utils/stl_to_obj.py b/assets/obj_utils/stl_to_obj.py new file mode 100644 index 0000000..f7cb1d0 --- /dev/null +++ b/assets/obj_utils/stl_to_obj.py @@ -0,0 +1,41 @@ +import numpy as np +import stl +from stl import mesh +import pywavefront +import glob +import os +from argparse import ArgumentParser + + +def stl_to_obj(stl_file, obj_file): + # Load the STL files and add the vectors to the plot + stl_mesh = mesh.Mesh.from_file(stl_file) + with open(obj_file, 'w') as file: + for i, facet in enumerate(stl_mesh.vectors): + # Write vertices + for vertex in facet: + file.write('v {0} {1} {2}\n'.format(vertex[0], vertex[1], vertex[2])) + # Write faces + file.write('f {0} {1} {2}\n'.format(i*3+1, i*3+2, i*3+3)) + print(f"{stl_file} has been converted to {obj_file}") + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--input-path', type=str, required=True) + parser.add_argument('--output-path', type=str, required=True) + parser.add_argument('--batch', default=False, action='store_true') + args = parser.parse_args() + + if args.batch: + for stl_file in os.listdir(args.input_path): + stl_file = stl_file.lower() + if not stl_file.endswith('.stl'): + continue + input_path = os.path.join(args.input_path, stl_file) + output_path = os.path.join(args.output_path, os.path.basename(stl_file).replace('.stl', '.obj')) + os.makedirs(args.output_path, exist_ok=True) + stl_to_obj(input_path, output_path) + else: + assert os.path.isfile(args.input_path) and args.input_path.endswith('.stl') + stl_to_obj(args.input_path, args.output_path) diff --git a/assets/obj_utils/translate_obj.py b/assets/obj_utils/translate_obj.py new file mode 100644 index 0000000..b41c400 --- /dev/null +++ b/assets/obj_utils/translate_obj.py @@ -0,0 +1,31 @@ +import numpy as np +import trimesh +import os +from argparse import ArgumentParser + + +def translate_obj(input_path, output_path, translation): + mesh = trimesh.load(input_path) + mesh.apply_translation(translation) + mesh.export(output_path) + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--input-path', type=str, required=True) + parser.add_argument('--output-path', type=str, required=True) + parser.add_argument('--translation', type=float, nargs='+', required=True) + parser.add_argument('--batch', default=False, action='store_true') + args = parser.parse_args() + + if args.batch: + os.makedirs(args.output_path, exist_ok=True) + for obj_file in os.listdir(args.input_path): + obj_file = obj_file.lower() + if not obj_file.lower().endswith('.obj'): + continue + input_path = os.path.join(args.input_path, obj_file) + output_path = os.path.join(args.output_path, obj_file) + translate_obj(input_path, output_path, args.translation) + else: + assert os.path.isfile(args.input_path) and args.input_path.endswith('.obj') + translate_obj(args.input_path, args.output_path, args.translation) diff --git a/assets/panda/panda.xml b/assets/panda/panda.xml new file mode 100644 index 0000000..c5bdcc7 --- /dev/null +++ b/assets/panda/panda.xml @@ -0,0 +1,74 @@ + + + + diff --git a/assets/panda/panda_generate.py b/assets/panda/panda_generate.py new file mode 100644 index 0000000..a41d856 --- /dev/null +++ b/assets/panda/panda_generate.py @@ -0,0 +1,87 @@ +mesh_type = 'collision' +body_type = 'SDF' +dx = 1 +scale = 1 + +string = f''' + + + +''' + +with open('panda.xml', 'w') as fp: + fp.write(string) \ No newline at end of file diff --git a/assets/panda/panda_gripper.xml b/assets/panda/panda_gripper.xml new file mode 100644 index 0000000..c1f409d --- /dev/null +++ b/assets/panda/panda_gripper.xml @@ -0,0 +1,38 @@ + + + + diff --git a/assets/process_mesh.py b/assets/process_mesh.py new file mode 100644 index 0000000..57518d6 --- /dev/null +++ b/assets/process_mesh.py @@ -0,0 +1,185 @@ +''' +Postprocessing for multi assembly +''' + +import os +os.environ['OMP_NUM_THREADS'] = '1' +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import json +import numpy as np +import trimesh + +from assets.subdivide import subdivide_to_size + + +def norm_to_transform(center, scale): + transform0 = np.eye(4) + transform0[:3, 3] = -center + transform1 = np.eye(4) + transform1[:3, :3] = np.eye(3) * scale + return transform1.dot(transform0) + + +def scale_to_transform(scale): + transform = np.eye(4) + transform[:3, :3] = np.eye(3) * scale + return transform + + +def com_to_transform(com): + transform = np.eye(4) + transform[:3, 3] = com + return transform + + +def normalize(meshes, bbox_size=10): + + # compute normalization factors + vertex_all_stacked = np.vstack([mesh.vertices for mesh in meshes]) + min_box = vertex_all_stacked.min(axis=0) + max_box = vertex_all_stacked.max(axis=0) + center = (min_box + max_box) / 2 + scale = max_box - min_box + scale_factor = bbox_size / np.max(scale) + scale_transform = norm_to_transform(center, scale_factor) + + # normalization + for mesh in meshes: + mesh.apply_transform(scale_transform) + return meshes + + +def rescale(meshes, scale_factor): + + scale_transform = scale_to_transform(scale_factor) + + # normalization + for mesh in meshes: + mesh.apply_transform(scale_transform) + return meshes + + +def get_scale(meshes): + vertex_all_stacked = np.vstack([mesh.vertices for mesh in meshes]) + min_box = vertex_all_stacked.min(axis=0) + max_box = vertex_all_stacked.max(axis=0) + scale = max_box - min_box + return np.min(scale), np.max(scale) + + +def get_oriented_bounding_box(mesh): + _, extents = trimesh.bounds.oriented_bounds(mesh) + return extents + + +def as_mesh(scene_or_mesh): + """ + Convert a possible scene to a mesh. + + If conversion occurs, the returned mesh has only vertex and face data. + """ + if isinstance(scene_or_mesh, trimesh.Scene): + if len(scene_or_mesh.geometry) == 0: + mesh = None # empty scene + else: + # we lose texture information here + mesh = trimesh.util.concatenate( + tuple(trimesh.Trimesh(vertices=g.vertices, faces=g.faces) + for g in scene_or_mesh.geometry.values())) + else: + assert(isinstance(mesh, trimesh.Trimesh)) + mesh = scene_or_mesh + return mesh + + +def process_mesh(source_dir, target_dir, subdivide, rescale_factor=None, verbose=False): + ''' + 1. Scale to unit bounding box + 2. Check thickness (optional) + 3. Subdivide (optional) + 4. Translate + ''' + # order objs + source_files = [] + for source_file in os.listdir(source_dir): + if not source_file.endswith('.obj'): continue + source_files.append(source_file) + source_files.sort() + + # load meshes + meshes = [] + obj_ids = {} + watertight = True + for source_file in source_files: + source_id = source_file.replace('.obj', '') + obj_ids[source_id] = source_file + source_path = os.path.join(source_dir, source_file) + mesh = trimesh.load_mesh(source_path, process=False, maintain_order=True) + if isinstance(mesh, trimesh.Scene): + mesh = as_mesh(mesh) + if not isinstance(mesh, trimesh.Trimesh): + print(f'Failed to load {source_path} as mesh') + return False + + if not mesh.is_watertight: + print(f'Mesh {source_path} is not watertight') + + # mesh.fix_normals() + # mesh.fill_holes() + mesh = trimesh.Trimesh(mesh.vertices, mesh.faces) + if not mesh.is_watertight: + watertight = False + print('non-watertight mesh not fixed') + else: + print('non-watertight mesh fixed') + + meshes.append(mesh) + if not watertight: + return False + + # scale + # meshes = normalize(meshes) + if rescale_factor is not None: + meshes = rescale(meshes, rescale_factor) + + # get scale + scale_min, scale_max = get_scale(meshes) + + # subdivide mesh + # max_edge = 0.5 + max_edge = min(scale_min, scale_max / 20) + if subdivide: + for i in range(len(meshes)): + meshes[i] = subdivide_to_size(meshes[i], max_edge=max_edge) + + # make target directory + os.makedirs(target_dir, exist_ok=True) + + # write processed objs + os.makedirs(target_dir, exist_ok=True) + assert len(meshes) == len(obj_ids) + for mesh, obj_id in zip(meshes, obj_ids.keys()): + obj_target_path = os.path.join(target_dir, f'{obj_id}.obj') + mesh.export(obj_target_path, header=None, include_color=False) + if verbose: + print(f'Processed obj written to {obj_target_path}') + + return True + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--source-dir', type=str, required=True) + parser.add_argument('--target-dir', type=str, required=True) + parser.add_argument('--subdivide', default=False, action='store_true') + parser.add_argument('--rescale', type=float, default=None) + args = parser.parse_args() + + success = process_mesh(args.source_dir, args.target_dir, args.subdivide, rescale_factor=args.rescale, verbose=True) + print(f'Success: {success}') diff --git a/assets/robotiq_85/contacts/inner_finger_coarse.txt b/assets/robotiq_85/contacts/inner_finger_coarse.txt new file mode 100644 index 0000000..de8c822 --- /dev/null +++ b/assets/robotiq_85/contacts/inner_finger_coarse.txt @@ -0,0 +1,121 @@ +120 +-0.780030433088541 -1.0999999940395355 0.699966074898839 +-0.780030433088541 1.0999999940395355 0.699966074898839 +2.259989082813263 -0.7499999832361937 -0.8224811404943466 +2.259989455342293 -0.7499999832361937 -0.4804609343409538 +2.259989082813263 0.7499999832361937 -0.8224811404943466 +2.259989455342293 0.7499999832361937 -0.4804609343409538 +2.353949472308159 0.7000000216066837 -0.4462339449673891 +2.353949472308159 -0.7000000216066837 -0.4462339449673891 +2.3539669811725616 0.7000000216066837 -0.8566581644117832 +2.3539669811725616 -0.7000000216066837 -0.8566581644117832 +2.1115360781550407 -0.7499999832361937 -1.0344930924475193 +2.1115360781550407 0.7499999832361937 -1.0344930924475193 +2.2825464606285095 -0.7499999832361937 -0.738295167684555 +2.2825464606285095 0.7499999832361937 -0.738295167684555 +2.2825466468930244 -0.7499999832361937 -0.5646469537168741 +2.2825466468930244 0.7499999832361937 -0.5646469537168741 +2.2231556475162506 -0.7499999832361937 -0.901470985263586 +2.2231556475162506 0.7499999832361937 -0.901470985263586 +-0.29997758101671934 0.7000000216066837 -0.5196283105760813 +-0.29997758101671934 -0.7000000216066837 -0.5196283105760813 +2.2497860714793205 0.7000000216066837 -1.0371231473982334 +2.2497860714793205 -0.7000000216066837 -1.0371231473982334 +1.5849549323320389 0.7000000216066837 -1.2152950279414654 +1.5849549323320389 -0.7000000216066837 -1.2152950279414654 +-0.10003043571487069 -1.0999999940395355 0.699995644390583 +-0.10003043571487069 1.0999999940395355 0.699995644390583 +-0.5196021869778633 0.7000000216066837 -0.30002258718013763 +-0.5196021869778633 -0.7000000216066837 -0.30002258718013763 +2.0401423797011375 -0.7499999832361937 -1.0844835080206394 +2.0401423797011375 0.7499999832361937 -1.0844835080206394 +2.175835147500038 0.7000000216066837 -1.1110804975032806 +2.175835147500038 -0.7000000216066837 -1.1110804975032806 +-0.780190946534276 -0.6868240889161825 4.392369836568832 +-0.7801912724971771 -0.6000000052154064 4.399966076016426 +-0.7801912724971771 0.6000000052154064 4.399966076016426 +-0.780190946534276 0.6868240889161825 4.392369836568832 +-0.7801899686455727 -0.7710100617259741 4.369812458753586 +-0.7801899686455727 0.7710100617259741 4.369812458753586 +-0.7801883853971958 0.8500000461935997 4.332978650927544 +-0.7801883853971958 -0.8500000461935997 4.332978650927544 +-0.7801861967891455 0.9213938377797604 4.2829882353544235 +-0.7801861967891455 -0.9213938377797604 4.2829882353544235 +-0.7801835425198078 -0.9830222465097904 4.221360012888908 +-0.7801835425198078 0.9830222465097904 4.221360012888908 +-0.7801804225891829 1.0330126620829105 4.149965941905975 +-0.7801804225891829 -1.0330126620829105 4.149965941905975 +-0.7801769766956568 1.0698462836444378 4.0709760040044785 +-0.7801769766956568 -1.0698462836444378 4.0709760040044785 +-0.2500004833564162 -0.7499999832361937 -0.4330124706029892 +-0.2500004833564162 0.7499999832361937 -0.4330124706029892 +-0.7801733445376158 1.0924038477241993 3.986790031194687 +-0.7801733445376158 -1.0924038477241993 3.986790031194687 +1.9953791052103043 0.7000000216066837 -1.2152772396802902 +1.9953791052103043 -0.7000000216066837 -1.2152772396802902 +-0.7801695726811886 -1.0999999940395355 3.8999661803245544 +-0.7801695726811886 1.0999999940395355 3.8999661803245544 +-0.20518761593848467 0.7000000216066837 -0.5638245027512312 +-0.20518761593848467 -0.7000000216066837 -0.5638245027512312 +2.3901427164673805 0.7000000216066837 -0.651444448158145 +2.3901427164673805 -0.7000000216066837 -0.651444448158145 +2.3097706958651543 0.7000000216066837 -0.9514479897916317 +2.3097706958651543 -0.7000000216066837 -0.9514479897916317 +-0.38565248250961304 0.7000000216066837 -0.45964340679347515 +-0.38565248250961304 -0.7000000216066837 -0.45964340679347515 +1.7033178359270096 -0.7499999832361937 -1.1438743211328983 +1.7033178359270096 0.7499999832361937 -1.1438743211328983 +-0.5638067610561848 0.7000000216066837 -0.2052366267889738 +-0.5638067610561848 -0.7000000216066837 -0.2052366267889738 +-0.10019094916060567 -0.6868240889161825 4.39239963889122 +-0.10019127512350678 -0.6000000052154064 4.399995878338814 +-0.10019127512350678 0.6000000052154064 4.399995878338814 +-0.10019094916060567 0.6868240889161825 4.39239963889122 +-0.10018997127190232 -0.7710100617259741 4.3698422610759735 +-0.10018997127190232 0.7710100617259741 4.3698422610759735 +-0.10018836474046111 0.8500000461935997 4.333008453249931 +-0.10018836474046111 -0.8500000461935997 4.333008453249931 +-0.10018619941547513 0.9213938377797604 4.283018037676811 +-0.10018619941547513 -0.9213938377797604 4.283018037676811 +-0.45960983261466026 0.7000000216066837 -0.38569250609725714 +-0.45960983261466026 -0.7000000216066837 -0.38569250609725714 +-0.10018351022154093 -0.9830222465097904 4.221389815211296 +-0.10018351022154093 0.9830222465097904 4.221389815211296 +-0.10018041357398033 1.0330126620829105 4.149995744228363 +-0.10018041357398033 -1.0330126620829105 4.149995744228363 +-0.10017697932198644 1.0698462836444378 4.071005806326866 +-0.10017697932198644 -1.0698462836444378 4.071005806326866 +-0.10017332388088107 1.0924038477241993 3.9868198335170746 +-0.10017332388088107 -1.0924038477241993 3.9868198335170746 +2.090165391564369 0.7000000216066837 -1.1710727587342262 +2.090165391564369 -0.7000000216066837 -1.1710727587342262 +-0.1001695403829217 -1.0999999940395355 3.899995982646942 +-0.1001695403829217 1.0999999940395355 3.899995982646942 +1.6191322356462479 -0.7499999832361937 -1.1213166639208794 +1.6191322356462479 0.7499999832361937 -1.1213166639208794 +1.7901424318552017 -0.7499999832361937 -1.151470560580492 +1.7901424318552017 0.7499999832361937 -1.151470560580492 +1.9611526280641556 -0.7499999832361937 -1.1213170364499092 +1.9611526280641556 0.7499999832361937 -1.1213170364499092 +1.8943574279546738 0.7000000216066837 -1.2423506937921047 +1.8943574279546738 -0.7000000216066837 -1.2423506937921047 +1.7901692539453506 0.7000000216066837 -1.2514705769717693 +1.7901692539453506 -0.7000000216066837 -1.2514705769717693 +0.3998346161097288 0.7000000216066837 3.800017386674881 +0.3998346161097288 -0.7000000216066837 3.800017386674881 +1.6859795898199081 0.7000000216066837 -1.2423597276210785 +1.6859795898199081 -0.7000000216066837 -1.2423597276210785 +2.381022647023201 0.7000000216066837 -0.5472559947520494 +2.381022647023201 -0.7000000216066837 -0.5472559947520494 +2.2901425138115883 -0.7499999832361937 -0.651471083983779 +2.2901425138115883 0.7499999832361937 -0.651471083983779 +-0.5908802151679993 0.7000000216066837 -0.1042145537212491 +-0.5908802151679993 -0.7000000216066837 -0.1042145537212491 +1.8769662827253342 -0.7499999832361937 -1.1438745073974133 +1.8769662827253342 0.7499999832361937 -1.1438745073974133 +2.381031960248947 0.7000000216066837 -0.7556337863206863 +2.381031960248947 -0.7000000216066837 -0.7556337863206863 +2.173164300620556 -0.7499999832361937 -0.9728647768497467 +2.173164300620556 0.7499999832361937 -0.9728647768497467 +-0.1710105803795159 -0.7499999832361937 -0.46984609216451645 +-0.1710105803795159 0.7499999832361937 -0.46984609216451645 diff --git a/assets/robotiq_85/contacts/inner_knuckle_coarse.txt b/assets/robotiq_85/contacts/inner_knuckle_coarse.txt new file mode 100644 index 0000000..85b905d --- /dev/null +++ b/assets/robotiq_85/contacts/inner_knuckle_coarse.txt @@ -0,0 +1,71 @@ +70 +1.743362657725811 -1.6624609008431435 3.2848570495843887 +1.743362657725811 1.6624609008431435 3.2848570495843887 +2.980872057378292 1.2000000104308128 4.912802204489708 +2.980872057378292 -1.2000000104308128 4.912802204489708 +3.361816704273224 1.3500000350177288 4.780237004160881 +3.361816704273224 -1.3500000350177288 4.780237004160881 +-0.47765900380909443 1.9500000402331352 0.3631003899499774 +-0.47765900380909443 -1.9500000402331352 0.3631003899499774 +4.011814668774605 1.2000000104308128 4.781816527247429 +4.011814668774605 -1.2000000104308128 4.781816527247429 +-0.4405286628752947 1.9500000402331352 -0.40735057555139065 +-0.4405286628752947 -1.9500000402331352 -0.40735057555139065 +-0.2746394369751215 1.9500000402331352 -0.533453980460763 +-0.2746394369751215 -1.9500000402331352 -0.533453980460763 +0.324664986692369 1.9500000402331352 -0.504571758210659 +0.324664986692369 -1.9500000402331352 -0.504571758210659 +3.326019272208214 1.2000000104308128 5.134886130690575 +3.326019272208214 -1.2000000104308128 5.134886130690575 +3.534155711531639 1.2000000104308128 5.144916847348213 +3.534155711531639 -1.2000000104308128 5.144916847348213 +4.031571373343468 1.2000000104308128 4.371868073940277 +4.031571373343468 -1.2000000104308128 4.371868073940277 +2.5836510583758354 -1.7000000923871994 2.4073349311947823 +2.5836510583758354 1.7000000923871994 2.4073349311947823 +2.085224539041519 1.2000000104308128 3.7345770746469498 +2.085224539041519 -1.2000000104308128 3.7345770746469498 +0.9150488302111626 1.9500000402331352 0.21228655241429806 +0.9150488302111626 -1.9500000402331352 0.21228655241429806 +3.6890659481287003 1.3500000350177288 4.6464163810014725 +3.6890659481287003 -1.3500000350177288 4.6464163810014725 +-0.5730402655899525 1.9500000402331352 0.17783374059945345 +-0.5730402655899525 -1.9500000402331352 0.17783374059945345 +-0.0756246387027204 1.9500000402331352 -0.5952150095254183 +-0.0756246387027204 -1.9500000402331352 -0.5952150095254183 +2.3993849754333496 -0.8545084856450558 2.1649323403835297 +2.3993849754333496 0.8545084856450558 2.1649323403835297 +0.13251156779006124 1.9500000402331352 -0.5851842928677797 +0.13251156779006124 -1.9500000402331352 -0.5851842928677797 +3.7065375596284866 1.3500000350177288 4.518191888928413 +3.7065375596284866 -1.3500000350177288 4.518191888928413 +3.1338661909103394 1.2000000104308128 5.054273456335068 +3.1338661909103394 -1.2000000104308128 5.054273456335068 +1.628333143889904 -1.7000000923871994 3.133535757660866 +1.628333143889904 1.7000000923871994 3.133535757660866 +3.7331704050302505 1.2000000104308128 5.083156004548073 +3.7331704050302505 -1.2000000104308128 5.083156004548073 +-0.040269127930514514 1.9500000402331352 0.9384873323142529 +-0.040269127930514514 -1.9500000402331352 0.9384873323142529 +3.8990598171949387 1.2000000104308128 4.957052320241928 +3.8990598171949387 -1.2000000104308128 4.957052320241928 +0.9949996136128902 -1.932230219244957 0.3174618585035205 +0.9949996136128902 1.932230219244957 0.3174618585035205 +2.6986805722117424 -1.6624609008431435 2.55865640938282 +2.6986805722117424 1.6624609008431435 2.55865640938282 +-0.553283654153347 1.9500000402331352 -0.23211461957544088 +-0.553283654153347 -1.9500000402331352 -0.23211461957544088 +3.9361901581287384 1.2000000104308128 4.186601564288139 +3.9361901581287384 -1.2000000104308128 4.186601564288139 +1.0692675597965717 1.8801841884851456 0.41516139172017574 +1.0692675597965717 -1.8801841884851456 0.41516139172017574 +0.47765900380909443 1.9500000402331352 -0.3631003899499774 +0.47765900380909443 -1.9500000402331352 -0.3631003899499774 +3.609823063015938 1.3500000350177288 4.748726636171341 +3.609823063015938 -1.3500000350177288 4.748726636171341 +4.057835415005684 1.2000000104308128 4.578584060072899 +4.057835415005684 -1.2000000104308128 4.578584060072899 +-0.5993044469505548 1.9500000402331352 -0.028882280457764864 +-0.5993044469505548 -1.9500000402331352 -0.028882280457764864 +3.490041196346283 1.3500000350177288 4.797708243131638 +3.490041196346283 -1.3500000350177288 4.797708243131638 diff --git a/assets/robotiq_85/contacts/outer_finger_coarse.txt b/assets/robotiq_85/contacts/outer_finger_coarse.txt new file mode 100644 index 0000000..ae86052 --- /dev/null +++ b/assets/robotiq_85/contacts/outer_finger_coarse.txt @@ -0,0 +1,81 @@ +80 +0.8883407339453697 1.2000000104308128 4.706628620624542 +0.8883407339453697 -1.2000000104308128 4.706628620624542 +0.3366659861057997 1.3500000350177288 4.988677799701691 +0.3366659861057997 -1.3500000350177288 4.988677799701691 +-0.03299370291642845 1.2000000104308128 5.249166861176491 +-0.03299370291642845 -1.2000000104308128 5.249166861176491 +0.1503073493950069 1.2000000104308128 -0.5808680318295956 +0.1503073493950069 -1.2000000104308128 -0.5808680318295956 +0.7954456843435764 1.2000000104308128 5.065625160932541 +0.7954456843435764 -1.2000000104308128 5.065625160932541 +0.1142302411608398 1.3500000350177288 4.9214910715818405 +0.1142302411608398 -1.3500000350177288 4.9214910715818405 +-0.036547554191201925 1.2000000104308128 -0.5988859571516514 +-0.036547554191201925 -1.2000000104308128 -0.5988859571516514 +0.6710388697683811 1.2000000104308128 5.2062030881643295 +0.6710388697683811 -1.2000000104308128 5.2062030881643295 +-0.3094308078289032 1.2000000104308128 4.779723659157753 +-0.3094308078289032 -1.2000000104308128 4.779723659157753 +-0.21982486359775066 1.2000000104308128 -0.5582805722951889 +-0.21982486359775066 -1.2000000104308128 -0.5582805722951889 +0.21716803312301636 1.3500000350177288 4.9824971705675125 +0.21716803312301636 -1.3500000350177288 4.9824971705675125 +-0.4195000510662794 0.657006399706006 2.9760725796222687 +-0.4195000510662794 -0.657006399706006 2.9760725796222687 +0.5092791747301817 1.2000000104308128 5.301456898450851 +0.5092791747301817 -1.2000000104308128 5.301456898450851 +0.5988859105855227 1.2000000104308128 -0.03654716711025685 +0.5988859105855227 -1.2000000104308128 -0.03654716711025685 +-0.38158379029482603 1.2000000104308128 -0.4630269017070532 +-0.38158379029482603 -1.2000000104308128 -0.4630269017070532 +0.19544099923223257 1.3500000350177288 -0.15589372487738729 +0.19544099923223257 -1.3500000350177288 -0.15589372487738729 +0.3260022262111306 1.2000000104308128 5.342061817646027 +0.3260022262111306 -1.2000000104308128 5.342061817646027 +-0.5059906747192144 1.2000000104308128 -0.3224489511922002 +-0.5059906747192144 -1.2000000104308128 -0.3224489511922002 +-0.13119933428242803 1.3500000350177288 -0.21280692890286446 +-0.13119933428242803 -1.3500000350177288 -0.21280692890286446 +-0.01727497874526307 1.3500000350177288 -0.24940227158367634 +-0.01727497874526307 -1.3500000350177288 -0.24940227158367634 +0.13914735754951835 1.2000000104308128 5.324044078588486 +0.13914735754951835 -1.2000000104308128 5.324044078588486 +0.7028636056929827 -0.4070064052939415 1.6672894358634949 +0.7028636056929827 0.4070064052939415 1.6672894358634949 +0.3224487416446209 1.2000000104308128 -0.5059910006821156 +0.3224487416446209 -1.2000000104308128 -0.5059910006821156 +-0.5988860037177801 1.2000000104308128 0.03654742904473096 +-0.5988860037177801 -1.2000000104308128 0.03654742904473096 +0.04316562553867698 1.3500000350177288 4.70026321709156 +0.04316562553867698 -1.3500000350177288 4.70026321709156 +0.44534914195537567 1.3500000350177288 4.93861697614193 +0.44534914195537567 -1.3500000350177288 4.93861697614193 +0.5183180794119835 1.3500000350177288 4.843783006072044 +0.5183180794119835 -1.3500000350177288 4.843783006072044 +0.463026762008667 1.2000000104308128 -0.38158376701176167 +0.463026762008667 -1.2000000104308128 -0.38158376701176167 +0.8703230880200863 1.2000000104308128 4.893483594059944 +0.8703230880200863 -1.2000000104308128 4.893483594059944 +-0.2496659755706787 1.3500000350177288 -0.012913186219520867 +-0.2496659755706787 -1.3500000350177288 -0.012913186219520867 +-0.4949086345732212 -0.4070064052939415 1.7403842881321907 +-0.4949086345732212 0.4070064052939415 1.7403842881321907 +0.5582804791629314 1.2000000104308128 -0.21982446778565645 +0.5582804791629314 -1.2000000104308128 -0.21982446778565645 +-0.21506755147129297 1.3500000350177288 -0.12745968997478485 +-0.21506755147129297 -1.3500000350177288 -0.12745968997478485 +-0.2688254229724407 1.2000000104308128 4.963000491261482 +-0.2688254229724407 -1.2000000104308128 4.963000491261482 +0.5388573277741671 1.3500000350177288 4.725901037454605 +0.5388573277741671 -1.3500000350177288 4.725901037454605 +0.0514335697516799 1.3500000350177288 4.819635301828384 +0.0514335697516799 -1.3500000350177288 4.819635301828384 +-0.5808680318295956 1.2000000104308128 -0.1503074774518609 +-0.5808680318295956 -1.2000000104308128 -0.1503074774518609 +-0.1735716941766441 1.2000000104308128 5.124759674072266 +-0.1735716941766441 -1.2000000104308128 5.124759674072266 +0.24550179950892925 1.3500000350177288 -0.04721128789242357 +0.24550179950892925 -1.3500000350177288 -0.04721128789242357 +0.10060681961476803 1.3500000350177288 -0.22886302322149277 +0.10060681961476803 -1.3500000350177288 -0.22886302322149277 diff --git a/assets/robotiq_85/contacts/outer_knuckle_coarse.txt b/assets/robotiq_85/contacts/outer_knuckle_coarse.txt new file mode 100644 index 0000000..52fc28b --- /dev/null +++ b/assets/robotiq_85/contacts/outer_knuckle_coarse.txt @@ -0,0 +1,105 @@ +104 +3.2665640115737915 -0.44999998062849045 1.4036325737833977 +3.2665640115737915 0.44999998062849045 1.4036325737833977 +-0.1443783286958933 0.5499999970197678 -0.7359721697866917 +-0.1443783286958933 -0.5499999970197678 -0.7359721697866917 +-0.6735266651958227 0.5499999970197678 0.3299423959106207 +-0.6735266651958227 -0.5499999970197678 0.3299423959106207 +2.3416511714458466 1.1500000022351742 1.0809628292918205 +2.3416511714458466 -1.1500000022351742 1.0809628292918205 +-0.7482623681426048 0.5499999970197678 -0.05102480645291507 +-0.7482623681426048 -0.5499999970197678 -0.05102480645291507 +-0.7359721232205629 0.5499999970197678 0.14437815407291055 +-0.7359721232205629 -0.5499999970197678 0.14437815407291055 +2.6230081915855408 1.2000000104308128 0.9111431427299976 +2.6230081915855408 -1.2000000104308128 0.9111431427299976 +2.5303369387984276 1.2000000104308128 0.6796039640903473 +2.5303369387984276 -1.2000000104308128 0.6796039640903473 +-0.4930214025080204 0.5499999970197678 -0.5651813000440598 +-0.4930214025080204 -0.5499999970197678 -0.5651813000440598 +-0.3299423726275563 0.5499999970197678 -0.6735267583280802 +-0.3299423726275563 -0.5499999970197678 -0.6735267583280802 +3.4898359328508377 0.4999999888241291 -0.5769731942564249 +3.4898359328508377 -0.4999999888241291 -0.5769731942564249 +3.2031212002038956 0.4999999888241291 -0.6922378670424223 +3.2031212002038956 -0.4999999888241291 -0.6922378670424223 +2.445109002292156 1.2000000104308128 0.6539399269968271 +2.445109002292156 -1.2000000104308128 0.6539399269968271 +2.289211004972458 -0.44999998062849045 1.4363599941134453 +2.289211004972458 0.44999998062849045 1.4363599941134453 +-0.565181439742446 0.5499999970197678 0.4930214025080204 +-0.565181439742446 -0.5499999970197678 0.4930214025080204 +-0.7095597218722105 0.5499999970197678 -0.24295086041092873 +-0.7095597218722105 -0.5499999970197678 -0.24295086041092873 +2.5790225714445114 1.2000000104308128 0.9885236620903015 +2.5790225714445114 -1.2000000104308128 0.9885236620903015 +0.05102480645291507 0.5499999970197678 -0.7482622750103474 +0.05102480645291507 -0.5499999970197678 -0.7482622750103474 +3.107667714357376 -0.44999998062849045 -0.7902426645159721 +3.107667714357376 0.44999998062849045 -0.7902426645159721 +2.2339405491948128 1.2000000104308128 0.8846121840178967 +2.2339405491948128 -1.2000000104308128 0.8846121840178967 +-0.6225018296390772 0.5499999970197678 -0.4183199256658554 +-0.6225018296390772 -0.5499999970197678 -0.4183199256658554 +2.5058185681700706 1.2000000104308128 1.0391565039753914 +2.5058185681700706 -1.2000000104308128 1.0391565039753914 +3.6793362349271774 -0.44999998062849045 1.2023800984025002 +3.6793362349271774 0.44999998062849045 1.2023800984025002 +2.3079585283994675 1.1500000022351742 1.0708172805607319 +2.3079585283994675 -1.1500000022351742 1.0708172805607319 +2.2670146077871323 1.2000000104308128 0.9672475047409534 +2.2670146077871323 -1.2000000104308128 0.9672475047409534 +2.450580894947052 1.1500000022351742 1.09721003100276 +2.450580894947052 -1.1500000022351742 1.09721003100276 +2.595989592373371 1.2000000104308128 0.7397056091576815 +2.595989592373371 -1.2000000104308128 0.7397056091576815 +3.56111079454422 -0.44999998062849045 1.3051234185695648 +3.56111079454422 0.44999998062849045 1.3051234185695648 +3.7669405341148376 -0.44999998062849045 1.0725387372076511 +3.7669405341148376 0.44999998062849045 1.0725387372076511 +2.4144940078258514 1.1500000022351742 1.1028972454369068 +2.4144940078258514 -1.1500000022351742 1.1028972454369068 +3.4203216433525085 -0.44999998062849045 1.3737669214606285 +3.4203216433525085 0.44999998062849045 1.3737669214606285 +3.828902170062065 -0.44999998062849045 0.768199423328042 +3.828902170062065 0.44999998062849045 0.768199423328042 +3.557301312685013 -0.44999998062849045 -0.6508933380246162 +3.557301312685013 0.44999998062849045 -0.6508933380246162 +3.767990320920944 -0.44999998062849045 -0.22994366008788347 +3.767990320920944 0.44999998062849045 -0.22994366008788347 +2.3571856319904327 1.2000000104308128 0.6677965633571148 +2.3571856319904327 -1.2000000104308128 0.6677965633571148 +3.664839267730713 -0.44999998062849045 -0.5314007867127657 +3.664839267730713 0.44999998062849045 -0.5314007867127657 +2.6290636509656906 1.2000000104308128 0.822340976446867 +2.6290636509656906 -1.2000000104308128 0.822340976446867 +3.4218959510326385 -0.44999998062849045 -0.7375437300652266 +3.4218959510326385 0.44999998062849045 -0.7375437300652266 +2.283981814980507 1.2000000104308128 0.7184294518083334 +2.283981814980507 -1.2000000104308128 0.7184294518083334 +2.4680495262145996 -0.44999998062849045 1.4523625373840332 +2.4680495262145996 0.44999998062849045 1.4523625373840332 +3.736790269613266 -0.44999998062849045 -0.3876443952322006 +3.736790269613266 0.44999998062849045 -0.3876443952322006 +3.355606272816658 0.4999999888241291 -0.6573110818862915 +3.355606272816658 -0.4999999888241291 -0.6573110818862915 +2.631130628287792 1.2000000104308128 0.8412940427660942 +2.631130628287792 -1.2000000104308128 0.8412940427660942 +3.5926703363656998 0.4999999888241291 -0.45908810570836067 +3.5926703363656998 -0.4999999888241291 -0.45908810570836067 +3.817955404520035 -0.44999998062849045 0.9244478307664394 +3.817955404520035 0.44999998062849045 0.9244478307664394 +2.417895756661892 1.2000000104308128 1.0530131869018078 +2.417895756661892 -1.2000000104308128 1.0530131869018078 +2.5243978947401047 1.1500000022351742 1.0855765081942081 +2.5243978947401047 -1.1500000022351742 1.0855765081942081 +-0.4183200653642416 0.5499999970197678 0.6225018296390772 +-0.4183200653642416 -0.5499999970197678 0.6225018296390772 +3.2683439552783966 -0.44999998062849045 -0.7851325906813145 +3.2683439552783966 0.44999998062849045 -0.7851325906813145 +-0.2429508138448 0.5499999970197678 0.7095597218722105 +-0.2429508138448 -0.5499999970197678 0.7095597218722105 +2.332667261362076 1.2000000104308128 1.027349103242159 +2.332667261362076 -1.2000000104308128 1.027349103242159 +2.2399960085749626 1.2000000104308128 0.795810017734766 +2.2399960085749626 -1.2000000104308128 0.795810017734766 diff --git a/assets/robotiq_85/contacts/robotiq_base_coarse.txt b/assets/robotiq_85/contacts/robotiq_base_coarse.txt new file mode 100644 index 0000000..584d141 --- /dev/null +++ b/assets/robotiq_85/contacts/robotiq_base_coarse.txt @@ -0,0 +1,409 @@ +408 +3.3330610949185158e-12 -3.6730486899614334 4.086745902895927 +1.002087579853473e-12 -3.74087393283844 -8.883843678203162e-16 +1.1337352362255845e-11 3.736123815178871 3.9157740771770477 +1.0951443473860428e-11 3.750000149011612 3.7837501615285873 +3.3407050590477175e-12 -3.750000149011612 3.7837501615285873 +3.3326890780480817e-12 -3.736123815178871 3.9157740771770477 +-1.0021743160272718e-12 3.74087393283844 8.883843678203162e-16 +1.1822968548191176e-11 3.6730486899614334 4.086745902895927 +0.178432185202837 -3.7457525730133057 1.0987496934831142 +0.178432185202837 3.7457525730133057 1.0987496934831142 +0.5038094241172075 -3.7160027772188187 3.7837501615285873 +0.5038094241172075 3.7160027772188187 3.7837501615285873 +4.125184565782547 -0.8331744000315666 6.327235698699951 +-4.131583124399185 -0.712155643850565 6.672405451536179 +4.0532514452934265 0.47000013291835785 6.950187683105469 +4.014596343040466 -0.8160552009940147 6.805375963449478 +-2.405371703207493 0.7058989722281694 9.136901795864105 +-2.405371703207493 -0.7058989722281694 9.136901795864105 +-4.214010760188103 -0.6223676260560751 6.152345985174179 +3.941381722688675 -0.9162666276097298 6.767594069242477 +-4.11212183535099 -0.8280591107904911 6.492333114147186 +4.102662205696106 0.46999999321997166 6.865449994802475 +-4.053240641951561 0.4700000397861004 6.9501809775829315 +2.33114305883646 -2.9196562245488167 3.9157740771770477 +2.33114305883646 2.9196562245488167 3.9157740771770477 +-4.125174880027771 -0.8331162855029106 6.32924810051918 +-4.141813889145851 0.46999999321997166 6.784599274396896 +-2.4491405114531517 0.46500000171363354 9.168601036071777 +-2.4491405114531517 -0.46500000171363354 9.168601036071777 +-4.208626598119736 -0.606628367677331 6.509565562009811 +2.1616769954562187 0.9140128269791603 9.219654649496078 +2.1616769954562187 -0.9140128269791603 9.219654649496078 +2.4379022419452667 0.5970239173620939 9.160462021827698 +2.4379022419452667 -0.5970239173620939 9.160462021827698 +2.0510856062173843 0.46500000171363354 9.546861797571182 +2.0510856062173843 -0.46500000171363354 9.546861797571182 +1.9248783588409424 3.2182827591896057 3.7837501615285873 +1.9248783588409424 -3.2182827591896057 3.7837501615285873 +-3.9411060512065887 -0.9162453003227711 6.76831528544426 +4.224782809615135 -0.6151242181658745 6.329680234193802 +0.7500963285565376 3.674215078353882 -2.130402720012213e-12 +0.7500963285565376 3.674215078353882 1.0999999940395355 +0.7500963285565376 -3.674215078353882 -2.1321479466967358e-12 +0.7500963285565376 -3.674215078353882 1.0999999940395355 +-4.174830764532089 0.7327178958803415 6.156453490257263 +-1.4750538393855095 -3.4477118402719498 3.7837501615285873 +-1.4750538393855095 3.4477118402719498 3.7837501615285873 +-4.224750399589539 -0.6150274537503719 6.331877410411835 +4.2060986161231995 0.49518970772624016 6.59409761428833 +3.9017148315906525 0.999937392771244 6.594298034906387 +-2.7171652764081955 -0.46999999321997166 8.798493444919586 +-2.7171652764081955 0.46999999321997166 8.798493444919586 +4.129813238978386 -0.46999999321997166 6.807033717632294 +-2.7122989296913147 -2.5895820930600166 3.7837501615285873 +-2.7122989296913147 2.5895820930600166 3.7837501615285873 +4.07477393746376 0.8223180659115314 6.653102487325668 +4.171798378229141 0.7199001498520374 6.502988934516907 +-3.9021819829940796 0.9999623522162437 6.592797487974167 +-0.9947890415787697 3.6012519150972366 3.9157740771770477 +-0.9947890415787697 -3.6012519150972366 3.9157740771770477 +3.8515478372573853 -0.9976780042052269 6.721235811710358 +-3.862755000591278 0.9140128269791603 6.899682432413101 +-3.862755000591278 -0.9140128269791603 6.899682432413101 +4.149789735674858 0.4840849433094263 6.7649587988853455 +-3.9963852614164352 -0.5733043421059847 6.996463984251022 +-3.035617433488369 2.201709896326065 3.7837501615285873 +-3.035617433488369 -2.201709896326065 3.7837501615285873 +-4.031198471784592 0.9241457097232342 6.477177143096924 +3.8512982428073883 0.9976662695407867 6.72188475728035 +3.2860510051250458 1.7821067944169044 -9.336350187969314e-12 +3.2860510051250458 -1.7821067944169044 -9.33719654329021e-12 +-4.206813499331474 0.495365122333169 6.591203063726425 +-4.042970761656761 0.9274770505726337 6.3252173364162445 +-1.8912890926003456 0.46500000171363354 9.628433734178543 +-1.8912890926003456 -0.46500000171363354 9.628433734178543 +-2.3398010060191154 2.9305001720786095 3.7837501615285873 +-2.3398010060191154 -2.9305001720786095 3.7837501615285873 +-4.0142972022295 -0.8160226978361607 6.806154549121857 +-4.177623987197876 -0.46999999321997166 6.693287193775177 +-3.348951041698456 1.675841212272644 9.515891357227482e-12 +-3.348951041698456 -1.675841212272644 9.515095146257063e-12 +4.187178239226341 0.46999999321997166 6.664543598890305 +-4.042963683605194 -0.9274390526115894 6.327077746391296 +4.238125681877136 -0.515054352581501 6.2151797115802765 +1.557806320488453 -3.4111198037862778 1.0987496934831142 +1.557806320488453 3.4111198037862778 1.0987496934831142 +4.225839301943779 -0.46999999321997166 6.507808715105057 +1.7741292715072632 0.46500000171363354 9.68824028968811 +1.7741292715072632 -0.46500000171363354 9.68824028968811 +-4.178895056247711 0.46999999321997166 6.68959766626358 +-4.067277908325195 0.7037220988422632 6.8325623869895935 +-2.292940579354763 0.46500000171363354 9.351415932178497 +-2.292940579354763 -0.46500000171363354 9.351415932178497 +-4.165834188461304 -0.5971318576484919 6.684044003486633 +1.875000074505806 -3.2475952059030533 -5.328275323669869e-12 +1.875000074505806 -3.2475952059030533 1.0999999940395355 +1.875000074505806 3.2475952059030533 -5.3267330460795084e-12 +1.875000074505806 3.2475952059030533 1.0999999940395355 +-4.1863106191158295 0.7268115412443876 6.328735500574112 +4.0133703500032425 -0.46999999321997166 7.008764892816544 +4.0133703500032425 0.46999999321997166 7.008764892816544 +-0.7743414025753736 0.9812723845243454 -0.3000000026077032 +-0.7743414025753736 -0.9812723845243454 -0.3000000026077032 +1.9177556037902832 -3.2063741236925125 3.9157740771770477 +1.9177556037902832 3.2063741236925125 3.9157740771770477 +0.48774308525025845 -1.1509155854582787 -0.3000000026077032 +0.48774308525025845 1.1509155854582787 -0.3000000026077032 +4.097855091094971 0.5867654923349619 6.849353760480881 +-3.701438382267952 -0.6015423219650984 1.0516885078732871e-11 +-3.701438382267952 0.6015423219650984 1.0517171037055864e-11 +3.449922800064087 -1.4698747545480728 -9.802737370749257e-12 +3.449922800064087 1.4698747545480728 -9.802038737974361e-12 +4.166468977928162 -0.5972458049654961 6.682094186544418 +4.075334221124649 -0.8223871700465679 6.651301681995392 +-0.501945149153471 -3.702252358198166 3.9157740771770477 +-0.501945149153471 3.702252358198166 3.9157740771770477 +-2.7022624388337135 2.579999715089798 3.9157740771770477 +-2.7022624388337135 -2.579999715089798 3.9157740771770477 +0.9779945947229862 -3.5404540598392487 4.086745902895927 +0.9779945947229862 3.5404540598392487 4.086745902895927 +-4.186291992664337 -0.7267329376190901 6.330861896276474 +1.5555334277451038 3.4066639840602875 3.7837501615285873 +1.5555334277451038 -3.4066639840602875 3.7837501615285873 +4.244302213191986 -0.46999999321997166 6.288154423236847 +-0.5336806643754244 3.7118304520845413 1.0987496934831142 +-0.5336806643754244 -3.7118304520845413 1.0987496934831142 +-1.4447852969169617 3.37696373462677 4.086745902895927 +-1.4447852969169617 -3.37696373462677 4.086745902895927 +-4.238000139594078 -0.5063106305897236 6.396056711673737 +-1.549999974668026 0.9999999776482582 9.788750112056732 +-1.549999974668026 -0.9999999776482582 9.788750112056732 +-2.455727756023407 -2.834060974419117 1.0987496934831142 +-2.455727756023407 2.834060974419117 1.0987496934831142 +-0.4520125687122345 -3.7226583808660507 1.2834353331080302e-12 +-0.4520125687122345 -3.7226583808660507 1.0999999940395355 +-0.4520125687122345 3.7226583808660507 1.2852034296821288e-12 +-0.4520125687122345 3.7226583808660507 1.0999999940395355 +-1.6075970605015755 3.3879391849040985 4.568527088751051e-12 +-1.6075970605015755 3.3879391849040985 1.0999999940395355 +-1.6075970605015755 -3.3879391849040985 4.566918064964447e-12 +-1.6075970605015755 -3.3879391849040985 1.0999999940395355 +0.9984837844967842 -3.6146271973848343 3.7837501615285873 +0.9984837844967842 3.6146271973848343 3.7837501615285873 +2.3716701194643974 -2.9047686606645584 -6.739400026543538e-12 +2.3716701194643974 -2.9047686606645584 1.0999999940395355 +2.3716701194643974 2.9047686606645584 -6.73802037927905e-12 +2.3716701194643974 2.9047686606645584 1.0999999940395355 +3.5293016582727432 1.2321067973971367 -1.0027637493146072e-11 +4.132184013724327 -0.712248682975769 6.670510023832321 +-2.238631062209606 -0.7679957896471024 9.296900779008865 +-2.238631062209606 0.7679957896471024 9.296900779008865 +-4.243877530097961 -0.46999999321997166 6.264010071754456 +-4.105377942323685 0.47751530073583126 6.85216560959816 +3.974238410592079 -0.7080039940774441 6.980423629283905 +3.974238410592079 0.7080039940774441 6.980423629283905 +3.976541757583618 -0.6939960177987814 6.982091814279556 +3.976541757583618 0.6939958315342665 6.982091814279556 +-0.4934710916131735 -3.639749065041542 4.086745902895927 +-0.4934710916131735 3.639749065041542 4.086745902895927 +-1.4695956371724606 -3.434954211115837 3.9157740771770477 +-1.4695956371724606 3.434954211115837 3.9157740771770477 +4.174947738647461 0.7326914928853512 6.157279387116432 +-4.230043292045593 -0.46999999321997166 6.482493877410889 +-2.1802501752972603 1.0230489075183868 8.973858505487442 +-2.1802501752972603 -1.0230489075183868 8.973858505487442 +-2.7129849418997765 0.46500000171363354 8.804299682378769 +-2.7129849418997765 -0.46500000171363354 8.804299682378769 +1.329768355935812 -3.5063110291957855 -3.779150657776814e-12 +1.329768355935812 -3.5063110291957855 1.0999999940395355 +1.329768355935812 3.5063110291957855 -3.777485391002512e-12 +1.329768355935812 3.5063110291957855 1.0999999940395355 +4.237160086631775 -0.5057685077190399 6.4064741134643555 +-3.72290201485157 -0.44999998062849045 1.0577906687505786e-11 +-3.72290201485157 0.44999998062849045 1.0578120139808495e-11 +-2.9979104176163673 -2.252783440053463 8.517534279880307e-12 +-2.9979104176163673 2.252783440053463 8.518604251899278e-12 +-4.17192280292511 0.7199336774647236 6.50220587849617 +-1.0059714317321777 0.7419713772833347 -0.3000000026077032 +-1.0059714317321777 -0.7419713772833347 -0.3000000026077032 +-3.5570114850997925 -1.1875050142407417 1.010638106405462e-11 +-3.5570114850997925 1.1875050142407417 1.0106944849184313e-11 +4.112236574292183 -0.8280839771032333 6.491590291261673 +1.166190393269062 -0.44999998062849045 -0.3000000026077032 +1.166190393269062 0.44999998062849045 -0.3000000026077032 +4.2443349957466125 0.46999999321997166 6.295299530029297 +-4.098191112279892 0.5868189036846161 6.848514825105667 +-2.2985095158219337 0.9140128269791603 9.05950739979744 +-2.2985095158219337 -0.9140128269791603 9.05950739979744 +-4.066958278417587 -0.7036783266812563 6.833380460739136 +-4.066189751029015 -0.47170319594442844 6.9294072687625885 +4.244082793593407 -0.46999999321997166 6.322023272514343 +4.1288841515779495 -0.48090359196066856 6.807974725961685 +-3.320460021495819 1.7427118495106697 9.434954987425082e-12 +-3.320460021495819 -1.7427118495106697 9.434126928015846e-12 +-2.2831471636891365 0.5970239173620939 9.341585636138916 +-2.2831471636891365 -0.5970239173620939 9.341585636138916 +4.031093418598175 0.9241294115781784 6.4778633415699005 +-2.043529599905014 0.5970239173620939 9.535223245620728 +-2.043529599905014 -0.5970239173620939 9.535223245620728 +3.996789827942848 0.9203702211380005 6.626603752374649 +4.20876108109951 -0.6066694855690002 6.508757919073105 +0.1665213261730969 1.2388586066663265 -0.3000000026077032 +0.1665213261730969 -1.2388586066663265 -0.3000000026077032 +3.9973050355911255 -0.9204153902828693 6.624937802553177 +-4.213894158601761 0.6224001757800579 6.151491031050682 +-2.3868178948760033 -0.7679957896471024 9.123463928699493 +-2.3868178948760033 0.7679957896471024 9.123463928699493 +-4.141953215003014 0.482787424698472 6.7834049463272095 +-4.237440228462219 -0.5154469050467014 6.206447258591652 +0.8840960450470448 -3.6442935466766357 1.0987496934831142 +0.8840960450470448 3.6442935466766357 1.0987496934831142 +4.237440228462219 0.5154469050467014 6.206447258591652 +4.141953215003014 -0.482787424698472 6.7834049463272095 +2.3868178948760033 -0.7679957896471024 9.123463928699493 +2.3868178948760033 0.7679957896471024 9.123463928699493 +2.8069153428077698 -2.486709877848625 -7.975978682855586e-12 +2.8069153428077698 -2.486709877848625 1.0999999940395355 +2.8069153428077698 2.486709877848625 -7.974797580113935e-12 +2.8069153428077698 2.486709877848625 1.0999999940395355 +-2.9423311352729797 -2.3136217147111893 3.7837501615285873 +-2.9423311352729797 2.3136217147111893 3.7837501615285873 +4.213894158601761 -0.6224001757800579 6.151491031050682 +-3.9973050355911255 0.9204153902828693 6.624937802553177 +-0.1665213261730969 1.2388586066663265 -0.3000000026077032 +-0.1665213261730969 -1.2388586066663265 -0.3000000026077032 +-4.20876108109951 0.6066694855690002 6.508757919073105 +-3.996789827942848 -0.9203702211380005 6.626603752374649 +2.043529599905014 0.5970239173620939 9.535223245620728 +2.043529599905014 -0.5970239173620939 9.535223245620728 +-4.031093418598175 -0.9241294115781784 6.4778633415699005 +2.2831471636891365 0.5970239173620939 9.341585636138916 +2.2831471636891365 -0.5970239173620939 9.341585636138916 +-1.0433155111968517 3.6019429564476013 2.9652648202540058e-12 +-1.0433155111968517 3.6019429564476013 1.0999999940395355 +-1.0433155111968517 -3.6019429564476013 2.963554152513731e-12 +-1.0433155111968517 -3.6019429564476013 1.0999999940395355 +-4.1288841515779495 0.48090359196066856 6.807974725961685 +-2.9476990923285484 2.318096160888672 1.0987496934831142 +-2.9476990923285484 -2.318096160888672 1.0987496934831142 +-4.244082793593407 0.46999999321997166 6.322023272514343 +4.066189751029015 0.47170319594442844 6.9294072687625885 +4.066958278417587 0.7036783266812563 6.833380460739136 +2.2985095158219337 0.9140128269791603 9.05950739979744 +2.2985095158219337 -0.9140128269791603 9.05950739979744 +4.098191112279892 -0.5868189036846161 6.848514825105667 +-4.2443349957466125 -0.46999999321997166 6.295299530029297 +-1.166190393269062 -0.44999998062849045 -0.3000000026077032 +-1.166190393269062 0.44999998062849045 -0.3000000026077032 +-4.112236574292183 0.8280839771032333 6.491590291261673 +1.0059714317321777 0.7419713772833347 -0.3000000026077032 +1.0059714317321777 -0.7419713772833347 -0.3000000026077032 +2.0571067929267883 -3.1218960881233215 -5.845671846973002e-12 +2.0571067929267883 3.1218960881233215 -5.8441892005021284e-12 +2.7140026912093163 -2.587796375155449 1.0987496934831142 +2.7140026912093163 2.587796375155449 1.0987496934831142 +4.17192280292511 -0.7199336774647236 6.50220587849617 +-4.237160086631775 0.5057685077190399 6.4064741134643555 +2.7129849418997765 0.46500000171363354 8.804299682378769 +2.7129849418997765 -0.46500000171363354 8.804299682378769 +2.1802501752972603 1.0230489075183868 8.973858505487442 +2.1802501752972603 -1.0230489075183868 8.973858505487442 +4.230043292045593 0.46999999321997166 6.482493877410889 +-4.174947738647461 -0.7326914928853512 6.157279387116432 +1.4695956371724606 -3.434954211115837 3.9157740771770477 +1.4695956371724606 3.434954211115837 3.9157740771770477 +0.4934710916131735 -3.639749065041542 4.086745902895927 +0.4934710916131735 3.639749065041542 4.086745902895927 +-3.976541757583618 -0.6939958315342665 6.982091814279556 +-3.976541757583618 0.6939960177987814 6.982091814279556 +-3.974238410592079 -0.7080039940774441 6.980423629283905 +-3.974238410592079 0.7080039940774441 6.980423629283905 +4.105377942323685 -0.47751530073583126 6.85216560959816 +4.243877530097961 0.46999999321997166 6.264010071754456 +-3.5380087792873383 1.2321067973971367 1.005296242301626e-11 +2.238631062209606 -0.7679957896471024 9.296900779008865 +2.238631062209606 0.7679957896471024 9.296900779008865 +-4.132184013724327 0.712248682975769 6.670510023832321 +-2.597716264426708 2.704509161412716 7.38162582816261e-12 +-2.597716264426708 2.704509161412716 1.0999999940395355 +-2.597716264426708 -2.704509161412716 7.380341048588215e-12 +-2.597716264426708 -2.704509161412716 1.0999999940395355 +-0.9984837844967842 -3.6146271973848343 3.7837501615285873 +-0.9984837844967842 3.6146271973848343 3.7837501615285873 +1.549999974668026 0.9999999776482582 9.788750112056732 +1.549999974668026 -0.9999999776482582 9.788750112056732 +4.238000139594078 0.5063106305897236 6.396056711673737 +1.4447852969169617 3.37696373462677 4.086745902895927 +1.4447852969169617 -3.37696373462677 4.086745902895927 +-4.244302213191986 0.46999999321997166 6.288154423236847 +4.186291992664337 0.7267329376190901 6.330861896276474 +-0.9779945947229862 -3.5404540598392487 4.086745902895927 +-0.9779945947229862 3.5404540598392487 4.086745902895927 +2.7022624388337135 2.579999715089798 3.9157740771770477 +2.7022624388337135 -2.579999715089798 3.9157740771770477 +3.1694628298282623 2.004246786236763 -9.0050315565849e-12 +3.1694628298282623 -2.004246786236763 -9.005982943991256e-12 +0.8828718215227127 3.638320043683052 3.7837501615285873 +0.8828718215227127 -3.638320043683052 3.7837501615285873 +0.501945149153471 -3.702252358198166 3.9157740771770477 +0.501945149153471 3.702252358198166 3.9157740771770477 +-4.075334221124649 0.8223871700465679 6.651301681995392 +-4.166468977928162 0.5972458049654961 6.682094186544418 +-2.130242809653282 3.086189553141594 6.053467324846143e-12 +-2.130242809653282 3.086189553141594 1.0999999940395355 +-2.130242809653282 -3.086189553141594 6.052001619034214e-12 +-2.130242809653282 -3.086189553141594 1.0999999940395355 +-4.097855091094971 -0.5867654923349619 6.849353760480881 +-0.48774308525025845 -1.1509155854582787 -0.3000000026077032 +-0.48774308525025845 1.1509155854582787 -0.3000000026077032 +-3.2955482602119446 1.7821067944169044 9.364181657737017e-12 +-3.2955482602119446 -1.7821067944169044 9.36333530241612e-12 +-1.9177556037902832 -3.2063741236925125 3.9157740771770477 +-1.9177556037902832 3.2063741236925125 3.9157740771770477 +0.7743414025753736 0.9812723845243454 -0.3000000026077032 +0.7743414025753736 -0.9812723845243454 -0.3000000026077032 +-4.0133703500032425 -0.46999999321997166 7.008764892816544 +-4.0133703500032425 0.46999999321997166 7.008764892816544 +4.1863106191158295 -0.7268115412443876 6.328735500574112 +-1.875000074505806 -3.2475952059030533 1.0987496934831142 +-1.875000074505806 3.2475952059030533 1.0987496934831142 +3.6410316824913025 -0.897433701902628 -1.0345605530029042e-11 +3.6410316824913025 0.897433701902628 -1.0345179303049984e-11 +4.165834188461304 0.5971318576484919 6.684044003486633 +2.292940579354763 0.46500000171363354 9.351415932178497 +2.292940579354763 -0.46500000171363354 9.351415932178497 +4.067277908325195 -0.7037220988422632 6.8325623869895935 +4.178895056247711 -0.46999999321997166 6.68959766626358 +-1.7741292715072632 0.46500000171363354 9.68824028968811 +-1.7741292715072632 -0.46500000171363354 9.68824028968811 +-4.225839301943779 0.46999999321997166 6.507808715105057 +-4.238125681877136 0.515054352581501 6.2151797115802765 +4.042963683605194 0.9274390526115894 6.327077746391296 +0.15099727315828204 -3.7469588220119476 -4.2992372730171324e-13 +0.15099727315828204 -3.7469588220119476 1.0999999940395355 +0.15099727315828204 3.7469588220119476 -4.281440687278846e-13 +0.15099727315828204 3.7469588220119476 1.0999999940395355 +-4.187178239226341 -0.46999999321997166 6.664543598890305 +4.177623987197876 0.46999999321997166 6.693287193775177 +4.0142972022295 0.8160226978361607 6.806154549121857 +2.3398010060191154 2.9305001720786095 3.7837501615285873 +2.3398010060191154 -2.9305001720786095 3.7837501615285873 +1.8912890926003456 0.46500000171363354 9.628433734178543 +1.8912890926003456 -0.46500000171363354 9.628433734178543 +4.042970761656761 -0.9274770505726337 6.3252173364162445 +4.206813499331474 -0.495365122333169 6.591203063726425 +-3.8512982428073883 -0.9976662695407867 6.72188475728035 +4.031198471784592 -0.9241457097232342 6.477177143096924 +3.035617433488369 2.201709896326065 3.7837501615285873 +3.035617433488369 -2.201709896326065 3.7837501615285873 +3.9963852614164352 0.5733043421059847 6.996463984251022 +-4.149789735674858 -0.4840849433094263 6.7649587988853455 +3.862755000591278 0.9140128269791603 6.899682432413101 +3.862755000591278 -0.9140128269791603 6.899682432413101 +-3.8515478372573853 0.9976780042052269 6.721235811710358 +0.9947890415787697 3.6012519150972366 3.9157740771770477 +0.9947890415787697 -3.6012519150972366 3.9157740771770477 +3.9021819829940796 -0.9999623522162437 6.592797487974167 +-1.8734326586127281 -3.244522213935852 3.7837501615285873 +-1.8734326586127281 3.244522213935852 3.7837501615285873 +-4.171798378229141 -0.7199001498520374 6.502988934516907 +-4.07477393746376 -0.8223180659115314 6.653102487325668 +2.7122989296913147 -2.5895820930600166 3.7837501615285873 +2.7122989296913147 2.5895820930600166 3.7837501615285873 +-4.129813238978386 0.46999999321997166 6.807033717632294 +2.175213396549225 3.054659813642502 1.0987496934831142 +2.175213396549225 -3.054659813642502 1.0987496934831142 +2.7171652764081955 -0.46999999321997166 8.798493444919586 +2.7171652764081955 0.46999999321997166 8.798493444919586 +-3.9017148315906525 -0.999937392771244 6.594298034906387 +-4.2060986161231995 -0.49518970772624016 6.59409761428833 +4.224750399589539 0.6150274537503719 6.331877410411835 +1.4750538393855095 -3.4477118402719498 3.7837501615285873 +1.4750538393855095 3.4477118402719498 3.7837501615285873 +4.174830764532089 -0.7327178958803415 6.156453490257263 +3.7378400564193726 -0.3017496317625046 -1.0620529385411623e-11 +3.7378400564193726 0.3017496317625046 -1.0620385728623769e-11 +-4.224782809615135 0.6151242181658745 6.329680234193802 +3.9411060512065887 0.9162453003227711 6.76831528544426 +-1.9248783588409424 3.2182827591896057 3.7837501615285873 +-1.9248783588409424 -3.2182827591896057 3.7837501615285873 +-2.0510856062173843 0.46500000171363354 9.546861797571182 +-2.0510856062173843 -0.46500000171363354 9.546861797571182 +-2.4379022419452667 0.5970239173620939 9.160462021827698 +-2.4379022419452667 -0.5970239173620939 9.160462021827698 +-2.1616769954562187 0.9140128269791603 9.219654649496078 +-2.1616769954562187 -0.9140128269791603 9.219654649496078 +4.208626598119736 0.606628367677331 6.509565562009811 +2.4491405114531517 0.46500000171363354 9.168601036071777 +2.4491405114531517 -0.46500000171363354 9.168601036071777 +4.141813889145851 -0.46999999321997166 6.784599274396896 +-1.2265048921108246 -3.5437531769275665 1.0987496934831142 +-1.2265048921108246 3.5437531769275665 1.0987496934831142 +4.125174880027771 0.8331162855029106 6.32924810051918 +-2.33114305883646 -2.9196562245488167 3.9157740771770477 +-2.33114305883646 2.9196562245488167 3.9157740771770477 +4.053240641951561 -0.4700000397861004 6.9501809775829315 +-4.102662205696106 -0.46999999321997166 6.865449994802475 +4.11212183535099 0.8280591107904911 6.492333114147186 +-3.941381722688675 0.9162666276097298 6.767594069242477 +4.214010760188103 0.6223676260560751 6.152345985174179 +2.405371703207493 0.7058989722281694 9.136901795864105 +2.405371703207493 -0.7058989722281694 9.136901795864105 +-4.014596343040466 0.8160552009940147 6.805375963449478 +-4.0532514452934265 -0.47000013291835785 6.950187683105469 +4.131583124399185 0.712155643850565 6.672405451536179 +-4.125184565782547 0.8331744000315666 6.327235698699951 +-0.5038094241172075 -3.7160027772188187 3.7837501615285873 +-0.5038094241172075 3.7160027772188187 3.7837501615285873 diff --git a/assets/robotiq_85/robotiq.urdf b/assets/robotiq_85/robotiq.urdf new file mode 100644 index 0000000..7845314 --- /dev/null +++ b/assets/robotiq_85/robotiq.urdf @@ -0,0 +1,517 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/robotiq_85/robotiq.xml b/assets/robotiq_85/robotiq.xml new file mode 100644 index 0000000..387f89c --- /dev/null +++ b/assets/robotiq_85/robotiq.xml @@ -0,0 +1,80 @@ + + diff --git a/assets/robotiq_85/robotiq_sdf.xml b/assets/robotiq_85/robotiq_sdf.xml new file mode 100644 index 0000000..45debf1 --- /dev/null +++ b/assets/robotiq_85/robotiq_sdf.xml @@ -0,0 +1,75 @@ + + diff --git a/assets/save.py b/assets/save.py new file mode 100644 index 0000000..4cd10e2 --- /dev/null +++ b/assets/save.py @@ -0,0 +1,102 @@ +''' +Save transformed assembly meshes +''' +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np + +from assets.transform import get_transform_matrix +from assets.load import load_assembly + + +def sample_path(path, n_frame=None): + if n_frame is None: return path + if len(path) > n_frame: + interp_path = [] + for i in range(n_frame - 1): + interp_path.append(path[int(i / n_frame * len(path))]) + interp_path.append(path[-1]) + else: + interp_path = path + return interp_path + + +def extrapolate_path(path, n_frame=None): + if n_frame is None: return path + direction = path[-1] - path[-2] + extrap_path = path.copy() + for i in range(n_frame): + extrap_path.append(path[-1] + direction * (i + 1)) + return extrap_path + + +def save_path(obj_dir, path, n_frame=None): + ''' + Save motion of assembly meshes at every time step + ''' + if path is None: return + path = sample_path(path, n_frame) + + os.makedirs(obj_dir, exist_ok=True) + for frame, state in enumerate(path): + frame_transform = get_transform_matrix(state) + np.save(os.path.join(obj_dir, f'{frame}.npy'), frame_transform) + + +def save_path_new(obj_dir, path, n_frame=None): + ''' + Save motion of assembly meshes at every time step + ''' + if path is None: return + path = sample_path(path, n_frame) + + os.makedirs(obj_dir, exist_ok=True) + for frame, transform in enumerate(path): + np.save(os.path.join(obj_dir, f'{frame}.npy'), transform) + + +def save_path_all_objects(obj_dir, matrices, n_frame=None): + ''' + Save motion of all meshes at every time step + ''' + if matrices is None: return + matrices = sample_path(matrices, n_frame) + + os.makedirs(obj_dir, exist_ok=True) + for frame, matrix_dict in enumerate(matrices): + frame_dir = os.path.join(obj_dir, f'{frame}') + os.makedirs(frame_dir, exist_ok=True) + for name, matrix in matrix_dict.items(): + np.save(os.path.join(frame_dir, f'{name}.npy'), matrix) + + +def save_posed_mesh(obj_dir, assembly_dir, parts, pose): + ''' + Save posed assembly meshes at a single step + ''' + assembly = load_assembly(assembly_dir, transform='none') + os.makedirs(obj_dir) + for part_id, part_data in assembly.items(): + name = part_data['name'] + mesh = part_data['mesh'] + if part_id in parts: + matrix = get_transform_matrix(part_data['final_state']) + if pose is not None: + matrix = pose @ matrix + mesh.apply_transform(matrix) + obj_target_path = os.path.join(obj_dir, name) + mesh.export(obj_target_path, header=None, include_color=False) + + +def clear_saved_sdfs(obj_dir): + for file in os.listdir(obj_dir): + file_path = os.path.join(obj_dir, file) + if file_path.endswith('.sdf'): + try: + os.remove(file_path) + except: + pass diff --git a/assets/simple_gripper.xml b/assets/simple_gripper.xml new file mode 100644 index 0000000..92443e3 --- /dev/null +++ b/assets/simple_gripper.xml @@ -0,0 +1,35 @@ + + diff --git a/assets/subdivide.py b/assets/subdivide.py new file mode 100644 index 0000000..dab01ce --- /dev/null +++ b/assets/subdivide.py @@ -0,0 +1,127 @@ +''' +Subdivide a mesh until every edge is shorter than a specified length +''' + +import os +os.environ['OMP_NUM_THREADS'] = '1' +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import shutil +import numpy as np +import trimesh +from sortedcontainers import SortedKeyList + +from assets.load import load_assembly + + +def subdivide_to_size(mesh, max_edge): + vertices = mesh.vertices + faces = mesh.faces + edges = mesh.edges + + # check if reversed edges exist + edges_rev = edges[:, ::-1] + edges_unique = np.unique(np.vstack([edges, edges_rev]), axis=0) + assert len(edges_unique) == len(edges) + + # quick reference from edge to face and length + edges_face = mesh.edges_face + edges_length = np.linalg.norm(vertices[edges][:, 0] - vertices[edges][:, 1], axis=1) + edge_face_dict = dict(zip(map(tuple, edges), edges_face)) + edge_length_dict = dict(zip(map(tuple, edges), edges_length)) + edge_sorted = SortedKeyList(map(tuple, edges), key=lambda e: edge_length_dict[e]) + + while True: + # check longest edge + longest_edge = edge_sorted[-1] + longest_edge_length = edge_length_dict[longest_edge] + if longest_edge_length < max_edge: + break + + # build 1 new vertex + new_vertex = vertices[list(longest_edge)].mean(axis=0) + + # add 1 new vertex + new_vertex_idx = len(vertices) + vertices = np.vstack([vertices, new_vertex]) + + # build 4 new faces + vertex0_idx, vertex1_idx = longest_edge + face0_idx, face1_idx = edge_face_dict[longest_edge], edge_face_dict[longest_edge[::-1]] + face0, face1 = faces[face0_idx], faces[face1_idx] + new_face00, new_face01 = face0.copy(), face0.copy() + new_face10, new_face11 = face1.copy(), face1.copy() + new_face00[face0 == vertex0_idx] = new_vertex_idx + new_face01[face0 == vertex1_idx] = new_vertex_idx + new_face10[face1 == vertex0_idx] = new_vertex_idx + new_face11[face1 == vertex1_idx] = new_vertex_idx + + # remove 2 old faces and add 4 new faces + new_face00_idx, new_face01_idx = face0_idx, face1_idx + new_face10_idx, new_face11_idx = len(faces), len(faces) + 1 + faces[face0_idx] = new_face00 + faces[face1_idx] = new_face01 + faces = np.vstack([faces, [new_face10, new_face11]]) + + # remove 2 old edges and add 8 new edges + edge_sorted.remove(longest_edge) + edge_sorted.remove(longest_edge[::-1]) + edge_face_dict.pop(longest_edge) + edge_face_dict.pop(longest_edge[::-1]) + edge_length_dict.pop(longest_edge) + edge_length_dict.pop(longest_edge[::-1]) + + for new_face, new_face_idx in zip([new_face00, new_face01, new_face10, new_face11], [new_face00_idx, new_face01_idx, new_face10_idx, new_face11_idx]): + new_edges = [tuple(new_face[[0, 1]]), tuple(new_face[[1, 2]]), tuple(new_face[[2, 0]])] + for new_edge in new_edges: + edge_face_dict[new_edge] = new_face_idx + edge_length_dict[new_edge] = np.linalg.norm(vertices[new_edge[0]] - vertices[new_edge[1]]) + edge_sorted.discard(new_edge) + edge_sorted.add(new_edge) + + result = trimesh.Trimesh( + vertices=vertices, + faces=faces, + process=False, + maintain_order=True) + assert result.is_watertight + return result + + +def subdivide_assembly(source_dir, target_dir, max_edge): + # load objs + assembly = load_assembly(source_dir, transform='none') + + os.makedirs(target_dir, exist_ok=True) + + for part_id, part_data in assembly.items(): + name = part_data['name'] + mesh = part_data['mesh'] + + # subdivide + new_mesh = subdivide_to_size(mesh, max_edge) + + # export obj + target_obj_path = os.path.join(target_dir, name) + new_mesh.export(target_obj_path, header=None) + + # copy config + source_cfg_path = os.path.join(source_dir, 'config.json') + target_cfg_path = os.path.join(target_dir, 'config.json') + if os.path.exists(source_cfg_path): + shutil.copyfile(source_cfg_path, target_cfg_path) + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--source-dir', type=str, required=True) + parser.add_argument('--target-dir', type=str, required=True) + parser.add_argument('--max-edge', type=float, required=True) + args = parser.parse_args() + + subdivide_assembly(args.source_dir, args.target_dir, args.max_edge) diff --git a/assets/subdivide_batch.py b/assets/subdivide_batch.py new file mode 100644 index 0000000..06f00b9 --- /dev/null +++ b/assets/subdivide_batch.py @@ -0,0 +1,42 @@ +''' +Batch subdivision for meshes +''' + +import os +os.environ['OMP_NUM_THREADS'] = '1' +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +from argparse import ArgumentParser + +from utils.parallel import parallel_execute +from subdivide import subdivide_assembly + + +parser = ArgumentParser() +parser.add_argument('--source-dir', type=str, required=True) +parser.add_argument('--target-dir', type=str, required=True) +parser.add_argument('--max-edge', type=float, required=True) +parser.add_argument('--num-proc', type=int, default=8) +args = parser.parse_args() + +source_ids = [] +for source_id in os.listdir(args.source_dir): + dir_path = os.path.join(args.source_dir, source_id) + if os.path.isdir(dir_path): + source_ids.append(source_id) +source_ids.sort() + +worker_args = [] +for source_id in source_ids: + worker_args.append([ + os.path.join(args.source_dir, source_id), + os.path.join(args.target_dir, source_id), + args.max_edge, + ]) + +os.makedirs(args.target_dir, exist_ok=True) +for _ in parallel_execute(subdivide_assembly, worker_args, args.num_proc): + pass diff --git a/assets/transform.py b/assets/transform.py new file mode 100644 index 0000000..516c0c3 --- /dev/null +++ b/assets/transform.py @@ -0,0 +1,213 @@ +''' +Transformation utilities +''' + +import numpy as np +from scipy.spatial.transform import Rotation + + +def get_transform_matrix(state): + ''' + Get transformation matrix of the given state and center of mass + COM (or previous translation) is necessary when applying rotation on translated meshes + ''' + if len(state) == 3: # translation only + transform = np.eye(4) + transform[:3, 3] = state + return transform + elif len(state) == 6: # translation + rotation + translation, rotation = state[:3], state[3:] + rotation = Rotation.from_euler('xyz', rotation).as_matrix() + transform = np.eye(4) + transform[:3, :3] = rotation + transform[:3, 3] = translation + return transform + else: + raise NotImplementedError + + +def transform_pt_by_matrix(pt, matrix): + ''' + Transform a single xyz pt by a 4x4 matrix + ''' + pt = np.array(pt) + if len(pt) == 3: + v = np.append(pt, 1.0) + v = matrix @ v + return v[0:3] + elif len(pt) == 6: + return get_pos_euler_from_transform_matrix(matrix @ get_transform_matrix(pt)) + else: + raise NotImplementedError + + +def transform_pts_by_matrix(pts, matrix): + ''' + Transform an array of xyz pts (n, 3) by a 4x4 matrix + ''' + pts = np.array(pts) + if len(pts.shape) == 1: + if len(pts) == 3: + v = np.append(pts, 1.0) + elif len(pts) == 4: + v = pts + else: + raise NotImplementedError + v = matrix @ v + return v[0:3] + elif len(pts.shape) == 2: + # transpose first + if pts.shape[1] == 3: + # pad the points with ones to be (n, 4) + v = np.hstack([pts, np.ones((len(pts), 1))]).T + elif pts.shape[1] == 4: + v = pts.T + else: + raise NotImplementedError + v = matrix @ v + # transpose and crop back to (n, 3) + return v.T[:, 0:3] + else: + raise NotImplementedError + + +def transform_pts_by_state(pts, state): + matrix = get_transform_matrix(state) + return transform_pts_by_matrix(pts, matrix) + + +def pos_quat_to_mat(pos, quat): + mat = np.eye(4) + mat[:3, 3] = pos + mat[:3, :3] = Rotation.from_quat(np.array(quat)[[1, 2, 3, 0]]).as_matrix() + return mat + + +def mat_to_pos_quat(mat): + pos = mat[:3, 3] + quat = Rotation.from_matrix(mat[:3, :3]).as_quat()[[3, 0, 1, 2]] + return pos, quat + + +def mat_dict_to_pos_quat_dict(mat_dict): + pos_dict, quat_dict = {}, {} + for part_id, mat in mat_dict.items(): + pos, quat = mat_to_pos_quat(mat) + pos_dict[part_id] = pos + quat_dict[part_id] = quat + return pos_dict, quat_dict + + +def q_to_pos_quat(q): + pos = q[:3] + if len(q) == 3: + quat = [1, 0, 0, 0] + elif len(q) == 6: + quat = Rotation.from_euler('xyz', q[3:]).as_quat()[[3, 0, 1, 2]].tolist() + else: + raise Exception(f'incorrect state dimension') + return pos, quat + + +def pos_quat_to_q(pos, quat): + euler = Rotation.from_quat(np.array(quat)[[1, 2, 3, 0]]).as_euler('xyz') + return np.concatenate([pos, euler]) + + +def q_dict_to_pos_quat_dict(q_dict): + pos_dict, quat_dict = {}, {} + for part_id, q in q_dict.items(): + pos, quat = q_to_pos_quat(q) + pos_dict[part_id] = pos + quat_dict[part_id] = quat + return pos_dict, quat_dict + + +def get_pos_quat_from_pose(pos, quat, pose): + if pose is None: return pos, quat + matrix = pos_quat_to_mat(pos, quat) + matrix = pose @ matrix + pos = matrix[:3, 3] + quat = Rotation.from_matrix(matrix[:3, :3]).as_quat()[[3, 0, 1, 2]] + return pos, quat + + +def get_pos_quat_from_pose_global(pos, quat, pose): + if pose is None: return pos, quat + matrix = pos_quat_to_mat(pos, quat) + matrix = matrix @ pose + pos = matrix[:3, 3] + quat = Rotation.from_matrix(matrix[:3, :3]).as_quat()[[3, 0, 1, 2]] + return pos, quat + + +def get_translate_matrix(translate): + translate_matrix = np.eye(4) + translate_matrix[:3, 3] = translate + return translate_matrix + + +def get_scale_matrix(scale): + scale_matrix = np.eye(4) + scale_matrix[:3, :3] *= scale + return scale_matrix + + +def get_revolute_matrix(axis, angle): + if axis == 'X': + axis_arr = np.array([1, 0, 0]) + elif axis == 'Y': + axis_arr = np.array([0, 1, 0]) + elif axis == 'Z': + axis_arr = np.array([0, 0, 1]) + else: + raise NotImplementedError + revolute_matrix = np.eye(4) + revolute_matrix[:3, :3] = Rotation.from_rotvec(axis_arr * angle).as_matrix() + return revolute_matrix + + +def get_transform_matrix_quat(pos, quat): # quat: wxyz + pos = np.array(pos) + quat = np.array(quat) + rotation = Rotation.from_quat(quat[[1, 2, 3, 0]]) + transform_matrix = np.eye(4) + transform_matrix[:3, :3] = rotation.as_matrix() + transform_matrix[:3, 3] = pos + return transform_matrix + + +def get_transform_matrix_euler(pos, euler): # euler: xyz + pos = np.array(pos) + euler = np.array(euler) + rotation = Rotation.from_euler('xyz', euler) + transform_matrix = np.eye(4) + transform_matrix[:3, :3] = rotation.as_matrix() + transform_matrix[:3, 3] = pos + return transform_matrix + + +def get_pos_euler_from_transform_matrix(transform_matrix): + pos = transform_matrix[:3, 3] + rotation = Rotation.from_matrix(transform_matrix[:3, :3]) + euler = rotation.as_euler('xyz') + return np.concatenate([pos, euler]) + + +def quat_to_euler(quat): + return Rotation.from_quat(quat[[1, 2, 3, 0]]).as_euler('xyz') + + +def get_transform_from_path(path, n_sample=None): + if n_sample is not None: + path = path.copy()[::len(path) // n_sample] + T = [get_transform_matrix_euler(p[:3], p[3:]) for p in path] + return T + + +def get_sequential_transform_from_path(path, n_sample=None): + if n_sample is not None: + path = path.copy()[::len(path) // n_sample] + T = [get_transform_matrix_euler(p[:3], p[3:]) for p in path] + T_seq = [np.eye(4)] + [T[i] @ np.linalg.inv(T[i-1]) for i in range(1, len(T))] + return T_seq diff --git a/assets/xarm7/contacts/link1_vhacd.txt b/assets/xarm7/contacts/link1_vhacd.txt new file mode 100644 index 0000000..6593dfb --- /dev/null +++ b/assets/xarm7/contacts/link1_vhacd.txt @@ -0,0 +1,1294 @@ +1293 +0.6015999999999999 -5.4625 -1.7126 +-2.6752000000000002 -4.0148 -4.9135 +-2.6752000000000002 -3.9385000000000003 -4.6845 +-3.5136000000000003 -3.7862 -4.9135 +-0.23679999999999998 -5.2338000000000005 3.0113999999999996 +-0.23679999999999998 -5.691199999999999 0.0398 +-3.4368000000000003 -4.3197 2.0211 +-3.4368000000000003 2.1574 -2.8565 +-3.4368000000000003 3.3005 -2.8565 +2.2016 -4.2432 2.7824 +2.2016 -2.6432 3.6207999999999996 +2.2016 3.6813 -8.9518 +2.2016 3.8339 -9.0283 +2.2016 2.3102 -6.5902 +2.2016 2.9958 -6.8187999999999995 +2.2016 4.0623 -9.0277 +2.2016 3.6051 -7.656300000000001 +2.2016 -2.5668 4.077999999999999 +2.2016 4.2912 -11.2381 +2.2016 -3.7861 3.6207999999999996 +2.2016 -2.6433 3.6207999999999996 +2.2016 -0.8139000000000001 4.3066 +2.2016 3.7575 -11.2381 +2.2016 3.7575 -9.0283 +2.2016 4.1387 -9.0283 +2.2016 2.5387 -6.2094000000000005 +2.2016 2.3101 -6.0568 +2.2016 2.3101 -6.5903 +2.2016 4.2145 -11.2381 +2.2016 4.2145 -9.5619 +2.2016 3.2243 3.8493 +2.2016 4.0622 -9.0277 +-1.0752 2.2339 -4.9135 +-1.0752 2.1574 -4.9135 +-4.2752 -2.1098 -4.9135 +4.64 -1.9571999999999998 1.1824 +4.64 7.5673 1.1828999999999998 +4.64 -1.7283 1.1825999999999999 +-1.9136 7.567699999999999 -2.8562 +-1.9136 3.3005 -2.8562 +1.44 7.567699999999999 -4.6084 +3.3449 7.567699999999999 -0.8748 +3.3449 3.3005 -0.8748 +-3.2087 -4.0148 -4.9135 +-3.2087 -3.9385000000000003 -2.8565 +-3.2087 -4.6244 1.8682 +-3.9703000000000004 3.3769 -2.856 +-3.9703000000000004 2.8434 -10.019 +-3.9703000000000004 7.567699999999999 -2.7796000000000003 +1.6681000000000001 -4.7767 -5.1431 +1.6681000000000001 3.2251000000000003 4.611400000000001 +1.6681000000000001 -4.015 -11.2381 +1.6681000000000001 -4.015 -8.8753 +1.6681000000000001 3.2243 4.611400000000001 +-4.8087 0.1764 0.8776 +-4.8087 3.1481000000000003 -0.8746 +-4.8087 -2.7194 -0.8746 +-4.8087 -1.1954 -2.856 +-4.8087 0.3286 -1.1037 +-4.8087 -2.2616 0.26789999999999997 +-4.8087 -2.1858 0.2682 +4.1065 -2.4911 -11.2381 +4.1065 -2.3387000000000002 -11.2381 +4.1065 -2.3387000000000002 -4.914700000000001 +4.1065 -3.0245 -4.914700000000001 +4.1065 -3.6337 1.4112 +-3.6654 -4.0148 -2.8565 +-3.6654 7.567699999999999 -3.1611000000000002 +1.973 7.567699999999999 -2.7796000000000003 +1.973 7.567699999999999 -2.856 +1.973 2.1574 -4.6084 +1.973 3.3005 -2.7796000000000003 +1.973 3.3005 -2.856 +-4.5038 -3.6336 -1.3325 +-4.5038 7.567699999999999 -1.7895 +-4.5038 -3.5575 0.1922 +-4.5038 -0.967 -4.914700000000001 +-4.5038 0.32889999999999997 -0.8752 +-2.0654 3.3005 -4.4561 +-2.0654 -4.3956 -11.2381 +-2.9038 3.7574000000000005 -8.8756 +-2.9038 -4.0147 3.0116 +2.8114 -4.2432 2.8587000000000002 +2.8114 3.9098 -9.7142 +-3.7421999999999995 -3.9385000000000003 1.9444 +-3.7421999999999995 -2.7957 1.8682 +1.5163 -5.5385 1.4112 +-1.7605 3.2243 4.0783 +3.8779 -2.872 -11.2381 +3.8779 7.567699999999999 -2.856 +3.8779 -4.3194 -1.3324 +3.8779 2.1574 -2.8563 +3.8779 2.1574 -3.0086000000000004 +3.8779 -2.3387000000000002 -6.361999999999999 +3.8779 2.3864 -7.504700000000001 +3.1163 -4.0144 -4.9135 +2.2779000000000003 -1.6524 4.2303 +2.2779000000000003 3.2243 4.3066 +1.4395 7.2623999999999995 4.611400000000001 +4.7162999999999995 3.2251000000000003 1.1828999999999998 +4.7162999999999995 -0.357 -4.9135 +4.7162999999999995 -0.5856 -4.3797999999999995 +4.7162999999999995 0.024 1.1825999999999999 +4.7162999999999995 -0.6617999999999999 -4.3797999999999995 +4.7162999999999995 3.2243 1.2588 +-1.8373 -4.2434 3.6207000000000003 +3.3444000000000003 3.3765000000000005 -8.9518 +2.5828 3.2251000000000003 4.1539 +2.5828 -0.5852999999999999 4.154100000000001 +2.5828 3.2243 4.154100000000001 +1.7444000000000002 -4.2435 -5.752199999999999 +-4.7324 3.1481000000000003 -0.8752 +-4.7324 7.1865 0.9538 +-4.7324 -2.2623 -4.2274 +4.182799999999999 -2.6432 1.1825999999999999 +4.182799999999999 -0.4331 2.5539 +4.182799999999999 2.2334 -8.4951 +4.182799999999999 1.1668 -11.2381 +4.182799999999999 1.1668 -8.9524 +4.182799999999999 2.3095999999999997 -11.2381 +4.182799999999999 3.2243 2.5539 +-2.3708 -3.4053 3.773 +-2.3708 2.3863 -6.0565 +-2.294 -4.7008 1.8680999999999999 +2.8877 -3.8621999999999996 -11.2381 +4.4877 -2.6432 -0.6461 +4.4877 1.4715 -7.6576 +4.4877 -0.8906000000000001 -4.914700000000001 +4.4877 1.7002 -11.2381 +4.4877 3.3005 -0.6461 +0.4493 -2.6433 4.2303 +-4.1226 2.5387 -9.0283 +-1.7610000000000001 4.443 -11.2381 +-1.7610000000000001 3.9859 -11.2381 +-1.7610000000000001 4.2908 -9.0283 +1.5926 -5.3861 2.0971 +-1.6842 -1.1954 4.535299999999999 +0.7542 3.3769 -4.8370999999999995 +3.1158 -4.015 -2.8565 +3.1158 -4.472099999999999 -2.8565 +-0.161 1.0146 -4.761 +-0.161 0.786 -4.5323 +-0.161 2.1572999999999998 -4.9135 +-0.161 2.1572999999999998 -4.5323 +-3.361 0.6334000000000001 -3.8468 +-3.361 3.3012 -0.8752 +-3.361 0.5571999999999999 -4.5323 +2.2774 -4.9293 2.5542 +2.3542 7.4146 4.2299999999999995 +-4.1994 -4.0908 0.1152 +-4.1994 -4.0908 -0.799 +-4.1994 -1.1196 -8.8753 +1.0591 -5.614800000000001 1.4112 +1.0591 -5.2338000000000005 -2.8558 +2.5823 3.3005 -4.1512 +-4.6560999999999995 3.2251000000000003 1.335 +-4.6560999999999995 -2.9482999999999997 -2.8565 +-4.6560999999999995 3.1481000000000003 -1.4847000000000001 +-4.6560999999999995 3.1481000000000003 1.335 +-4.6560999999999995 7.567699999999999 -0.8752 +-4.6560999999999995 7.567699999999999 -0.8748 +-4.6560999999999995 -2.186 -4.9135 +4.2591 2.005 -8.4187 +4.2591 0.938 -11.2381 +4.2591 -0.662 -2.8565 +4.2591 0.7097 -5.2188 +4.2591 1.2427000000000001 -8.341800000000001 +4.2591 1.7002 -7.4286 +4.2591 -0.1286 -4.9903 +4.2591 2.0812 -9.4082 +4.2591 -0.2046 -4.914700000000001 +4.2591 1.7761 -7.2752 +2.964 -4.9292 -0.7988000000000001 +2.964 -4.166799999999999 -2.475 +2.964 -4.166799999999999 -2.856 +2.964 -4.5479 -0.4177 +2.964 -4.5479 -2.856 +-3.5128 0.6334000000000001 -4.9135 +2.1256 2.1574 -3.9229 +2.1256 0.7858999999999999 -3.9229 +-1.1512 -4.4718 -5.447699999999999 +-1.1512 -4.6243 -11.2381 +-1.1512 -4.548 -4.914700000000001 +-1.1512 -4.2436 -11.2381 +-1.1512 -4.7005 -11.2381 +-1.1512 -4.9291 -4.914700000000001 +-1.1512 -4.2435 -11.2381 +-1.1512 -4.2435 -8.8753 +-1.1512 -4.472099999999999 -5.6000000000000005 +-1.1512 -4.853 -4.914700000000001 +3.6488 0.7096 -3.9229 +2.4305 4.0622 -9.1049 +4.7921 -2.6432 -2.2460999999999998 +4.7921 -2.6432 -0.3414 +4.7921 -2.6433999999999997 -0.3414 +4.7921 -2.8721 -1.2559 +-1.6078999999999999 -5.5386999999999995 0.116 +-1.6078999999999999 -5.5386999999999995 1.3347 +4.0305 -0.12869999999999998 -2.856 +4.0305 -1.6524 2.6303 +4.0305 0.1 -2.6273999999999997 +-2.5231 -4.5483 1.9444 +-2.5231 -5.234 1.2585000000000002 +-2.5231 -4.8528 0.1158 +3.1921 3.2242 -7.9611 +-3.2847 -4.853 -0.6466000000000001 +2.3537 -5.3102 -0.1131 +2.3537 -5.3100000000000005 1.1062 +-2.2182 -1.9571999999999998 4.2304 +-3.8182 -3.9383 0.1152 +-3.8182 -3.329 -5.3715 +-3.8182 -3.5576000000000003 -2.6271 +-3.8182 -2.2622 -11.2381 +-3.8182 -3.4815 -2.8558 +-3.8182 -2.1101 -11.2381 +-3.8182 -2.1101 -8.8753 +-3.8182 -2.9482 -4.914700000000001 +-3.8182 -2.8714 -11.2381 +-3.8182 -2.8714 -4.914700000000001 +-3.8182 -3.4049000000000005 -4.914700000000001 +-3.8182 -0.1281 3.0877000000000003 +-3.8182 -4.4719 0.1152 +-3.8182 -4.3956 0.1152 +-3.8182 -4.0149 -2.8558 +-3.8182 -3.0244 -11.2381 +-3.7414000000000005 0.6334000000000001 -4.0752999999999995 +-1.3798 -4.6243 -11.2381 +3.8019 0.9386 -4.9140999999999995 +3.8019 0.4047 -2.8565 +-2.7517 7.338500000000001 4.0017 +-2.7517 3.9859 -9.5619 +-1.1517 3.3005 -4.7608999999999995 +-4.3517 -2.7194 0.2682 +-4.3517 0.3286 -2.7796000000000003 +-1.0749 -4.5483 -4.9908 +-1.0749 4.6719 -9.5619 +-3.2084 -2.7194 2.7828 +-3.2084 -4.4719 -2.8558 +-4.046799999999999 -2.7191 -11.2381 +-4.046799999999999 0.7098 -4.8372 +-4.8084 -2.1098 -2.8565 +4.1068 -2.262 -4.9908 +1.1349 7.567699999999999 -4.6847 +3.5733 -2.3382 3.0875 +3.5733 -0.9667 3.3162 +3.5733 3.2243 3.3162 +2.7348999999999997 -3.5576000000000003 -6.8956 +2.7348999999999997 -3.4052 -11.2381 +2.7348999999999997 -5.0817 1.4112 +-3.7419000000000002 3.3769 -3.1611000000000002 +-3.7419000000000002 3.2251000000000003 3.1635999999999997 +-3.7419000000000002 -4.0148 -2.8565 +-3.7419000000000002 7.5673 3.0872 +-3.7419000000000002 3.2243 3.164 +1.8964999999999999 4.2912 -9.0283 +3.0398 -2.6432 3.5446999999999997 +3.0398 3.2243 3.8493 +-3.437 -4.7767 0.1158 +-3.437 3.1481000000000003 -2.856 +2.2782 -4.2432 3.3160000000000003 +2.2782 -2.872 4.002 +-4.2754 -0.7382 -2.8565 +-4.2754 -0.9668 -11.2381 +-4.2754 -0.9668 -8.8753 +-4.2754 2.3098 -11.2381 +-4.2754 2.3098 -9.3321 +-4.2754 1.6238 -6.7433000000000005 +4.6398 3.3769 -1.5609 +4.6398 7.567699999999999 -0.8752 +4.6398 7.567699999999999 1.1825999999999999 +4.6398 -3.2531 0.039599999999999996 +4.6398 -2.8721 -2.856 +4.6398 -3.3293000000000004 -0.3414 +4.6398 -3.3293000000000004 -1.1798 +-1.8370000000000002 -4.7767 -4.8369 +3.3446999999999996 7.567699999999999 -3.4657 +3.3446999999999996 7.567699999999999 -0.8752 +3.3446999999999996 0.7095 -3.6182 +3.3446999999999996 3.3005 -0.8752 +3.3446999999999996 0.6333 -4.7608 +-3.1321000000000003 3.3005 -3.7708 +-1.6089 3.3769 -4.6085 +-1.5321 -2.7956000000000003 4.3827 +4.1063 2.3102 -8.5707 +4.1063 2.3864 -9.0277 +4.1063 2.3864 -8.5707 +4.1063 0.7096 -2.9324 +0.9063 4.2907 -8.265799999999999 +-2.3705 3.2251000000000003 4.3066 +-2.3705 2.2335000000000003 4.3066 +-4.504 -0.7383 -4.9135 +-4.504 0.25270000000000004 -4.914700000000001 +-4.504 3.1481000000000003 0.2682 +-4.504 -2.7194 1.2587 +-4.504 -2.1096 -3.085 +-4.504 -0.7382 -4.9135 +-4.504 -0.9668 -4.914700000000001 +-1.2272 4.2907 -8.341999999999999 +4.4112 -2.6433999999999997 -0.3414 +4.4112 -3.5578 0.5728 +4.4112 -2.5673000000000004 -5.067 +4.4112 -0.6617999999999999 -4.9135 +4.4112 -2.8721 1.4112 +1.2112 -4.6246 3.5446 +-2.0656 -1.3475000000000001 4.3827 +-2.0656 3.2243 3.9257 +0.3728 -4.2432 3.6211 +0.3728 -2.6432 4.3067 +0.3728 -5.3102 -2.7795 +0.3728 -5.3102 -0.0369 +0.3728 3.2251000000000003 4.7638 +0.3728 -0.8906000000000001 4.535200000000001 +0.3728 -5.6911000000000005 0.192 +0.3728 -5.6911000000000005 1.4112 +0.3728 -5.3862 0.1158 +0.3728 -5.3862 0.0393 +0.3728 -5.614800000000001 0.1158 +0.3728 -1.805 4.764 +0.3728 -5.5385 1.9446 +0.3728 -5.0055000000000005 -2.3983 +0.3728 -5.0055000000000005 -2.856 +0.3728 3.3012 3.4688 +0.3728 -4.0908 4.0781 +0.3728 -0.814 4.8402 +0.3728 -4.0145 3.6975000000000002 +0.3728 -5.615 0.1152 +0.3728 -5.615 -0.7228 +0.3728 -5.3101 1.9446 +0.3728 -4.2436 4.002 +0.3728 -5.0052 -2.3223000000000003 +0.3728 -5.2338000000000005 1.9446 +0.3728 -1.1954 4.4591 +0.3728 -5.4624 -1.789 +0.3728 -2.6433 4.5354 +0.3728 2.9951 4.8402 +0.3728 0.7866 4.4591 +0.3728 2.3098 -4.9138 +0.3728 -4.0907 4.0781 +0.3728 -5.691199999999999 0.116 +0.3728 7.5673 4.7638 +0.3728 7.5673 3.3927 +0.3728 -5.3863 0.0398 +0.3728 -5.6149 1.8680999999999999 +0.3728 -5.6149 0.0393 +0.3728 -5.3100000000000005 2.8590999999999998 +0.3728 -5.3100000000000005 -0.037 +0.3728 -5.3100000000000005 -2.7795 +0.3728 -4.1672 3.6975000000000002 +0.3728 -4.1672 3.621 +0.3728 -4.7007 3.621 +0.3728 3.2243 4.4591 +-2.904 3.9097 -11.2381 +2.8112000000000004 -4.2432 -5.067 +2.8112000000000004 -3.9388 -10.3226 +2.8112000000000004 -3.4812999999999996 -7.0479 +2.8112000000000004 -3.8621999999999996 -11.2381 +2.8112000000000004 -3.7859 -4.914700000000001 +2.8112000000000004 -3.4052 -8.8753 +2.8112000000000004 -3.8626 -11.2381 +2.8112000000000004 -3.8626 -4.914700000000001 +2.8112000000000004 -3.3287999999999998 -11.2381 +2.8112000000000004 -3.3287999999999998 -8.8753 +2.8112000000000004 -4.1672 -5.2193000000000005 +-0.4656 -5.691199999999999 1.1060999999999999 +1.5161 -5.5388 0.1152 +-2.5991 -2.7194 3.8494 +-0.9991 -5.6149 -0.037 +-4.1991 -0.9664 2.4779 +-4.1991 2.0048 2.5539 +-4.1991 1.5479 -8.1142 +-4.1991 2.2335000000000003 -8.1142 +-4.1991 2.3098 -11.2378 +-4.1991 1.3954 -11.2378 +4.7161 7.567699999999999 1.1063 +4.7161 7.567699999999999 -0.8748 +4.7161 3.3005 1.1825999999999999 +4.7161 -1.8049 -4.914700000000001 +0.1442 4.672 -9.1049 +0.1442 4.3674 -11.2381 +0.1442 4.3674 -9.0283 +0.1442 4.1383 -7.8849 +0.1442 4.2146 -8.9515 +0.1442 4.5958 -9.0283 +0.1442 4.748200000000001 -9.5619 +0.1442 4.8245000000000005 -11.2381 +0.1442 4.8245000000000005 -10.857 +0.1442 4.5959 -9.0277 +0.1442 2.3101 -6.285499999999999 +0.1442 2.3864 -5.8279 +0.1442 4.3671 -11.2381 +0.1442 4.3671 -9.0283 +-3.1326 5.4336 1.335 +-3.1326 -4.0148 1.8682 +-3.1326 2.31 -6.4378 +-3.1326 2.9196 -7.1998999999999995 +-3.1326 7.5673 1.335 +2.5826000000000002 -3.9384 -4.8369 +2.5826000000000002 -4.0144 -4.9135 +-3.8941999999999997 2.1572999999999998 -2.8563 +-4.7326 -0.9669000000000001 -2.8565 +-4.7326 1.0900999999999998 -8.723 +-4.7326 1.1664 -11.2381 +-4.7326 3.1481000000000003 -1.1799 +-4.7326 3.1481000000000003 -0.8752 +-4.7326 6.8811 -0.9511999999999999 +-4.7326 -2.7194 0.1152 +-4.7326 -2.7194 -2.7795 +-4.7326 -2.7194 -2.856 +-4.7326 -0.9668 -11.2381 +-4.7326 -0.967 -11.2381 +-4.7326 -1.9571999999999998 -4.9135 +-4.7326 -0.2046 -4.8369 +-4.7326 -2.7195 0.1158 +-1.4558 7.5673 4.611400000000001 +0.9825999999999999 4.672 -9.5619 +-2.2942 1.7762 -5.1425 +-2.2942 -3.71 -11.2381 +-2.2942 -3.71 -8.8753 +-2.7508999999999997 7.567699999999999 -3.9988 +-3.5893 -1.4999 3.2401 +-4.4277 3.1481000000000003 -0.8752 +-4.4277 0.024399999999999998 2.0967 +-4.4277 -2.7194 1.335 +-1.1509 -5.233899999999999 -2.856 +4.4875 -2.6432 -0.6462 +4.4875 -2.6432 1.335 +4.4875 7.567699999999999 -1.7895 +4.4875 -2.3387000000000002 -4.9908 +4.4875 3.3005 -1.9414 +4.4875 0.1 -0.7987 +4.4875 0.4049 -0.6462 +4.4875 -1.8814000000000002 -3.1611000000000002 +4.4875 -1.8046 1.7162 +4.4875 -2.5672 -4.6845 +-1.9893 -5.0816 -2.5507999999999997 +-1.9893 1.7766 -4.9138 +0.4491 3.2245000000000004 -6.7425 +-2.8277 2.3097 -6.133 +-4.1228 3.2251000000000003 2.6307 +-4.1228 0.6334000000000001 -2.8563 +4.7924 -2.6432 -0.6462 +4.7924 0.1 -1.1799 +4.7924 0.1 -0.6462 +4.7924 -2.4907 -2.856 +4.7924 -1.2716 -2.856 +-1.7611999999999999 0.786 -4.0752999999999995 +-1.7611999999999999 -5.0812 2.7067 +-1.7611999999999999 2.1572999999999998 -4.0752999999999995 +-1.6844000000000001 -4.1672 3.6975000000000002 +3.9539999999999997 1.8526 -2.8563 +3.1924 -3.9384 -2.8565 +-3.3612 -2.6432 2.5539 +-3.3612 3.3012 -0.8748 +-3.3612 7.567699999999999 -0.8748 +-3.2843999999999998 0.6334000000000001 -4.0752999999999995 +2.3539999999999996 2.2335000000000003 -6.5897 +2.3539999999999996 2.3098 -6.5897 +1.0589 2.1574 -4.9135 +3.4972999999999996 0.7095 -4.9135 +-3.0563 -3.7859999999999996 -11.2381 +-0.6179 -3.2529000000000003 4.459 +-3.8179 7.567699999999999 -2.9325 +-3.8179 7.567699999999999 -2.8562 +-4.6563 -0.9664 1.4112 +-4.6563 -0.7383 -2.8565 +-4.6563 -2.5666 0.8776 +-4.6563 3.1481000000000003 1.335 +-4.6563 -2.1096 -4.9135 +-4.6563 -0.6618999999999999 -3.085 +-4.6563 -1.1951 1.335 +-4.6563 3.2243 1.335 +-1.3795 3.3773 4.6876 +-1.3795 -1.8051000000000001 4.6116 +-1.3795 3.2243 4.6877 +4.258900000000001 0.4809 -4.9135 +4.258900000000001 -0.6617999999999999 -2.8565 +4.258900000000001 -0.6617999999999999 -3.9227 +2.887 2.1574 -3.9229 +2.887 2.1574 -3.9991 +2.9638 -4.4718 1.4112 +2.9638 -4.624099999999999 -0.3414 +2.9638 -4.8526 1.4112 +2.9638 -5.0049 0.2683 +2.9638 -5.0049 0.649 +-0.313 2.3098 -4.9138 +-4.3514 0.7861999999999999 -0.9511999999999999 +-4.3514 3.1481000000000003 -0.9511999999999999 +-4.3514 -2.7194 -2.8558 +-4.3514 0.32889999999999997 -2.7034 +-4.3514 -2.7195 0.1922 +4.5638 -2.6432 1.0299 +4.5638 1.4715 -8.9514 +4.5638 -1.8812 -2.8565 +4.5638 -1.8814000000000002 -2.8565 +4.5638 -0.4332 -2.8565 +4.5638 -3.0239 -3.0086999999999997 +3.7254 2.3099000000000003 -11.2381 +3.7254 2.3099000000000003 -9.0283 +3.7254 2.3102 -9.0277 +3.7254 2.9958 -9.0283 +3.7254 -4.0144 -3.0086999999999997 +3.7254 0.7096 -2.8563 +-3.2081 -3.1005000000000003 3.2398000000000002 +-4.0465 -4.167400000000001 0.7256 +1.5918999999999999 -4.5481 -11.1607 +4.8687000000000005 3.3769 0.26789999999999997 +4.8687000000000005 -0.20500000000000002 -0.7226 +4.8687000000000005 3.3005 -0.2652 +4.8687000000000005 -1.8046 -2.5511 +4.8687000000000005 -2.3381 -0.6462 +-4.8849 -0.5857 -0.8746 +-4.8849 -1.0429000000000002 0.26789999999999997 +-4.8849 3.1481000000000003 0.26789999999999997 +-4.8849 3.1481000000000003 0.2682 +-4.8849 -2.4143999999999997 -0.7223 +-1.6081 -4.0907 3.2401 +4.0302999999999995 -3.2529000000000003 2.0211 +4.0302999999999995 0.7095 -4.9135 +4.0302999999999995 -2.6433 1.4112 +-2.4465 -4.4718 -4.914700000000001 +-2.4465 -4.167400000000001 -11.2381 +-2.4465 -3.71 -11.2381 +-2.4465 -3.71 -8.8753 +3.2687 -4.8527000000000005 -0.3414 +3.2687 -3.5573 -11.2381 +3.2687 -4.7003 -1.5608 +3.2687 -3.9384 -4.914700000000001 +3.2687 -4.167 1.4112 +-3.2849000000000004 -2.7194 2.7828 +2.3535 -4.8529 -2.9326000000000003 +-4.58 7.567699999999999 1.335 +-4.58 3.2243 1.7162 +4.3352 -2.6432 -2.856 +1.1352 -5.1575999999999995 2.9352 +3.4968 2.3864 -6.8187999999999995 +2.6584 7.491200000000001 -4.075 +-3.7415999999999996 -2.7199 1.9449999999999998 +-3.7415999999999996 -3.5576999999999996 2.3258 +3.8017000000000003 3.2251000000000003 3.0872 +3.0401000000000002 3.2251000000000003 3.849 +3.0401000000000002 -4.9292 -0.7988000000000001 +-3.5135 3.2243 2.7064999999999997 +-3.5135 3.2243 2.7828 +4.6400999999999994 -0.7382 -2.8565 +-1.9135 -5.3102 1.9446 +-1.9135 4.443 -9.8667 +-3.2086000000000006 -3.9385000000000003 1.9444 +-3.2086000000000006 -4.0145 1.9444 +4.1066 2.3099000000000003 -9.0283 +4.1066 0.7095 -2.8565 +4.1066 7.5673 2.5542 +-4.5037 -2.1098 -2.9326000000000003 +-4.5037 -2.5669999999999997 -4.9135 +4.4115 -0.662 -4.9135 +4.4115 -2.7196000000000002 1.4874999999999998 +4.4115 -2.6433 1.4874999999999998 +-2.0653 4.2146 -8.9515 +3.5730999999999997 2.2334 -7.9612 +3.5730999999999997 3.2244 -9.7142 +3.5730999999999997 0.5574 -4.9901 +2.7347 -4.3198 2.8588999999999998 +2.7347 -5.0813999999999995 1.4874999999999998 +2.8115 3.1482 -7.3523000000000005 +-3.7421 -2.6432 2.7828 +1.5164 1.5478 -4.9135 +3.878 2.8434999999999997 -11.2381 +3.0396 3.3005 -3.8466 +3.1164 3.6811999999999996 -11.2381 +-3.4372 0.7861999999999999 -2.7796000000000003 +-3.4372 3.1481000000000003 -2.7796000000000003 +-3.4372 3.1481000000000003 -2.856 +2.278 0.7858999999999999 -3.9229 +-4.2756 -2.338 -11.2381 +-4.2756 -0.967 -11.2381 +-1.8372 7.567699999999999 -4.4561 +3.3445 1.2432 -4.9135 +-3.2091000000000003 3.2251000000000003 3.6971 +-3.2091000000000003 3.3012 1.335 +3.4213 -4.0144 -4.0749 +-3.9707 3.1481000000000003 -2.856 +-0.6939 -4.7007 3.621 +-3.8939000000000004 2.9196 -11.2381 +-1.4555 -5.4624 -1.0274999999999999 +4.1829 -2.6432 1.1824 +4.1829 2.3099000000000003 -11.2381 +4.1829 -3.6338000000000004 -2.7797 +4.1829 2.3863 -10.3233 +4.1829 -0.1286 -4.9903 +4.1829 -2.5669999999999997 0.9538 +4.1829 -4.0907 -0.3414 +4.1829 1.3191 -8.4187 +3.2676999999999996 1.2430999999999999 -4.9135 +-3.6658000000000004 2.2334 -7.809099999999999 +-3.6658000000000004 2.3097 -7.809099999999999 +-3.6658000000000004 0.5574 -5.0663 +-3.6658000000000004 0.5574 -4.99 +-3.6658000000000004 2.1572 -6.5896 +-3.6658000000000004 2.2333 -8.1136 +-3.6658000000000004 1.0145 -4.9138 +-3.6658000000000004 1.0908 -4.914000000000001 +-1.2274 -4.167400000000001 -8.8753 +-4.4274000000000004 7.5673 1.9448 +1.2109999999999999 3.6051 -7.276000000000001 +-1.989 3.8336 -9.0277 +0.37260000000000004 3.2251000000000003 4.459 +0.37260000000000004 3.3012 3.4688 +0.37260000000000004 0.786 4.4592 +0.37260000000000004 -1.1954 4.535299999999999 +0.37260000000000004 3.3773 4.839799999999999 +0.37260000000000004 -0.9665 4.8402 +0.37260000000000004 7.5673 3.3926 +0.37260000000000004 7.5673 4.7638 +0.37260000000000004 3.2243 4.8402 +0.37260000000000004 3.2243 4.4592 +3.6494 -3.2529000000000003 2.6308000000000002 +3.6494 -2.3387000000000002 -11.2381 +3.6494 -2.3387000000000002 -8.8753 +3.6494 -2.7196000000000002 2.8587000000000002 +3.6494 -3.9384 2.0974 +3.6494 0.7096 -3.9229 +-2.8274 -4.8527000000000005 1.9446 +2.811 -4.7008 0.1158 +2.811 -4.5482000000000005 1.4112 +1.5159 -4.2437000000000005 3.6969000000000003 +3.9543000000000004 2.2332 -7.3514 +3.1159 -0.5095 3.7731 +-0.1609 -4.7767 -3.9227 +-0.1609 -5.0053 -4.9135 +-0.1609 -4.7005 -4.9135 +-0.1609 -5.234 -2.8565 +-0.1609 -5.234 -3.3896999999999995 +-0.1609 -4.9291 -2.9326000000000003 +-3.3609 -4.7767 1.1062 +-3.3609 -2.4145 3.3164 +2.2775 1.2433 -4.9135 +2.3543000000000003 2.1574 -3.7703 +2.3543000000000003 0.7858999999999999 -3.7703 +-0.9225000000000001 -4.2435 -8.8753 +-0.9225000000000001 -4.1672 3.9257 +4.7158999999999995 -1.9576 -4.6845 +3.344 0.7096 -4.9135 +0.14400000000000002 -1.1954 4.8402 +3.4208000000000003 -2.6432 2.5544000000000002 +3.4208000000000003 -2.3382 2.5544000000000002 +3.4208000000000003 3.2243 2.8592 +-0.6944 3.3005 -4.8369 +-3.8944 -3.9383 -2.8558 +-3.8944 -3.329 -5.3715 +-3.8944 3.3005 -2.8565 +-3.8944 3.3005 -2.9325 +-3.8944 3.3005 -2.8562 +-3.8944 -2.8714 -11.2381 +-3.8944 -4.3956 -0.6466000000000001 +-3.8176 2.1574 -3.085 +1.8207999999999998 -3.9388 -11.2381 +1.8207999999999998 -3.9388 -8.8753 +1.8207999999999998 -4.7006 -4.9908 +1.8207999999999998 -4.319599999999999 -4.914700000000001 +1.8207999999999998 -4.3957999999999995 -11.2381 +-1.456 -4.853 -4.9908 +-2.2944 4.2908 -11.2381 +2.8872999999999998 -4.624700000000001 -0.0369 +2.8872999999999998 -4.1672 -2.7033 +-3.5895 2.2334 -7.809099999999999 +-3.5895 0.5574 -4.99 +-4.4279 3.1481000000000003 0.4206 +-1.1511 -5.1577 2.9352 +1.2873 -5.5388 -0.5704 +1.2873 -5.614800000000001 0.3444 +3.7257 2.2334 -11.2381 +3.7257 2.2334 -8.4187 +3.7257 -2.3382 -11.2381 +3.7257 -2.1858 -11.2381 +3.7257 -2.1858 -8.8753 +3.7257 2.3095999999999997 -8.4187 +-2.8278999999999996 3.6051 -8.1897 +-2.8278999999999996 3.2243 4.001799999999999 +-2.8278999999999996 2.1572999999999998 -4.0752999999999995 +-4.123 1.5476 -8.1136 +-4.123 -2.7194 1.335 +-4.123 -2.643 1.1824 +-4.123 -2.9484 1.9449999999999998 +-4.123 -2.9484 2.0211 +-4.123 2.0046999999999997 -7.1228 +-4.123 3.2243 2.6303 +-4.123 0.0243 -4.9902 +4.7922 7.567699999999999 0.0397 +4.7922 7.567699999999999 -0.5699 +4.7922 3.3005 -0.9511999999999999 +4.7922 3.3005 -0.6462 +4.7922 3.3005 -0.8748 +4.7922 0.1 -1.1799 +4.7922 0.1 -0.6462 +-1.6846 -5.0053 1.9446 +-1.6846 -5.3862 1.9446 +-1.6846 -5.3862 2.0209 +-1.6846 -4.1671 3.6971999999999996 +-1.6846 -5.0051 1.9446 +-1.6846 -4.1672 3.621 +3.9537999999999998 3.3005 -2.856 +4.0306 3.3005 -2.7797 +-2.5229999999999997 -4.3954 -5.6000000000000005 +-2.5229999999999997 -5.234 -0.418 +-2.5229999999999997 -4.3957999999999995 -2.8558 +-2.5229999999999997 -4.853 -2.7033 +3.1154 -4.6246 2.0211 +0.8305999999999999 3.3005 -4.8369 +3.1921999999999997 3.3012 1.2593 +3.1921999999999997 3.3005 -3.6946 +-0.0078 7.567699999999999 -3.4659000000000004 +-0.0078 7.567699999999999 -4.7608999999999995 +-0.0078 3.3005 -4.8370999999999995 +-0.0078 3.3005 -3.4659000000000004 +1.0587 3.2251000000000003 4.7638 +1.0587 3.2243 4.7639000000000005 +-2.2180999999999997 3.7574000000000005 -7.8849 +-2.1413 3.9099000000000004 -8.1136 +-2.1413 3.7575 -8.9515 +-2.1413 2.9959 -6.7425 +-2.1413 2.3101 -6.0568 +-2.1413 2.3101 -6.514200000000001 +-2.1413 2.3864 -6.6664 +3.4971 -2.6432 2.4014 +3.4971 -2.6432 2.935 +3.4971 -2.3382 2.5544000000000002 +3.4971 -2.5668 3.0878 +3.4971 3.3005 -2.856 +3.4971 3.3005 -2.7797 +3.4971 0.7861 -2.7797 +3.4971 -0.9667 3.3162 +3.4971 -0.9667 3.3924999999999996 +3.4971 3.2243 2.7824 +3.4971 3.2243 2.8592 +3.4971 3.2243 3.3162 +3.4971 3.2243 3.3924999999999996 +-0.6181 -1.8051000000000001 4.764 +-1.4565 2.1572999999999998 -4.8372 +3.8019999999999996 -4.2431 1.3348 +-2.7516 -4.0145 -11.1607 +-2.6748000000000003 2.1572999999999998 -4.0752999999999995 +2.9636 -5.0055000000000005 0.1158 +2.9636 -4.7006 0.1152 +2.9636 -5.0052 0.1152 +2.9636 -5.0052 -0.49420000000000003 +2.9636 -4.5482000000000005 1.4112 +2.9636 -4.624700000000001 -2.7033 +2.9636 -4.1672 -2.8558 +-3.5131999999999994 -2.7199 3.0116 +2.1252 -0.8906000000000001 3.926 +2.1252 -0.814 4.383 +2.1252 -2.7196000000000002 3.6211 +2.1252 7.5673 2.7066 +-4.3515999999999995 -0.7383 -4.0749 +-4.3515999999999995 -0.9669000000000001 -2.8565 +-4.3515999999999995 1.9287999999999998 -7.8099 +-4.3515999999999995 -2.1096 -4.4559 +-4.3515999999999995 -2.1096 -4.9135 +-1.9132 0.786 -3.9989 +-1.9132 0.786 -4.0752999999999995 +-1.9132 2.1572999999999998 -3.9989 +2.4301 -5.157500000000001 -1.1801000000000001 +2.4301 1.6241999999999999 -4.9135 +2.4301 -4.167 -11.2381 +-0.8467 -5.0053 -4.9135 +-4.0467 -2.7194 1.4112 +-4.0467 2.31 -7.8849 +-4.0467 -3.6337 1.7156 +-1.6083 -4.7768999999999995 3.2397 +-1.6083 -4.1672 3.1635999999999997 +3.2685 3.3012 1.1825999999999999 +3.2685 7.5673 3.6209 +3.2685 7.5673 1.1825999999999999 +-0.0083 -5.0054 -5.5238000000000005 +-4.5802000000000005 -2.338 -4.9908 +-4.5802000000000005 -3.3291 -2.1699 +-4.5802000000000005 1.6238 -8.9514 +-2.1418 4.1385 -9.0277 +-2.1418 1.3192000000000002 -5.0661 +-2.1418 1.4718 -5.447 +-2.1418 3.7574000000000005 -9.0277 +-2.1418 2.31 -6.5902 +-2.1418 2.3863 -6.0565 +-2.1418 7.5673 4.3066 +-2.0650000000000004 2.1574 -4.5323 +-2.0650000000000004 3.3005 -4.4559 +-3.7418 -3.5576000000000003 -2.8558 +-3.7418 -3.5576000000000003 -2.6271 +-3.7418 -2.872 -5.2193000000000005 +-3.7418 -2.2622 -11.2381 +-3.7418 -2.2622 -8.8753 +-3.7418 2.31 -9.0277 +-3.7418 -4.0149 0.1152 +-3.7418 -4.3957999999999995 -1.5602 +1.8966 -1.5003 4.4591 +3.8015 7.567699999999999 -3.0086999999999997 +3.8015 7.567699999999999 -2.8562 +3.8015 3.3005 -3.0849 +-3.4368999999999996 0.786 -2.8563 +-3.4368999999999996 3.3766 -9.1049 +-3.4368999999999996 2.1572999999999998 -2.8563 +2.2015 -4.2432 3.3163 +2.2015 -2.6432 3.6974 +2.2015 3.2251000000000003 4.3065 +2.2015 3.2251000000000003 3.9255 +2.2015 -0.8906000000000001 4.3067 +2.2015 -0.8906000000000001 4.0021 +2.2015 3.3012 2.7066 +2.2015 -3.2529000000000003 3.9255999999999998 +2.2015 -2.6433 4.0781 +2.2015 -4.167 2.859 +2.2015 -1.3478999999999999 4.3067 +2.2015 7.5673 4.3065 +2.2015 7.5673 2.7066 +2.2015 3.2243 3.9258 +2.2015 3.2243 4.306900000000001 +-4.2753 -2.6432 1.8686 +-4.2753 3.1481000000000003 1.2586 +-4.2753 0.4815 -2.856 +-4.2753 3.2243 1.335 +-0.9985 -0.9665 4.7639000000000005 +4.6399 -1.1955 -11.2381 +4.6399 3.3005 -1.5610000000000002 +4.6399 0.1 -1.9415000000000002 +4.6399 -0.8907 -11.2381 +-3.2087999999999997 3.3012 1.335 +-3.2087999999999997 7.567699999999999 1.1063 +-3.2087999999999997 7.567699999999999 1.335 +-3.132 -4.0148 -2.8565 +-3.132 -4.091 -4.9135 +2.5063999999999997 1.5478 -4.9135 +2.5063999999999997 2.2334 -6.665799999999999 +2.5063999999999997 1.4718 -5.5995 +2.5063999999999997 2.3097 -6.133 +2.5063999999999997 1.3193 -5.3711 +2.5063999999999997 1.167 -4.9135 +2.5063999999999997 2.3098 -6.0563 +-4.8088 -0.7383 -4.9135 +-4.8088 0.25270000000000004 -6.5143 +-4.8088 -2.9482999999999997 -1.5602 +-4.8088 -0.4331 -4.914700000000001 +-4.8088 -0.7382 -4.9135 +-4.8088 -0.9668 -4.914700000000001 +-4.8088 -1.0433 -6.590400000000001 +-4.8088 -0.967 -4.914700000000001 +-4.8088 -1.6528 -4.914700000000001 +-4.8088 -0.7381000000000001 -10.627699999999999 +-4.8088 0.7091000000000001 -11.2381 +-1.532 4.5958 -11.2381 +4.106400000000001 -2.6433999999999997 1.1825 +4.106400000000001 -4.166799999999999 0.2683 +0.9063999999999999 -2.872 4.5354 +0.9063999999999999 -2.0335 4.6877 +-2.3704 -4.0912 -4.914700000000001 +-3.6655 -2.7194 2.8592 +-4.503900000000001 -2.7194 -0.8752 +-4.503900000000001 0.3286 -0.8752 +4.4113 -2.7197 -0.3414 +4.4113 3.3005 -0.7226 +4.4113 0.7861 -0.7226 +1.2113 -3.3292 4.3065 +3.6497 3.2243 3.2399999999999998 +1.5162 -4.8529 -4.8369 +-1.7606 3.6811999999999996 -7.504 +0.6778000000000001 2.2335000000000003 -4.9135 +0.6778000000000001 7.5673 4.7638 +-0.1606 -5.3102 -2.9326000000000003 +-0.1606 -5.0053 -4.9135 +-0.1606 -5.0053 -2.8565 +-0.1606 1.0146 -4.7608999999999995 +-0.1606 0.786 -4.5325 +-0.1606 -4.7005 -4.6845 +-0.1606 -4.7005 -4.9135 +-0.1606 -4.9291 -2.9326000000000003 +-0.1606 -5.6149 -0.8753000000000001 +-0.1606 2.1572999999999998 -4.913399999999999 +-0.1606 2.1572999999999998 -4.5325 +2.2778 -4.5483 -4.9135 +-4.199 -3.6336 -2.9326000000000003 +-4.199 3.1481000000000003 -2.551 +-4.199 -4.0145 0.1158 +-4.199 0.5571999999999999 -2.8565 +-4.199 -2.7195 1.9444 +4.716200000000001 -0.662 -4.9135 +4.716200000000001 0.48129999999999995 -6.819500000000001 +4.716200000000001 -0.8906000000000001 -11.2381 +4.716200000000001 -0.8906000000000001 -4.914700000000001 +4.716200000000001 -0.2808 -4.914700000000001 +4.716200000000001 0.8614999999999999 -11.2381 +4.716200000000001 0.8614999999999999 -9.0275 +4.716200000000001 -1.8812 -4.9135 +4.716200000000001 3.3005 1.1824 +4.716200000000001 -0.7378 1.1824 +-1.8374000000000001 3.9097 -9.0283 +-3.1325 -4.0907 -4.914700000000001 +-0.6941 3.2251000000000003 4.839799999999999 +-0.6941 4.5959 -9.0277 +-0.6941 3.2243 4.8402 +-3.8941000000000003 2.8434 -9.0277 +1.7443 4.2907 -8.7993 +-4.7325 -2.7194 0.26789999999999997 +4.1827000000000005 -4.0908 -0.3414 +4.1827000000000005 3.3773 2.5542 +0.9827 -0.8906000000000001 4.764 +2.8876 -2.6433 3.6207999999999996 +2.8876 2.3864 -6.285399999999999 +-3.5892 1.0908 -4.9135 +2.0492 3.8336 -9.0277 +2.0492 3.8339 -11.2381 +2.0492 3.8339 -9.0283 +-4.4276 -2.7194 0.1152 +-4.4276 -2.643 -4.9908 +1.2108 2.1572999999999998 -4.913399999999999 +4.4876 -2.3382 -5.2193000000000005 +4.4876 -0.8907 -4.914700000000001 +4.4876 7.5673 1.7162 +-1.9892 3.2251000000000003 4.0779000000000005 +-1.9892 3.2251000000000003 4.459 +-1.9892 -1.6527 4.3827 +-1.9892 -0.5854 4.4592 +-1.9892 3.3012 2.859 +-1.9892 -1.1954 4.0781 +-1.9892 -1.1954 4.0783 +-1.9892 -2.7191 3.7735 +-1.9892 -2.7191 4.1545 +-1.9892 7.5673 4.3066 +-1.9892 7.5673 2.859 +-1.9892 3.2243 4.4592 +-1.9892 3.2243 4.0783 +0.3724 -1.1954 4.764 +0.3724 -2.7191 4.6116 +0.3724 -1.2719 4.4591 +0.44920000000000004 -4.9289 -2.8558 +0.44920000000000004 -5.3100000000000005 1.4112 +-4.1227 0.6334000000000001 -4.9135 +4.7925 -0.2808 -7.276299999999999 +4.7925 -1.1192 -3.3896999999999995 +4.7925 0.10020000000000001 -10.703899999999999 +4.7925 -1.424 -4.9135 +4.7925 -1.8812 -2.8565 +4.7925 -2.4147 -2.8565 +4.7925 3.3005 -0.8752 +4.7925 -1.8814000000000002 -2.8565 +-1.6843000000000001 2.3864 -5.9046 +3.9541 -3.2529000000000003 -5.067 +0.7541 -5.0054 -4.9908 +-3.2842999999999996 -4.396 -3.0086999999999997 +2.3541 4.2145 -11.2381 +-0.9227000000000001 4.2146 -8.1136 +-2.2178 -4.9291 -2.8565 +0.1438 4.2146 -8.9515 +0.1438 4.367 -9.0277 +0.1438 4.5959 -8.875399999999999 +0.1438 2.5387 -5.9807 +0.1438 2.3101 -6.285499999999999 +0.1438 2.3101 -5.8279 +0.1438 3.9859 -7.656300000000001 +3.4206 2.1574 -2.8563 +3.4206 0.7858999999999999 -2.8563 +-3.8946 0.32889999999999997 -2.856 +-3.8177999999999996 2.1572999999999998 -3.0848 +1.8206 -4.015 -8.8753 +1.8206 -4.3959 -11.2381 +1.8206 -4.3959 -4.914700000000001 +1.8206 4.4433 -9.7142 +1.8206 -4.7005 -4.914700000000001 +-4.6562 3.1481000000000003 -1.4847000000000001 +4.259 -0.9669000000000001 -8.8753 +4.259 2.2334 -11.2381 +4.259 2.0811 -8.4187 +4.259 1.1668 -11.2381 +4.259 1.3194000000000001 -8.4187 +4.259 -3.7859999999999996 -2.0177 +0.5255 -2.6432 4.611400000000001 +0.5255 -0.6614 4.8402 +2.9638999999999998 2.1574 -3.9229 +2.0486999999999997 3.2242 -4.4559 +-4.3513 3.1481000000000003 -0.9511999999999999 +-4.3513 -0.7382 -4.1513 +1.2871000000000001 -0.8906000000000001 4.6878 +4.5639 0.1 -0.6462 +4.5639 0.024 1.7922 +4.5639 3.2243 1.7922 +-1.9897000000000002 7.567699999999999 -2.7798 +-1.9897000000000002 7.567699999999999 -2.856 +-1.9897000000000002 3.3008 -2.7798 +-1.9897000000000002 3.3008 -2.856 +-1.9129 -1.2719 4.0021 +3.7255000000000003 -4.2432 1.4874999999999998 +-4.1232 -3.1001000000000003 -4.914700000000001 +-0.8463999999999999 3.6051 -7.1998999999999995 +-1.6847999999999999 -2.7199 3.8493 +-1.6847999999999999 -2.9484 4.2304 +4.0304 -2.7197 1.4112 +4.0304 2.6149 -9.790600000000001 +4.0304 -3.1763 -4.9135 +0.8304 4.7482999999999995 -11.2381 +3.2688 7.567699999999999 -0.9511999999999999 +3.2688 7.567699999999999 1.1825999999999999 +3.2688 3.3005 -0.9511999999999999 +3.2688 3.3005 1.1825999999999999 +-4.5799 3.2251000000000003 1.7160000000000002 +-4.5799 0.1 -4.9135 +-4.5799 7.5673 1.4874 +-4.5799 7.5673 1.335 +4.3353 2.005 -11.2381 +4.3353 3.2251000000000003 1.1828999999999998 +4.3353 -0.8906000000000001 -11.2381 +4.3353 -0.8906000000000001 -8.8753 +4.3353 1.7002 -7.4286 +4.3353 0.4051 -4.914700000000001 +4.3353 -1.8812 -4.9135 +4.3353 3.3005 1.1824 +4.3353 2.0812 -9.4082 +2.7353 -3.3292 3.5444999999999998 +-3.8183000000000002 -4.0145 0.1158 +-0.5415 -4.7767 -11.2381 +-0.5415 -5.0054 -5.2193000000000005 +1.8969 -4.7006 -4.9908 +1.8969 3.3005 -2.856 +0.6018 -5.5385 2.2492 +2.125 -4.7008 3.0115 +-1.8366 3.3012 2.859 +-1.8366 -1.1954 4.0783 +-1.8366 7.5673 2.859 +-3.2085000000000004 2.1574 -3.6946 +2.4299 -4.015 -4.9135 +-3.1317 3.3005 -3.7706999999999997 +2.5067 3.9859999999999998 -8.9518 +-0.7701 -5.4624 2.4019 +-0.7701 -5.0054 -4.9908 +-4.8085 7.4911 0.0397 +-4.8085 3.1481000000000003 -0.8748 +-4.8085 7.567699999999999 -0.4176 +-4.8085 0.32889999999999997 -0.8752 +-4.8085 0.32889999999999997 -1.1037 +4.1067 2.3098 -8.189499999999999 +4.1067 -2.4903999999999997 1.2588 +-2.4469000000000003 -4.7767 2.6306 +-2.4469000000000003 -5.0053 1.9444 +-2.4469000000000003 -3.6336 -11.2381 +-2.4469000000000003 -3.6336 -8.8753 +-2.4469000000000003 -4.0145 -5.067 +-2.4469000000000003 1.6239 -4.914000000000001 +-2.4469000000000003 -2.7199 3.9254 +-2.4469000000000003 -4.3954 -5.6000000000000005 +-2.4469000000000003 -4.3954 -4.914700000000001 +-2.4469000000000003 4.1384 -9.4094 +-2.4469000000000003 -4.4719 -2.4747000000000003 +-2.4469000000000003 -5.234 0.1152 +-2.4469000000000003 -5.234 0.1158 +-2.4469000000000003 -4.0907 -11.2381 +-2.4469000000000003 -4.6244 1.9444 +-2.4469000000000003 -4.853 -0.1131 +-2.3701 -4.472 -2.6271 +-2.3701 -5.3101 1.1060999999999999 +-2.3701 -5.3100000000000005 -0.1894 +3.2682999999999995 0.7096 -3.6941 +1.9731999999999998 -4.3957999999999995 -11.2381 +1.1348 -4.7005 -10.9323 +4.4116 -2.6432 -2.856 +4.4116 0.1 -2.7036000000000002 +0.37320000000000003 -4.2437000000000005 3.5446 +0.37320000000000003 -5.0053 3.3159 +0.37320000000000003 -5.615 1.4112 +0.37320000000000003 -5.615 1.8686999999999998 +0.37320000000000003 -4.3198 3.9255999999999998 +-3.742 2.3094 -6.9705 +-3.742 2.2335000000000003 -8.1142 +-3.742 2.3098 -11.2378 +3.8781000000000003 2.1574 -3.0086999999999997 +3.8781000000000003 3.3005 -2.8565 +3.8781000000000003 0.7096 -4.9135 +0.6780999999999999 7.567699999999999 -4.7608999999999995 +3.0397 -4.0911 -4.9135 +-1.0755000000000001 -5.234 -2.8565 +2.2781 3.6813 -7.8849 +2.2781 2.3102 -6.0565 +2.2781 3.3773 4.3068 +2.2781 7.5673 4.2299999999999995 +-4.2755 3.1481000000000003 1.2587 +-4.2755 3.1481000000000003 1.335 +4.6397 -1.8814000000000002 -4.9135 +-3.1322 -0.35669999999999996 3.7733000000000003 +-3.9705999999999997 -0.2805 2.7828 +-3.9705999999999997 -0.2805 2.8592 +-3.9705999999999997 -1.1189 2.7828 +-3.9705999999999997 -4.0145 1.3347 +-3.9705999999999997 0.2523 -2.6272 +-3.9705999999999997 0.3286 -2.856 +-3.9705999999999997 3.2243 2.7828 +-3.9705999999999997 3.2243 2.8592 +4.183 -2.3382 -11.2381 +1.9727000000000001 -2.6432 4.2306 +-4.504099999999999 3.1481000000000003 0.26789999999999997 +-4.504099999999999 -2.7194 -0.8746 +3.6494999999999997 -4.2437000000000005 1.5637999999999999 +3.6494999999999997 1.0906 -5.0665000000000004 +3.6494999999999997 2.2334 -7.9612 +3.6494999999999997 2.3097 -6.970400000000001 +3.6494999999999997 0.5574 -4.9901 +3.6494999999999997 0.5574 -5.0665000000000004 +3.6494999999999997 -4.015 -3.0086999999999997 +3.6494999999999997 2.2332 -8.265699999999999 +3.6494999999999997 2.3098 -7.0467 +3.6494999999999997 1.0908 -4.9901 +0.4495 -5.3099 1.4112 +-0.46569999999999995 -0.7381000000000001 4.8402 +-1.7608 -4.7767 -5.067 +-1.7608 4.3674 -9.0283 +-1.7608 4.062600000000001 -9.0283 +-1.7608 4.5196 -11.2381 +-1.7608 -5.3863 1.9446 +3.8775999999999997 3.3005 -2.8562 +3.9544 -2.3382 -6.1336 +3.9544 -2.5668 2.4779 +3.9544 0.1 -2.856 +-2.5992 3.9859 -9.0283 +-2.5224 -4.0148 -4.9135 +-2.5224 -4.472099999999999 -4.9135 +3.116 2.3097 -6.3615 +-3.3608 3.5288 -10.019 +-4.1992 2.3099000000000003 -11.2381 +-4.1992 2.3099000000000003 -9.0283 +-4.1992 -4.0148 0.1158 +-4.1992 1.0900999999999998 -11.2381 +-4.1992 -0.0524 -4.914700000000001 +-4.1992 0.5574 -4.914700000000001 +-4.1992 0.6336999999999999 -4.9138 +-4.1992 2.3863 -9.0277 +-4.1992 2.3098 -11.2381 +-4.1992 2.0812 -7.9622 +-4.1992 2.157 -8.1136 +-4.1992 0.0243 -4.9902 +-0.9224 -3.862 4.1542 +-0.9224 4.748200000000001 -10.7045 +4.716 6.424 -0.9511999999999999 +3.4209000000000005 -4.7765 -0.2651 +2.5825 -5.233899999999999 0.1158 +2.5825 -3.4814 -8.8753 +2.5825 -4.777 -2.8558 +2.5825 -4.3957999999999995 -4.914700000000001 +-3.8943 7.567699999999999 -2.856 +4.1825 3.3769 -2.551 +0.9825 -5.233899999999999 -2.8565 +2.8874 -1.7283 3.8493 +-0.38939999999999997 -5.6149 1.9446 +-0.38939999999999997 -5.3100000000000005 -2.856 +-3.5894000000000004 -4.0148 1.9444 +-3.5894000000000004 -3.7098 -4.9908 +-3.5894000000000004 2.9196 -7.8849 +2.049 -4.2432 2.859 +2.049 -0.8906000000000001 4.0021 +2.049 3.3012 2.7066 +2.049 -2.5668 3.6974 +2.049 0.7866 3.9258 +2.049 -4.167 2.859 +2.049 3.2243 3.9258 +-4.4277999999999995 3.1481000000000003 -0.4175 +-4.4277999999999995 3.1481000000000003 -0.8746 +-4.4277999999999995 -2.7194 0.26789999999999997 +-4.4277999999999995 -2.7194 -0.2653 +-4.4277999999999995 -2.7194 -2.856 +-4.4277999999999995 0.3286 -1.1037 +-1.9893999999999998 -2.6432 4.1542 +-1.9893999999999998 3.2251000000000003 4.383 +-1.9893999999999998 3.3012 2.7829 +-1.9893999999999998 -2.7194 3.7733000000000003 +-1.9893999999999998 4.7487 4.383 +-1.9893999999999998 7.5673 4.3066 +-1.9893999999999998 7.5673 2.7829 +-1.9893999999999998 3.2243 4.001799999999999 +-1.9893999999999998 3.2243 4.3827 +0.449 -4.7767 -11.2381 +0.449 2.005 -5.9801 +0.449 1.7004 -5.3709 +0.449 -4.5483 -6.1336 +0.449 -4.6243 -5.067 +0.449 1.7765 -4.9135 +0.449 -4.3959 -11.2381 +0.449 -4.3959 -8.8753 +0.449 2.2335000000000003 -6.2087 +0.449 2.0049 -5.9801 +0.449 2.3098 -6.2087 +0.449 2.3098 -5.7516 +0.449 -5.0054 -4.914700000000001 +0.449 -4.7005 -4.914700000000001 +0.449 1.7766 -4.9138 +0.449 1.7766 -5.5995 +-4.1229000000000005 2.3098 -8.1142 +-4.1229000000000005 1.3954 -11.2378 +-4.1229000000000005 1.3954 -8.876100000000001 +-0.8461 -1.1954 4.764 +4.7923 -2.6432 -0.1127 +4.7923 -1.348 -4.914700000000001 +4.7923 3.3005 -0.6461 +4.7923 3.3005 0.9538 +4.7923 -1.4237 0.8014 +4.7923 -0.8907 -5.067 +0.7539 -5.0053 -4.9135 +3.1923 0.6333 -4.0749 +-2.218 1.5478 -5.5996 +-2.218 1.3192000000000002 -4.9138 +-2.218 2.2334 -6.513299999999999 +-2.218 2.3097 -5.980499999999999 +-2.218 1.3193 -5.1425 +-2.218 1.3193 -4.914000000000001 +-2.218 2.2335000000000003 -6.4375 +-2.218 2.0049 -6.2087 +-2.218 2.3098 -5.9801 +3.4204 2.1574 -3.5421 +3.4204 2.1574 -2.8565 +3.4204 3.3005 -2.8565 +3.4972000000000003 -4.2431 -2.856 +3.4972000000000003 -4.700200000000001 0.8015 +-0.618 3.3769 -4.8369 +-3.818 2.3863 -7.1998999999999995 +1.8204000000000002 -4.2432 3.6211 +1.8204000000000002 7.567699999999999 -2.856 +1.8204000000000002 3.3005 -4.5322000000000005 +-4.6564000000000005 1.0900999999999998 -7.3524 +-4.6564000000000005 -1.4243000000000001 -11.2381 +-4.6564000000000005 0.6336999999999999 -6.1336 +-4.6564000000000005 -3.3291 -0.1894 +4.2588 -1.9576 -4.9135 +4.2588 -3.4812000000000003 -2.8565 +0.5253 -4.3197 -8.8753 +3.8021 -0.12819999999999998 3.0875 +-2.7515 -1.3475000000000001 4.001799999999999 +-3.5899 0.6334000000000001 -4.9135 +-3.5899 0.6334000000000001 -3.1611000000000002 +-3.5131 3.2243 2.7828 +2.1253 3.6811999999999996 -8.875399999999999 +2.1253 2.3101 -6.5903 +2.2020999999999997 3.2251000000000003 3.849 +2.2020999999999997 3.3012 2.6306 +2.2020999999999997 3.3773 4.3068 +2.2020999999999997 7.5673 4.2299999999999995 +2.2020999999999997 7.5673 2.6306 +-1.0747 -2.948 4.459 +4.5637 3.2251000000000003 1.7924 +4.5637 -2.6433999999999997 1.0302 +4.5637 -1.5003 -11.2381 +-0.8465999999999999 7.567699999999999 -4.7608999999999995 +-4.0466 -3.3287999999999998 -4.6084 +1.5918 2.3864 -5.9046 +4.8686 0.5561 -0.6461 +4.8686 3.3005 0.2682 +4.8686 3.3005 -0.265 +4.8686 -2.2620999999999998 -0.6461 +4.8686 -0.7378 0.3442 +-4.885 3.3769 0.3443 +-4.885 3.1481000000000003 0.1159 +-4.885 -0.6622 -0.8752 +-4.885 -2.1096 -2.8565 +-4.885 -2.4905 -0.8752 +-4.885 -2.3384 -2.551 +-4.885 -1.6525 -2.856 +-1.6081999999999999 -0.662 4.6115 +-1.6081999999999999 4.062600000000001 -11.2381 +-2.4466 -5.233899999999999 0.0398 +-2.4466 -5.233899999999999 0.0393 +-2.4466 -4.8532 -2.856 +-2.4466 -4.472 -2.856 +-2.4466 -4.7008 1.9446 +-2.4466 -5.0817 1.9446 +-2.4466 -4.9293 0.0398 +-2.4466 -4.9293 0.0393 +3.1918 -4.2437000000000005 1.4112 +-3.2849999999999997 3.3012 -0.9511999999999999 +-3.2849999999999997 7.567699999999999 -0.8752 +-0.0082 2.6909 -4.9135 +-0.0082 7.567699999999999 -3.4659000000000004 +-0.0082 7.567699999999999 -4.7608999999999995 +-0.0082 2.1574 -4.9135 +-0.0082 2.1574 -4.5323 +-0.0082 3.3005 -4.4559 +-0.0082 3.3005 -3.4659000000000004 +-0.0082 3.3005 -4.8369 +-0.0082 2.3861 -4.4559 +2.3533999999999997 2.1574 -4.3797999999999995 +-4.5801 7.567699999999999 -1.5609 +-4.5801 -2.8719 0.9542 +4.3351 -0.8907 -11.2381 +4.3351 0.2526 -2.856 +4.3351 3.2243 1.1825999999999999 +2.7351 -3.9384 -4.1513 +-3.8185 0.6334000000000001 -2.8565 +-0.5417 7.5673 4.7638 +-3.7417 2.3099000000000003 -11.2381 +-3.7417 2.3099000000000003 -9.0283 +-3.7417 -4.0148 0.1158 +-3.7417 0.7098 -4.0752999999999995 +1.8967 -5.0816 -2.6271 diff --git a/assets/xarm7/contacts/link2_vhacd.txt b/assets/xarm7/contacts/link2_vhacd.txt new file mode 100644 index 0000000..4f2b511 --- /dev/null +++ b/assets/xarm7/contacts/link2_vhacd.txt @@ -0,0 +1,1645 @@ +1644 +3.7376 -19.2212 -2.0062 +3.7376 -19.2212 -1.7442 +1.3823999999999999 -14.1618 -4.0996999999999995 +1.3823999999999999 -15.0349 -2.5296 +-1.2352 -3.1694 11.8653 +-3.5904 -14.2487 4.712000000000001 +-3.5904 -13.551499999999999 9.946000000000002 +-3.5904 -9.276299999999999 -1.308 +-3.5904 -13.3766 2.4436 +-3.5904 -14.1617 -2.4421000000000004 +-3.5904 -14.1617 -1.3953 +-3.5904 -14.0744 8.5503 +2.7776 -19.2217 3.3154000000000003 +3.04 0.40679999999999994 11.4289 +3.04 1.8033000000000001 11.2545 +3.04 -9.4507 11.429 +3.04 -3.1694 11.4289 +3.04 -3.1694 10.992799999999999 +3.04 3.2862 9.5969 +-2.1952 -15.383099999999999 3.6642 +4.4352 -12.7659 8.5508 +4.4352 -10.061 10.5571 +4.4352 -3.8683 10.5571 +4.4352 -6.8324 9.858799999999999 +2.3424 -15.383099999999999 1.9201 +-2.8928 -14.2487 4.4502 +-2.8928 -14.2487 7.3285 +-2.8928 -14.8597 4.2757000000000005 +4.5225 -9.188699999999999 1.6581 +4.5225 -10.1484 -0.2607 +-2.8055 -7.0082 -0.17329999999999998 +-2.8055 -9.276299999999999 -2.7039 +-2.8055 -9.3643 -2.5293 +-2.8055 -8.1421 -2.0060000000000002 +3.8249 -13.637599999999999 1.9201 +3.8249 1.8033000000000001 10.4695 +3.8249 -14.336199999999998 2.0075 +3.8249 -13.3759 2.3563 +3.8249 -13.2018 4.2754 +3.8249 -14.1618 -1.7442 +3.8249 -7.9676 1.9201 +3.8249 -7.9676 4.2754 +3.8249 -13.3766 1.9201 +3.8249 -13.3766 1.9199000000000002 +3.8249 -13.3766 4.2754 +3.8249 -14.3371 -1.9188 +3.8249 -13.8128 4.2754 +3.8249 -11.8938 10.0333 +-3.5031 -7.618600000000001 0.08760000000000001 +-3.5031 -8.1421 1.9199000000000002 +2.8649 -3.8675 8.7248 +3.1273000000000004 -6.833500000000001 8.027199999999999 +-1.8455 -14.2486 2.6182 +-1.8455 -15.0337 2.3560999999999996 +-1.8455 -15.382599999999998 4.2754 +-1.8455 -12.678700000000001 3.9261 +2.9522 -3.7802000000000002 9.858799999999999 +3.2146 -3.1694 11.3419 +0.597 3.9838999999999998 10.4695 +0.597 1.8033000000000001 11.5165 +0.597 1.8033000000000001 11.8653 +0.597 4.4204 10.4695 +0.597 4.4204 7.5033 +0.597 1.8901000000000001 11.8653 +0.597 4.2461 10.7309 +0.597 -0.9878 11.9525 +0.597 3.8099000000000003 10.6434 +0.597 4.6821 7.5033 +0.597 2.7634 11.6907 +0.597 -3.1694 11.6035 +0.597 -3.1694 11.8653 +0.597 -3.1694 11.6037 +0.597 4.2459 8.4635 +0.597 4.4205000000000005 7.5033 +0.597 1.9778 11.5164 +0.597 4.6822 9.5967 +0.597 4.6822 7.5033 +0.597 3.8968000000000003 11.167399999999999 +-4.3758 0.0585 9.8586 +-4.3758 0.0585 7.5033 +4.6098 -9.4505 4.2754 +2.2546 -14.685400000000001 7.3288 +2.2546 3.6350000000000002 10.7314 +2.2546 3.7224 10.4695 +2.2546 3.1988999999999996 10.3821 +-0.363 -8.4916 11.8653 +-2.4558 -19.2217 3.5773 +3.9122 -8.142000000000001 4.2754 +3.9122 -8.2294 1.9201 +3.9122 -13.725200000000001 4.2754 +-3.4158 -19.2217 2.7054 +-3.4158 -15.383099999999999 2.7054 +1.3819 -7.0078000000000005 -1.9183 +1.3819 -6.310200000000001 1.9199000000000002 +-0.9733 4.2458 9.6845 +-0.9733 3.7226000000000004 10.7309 +-0.9733 4.1586 10.731200000000001 +-0.9733 4.2459 9.6843 +-0.9733 4.4205000000000005 10.3818 +-0.9733 3.7224 10.731200000000001 +-0.9733 4.5076 9.6843 +-0.9733 4.6822 7.5033 +-0.9733 4.3333 7.5033 +-3.3285 -7.9673 1.9201 +-3.3285 -7.9673 4.2754 +3.0395 -3.1694 8.7248 +3.0395 -3.1694 9.6842 +3.3019 -7.8804 1.9195 +-4.2885 -8.6656 7.3285 +-4.2885 -19.2212 0.5237999999999999 +-4.2885 -19.2212 0.5242 +-4.2885 -19.2212 0.6988 +-4.2885 -14.3371 -0.61 +-4.2885 -14.249 0.5237999999999999 +-4.2885 -18.959400000000002 0.1749 +-4.2885 -14.249500000000001 0.5237999999999999 +-4.2885 -14.249500000000001 0.5242 +-4.2885 -14.249500000000001 0.6988 +-4.0261 -12.1555 10.295 +4.6971 -1.8608 10.1202 +4.6971 -1.8608 8.5503 +4.6971 -10.410400000000001 1.92 +4.6971 -3.1694 9.0732 +4.6971 -3.1694 9.9461 +4.6971 -6.833500000000001 10.0333 +4.6971 -6.8324 9.858799999999999 +2.0795 -3.1694 11.6906 +-2.6309 3.3737999999999997 9.6845 +4.7844 -1.8608 9.7715 +4.7844 -10.410400000000001 4.2754 +4.7844 -3.1694 9.7715 +4.7844 -10.3227 2.618 +2.4292000000000002 -15.0339 7.3285 +-0.1884 -7.9677999999999995 -3.4888000000000003 +-2.5436 -7.8804 -2.0060000000000002 +4.0868 -14.161399999999999 1.9201 +4.0868 -1.8608 9.5972 +4.0868 1.1926 10.4694 +4.0868 -8.9273 7.3285 +1.4692 -6.746199999999999 1.9199000000000002 +-0.886 4.6822 9.3351 +-3.5035999999999996 -5.0013000000000005 11.2544 +-3.2412000000000005 -9.2761 -2.0060000000000002 +-3.2412000000000005 -8.0551 -2.0934999999999997 +0.7716 1.8033000000000001 11.4292 +0.7716 -3.1694 11.5165 +0.7716 -15.6447 4.6243 +-1.846 -5.0889 8.027 +-1.846 -5.6996 8.027 +-1.846 -5.6996 7.939499999999999 +-4.2012 -11.8935 0.5237999999999999 +-4.2012 -11.8935 -1.308 +-4.2012 -11.8066 10.2951 +-4.2012 -14.074200000000001 -1.0461 +-4.2012 -9.8873 10.295 +-1.7587 -19.2212 -2.3553 +-1.7587 -14.249899999999998 -2.6166 +-1.7587 -14.1618 -3.8379000000000003 +-1.7587 -18.959200000000003 -3.9253000000000005 +2.2540999999999998 3.9844 10.2076 +2.2540999999999998 4.2459 9.1606 +2.5165 -19.2212 -1.7442 +2.5165 -5.4379 8.114 +2.5165 -5.4379 8.2014 +2.5165 -5.0889 8.114 +2.5165 -16.692 -1.6568 +2.5165 -18.523400000000002 -1.5694 +4.1741 1.1926 9.5972 +1.5565 -7.9676 -3.0528 +1.8189 -15.383099999999999 3.9261999999999997 +-3.1538999999999997 -12.8535 10.905800000000001 +3.9989999999999997 1.1926 10.4694 +-0.7113999999999999 0.6688000000000001 11.9525 +-0.7113999999999999 -3.1694 11.5164 +-0.7113999999999999 1.9778 11.4292 +-3.329 -7.6188 7.3285 +-3.329 -9.2762 -2.0060000000000002 +-3.329 -14.1617 -2.7039 +-3.329 -8.1421 -2.0060000000000002 +-3.329 3.4606 8.4632 +0.9462 2.7634 11.6907 +0.9462 -7.880199999999999 -3.7504999999999997 +-4.0266 -8.2295 1.5706000000000002 +2.3414 -19.2217 1.9201 +2.3414 -15.383099999999999 1.9201 +2.6037999999999997 -10.410400000000001 -3.3145000000000002 +2.6037999999999997 -14.1617 -3.4890999999999996 +-0.0138 4.3333 7.5033 +0.0735 -4.7397 9.858799999999999 +-2.5441 -6.833500000000001 11.1673 +-2.5441 -6.833500000000001 11.5164 +-2.5441 -14.249 1.9201 +-2.5441 -11.5441 11.429 +-2.2817 -3.1694 11.6907 +-2.2817 4.2459 9.2477 +-2.2817 -6.396699999999999 11.6906 +1.7311 -10.4102 -3.4889 +1.7311 -10.4102 -3.8379999999999996 +1.7311 -7.9676 -3.4892 +1.7311 -7.9676 -2.9654 +1.7311 -9.1021 -3.7504999999999997 +-0.8865 4.2461 10.8185 +-3.2417000000000002 -6.9212 8.3756 +-3.2417000000000002 -6.8341 7.3288 +-2.9793 1.978 11.167399999999999 +3.3887 3.2866 7.5033 +3.3887 3.3739 8.5503 +3.3887 -13.027700000000001 1.9199000000000002 +3.3887 -12.678700000000001 1.9199000000000002 +-3.9393 -6.8341 9.073599999999999 +-3.9393 -7.7933 6.9795 +-3.9393 -14.249500000000001 1.7453 +-3.9393 -8.1421 1.9199000000000002 +3.476 -3.3441 7.5033 +3.476 -5.0887 8.8117 +3.476 -5.0887 8.376 +3.476 -5.0887 8.7247 +3.476 -3.1694 8.0269 +3.476 -3.1694 8.7248 +3.476 -3.1694 7.5033 +3.476 -3.1694 8.7247 +3.476 -3.1694 9.858799999999999 +3.476 -12.678 1.7453 +3.476 -12.678 1.9199000000000002 +3.476 -3.4314999999999998 7.5033 +3.476 -14.249 -1.6568 +3.476 -14.249 1.9199000000000002 +3.476 -5.0009999999999994 8.2884 +1.1208 -7.444000000000001 -3.576 +-1.4968000000000001 -6.6593 4.2757000000000005 +-1.4968000000000001 1.8901000000000001 11.3419 +-1.4968000000000001 -6.659 6.0199 +-1.4968000000000001 -6.659 4.2754 +-1.4968000000000001 -6.310300000000001 7.241300000000001 +-1.4968000000000001 -6.1357 7.241300000000001 +-1.4968000000000001 -6.1357 6.281200000000001 +-1.4968000000000001 -3.1694 11.7781 +-1.4968000000000001 -3.1694 11.5164 +-1.4968000000000001 1.9778 11.6908 +-1.4968000000000001 1.9778 11.4292 +-1.4968000000000001 1.9778 11.6909 +-1.4968000000000001 -6.310200000000001 7.1536 +-1.4968000000000001 -6.1356 7.3285 +0.1608 -12.1546 11.6908 +0.1608 -12.2424 11.3419 +0.1608 -15.383 7.3288 +0.1608 -15.383 7.329 +0.1608 -12.1556 11.6909 +0.1608 -15.2084 10.0333 +0.1608 -15.6446 8.6375 +0.1608 -15.6446 7.329 +0.1608 -11.632299999999999 11.341700000000001 +0.1608 -15.0335 10.295 +0.1608 -14.8594 9.9459 +0.1608 -5.0889 7.4161 +0.1608 -5.0889 7.8522 +0.1608 -15.6448 8.5505 +0.1608 -14.510200000000001 10.295 +0.1608 -15.2083 10.0333 +0.1608 -14.161499999999998 11.1673 +0.1608 -6.834 11.6035 +0.1608 -6.834 11.8653 +0.1608 -14.5982 10.295 +0.1608 -15.121200000000002 10.295 +0.1608 -11.5436 11.3419 +0.1608 -14.1612 11.167399999999999 +0.1608 -5.1761 7.8522 +0.1608 -14.771999999999998 10.0333 +0.1608 -5.6996 7.3288 +0.1608 -5.6996 7.5034 +0.1608 -12.2427 11.6035 +-2.1944000000000004 -4.3038 7.5033 +4.1736 -19.2212 0.2623 +4.1736 -19.1336 0.6113000000000001 +4.1736 -14.249500000000001 1.3962999999999999 +-0.7992000000000001 -6.8328 11.8653 +-0.7992000000000001 -4.7397 9.684099999999999 +-0.7992000000000001 -6.833500000000001 11.8653 +-3.1544000000000003 -6.8328 11.0802 +4.2609 -10.410400000000001 10.0336 +4.2609 -3.1694 8.1142 +4.2609 -12.33 4.2757000000000005 +-1.4095 -2.2967999999999997 11.8653 +-1.4095 0.6688000000000001 11.8653 +-3.7647 -19.2212 1.9199000000000002 +0.24810000000000001 -12.3301 11.2544 +-2.1071 -9.1888 -3.6634 +-2.1071 -15.2955 4.2754 +-4.7246999999999995 -11.108600000000001 1.9201 +-4.7246999999999995 -11.108600000000001 4.2754 +-4.7246999999999995 -11.6321 4.2754 +-4.7246999999999995 -6.8328 10.0335 +-4.7246999999999995 -6.8328 9.859 +-2.2822 -4.2162999999999995 9.8586 +-2.2822 -3.1694 11.6908 +-2.2822 -15.0349 -1.7443 +-4.6373999999999995 -9.799900000000001 7.3288 +-4.6373999999999995 -11.9805 7.3288 +-4.6373999999999995 -12.1556 2.0075 +-4.6373999999999995 -12.0683 1.9199000000000002 +-4.6373999999999995 -9.973600000000001 10.3824 +-4.6373999999999995 -9.973600000000001 10.295 +4.3482 -14.1611 0.2623 +4.3482 -14.074300000000001 0.2623 +4.3482 -10.410400000000001 -0.9587999999999999 +4.3482 -10.410400000000001 1.6578 +4.3482 -3.1694 9.946000000000002 +4.3482 -3.1694 8.2885 +4.3482 -14.249 0.6113000000000001 +1.7306 -6.3974 1.9201 +3.6506 -7.7061 4.2757000000000005 +3.6506 -8.404399999999999 4.2754 +3.6506 -10.410400000000001 -1.5694 +3.6506 -10.410400000000001 -1.7442 +3.6506 1.1926 10.2949 +3.6506 0.8435 10.3821 +3.6506 0.8435 10.4694 +1.2954 -19.2217 4.1007 +3.4755000000000003 -19.2212 -2.6169000000000002 +3.4755000000000003 -14.1618 -2.6169000000000002 +3.7379000000000002 -7.9681 -0.3479 +-1.2349 -5.0887 7.5033 +-1.2349 -6.2229 1.9199000000000002 +-3.5901 -3.1694 10.731200000000001 +-2.1949 -7.0082 1.9199000000000002 +-2.1949 -6.659 1.9199000000000002 +-2.1949 -7.4441 -1.8307 +-2.1949 -7.095400000000001 -2.0060000000000002 +-4.5501 -12.591099999999999 4.2757000000000005 +-4.5501 1.3668 9.5096 +-4.5501 -12.5916 4.2754 +-4.5501 -10.498000000000001 -0.2609 +-4.5501 -9.3636 1.9199000000000002 +-4.5501 -3.1694 10.3821 +-4.5501 -3.1694 8.8119 +-4.5501 -3.1694 8.8117 +-4.5501 -9.2765 4.2757000000000005 +-4.5501 -12.155199999999999 7.3288 +-4.5501 -12.155199999999999 9.0735 +-4.5501 -9.189400000000001 7.3285 +4.4355 -10.6721 7.3285 +4.4355 -0.0289 10.4694 +4.4355 -1.8608 10.4694 +4.4355 -5.0887 9.946000000000002 +4.4355 -9.014700000000001 6.9795 +4.4355 -9.014700000000001 4.2757000000000005 +4.4355 -10.410400000000001 1.9201 +4.4355 -10.410400000000001 4.2754 +4.4355 -3.1694 10.4695 +4.4355 1.1926 9.5972 +4.4355 -9.1014 7.3288 +4.4355 -2.0355000000000003 7.5033 +4.4355 -10.7592 4.9738 +-2.8925 -9.2761 -3.0528 +-2.8925 -6.833200000000001 7.939400000000001 +-2.8925 -14.1617 -3.1402 +4.5228 -11.8935 9.5097 +4.5228 -9.2766 7.3288 +4.5228 -10.8466 4.2757000000000005 +4.5228 -10.8466 7.3285 +2.1676 -19.2212 -3.7504000000000004 +-0.44999999999999996 -15.5575 9.3355 +-2.8052 -14.336199999999998 4.6243 +-2.8052 -14.1617 -2.7041 +-2.8052 -14.947099999999999 4.7116999999999996 +3.8252 -7.9681 1.9195 +3.8252 -7.9681 0.3502 +0.51 -7.9676 -3.8379000000000003 +0.51 -6.834 11.5164 +-4.4628 -11.108600000000001 1.9201 +-4.4628 -11.108600000000001 4.2754 +-4.4628 0.146 10.3821 +-4.4628 0.0585 9.5971 +0.3349 -5.0887 7.7650999999999994 +0.3349 -5.0887 7.5033 +0.3349 -4.3911 7.5033 +0.3349 -4.3038 8.2012 +-1.7579 -15.3829 7.3288 +-4.375500000000001 -11.5443 10.295 +-4.375500000000001 -9.799900000000001 7.3288 +-4.375500000000001 -5.0887 10.0333 +-4.375500000000001 -3.1694 10.0335 +-4.375500000000001 -3.1694 10.0333 +4.6101 -1.8608 8.027099999999999 +4.6101 -10.410400000000001 0.2623 +4.6101 -11.0217 0.2623 +4.6101 -12.242799999999999 7.3288 +4.6101 1.1926 8.8989 +4.6101 1.1926 7.503500000000001 +4.6101 1.5417999999999998 7.503500000000001 +4.6101 -11.8938 8.8987 +3.6500999999999997 -6.658799999999999 8.114 +1.2949 4.6821 7.9399999999999995 +1.2949 4.6821 7.5033 +1.2949 4.333200000000001 10.3821 +-3.6778999999999997 -9.451 -1.1333 +-3.6778999999999997 2.9372 9.5971 +-3.6778999999999997 -9.276299999999999 -1.308 +-3.6778999999999997 0.0585 10.731200000000001 +-3.6778999999999997 -3.1694 10.6439 +3.7373999999999996 -13.0275 10.120700000000001 +3.7373999999999996 -5.0889 8.463099999999999 +3.7373999999999996 -6.833200000000001 8.114 +-0.9730000000000001 -14.684800000000001 10.7314 +3.0398 -7.7061 5.5844 +3.0398 -7.7061 4.2757000000000005 +3.0398 -6.572 7.3285 +3.0398 -7.1823 4.2757000000000005 +3.0398 -7.1828 7.3285 +3.0398 -7.2698 4.2757000000000005 +3.0398 -7.0952 7.3285 +3.0398 -6.8328 11.0802 +3.0398 -6.8328 11.429300000000001 +3.0398 -7.6187000000000005 5.5844 +3.0398 -7.444599999999999 6.9795 +3.0398 -3.1694 11.0802 +3.0398 -3.1694 11.429300000000001 +3.0398 -7.9676 -2.0060000000000002 +-1.933 -15.2957 4.2754 +-1.933 -13.4635 11.1672 +-1.933 -14.946699999999998 4.2754 +-1.933 -13.3766 3.4025 +-1.933 -13.3766 3.839 +-1.933 -13.3766 3.4028 +-1.933 -13.3766 3.8392000000000004 +-1.933 -13.202 3.8392000000000004 +-1.933 -15.382599999999998 2.3560999999999996 +-1.933 -15.383099999999999 2.3563 +-1.933 -12.678700000000001 3.4028 +-1.933 -12.678700000000001 3.4899 +-1.933 -14.249 2.5308 +-1.933 -15.2955 4.2754 +-4.288200000000001 2.0650999999999997 7.503500000000001 +-4.288200000000001 -9.2762 -0.3478 +-4.288200000000001 -11.5441 10.3824 +2.0798 -4.3034 9.858799999999999 +2.3422 -19.2212 1.8325999999999998 +2.3422 -19.2212 1.9199000000000002 +2.1671 -5.7868 7.3288 +2.4295 -14.423 10.0334 +2.4295 -19.2212 -1.7442 +2.4295 -12.9407 11.1672 +-2.8057 -15.7327 -3.3145000000000002 +-2.8057 -19.2212 -1.308 +-2.8057 -18.7849 -3.3145000000000002 +-2.5433 3.3734 10.731200000000001 +-2.5433 -3.1694 11.1675 +-2.5433 2.8505 11.167399999999999 +3.8247000000000004 -10.3229 -2.0060000000000002 +3.8247000000000004 -19.2212 1.9199000000000002 +3.8247000000000004 -10.4101 -2.0060000000000002 +1.4695 -19.2212 -4.0124 +-1.1481 2.2398000000000002 11.7781 +-1.1481 -19.2217 4.1878 +-1.1481 3.5479 11.3419 +-3.5033000000000003 -6.746099999999999 7.939400000000001 +-3.5033000000000003 -12.6788 1.6580000000000001 +3.1271 -6.659 7.3285 +3.1271 -10.410400000000001 -2.8783 +-1.8457000000000001 -15.383099999999999 3.9261 +-4.2009 -6.833500000000001 10.295 +2.952 -14.859300000000001 4.2754 +3.2144 -14.249500000000001 0.2623 +-1.7584 -15.383 8.2885 +-0.1008 -6.3974 1.9199000000000002 +-0.1008 -14.2486 3.1414 +-0.1008 -6.658899999999999 -2.0060000000000002 +-0.1008 -6.658899999999999 -1.6563 +-0.1008 -6.310200000000001 -1.8307 +-0.1008 -6.1356 -0.6967 +-0.1008 -6.1356 1.9199000000000002 +-2.7184 -19.2212 1.0477 +-2.7184 -6.9209000000000005 1.9199000000000002 +-2.456 -11.5441 11.5163 +3.9120000000000004 -9.7121 -1.9185 +3.9120000000000004 0.4939 10.905800000000001 +3.9120000000000004 -10.410400000000001 -1.9188 +3.9120000000000004 -10.410400000000001 -1.7442 +3.9120000000000004 2.8499 7.9398 +3.9120000000000004 -8.8398 4.2757000000000005 +3.9120000000000004 -3.1694 10.4695 +3.9120000000000004 -14.0744 -1.7442 +1.5568 -15.383099999999999 2.5308 +1.5568 -12.678700000000001 4.0135 +1.5568 -14.249 2.7054 +-1.0608 -7.4441 -3.576 +-0.7984 -6.1355 6.0204 +-0.7984 -6.0483 6.0204 +-3.4160000000000004 -11.6321 11.08 +-3.4160000000000004 -14.510700000000002 4.2754 +-3.4160000000000004 -13.3766 1.9203000000000001 +-3.4160000000000004 -13.3766 1.9201 +-3.4160000000000004 -12.678700000000001 1.9203000000000001 +-3.4160000000000004 -12.678700000000001 2.7053000000000003 +3.9993 2.5009 9.5969 +3.9993 -7.7931 7.3290999999999995 +3.9993 -1.8608 10.4695 +3.9993 -1.8608 7.5033 +3.9993 -3.1694 10.4695 +3.9993 -13.5512 8.3758 +3.9993 -8.9273 7.154000000000001 +3.9993 -8.9273 4.2757000000000005 +3.9993 -0.20409999999999998 10.905800000000001 +3.9993 -7.880199999999999 6.8922 +-1.6711 -15.4701 4.6243 +4.696899999999999 -9.3628 10.120899999999999 +2.3417 -10.410400000000001 -3.5763000000000003 +2.3417 -10.410400000000001 -3.0530999999999997 +2.3417 -14.1617 -3.0530999999999997 +2.6041000000000003 -14.249 1.9201 +-2.6311 -7.2698 -2.0060000000000002 +-2.3687 -11.5441 11.0802 +2.429 -12.2424 10.9057 +-0.18860000000000002 3.6351 11.4291 +4.0866 -14.1611 1.9199000000000002 +4.0866 -1.8608 7.503500000000001 +4.0866 -1.8608 9.5969 +4.0866 -9.1014 7.3288 +4.0866 -1.5117 7.503500000000001 +1.469 -15.0341 10.0333 +1.469 -15.4703 7.3288 +1.469 -15.4703 8.4634 +1.469 -15.2957 9.422600000000001 +1.7314 -6.1356 7.3285 +-3.2413999999999996 -9.4508 -2.7041 +-3.2413999999999996 -14.1617 -2.7912 +3.1266000000000003 -19.1338 2.9671 +3.1266000000000003 -13.9874 7.3285 +0.7714000000000001 -6.1357 4.2754 +1.0338 -6.5721 -2.5294 +-4.2014000000000005 -13.376199999999999 4.9738 +-3.939 0.0582 10.9929 +3.2139 -6.658799999999999 7.3288 +3.2139 -7.8804 1.9199000000000002 +3.2139 -7.793 -1.8307 +3.2139 -6.833200000000001 8.114 +-1.7589000000000001 -6.397600000000001 1.9201 +-4.1141 -13.4635 4.2757000000000005 +-4.1141 -9.276299999999999 1.7448000000000001 +-4.1141 -3.1694 8.1142 +-4.1141 -13.2888 7.3285 +-4.1141 -14.1612 1.9201 +2.5163 -19.2212 -3.489 +2.5163 -10.410400000000001 -3.0530999999999997 +2.5163 -14.1617 -3.4890999999999996 +2.5163 -14.1617 -3.0530999999999997 +2.5163 -15.0349 -1.7442 +0.1611 -6.8328 11.6034 +0.1611 -6.8328 11.8653 +0.1611 -5.0888 11.6034 +-2.4565 -5.0887 7.8525 +-4.8117 -9.7997 8.8991 +-4.8117 -9.7997 9.073599999999999 +4.1739 1.1926 9.5972 +1.8186999999999998 -15.383 4.7993 +1.8186999999999998 -13.3766 3.9261999999999997 +-0.7988999999999999 -15.6447 7.3288 +1.6436 -10.4102 -3.4892 +1.6436 -10.4102 -3.9251 +1.9060000000000001 -7.9676 -3.4017 +0.946 -14.771999999999998 10.6441 +-1.4092 -14.859300000000001 10.295 +-4.0268 -2.7333 7.5033 +-4.0268 -2.5587 9.8586 +-4.0268 -19.2212 -1.308 +-4.0268 -13.4635 4.2757000000000005 +-4.0268 -13.5513 6.7177 +-4.0268 -1.8608 7.5033 +-4.0268 -7.5317 9.073599999999999 +-4.0268 -6.8341 9.161 +-4.0268 -13.638300000000001 4.2757000000000005 +-4.0268 -1.6859 9.771199999999999 +-4.0268 -14.1618 -1.5699 +-4.0268 -14.1618 -1.308 +-4.0268 -2.5586 7.5033 +-4.0268 -3.1694 8.637599999999999 +-4.0268 -12.940399999999999 4.2757000000000005 +-4.0268 -12.6782 4.2757000000000005 +-4.0268 -12.6782 7.3285 +-4.0268 -18.8721 -1.6575 +-4.0268 -2.3838999999999997 9.8586 +-4.0268 -1.599 7.5033 +-4.0268 -3.1693 7.9399999999999995 +-4.6371 -9.5375 7.3288 +-4.6371 -3.1694 10.0335 +4.3485000000000005 1.1926 7.503500000000001 +3.3884999999999996 -7.531300000000001 1.9199000000000002 +-1.5843 -6.310300000000001 4.2757000000000005 +-1.5843 -6.746499999999999 6.0198 +-3.9395 -8.6656 4.2757000000000005 +-3.9395 -8.6656 7.3285 +-3.9395 -8.8401 7.154000000000001 +-3.9395 -8.8401 4.2757000000000005 +-3.9395 -12.6788 0.5237999999999999 +-3.9395 2.0650999999999997 9.5969 +-3.9395 -14.249 0.5237999999999999 +-3.9395 1.8030000000000002 7.503500000000001 +3.4757999999999996 -14.161499999999998 8.6379 +3.4757999999999996 -14.1617 -2.6166 +3.4757999999999996 2.5016 10.556799999999999 +1.1206 3.5478 11.3419 +-1.2346 -6.2229 4.2754 +-3.8522 -13.725399999999999 7.8526 +-3.8522 -3.1694 11.0802 +-3.8522 1.3667 10.731200000000001 +2.5158 -5.0889 7.7649 +-4.549799999999999 -3.2573 10.4698 +-4.549799999999999 -6.8328 10.4696 +4.1734 -8.6646 10.818200000000001 +-3.1546 -14.249500000000001 0.5242 +-2.8922 -7.008100000000001 4.2754 +-2.8922 1.9778 10.731200000000001 +-2.8049 -5.3506 11.0802 +-2.8049 -6.8328 11.0802 +-2.8049 -7.4441 -2.1806 +-2.8049 1.978 10.731200000000001 +3.5631000000000004 -10.410400000000001 -1.7442 +3.5631000000000004 -14.1618 -2.4421999999999997 +3.5631000000000004 1.1926 10.4694 +1.2079 -3.1694 11.8653 +-3.7649000000000004 -13.900000000000002 7.241300000000001 +-3.7649000000000004 -11.544500000000001 10.2951 +-3.7649000000000004 -8.578199999999999 4.2757000000000005 +2.6031 -6.833400000000001 1.9201 +2.6031 -6.833400000000001 4.2754 +2.8655 -15.035000000000002 -0.4357 +0.24789999999999998 4.7695 7.5033 +-2.1073 -4.3035 9.858799999999999 +2.9528 -12.5915 11.0801 +-2.02 -3.8672999999999997 8.2012 +-0.6248 -15.5578 4.2754 +-2.98 -7.6188 6.1944 +-2.98 -7.6188 4.2757000000000005 +-2.98 -14.8597 4.2757000000000005 +-2.98 -14.6851 7.3285 +-2.98 3.8099000000000003 7.503500000000001 +-2.98 -7.531599999999999 6.1944 +-2.7176 -6.920999999999999 1.9201 +3.6504000000000003 -7.7058 3.0542 +3.6504000000000003 -14.074700000000002 4.2757000000000005 +3.6504000000000003 -13.9874 4.7993 +3.7377000000000002 -19.2217 2.0946 +3.7377000000000002 -19.2217 1.9201 +3.7377000000000002 -3.1694 11.0801 +3.7377000000000002 -15.383099999999999 2.0946 +3.7377000000000002 -15.383099999999999 1.9201 +1.3825 -11.8057 11.6908 +-3.5902999999999996 -14.1618 -2.4424 +-3.5902999999999996 -14.1618 -1.308 +-3.5902999999999996 -5.0889 8.4632 +2.7777 -6.8328 11.0802 +2.7777 -3.1694 11.0802 +3.0401000000000002 -13.9873 10.0333 +-1.9327 -3.8672999999999997 7.5033 +-2.8927 -3.9541 7.5033 +-2.8927 -14.7724 7.3288 +-2.8927 -14.249899999999998 -1.308 +4.522600000000001 -11.9808 9.422600000000001 +4.522600000000001 -5.0889 9.247900000000001 +-0.4502 -6.4847 1.9201 +-0.4502 -6.397500000000001 -2.0060000000000002 +-2.8054 -14.5976 9.4228 +-2.8054 3.7228 9.6843 +-2.8054 3.6353000000000004 9.5969 +-2.8054 2.5015 10.6438 +-2.8054 2.5015 10.731200000000001 +-2.8054 3.2863999999999995 7.503500000000001 +-2.8054 3.3737000000000004 9.5969 +-2.8054 3.7224 9.6845 +-2.8054 3.8973 7.5033 +1.2074 -14.2491 4.2754 +-1.1478 -6.2229 -0.43499999999999994 +-3.5029999999999997 -19.2212 -2.5298000000000003 +-3.5029999999999997 -6.8328 11.2549 +0.5098 -14.0745 4.3627 +-4.463 -9.1017 1.4833 +-4.463 -9.2762 1.9199000000000002 +2.9523 -7.4441999999999995 6.6304 +2.9523 -7.6187000000000005 4.2757000000000005 +3.2147 -11.37 11.2545 +-4.3757 1.9777 8.027099999999999 +-4.3757 0.0585 8.1142 +-4.3757 0.0585 7.503500000000001 +-4.3757 0.1459 9.5969 +-4.3757 -8.7529 7.3285 +-4.113300000000001 -13.1154 9.4228 +-0.3629 -6.397600000000001 1.9201 +-0.3629 -6.397600000000001 4.2754 +-0.3629 -6.1356 1.9201 +-0.3629 -6.1356 4.2754 +-2.7181 -8.2296 -2.9659 +-2.7181 -15.035000000000002 -1.308 +-2.7181 -15.035000000000002 -1.1334 +3.9122999999999997 -11.8935 10.0333 +3.9122999999999997 -13.114600000000001 0.2623 +3.9122999999999997 -13.3761 0.2623 +3.9122999999999997 -11.6314 10.0333 +3.9122999999999997 -14.249 0.2623 +3.9122999999999997 -14.249 -1.7442 +1.2947 0.9301 11.8653 +3.9995999999999996 -1.8608 10.4694 +3.9995999999999996 -10.410400000000001 -1.7442 +1.6444 -19.047 4.013400000000001 +-0.9732 -19.2212 -4.1867 +-3.5908 0.146 10.6438 +-3.5908 -8.3167 1.9199000000000002 +-3.5908 2.4138 10.5567 +-3.5908 -8.1421 1.9199000000000002 +-3.3284000000000002 -7.0077 7.241300000000001 +-3.3284000000000002 -7.5314000000000005 4.2757000000000005 +-3.3284000000000002 -7.5314000000000005 7.3285 +3.0396 -14.7723 4.2757000000000005 +0.6844 -15.4703 9.1605 +0.6844 -15.6448 7.3288 +-4.2884 -11.8935 1.9199000000000002 +-4.2884 -9.276299999999999 -0.6101 +-4.2884 0.0585 9.858799999999999 +4.6972 -11.8935 7.3288 +4.6972 -11.8935 8.6379 +4.6972 -1.8608 10.1204 +4.6972 -9.712800000000001 4.9738 +4.6972 -3.1694 9.946000000000002 +4.6972 -10.4106 10.0333 +4.6972 -1.1625999999999999 7.503500000000001 +4.6972 0.9308000000000001 8.9862 +2.342 -13.899500000000002 10.0334 +2.342 -10.4102 -3.576 +2.342 -14.423 10.0334 +2.342 -9.014800000000001 -3.4889 +2.342 -12.2427 11.2545 +-2.6308000000000002 -12.155100000000001 -3.4017 +4.7844999999999995 -10.2356 4.2757000000000005 +4.7844999999999995 -9.1888 9.422600000000001 +4.7844999999999995 -9.1888 9.9459 +4.7844999999999995 -10.8466 4.2757000000000005 +4.7844999999999995 -10.8466 7.3285 +4.7844999999999995 -10.3228 7.3285 +4.7844999999999995 -6.833500000000001 9.684099999999999 +4.7844999999999995 -11.283 7.3285 +2.1669 3.2866 10.3821 +2.1669 -16.6918 3.7517 +-0.1883 -7.8804 -3.8379999999999996 +-0.1883 -7.793 -3.8379999999999996 +-2.5435 -6.833200000000001 7.3288 +3.8245 1.8033000000000001 10.556899999999999 +-0.8859 -15.6448 4.6243 +-3.5035 3.1988999999999996 9.4223 +-1.8458999999999999 -11.2829 -3.8379999999999996 +-4.2011 -11.8935 0.7858999999999999 +-4.2011 -8.4917 4.2754 +3.2141999999999995 -13.8998 5.2353 +3.2141999999999995 -13.8998 7.3285 +0.5966 1.978 11.7781 +0.5966 2.0653 11.4291 +0.5966 3.7224 10.731200000000001 +0.5966 2.4143000000000003 11.7781 +0.5966 3.4606 11.4291 +0.859 4.3331 10.556799999999999 +-1.7586000000000002 4.333 9.7717 +-1.7586000000000002 4.5076 8.026800000000001 +-4.1138 -14.161399999999999 1.9199000000000002 +-4.1138 2.5887000000000002 7.503500000000001 +-4.1138 -8.142000000000001 7.154000000000001 +-4.1138 0.0585 10.731200000000001 +-4.1138 2.327 9.5969 +2.2542 -7.0952 1.9201 +2.2542 -7.0952 4.2754 +2.5166 -14.946599999999998 8.8113 +3.9118 -10.410400000000001 10.9926 +1.5566 -14.423 10.7314 +1.5566 -14.946499999999999 10.0333 +-3.4162 -9.5388 -2.6164 +-3.4162 -8.0555 1.9201 +-3.4162 -8.0555 4.2754 +-3.4162 -7.531599999999999 4.2757000000000005 +-3.4162 -7.6194 1.9201 +-3.4162 -7.6194 4.2754 +3.9991 -19.2212 1.6578 +3.9991 -10.2356 -0.6097 +3.9991 -10.6724 10.9056 +1.6439 -15.383 4.2757000000000005 +1.6439 -15.2957 7.3285 +1.6439 -15.0343 7.3288 +1.6439 -15.121 4.6243 +1.6439 -15.383099999999999 7.3288 +1.6439 -15.383099999999999 4.6243 +1.6439 -15.383099999999999 4.2754 +1.6439 -15.0339 4.2757000000000005 +1.6439 -15.0339 7.3285 +-0.9737000000000001 -15.6447 4.6243 +0.6839 -12.678700000000001 4.2752 +-1.4089 -14.946599999999998 10.295 +-4.0265 -19.2212 -1.308 +-4.0265 -9.276299999999999 -1.308 +2.3415 2.8505 11.2545 +2.6039 -14.249500000000001 1.9199000000000002 +-0.0137 1.2795 11.9525 +-2.3689 -6.0481 7.3288 +2.6912 -10.410400000000001 11.0801 +0.0736 -1.7728000000000002 11.9525 +0.0736 -15.3829 7.3288 +0.0736 -15.3829 4.6243 +0.0736 -15.383099999999999 7.3288 +0.0736 -15.383099999999999 4.6243 +0.0736 -15.6447 7.3288 +0.0736 -15.6447 4.6243 +4.086399999999999 -13.550799999999999 4.2757000000000005 +4.086399999999999 -10.4101 -0.6973 +4.086399999999999 -8.9276 -1.0465 +4.086399999999999 -13.463600000000001 7.3285 +-1.584 -7.1823 -3.1399000000000004 +-1.584 -6.6592 -2.2678 +-3.9392000000000005 -1.9484000000000001 9.771199999999999 +-3.9392000000000005 -2.1227 9.8586 +-3.9392000000000005 -1.8608 9.6838 +-3.9392000000000005 -1.8608 7.5033 +-3.9392000000000005 -6.9216 11.0801 +-3.9392000000000005 -8.9278 11.0801 +-3.8518999999999997 -3.1694 11.08 +2.5161 -6.1356 7.241300000000001 +2.7785 -10.410400000000001 11.429 +-2.4566999999999997 1.8030000000000002 11.5164 +-2.1943 -6.833500000000001 11.2548 +-2.1943 -8.4916 11.6907 +-4.8119000000000005 -9.799900000000001 8.8119 +-4.8119000000000005 -5.0887 9.5096 +-4.8119000000000005 -6.8341 9.5099 +-4.8119000000000005 -6.8341 9.858799999999999 +-4.8119000000000005 -11.2831 6.543400000000001 +-4.8119000000000005 -0.20339999999999997 7.5033 +-4.8119000000000005 0.0585 9.247900000000001 +-4.8119000000000005 -3.1694 9.8586 +-4.8119000000000005 -3.1694 9.5095 +-4.8119000000000005 -3.1694 9.858699999999999 +-4.8119000000000005 -10.5852 4.2757000000000005 +-4.8119000000000005 -10.5852 7.3285 +-4.8119000000000005 -11.0214 4.2757000000000005 +-4.8119000000000005 -9.7997 9.073599999999999 +-4.8119000000000005 -10.4978 7.3288 +-4.8119000000000005 -10.4978 9.684099999999999 +4.1737 -19.2212 0.2623 +4.1737 -5.0887 8.8117 +4.1737 1.2802 9.5969 +4.1737 1.3675 7.503500000000001 +1.5561 -7.008100000000001 -2.9654 +1.8185 -13.987 -3.9251 +-3.1543 -6.833200000000001 7.4161 +4.261 -10.410400000000001 0.2623 +4.261 1.1926 7.7654 +4.261 -8.4035 7.3285 +4.261 -14.249 -0.7844 +-0.7118 -4.7397 8.201500000000001 +-0.7118 -12.678700000000001 4.2754 +-3.0669999999999997 -3.6927000000000003 9.8586 +0.6834 -6.0483 5.933 +1.2082000000000002 -3.1694 11.8653 +2.6034 -6.8336 4.2757000000000005 +0.24819999999999998 -11.456800000000001 11.7781 +-2.3694 -6.1356 7.3285 +-4.724600000000001 -9.799900000000001 10.1205 +-4.724600000000001 -11.8059 8.026800000000001 +-4.724600000000001 -5.0887 10.0333 +-4.724600000000001 -10.410400000000001 1.9199000000000002 +-4.724600000000001 0.0585 9.5096 +-4.724600000000001 -3.1694 9.858799999999999 +-4.724600000000001 -3.1694 10.0334 +-4.724600000000001 -10.5849 4.2757000000000005 +-4.724600000000001 -11.282499999999999 1.2219 +-4.724600000000001 -0.9014 10.1205 +-4.724600000000001 -0.5522 9.858799999999999 +-2.2821000000000002 -4.303599999999999 7.5036000000000005 +-2.2821000000000002 -6.7463 -0.6094999999999999 +-4.6373 -11.8935 1.9199000000000002 +-4.6373 1.3668 7.503500000000001 +-4.6373 -6.8341 10.295 +-4.6373 0.0585 9.5971 +-4.6373 -12.0676 7.154000000000001 +4.3483 -9.1888 10.0333 +4.3483 -6.833500000000001 10.0333 +-0.6244999999999999 -14.1618 -4.2739 +-0.6244999999999999 -14.1617 -4.2742 +3.6506999999999996 -13.9873 7.3285 +1.0331 -15.0334 -2.7914000000000003 +-3.9397 -12.6788 0.5242 +-1.2348 -3.1694 11.8653 +-1.2348 1.9778 11.777999999999999 +-3.8524000000000003 -11.8935 -1.308 +-3.8524000000000003 -11.8935 -1.0461 +-3.8524000000000003 -7.9681 4.2754 +-3.8524000000000003 -14.249 0.6114999999999999 +2.778 -7.0952 1.9201 +2.778 -7.0952 4.2754 +0.4228 -15.2083 10.0333 +0.4228 -6.1356 1.5706000000000002 +-2.1948 -4.2162999999999995 7.5033 +-2.1948 -3.8672 9.8586 +-2.1948 -9.6254 -3.6634 +-2.1948 -14.1617 -3.7506999999999997 +-2.1948 -3.7801 9.771199999999999 +-2.1948 -3.7801 7.5033 +-1.9324000000000001 -7.8805 -3.4017 +-1.9324000000000001 -6.833699999999999 -2.0060000000000002 +4.4356 1.2802 9.7717 +1.818 -6.746499999999999 -2.0060000000000002 +1.818 -7.008100000000001 -2.7039 +-0.5372 -11.1958 -4.2742 +4.5229 -12.6788 4.2757000000000005 +4.5229 1.1926 9.5969 +4.5229 -12.504399999999999 7.3285 +4.5229 -12.33 4.2757000000000005 +1.9053 -6.4846 4.2754 +-2.8051 -14.946699999999998 4.6243 +1.2077 -19.2212 -2.7041 +1.2077 -19.2212 -4.0124 +1.2077 -10.5863 -4.0996 +1.2077 -14.249899999999998 -2.9653 +1.2077 -19.2209 -2.7914000000000003 +1.2077 -19.2209 -4.0996 +1.2077 -10.410400000000001 -3.6634 +1.2077 -10.410400000000001 -4.0123 +1.2077 -14.1618 -4.0996999999999995 +1.2077 -15.0334 -2.7914000000000003 +1.2077 -10.411299999999999 -3.7506 +1.2077 -14.1617 -4.0996999999999995 +-3.7651 -3.3441 7.678100000000001 +-3.7651 -11.9811 -1.2205000000000001 +-3.7651 -7.881 1.9201 +-3.5027000000000004 -12.1555 10.2076 +-3.5027000000000004 -12.1555 10.295 +2.8653 -7.6188 1.9201 +0.2477 -4.7395 8.2012 +-2.1075 -15.1214 7.3288 +-2.1075 -13.987 10.295 +-2.1075 -14.7724 7.3288 +-2.1075 -14.0745 10.2073 +-2.1075 -15.0337 9.0738 +-2.1075 -14.8596 7.329 +-2.1075 -14.5109 10.295 +-2.1075 -15.208499999999999 7.329 +-2.1075 -15.0339 9.422600000000001 +-4.4627 -9.102 1.9201 +-4.4627 -11.108 1.9201 +-4.4627 -11.108 4.2754 +-4.4627 -5.0889 9.8584 +-4.4627 -6.833200000000001 9.8584 +-4.4627 -9.7997 9.073599999999999 +2.9526 -7.0952 1.9201 +2.9526 -7.0952 4.2754 +-4.3754 -6.9212 8.9862 +-0.3626 -6.3974 1.9201 +-0.3626 -6.3974 4.2754 +-0.3626 -15.382599999999998 4.2752 +-0.3626 -15.382599999999998 3.0543 +-0.3626 -6.1356 1.9201 +-0.3626 -6.1356 4.2754 +-0.3626 -12.678700000000001 4.2752 +-0.3626 -12.678700000000001 3.7517 +-2.7178 -14.336199999999998 7.3288 +3.6502 -7.8804 0.08760000000000001 +3.6502 -7.793 0.08760000000000001 +3.6502 -7.793 1.9199000000000002 +3.6502 -12.678700000000001 2.3564000000000003 +-1.3226 -5.0889 7.5034 +-3.6778 -5.0887 8.5503 +-3.6778 -6.8328 11.0802 +-3.6778 -9.1017 -2.0060000000000002 +-3.6778 -14.249 -1.308 +-3.6778 -5.0888 11.0802 +-3.6778 -8.1421 -1.2201 +-3.4153999999999995 -13.377 10.295 +3.7375 -8.1424 -0.6976 +3.7375 -15.383099999999999 2.0946 +3.7375 -15.383099999999999 1.9201 +1.3823 -14.1617 -4.0996999999999995 +-1.2352999999999998 -6.2231000000000005 4.2754 +-1.2352999999999998 4.5076 9.6843 +-3.5905 -3.5187000000000004 8.4633 +-3.5905 -4.2162999999999995 8.637599999999999 +-3.5905 -4.2162999999999995 8.2014 +-3.5905 -11.9805 10.295 +-3.5905 -5.0887 8.985999999999999 +-3.5905 -7.4441 6.8049 +-3.5905 -3.1694 7.5905000000000005 +-3.5905 -12.155199999999999 10.2076 +3.0399 -19.2212 0.2623 +3.0399 -15.035000000000002 0.1749 +3.0399 -7.9681 -0.7848 +0.4223 -15.6448 4.4498999999999995 +-1.9328999999999998 -14.0745 10.2073 +-1.9328999999999998 -14.8596 7.329 +-1.9328999999999998 -15.208499999999999 8.9865 +-1.9328999999999998 -4.3907 8.201500000000001 +-4.2881 -12.242899999999999 9.8586 +-4.2881 -6.8341 9.073599999999999 +-4.2881 -12.155199999999999 7.3288 +-4.2881 -9.7997 7.3288 +-4.2881 -9.7997 8.026800000000001 +2.0799000000000003 -13.0281 11.2544 +-2.8929 -13.3765 -2.6164 +-2.8929 -3.1694 11.08 +-2.8929 3.0241000000000002 10.731200000000001 +4.5224 -11.1088 10.0336 +2.1672000000000002 -13.987 10.0333 +-2.8056 -13.986799999999999 10.3825 +-2.8056 3.2863 9.5971 +-2.8056 -19.2212 -0.9589000000000001 +-2.8056 -19.2212 -1.308 +-2.8056 -5.0884 11.167100000000001 +-2.8056 -5.0884 11.4288 +-2.8056 -3.1694 11.4288 +-2.8056 2.2394000000000003 10.731200000000001 +-2.8056 3.6353999999999997 9.8589 +-3.5032 -15.383099999999999 2.6182 +3.1272 -7.8804 -0.6976 +3.1272 -3.0819 7.5033 +3.1272 -3.1694 9.684099999999999 +3.1272 -3.1694 7.5033 +3.1272 -7.9681 -0.6973 +3.1272 -7.9681 0.0883 +0.5095999999999999 4.3333 10.6434 +-1.8456000000000001 -7.8804 -3.4017 +3.2145 -5.1761 8.114 +-0.10070000000000001 -10.4102 -4.1869000000000005 +-0.10070000000000001 -7.9676 -3.5765 +-0.10070000000000001 -8.1424 -3.9251 +-2.7182999999999997 -6.9212 7.3288 +-2.7182999999999997 -6.9212 7.5034 +-2.7182999999999997 -15.0339 4.2754 +3.9121 2.5882 9.5972 +1.5569 1.8033000000000001 11.6907 +1.5569 -6.3101 4.363 +1.5569 -6.7463 5.9326 +-1.0607 4.4201999999999995 10.2949 +-1.0607 4.2459 7.5033 +-1.0607 4.6822 7.5033 +-1.0607 -11.020299999999999 11.777999999999999 +3.9994 -9.1018 4.712000000000001 +3.9994 -8.9273 4.2757000000000005 +1.6441999999999999 -6.397500000000001 -0.43499999999999994 +1.6441999999999999 -6.833699999999999 1.9199000000000002 +-0.9733999999999999 -7.8805 -3.7506999999999997 +-3.3286000000000002 -8.1421 -1.9183 +3.0394 -5.0889 8.114 +3.0394 -3.1694 7.5033 +3.0394 -3.1694 8.7247 +3.3018 -9.4507 11.341700000000001 +3.3018 3.2862 9.8589 +3.3018 -6.833200000000001 8.2885 +0.6842 -15.0334 -4.2742 +-1.6709999999999998 -5.6995 7.3288 +-1.6709999999999998 -15.4702 4.537 +-4.2886 -8.6656 4.4502 +-4.2886 -6.8341 10.295 +-4.2886 -2.2963999999999998 7.5033 +-4.2886 2.0650999999999997 7.503500000000001 +-4.2886 -9.7997 10.295 +2.3418 -15.0341 8.8116 +2.3418 -13.9873 9.9459 +2.3418 -14.423 10.208 +2.3418 -13.987 10.0333 +2.3418 -12.3301 10.9055 +2.3418 -13.8125 10.7314 +2.3418 -12.2427 11.2544 +-0.0134 -8.753 -4.0996 +2.4291 -13.9873 10.0333 +2.4291 -13.900000000000002 10.0333 +2.4291 -14.685400000000001 7.3288 +2.4291 -14.423 9.9459 +2.4291 -6.1355 7.241499999999999 +2.4291 -7.0952 1.9201 +2.4291 -14.4237 10.0333 +2.4291 -14.946699999999998 7.3288 +2.4291 -14.5975 7.3288 +2.4291 -6.0483 7.3288 +2.4291 -7.1826 4.2754 +-2.5437000000000003 -11.8066 11.4289 +-2.2813 -5.0889 7.8522 +-2.2813 1.978 11.5164 +4.0867 -8.317 4.2754 +1.4690999999999999 -12.1546 11.6035 +1.7315 -6.397500000000001 1.9199000000000002 +-3.2413 -18.610599999999998 -2.878 +3.1267000000000005 -7.9676 -2.0060000000000002 +-4.2013 -11.8935 -1.308 +-4.2013 -10.061499999999999 -1.308 +-4.2013 0.0585 10.731200000000001 +-4.2013 -3.1694 10.731200000000001 +-4.2013 2.0650999999999997 9.5969 +3.2140000000000004 -13.9874 4.2757000000000005 +0.8588 4.6821 9.5093 +-1.4964 -13.6379 11.2546 +-4.114 -13.4635 -1.4826000000000001 +-4.114 -14.0738 -1.308 +-4.114 -9.8869 -1.4826000000000001 +-4.114 0.0582 10.8185 +-4.114 -3.1694 10.731200000000001 +-4.114 -14.249 -1.308 +2.5164 -10.410400000000001 -2.9654 +2.5164 -13.376299999999999 -3.4890999999999996 +2.5164 -14.1617 -2.9654 +-4.8116 -5.0889 9.5967 +-4.8116 -6.833200000000001 9.8584 +-4.8116 -6.833200000000001 9.5096 +4.1739999999999995 -9.1888 7.3288 +4.1739999999999995 -9.1888 8.3758 +4.1739999999999995 -9.1893 7.939499999999999 +4.1739999999999995 -9.4511 7.3288 +1.5564 -15.0343 4.9735000000000005 +-3.154 -4.303599999999999 7.8525 +-3.154 -13.3766 2.9666 +-0.7115 4.7695 7.5033 +-3.0667 -3.1694 11.4291 +3.3013 3.3739 9.5093 +3.3013 -13.202300000000001 10.556899999999999 +-1.6715 -3.1694 11.4291 +-4.0267 -12.1557 10.2951 +-2.3691 -19.2217 1.9201 +-2.3691 -15.383099999999999 1.9201 +2.691 -9.2756 11.0799 +2.691 -6.8331 11.429 +2.691 -8.0552 -2.0060000000000002 +2.691 -8.0552 -1.9185 +2.691 -10.410400000000001 11.429 +2.691 -10.410400000000001 11.0799 +2.691 -7.9676 -2.7913 +2.691 -5.961 8.2014 +2.691 -14.859300000000001 7.3288 +2.691 -14.249500000000001 -1.7442 +0.3358 -3.1694 11.6034 +0.3358 -3.1694 11.8653 +1.7309999999999999 -13.377 11.2544 +-0.6242 -6.1355 5.933 +-0.6242 4.3333 10.7309 +-3.2418000000000005 -9.276299999999999 -2.7039 +-3.2418000000000005 -14.249500000000001 0.5237999999999999 +3.3886 1.8033000000000001 10.4695 +3.3886 -12.5035 -2.7036000000000002 +3.3886 -14.1617 -1.8315000000000001 +1.0333999999999999 4.2457 10.6442 +1.0333999999999999 -6.2229 1.9201 +-3.9394 1.3673 10.731200000000001 +-3.9394 -12.940399999999999 4.2757000000000005 +-3.9394 -12.940399999999999 7.3285 +3.4758999999999998 -6.833500000000001 7.503799999999999 +-1.4969 -5.0889 7.939400000000001 +-3.8521 -8.6656 7.154000000000001 +-3.8521 -9.5388 -2.0060000000000002 +-3.8521 -14.3371 1.9199000000000002 +-3.8521 -11.107899999999999 10.9927 +-3.8521 -7.9677999999999995 4.2757000000000005 +-3.8521 2.0650999999999997 7.503500000000001 +-3.8521 2.0650999999999997 9.5969 +-3.8521 -11.5441 10.295 +2.5159000000000002 -15.470999999999998 3.4899 +2.7782999999999998 3.2862 10.4694 +4.1735 -13.2894 7.3288 +4.1735 -9.0149 -0.6973 +1.8183 1.7152 11.2547 +1.8183 -2.1224 11.777999999999999 +1.8183 0.843 11.777999999999999 +-0.7993 -6.1356 2.3563 +-3.1544999999999996 -9.0144 -1.9183 +4.2608 -19.2212 -0.7844 +4.2608 -19.2212 0.0005 +4.2608 -10.410400000000001 10.0336 +4.2608 -11.8938 10.0333 +4.2608 -14.249500000000001 0.2623 +4.2608 -14.249500000000001 -0.6974 +1.9056 1.8033000000000001 11.6035 +1.9056 1.8033000000000001 11.2545 +1.9056 -3.1694 11.4289 +1.9056 -3.1694 11.6908 +1.9056 -3.1694 11.4292 +1.9056 -3.1694 11.6906 +1.9056 1.6281 11.6035 +3.5631999999999997 -8.2294 1.9201 +3.5631999999999997 -8.2294 4.2754 +1.208 -5.0889 7.4161 +1.208 -12.3301 11.6035 +-3.7648 -9.1889 -2.0060000000000002 +-3.7648 -7.880199999999999 1.9199000000000002 +2.6032 -14.249899999999998 -1.7442 +2.6032 -14.1618 -3.489 +2.8656 -15.035000000000002 0.6986 +-2.3695999999999997 -19.2212 1.9199000000000002 +-2.3695999999999997 0.6688000000000001 11.6908 +-2.3695999999999997 -15.035000000000002 1.8324 +2.6904999999999997 -6.9209000000000005 -0.17329999999999998 +2.6904999999999997 -13.3766 3.4028 +2.6904999999999997 -12.678700000000001 3.4028 +2.9529 3.1988999999999996 9.5972 +0.3353 -17.825499999999998 4.2754 +0.3353 -19.2217 3.0542 +0.3353 -19.2217 4.1878 +0.3353 -5.0884 11.6036 +0.3353 -5.0884 11.8653 +0.3353 -4.3035 8.201500000000001 +0.3353 -4.3035 9.684099999999999 +0.3353 -14.2491 4.4498999999999995 +0.3353 -3.1694 11.6036 +0.3353 -3.1694 11.8653 +0.3353 -4.7397 8.201500000000001 +0.3353 -15.383099999999999 3.0542 +0.3353 -15.383099999999999 4.2754 +0.3353 -4.478 9.858799999999999 +4.3481 -3.1694 10.5571 +4.3481 -3.1694 9.9461 +4.3481 -11.8938 7.3288 +4.3481 -10.3227 4.2754 +4.3481 -8.7529 4.013 +1.9929 -3.1694 11.341800000000001 +1.9929 1.1053 11.6906 +-0.6247 -11.544500000000001 11.7781 +-0.6247 -5.2634 7.3288 +-3.6775 -19.2217 1.9201 +-3.6775 -8.0549 -0.8712 +3.4754 -13.3766 1.9201 +3.7378 -13.9873 4.2757000000000005 +3.7378 -3.0819 7.5033 +3.7378 -3.1694 11.079799999999999 +1.1202 -6.4847 -2.0060000000000002 +1.1202 -8.9276 -4.0124 +1.1202 -6.2229 -0.43499999999999994 +1.1202 -5.4377 7.3288 +-3.5902000000000003 -4.2162999999999995 8.2012 +-3.5902000000000003 -5.0887 8.899 +2.7778 -7.3568 -2.0060000000000002 +2.7778 -6.833200000000001 7.3288 +2.7778 -7.444000000000001 -2.1806 +0.16019999999999998 4.2461 10.731200000000001 +0.16019999999999998 4.2461 10.8185 +-2.1950000000000003 -14.1618 -3.7503 +-2.1950000000000003 -12.678700000000001 3.6645 +-4.5502 -11.8935 0.5237999999999999 +-4.5502 -11.8935 0.5242 +-4.5502 -12.1555 8.9864 +4.4354 -6.5714999999999995 9.0733 +4.4354 -10.410400000000001 1.92 +4.4354 -10.410400000000001 10.4698 +4.4354 -5.0889 9.858799999999999 +4.4354 -10.4101 -0.6097 +4.4354 1.6291 9.5969 +4.4354 -6.833200000000001 9.858799999999999 +2.0802 -15.2957 4.2754 +-2.8926 -14.336199999999998 4.6243 +-2.8926 -8.2295 -1.8307 +-2.8926 -14.772599999999999 7.3288 +-2.8926 -14.4239 4.2754 +-2.8926 -14.3363 4.6243 +-2.8926 -14.8598 4.6243 +-2.8926 -8.1421 -1.8307 +-2.6302 -7.8805 -2.0060000000000002 +4.5227 -12.678 1.9201 +4.5227 -12.678 4.2754 +2.1675 -0.7263999999999999 11.6906 +-2.8053000000000003 -3.1694 11.5163 +3.8251 -14.249 0.43689999999999996 +1.2075 -15.5575 7.3288 +1.4699 -4.565099999999999 8.7248 +-3.5029 -4.390899999999999 8.8116 +-3.5029 -6.746099999999999 7.939499999999999 +-3.5029 -17.825499999999998 2.618 +-3.5029 -5.0887 8.3753 +-3.5029 -6.833200000000001 7.939499999999999 +2.8651 -5.0887 7.9395999999999995 +2.8651 3.2866 7.5033 +2.8651 3.8973 7.5033 +-2.1077 -19.2212 -3.7503 +-4.4629 -11.8935 -0.3481 +-4.4629 -6.9212 9.073599999999999 +-4.4629 -9.7126 -0.2609 +-4.4629 -12.2426 -0.3485 +-4.4629 -3.1694 9.8586 +-4.4629 -3.1694 9.858799999999999 +-4.4629 -10.5852 4.2757000000000005 +-4.4629 -10.5852 7.3285 +-4.4629 -12.679000000000002 7.3288 +-4.4629 -12.5922 8.899 +-4.4629 -10.5849 4.2757000000000005 +-4.4629 -10.5849 7.3285 +-4.4629 -12.6782 7.3285 +-4.4629 -9.7997 9.073599999999999 +0.5972 -13.115099999999998 11.5162 +-4.3756 -11.196100000000001 1.9201 +-4.3756 0.0585 10.5567 +-4.3756 -13.638 -0.43550000000000005 +4.61 -0.2035 10.1204 +4.61 -12.3297 6.7177 +4.61 -10.410400000000001 0.1749 +4.61 -10.410400000000001 0.2623 +4.61 -9.4511 7.3285 +4.61 -10.5851 0.0005 +-0.3628 -14.2486 3.2287999999999997 +-0.3628 -15.382599999999998 3.0540000000000003 +-0.3628 -15.382599999999998 4.2754 +-0.3628 -9.4508 -4.1868 +-0.3628 -12.678700000000001 3.7518000000000002 +-0.3628 -12.678700000000001 4.2754 +-0.3628 -13.376299999999999 11.429 +-2.718 -9.276299999999999 -2.7041 +-2.718 3.3737999999999997 9.6843 +-2.718 3.3737999999999997 7.5033 +1.2948 -15.0337 2.705 +-3.4156 1.9778 10.9057 +3.7373000000000003 -13.900000000000002 7.3288 +3.7373000000000003 -13.5512 9.597 +3.7373000000000003 2.2394000000000003 10.4694 +1.3820999999999999 -5.0887 7.5033 +0.6845 3.9844 10.3821 +0.6845 1.8033000000000001 11.4291 +-1.9331 0.5817 11.7781 +-1.9331 -14.1617 -3.3144 +-4.2883 -11.8935 1.9199000000000002 +-4.2883 -12.155199999999999 7.3288 +-4.2883 -14.249 0.5242 +4.6973 -12.0686 4.2754 +4.6973 -12.0678 4.2757000000000005 +4.6973 -11.719100000000001 1.9199000000000002 +4.6973 -10.410400000000001 1.309 +4.6973 -10.410400000000001 1.9199000000000002 +4.6973 -11.7193 1.9201 +4.6973 -11.4576 1.1346 +2.3421000000000003 -15.208499999999999 4.2757000000000005 +4.7846 -0.0289 9.5096 +4.7846 0.49439999999999995 7.503500000000001 +4.7846 -1.8608 9.5972 +4.7846 -1.8608 9.5969 +4.7846 -5.0887 9.684 +4.7846 -9.2766 9.9459 +4.7846 -9.1893 9.3352 +4.7846 -11.2826 7.3288 +4.7846 -10.410400000000001 2.4437 +4.7846 -10.410400000000001 4.2754 +4.7846 -5.0889 9.7714 +4.7846 -3.1694 9.5969 +4.7846 -11.0214 2.0075 +4.7846 -11.1952 8.8116 +4.7846 -0.4647 9.6844 +4.7846 -6.833200000000001 9.6843 +4.7846 -10.3235 7.3288 +2.167 -7.9676 -3.2272000000000003 +2.4294 -15.035000000000002 1.7453 +-0.1882 -15.5575 9.3355 +-0.1882 4.5949 10.2074 +-2.8058 -9.2759 11.5164 +-2.8058 -6.746099999999999 8.027 +-2.8058 -5.0889 8.027 +-2.8058 -6.833500000000001 11.5164 +-2.5433999999999997 -9.7121 11.6035 +-2.5433999999999997 4.0715 7.5033 +-2.5433999999999997 3.4610000000000003 10.731200000000001 +-2.5433999999999997 -6.833500000000001 11.2548 +-2.5433999999999997 -6.833500000000001 11.6035 +-2.5433999999999997 -11.5441 11.0802 +3.8246 -19.2212 -1.7442 +1.4694 -6.222799999999999 7.154000000000001 +1.4694 -14.4235 4.2754 +1.4694 -6.659 6.0196 +1.4694 -6.659 4.2754 +1.4694 -14.2486 4.2752 +1.4694 -14.2486 2.8798 +1.4694 -6.1357 7.0668 +1.4694 -13.3766 3.6642 +1.4694 -13.3766 3.6645 +1.4694 -13.3766 4.013 +1.4694 -15.382599999999998 4.2752 +1.4694 -15.382599999999998 2.705 +1.4694 -15.383099999999999 4.2754 +1.4694 -6.310200000000001 4.2754 +1.4694 -6.2229 7.0668 +1.4694 -6.1356 6.2816 +1.4694 -12.678700000000001 3.7517 +1.4694 -12.678700000000001 3.6645 +1.4694 -12.678700000000001 4.0135 +1.4694 -15.0339 2.6182 +1.4694 -6.6591 4.2757000000000005 +-0.8857999999999999 -5.4377 7.241499999999999 +3.127 1.891 11.167399999999999 +0.7718 -6.1356 4.2754 +-1.8457999999999999 -11.544500000000001 11.1672 +-1.8457999999999999 -14.161299999999999 10.8186 +-4.201 -8.6656 4.2757000000000005 +-4.201 -8.491 4.2757000000000005 +-4.201 2.0646999999999998 9.7716 +-4.201 -9.1017 -0.6967 +-1.7585 -12.9408 11.341700000000001 +-1.7585 -14.074100000000001 10.2951 +-1.7585 -19.2212 -2.4421999999999997 +-1.7585 -19.2212 -3.9251 +-1.7585 -11.544500000000001 11.2546 +-1.7585 -11.544500000000001 11.6036 +-1.7585 -13.8124 11.0801 +-1.7585 -14.249899999999998 -2.7041 +-1.7585 -9.276299999999999 -3.7509 +-1.7585 -9.276299999999999 -3.4017 +-1.7585 -9.276299999999999 -3.4890999999999996 +-1.7585 -9.276299999999999 -3.7506999999999997 +-1.7585 -14.1618 -3.9251 +-1.7585 -14.684800000000001 10.295 +-1.7585 -14.5977 10.2951 +-1.7585 -14.1612 10.295 +-1.7585 -14.1617 -3.9252000000000002 +-1.7585 -14.1617 -3.4889 +-1.7585 -14.1617 -3.5763999999999996 +-1.7585 -14.1617 -3.8379999999999996 +-4.1137 -9.2762 1.9199000000000002 +-4.1137 -18.959400000000002 -1.0461 +-4.1137 -8.404 0.6982 +-4.1137 -14.249500000000001 -1.308 +4.6095 -10.410400000000001 10.0336 +4.6095 -3.1694 10.2952 +-0.10089999999999999 -12.9413 -4.2742 +-0.10089999999999999 -6.4847 -2.6168 +-0.10089999999999999 -6.3101 -1.7439 +-0.10089999999999999 -19.2212 -4.1867 +-0.10089999999999999 -19.2212 -3.0530999999999997 +-0.10089999999999999 -7.8804 -3.4889 +-0.10089999999999999 -6.9209000000000005 -3.3144 +-0.10089999999999999 -9.2761 -4.0996999999999995 +-0.10089999999999999 -9.1888 -3.7506999999999997 +-0.10089999999999999 -18.0871 -4.2739 +-0.10089999999999999 -14.249899999999998 -3.2276 +-0.10089999999999999 -18.348200000000002 -4.2742 +-0.10089999999999999 -19.2209 -3.053 +-0.10089999999999999 -19.2209 -4.1868 +-0.10089999999999999 -9.276299999999999 -3.8381 +-0.10089999999999999 -9.276299999999999 -4.0996 +-0.10089999999999999 -14.1618 -4.2739 +-0.10089999999999999 -6.6592 -2.0060000000000002 +-0.10089999999999999 -7.3568 -3.6633 +-0.10089999999999999 -7.9676 -3.576 +-0.10089999999999999 -7.9676 -3.8379999999999996 +-0.10089999999999999 -6.397500000000001 -2.0060000000000002 +-0.10089999999999999 -6.397500000000001 1.9199000000000002 +-0.10089999999999999 -15.0334 -3.053 +-0.10089999999999999 -7.8805 -3.8379999999999996 +-0.10089999999999999 -6.1356 -0.6094999999999999 +-0.10089999999999999 -6.1356 1.9199000000000002 +-0.10089999999999999 -10.411299999999999 -4.1868 +-0.10089999999999999 -10.411299999999999 -3.9251 +-0.10089999999999999 -14.1617 -3.8381 +-0.10089999999999999 -14.1617 -4.2742 +-0.10089999999999999 -15.0349 -3.0530999999999997 +0.16149999999999998 -5.0889 7.4161 +0.16149999999999998 -5.3507 7.7649 +0.16149999999999998 -5.6996 7.3288 +0.16149999999999998 -5.6996 7.5034 +-2.4561 3.3734 10.9057 +3.9119 -12.155100000000001 10.5571 +3.9119 -14.249500000000001 1.9199000000000002 +3.9119 -14.249500000000001 -1.7442 +1.5567 -6.3974 -0.6094999999999999 +1.5567 -6.3974 1.9199000000000002 +1.5567 -6.6592 -2.0060000000000002 +1.5567 -7.008100000000001 -2.0060000000000002 +1.5567 -6.658899999999999 -2.0060000000000002 +1.5567 -6.397500000000001 1.9199000000000002 +1.5567 -7.0078000000000005 -2.0060000000000002 +1.5567 -6.7463999999999995 1.9199000000000002 +-0.7985000000000001 -6.1357 4.2754 +-3.4160999999999997 -7.5312 1.9201 +-3.4160999999999997 -7.5312 4.2754 +-3.4160999999999997 -13.725100000000001 1.9199000000000002 +-3.4160999999999997 -7.9673 1.9201 +-3.4160999999999997 -14.249 1.8324 +3.9992 -10.4101 -0.6976 +3.9992 -14.3371 -1.6568 +3.9992 -8.6659 -0.6976 +1.644 -14.1618 -4.0124 +3.3015999999999996 -13.9873 4.2757000000000005 +3.3015999999999996 -7.8804 -1.8313 +0.9464 -15.383099999999999 4.1881 +-1.6712 -9.5388 -3.8381 +-1.6712 -19.2212 -4.0122 +-1.6712 -16.2562 -2.5297 +-1.6712 -18.3486 -2.4421999999999997 +-4.0264 -7.8807 7.3288 +-4.0264 -6.8328 10.9927 +2.3416 -9.5382 11.6035 +2.3416 -5.0889 8.114 +2.604 -14.161499999999998 10.3825 +-0.0136 -6.746499999999999 -3.1399000000000004 +-2.6311999999999998 -11.5441 10.9927 +-2.6311999999999998 -14.249500000000001 1.9199000000000002 +-2.6311999999999998 -15.0349 -1.308 +0.0737 -10.4102 -3.8379000000000003 +0.0737 -10.4102 -4.1869000000000005 +4.0865 -14.249 -1.4822 +1.7312999999999998 -14.9468 4.9738 +3.3889000000000005 3.2862 9.5969 +0.7713 -19.2209 -4.2742 +-1.5838999999999999 -9.9745 -3.4890999999999996 +3.4762 -10.4101 -2.0060000000000002 +3.4762 -10.4101 -1.8313 +3.4762 3.2862 7.503500000000001 +3.4762 -8.4913 -2.0060000000000002 +1.121 -4.6522 9.858799999999999 +-1.4966 -6.5718 -2.0060000000000002 +-1.4966 -15.0349 -2.6168 +2.5162 -6.834 11.1675 +0.161 -10.411299999999999 -3.8379000000000003 +-4.8118 -10.4975 5.1480999999999995 +-4.8118 -10.4975 7.3285 +-4.8118 -11.0205 4.2754 +-4.8118 0.0585 7.503500000000001 +-4.8118 0.23310000000000003 7.503500000000001 +-4.8118 -10.584399999999999 4.2754 +-4.8118 -10.4973 2.7925 +-4.8118 0.3205 9.1606 +4.1738 -12.33 4.6248 +4.1738 -12.33 7.3285 +-3.1542 -9.3643 -2.8785000000000003 +4.2611 -12.3297 4.2757000000000005 +4.2611 -12.3297 7.3285 +4.2611 -11.9805 7.3285 +4.2611 1.1926 8.3759 +4.2611 1.1926 9.5969 +4.2611 -14.3371 0.9603 +4.2611 -12.155199999999999 4.2757000000000005 +4.2611 -14.249500000000001 0.2623 +1.6435000000000002 -6.8328 11.777999999999999 +1.6435000000000002 -9.5382 11.7781 +1.6435000000000002 -6.834 11.7781 +1.9059 -6.4847 -0.43499999999999994 +1.9059 -6.7463999999999995 -1.9183 +-0.7117 -6.1356 1.9199000000000002 +3.3011 -9.2759 -2.7039 +3.3011 1.8033000000000001 10.4695 +3.3011 -15.383099999999999 2.7925999999999997 +3.5635 -7.8804 -0.6973 +-4.0268999999999995 -12.155199999999999 10.295 +2.6035 -7.8804 -2.0060000000000002 +2.6035 -7.9676 -2.0060000000000002 +2.6035 -6.833699999999999 1.9199000000000002 +-2.3693 -15.383099999999999 1.9201 +-4.7245 -11.108 1.9201 +-4.7245 -0.46499999999999997 9.8586 +-4.7245 -1.0758 7.5033 +-4.7245 -9.7997 10.2076 +2.6908000000000003 -12.1546 11.2547 +2.6908000000000003 -12.2424 10.9057 +2.6908000000000003 3.2866 10.4695 +2.6908000000000003 -6.834 11.1675 +2.6908000000000003 -6.834 11.5164 +2.6908000000000003 -11.1074 11.4291 +0.3356 -4.390899999999999 7.5033 +0.3356 -4.303599999999999 8.7247 +0.3356 -19.2217 3.0541 +0.3356 -19.2217 4.1881 +0.3356 -5.0887 7.7652 +0.3356 -4.6522 8.7248 +0.3356 -4.6522 9.858799999999999 +0.3356 -15.383099999999999 3.0541 +0.3356 -15.383099999999999 4.1881 +0.3356 -4.3034 8.7248 +0.3356 -4.3034 9.6842 +0.3356 -4.6523 8.7247 +-2.282 -15.1214 8.201 +-2.282 -14.422799999999999 10.295 +-4.6372 -9.625 3.9261 +4.3484 -11.8935 7.3288 +4.3484 -11.8059 10.0333 +4.3484 -9.1893 10.0333 +4.3484 -8.752799999999999 4.2757000000000005 +4.3484 -3.1694 10.556899999999999 +4.3484 -10.4101 -0.6976 +4.3484 0.23210000000000003 10.4695 +4.3484 -8.9273 7.3285 +3.3884 -10.4102 -2.0060000000000002 +3.3884 3.1988999999999996 9.8589 +3.3884 -14.3363 6.8922 +-1.5844 -6.310200000000001 4.2754 +-1.322 -15.4712 -4.0996 +3.4757000000000002 -10.4102 -2.5294 +3.4757000000000002 -8.665799999999999 -2.0933 +-3.8523 -11.8935 -1.308 +-3.8523 -14.336199999999998 2.0075 +-3.8523 -13.899600000000001 4.2754 +-3.8523 -8.1421 1.9199000000000002 +0.1605 -6.8328 11.6034 +0.1605 -6.8328 11.8653 +0.1605 -10.7588 11.429300000000001 +0.1605 -6.833500000000001 11.6035 +0.1605 -6.833500000000001 11.8653 +0.1605 -11.5441 11.429300000000001 +0.1605 -11.5441 11.777999999999999 +-2.1947 -6.9207 -1.7439 +-2.1947 -4.2162999999999995 8.201500000000001 +-2.1947 -6.1355 7.3288 +-2.1947 -3.9545999999999997 9.858799999999999 +-2.1947 -3.8672999999999997 8.201500000000001 +-2.1947 -7.0079 1.9199000000000002 +-4.5499 1.0182 9.5971 +-4.5499 -6.833500000000001 10.4696 +4.4357 -11.0211 4.2757000000000005 +4.4357 -10.9338 7.066699999999999 +-0.7995 -15.6446 8.3756 +-0.7995 -15.6446 7.329 +-2.8923 -7.0077 4.2757000000000005 +-2.8923 -7.8804 -2.3550999999999997 +-2.8923 -7.5314000000000005 6.1071 +-2.8923 -7.5314000000000005 4.2757000000000005 +-0.7121999999999999 -9.2761 -4.0996999999999995 +-0.7121999999999999 -9.0144 -4.0996999999999995 +-0.44980000000000003 4.7695 8.8994 +-3.0674 -19.2212 0.5237999999999999 +-3.0674 -3.1694 11.4288 +3.563 -13.9874 7.3285 +-3.765 -17.825499999999998 2.0075 +-3.765 -13.2889 3.4899 +-3.765 -13.2889 4.2754 +-3.765 -13.8124 1.9201 +-3.765 -13.9872 4.2754 +-3.765 -13.3766 1.9201 +-3.765 -13.3766 4.2754 +-3.765 -15.383099999999999 1.9201 +-3.765 -14.1612 3.1411000000000002 +-3.765 -12.678700000000001 1.9203000000000001 +2.8653999999999997 -6.9209000000000005 7.503799999999999 +2.8653999999999997 -6.833500000000001 7.3290999999999995 +0.5102 -6.8328 11.5163 +-2.1073999999999997 -7.0079 1.9199000000000002 +-2.1073999999999997 -7.356999999999999 -2.0060000000000002 +-2.1073999999999997 -7.356999999999999 -1.6563 +-2.1073999999999997 -6.5718 -0.2605 +-2.1073999999999997 -6.5718 1.9199000000000002 +-4.4626 -6.8328 9.859 +-4.4626 -5.0888 9.859 +2.9527 3.1988999999999996 8.6372 +2.9527 3.1988999999999996 7.503500000000001 +-2.0201000000000002 -3.8672999999999997 9.7714 +-2.0201000000000002 4.0714 10.2949 +-2.9801 -16.6049 0.5237999999999999 +-2.9801 -19.2212 0.5242 +-2.9801 -7.5314000000000005 -1.8307 +-2.9801 -15.035000000000002 0.5237999999999999 +-2.9801 -15.035000000000002 0.5242 +-2.9801 -14.1617 -2.7039 +-2.9801 -14.249500000000001 -1.308 +1.2951000000000001 -10.934000000000001 -4.0996999999999995 +1.2951000000000001 -14.1617 -3.7506 +-3.6776999999999997 -13.986699999999999 7.3288 +-3.6776999999999997 -7.531599999999999 7.3285 +-3.4153000000000002 2.1525 10.731200000000001 diff --git a/assets/xarm7/contacts/link3_vhacd.txt b/assets/xarm7/contacts/link3_vhacd.txt new file mode 100644 index 0000000..2f5e5df --- /dev/null +++ b/assets/xarm7/contacts/link3_vhacd.txt @@ -0,0 +1,1448 @@ +1447 +0.992 2.2825 1.2772999999999999 +0.992 -2.4893 -6.097 +0.992 -2.5617 -6.17 +1.7152 -1.55 -2.4103 +1.7152 -2.6349 -2.4823999999999997 +-2.4063999999999997 -2.4175 -5.5916 +-1.6832 4.9571 -0.6025 +6.848 4.8125 -2.7718 +-3.6352 2.4986 -4.3618999999999994 +-3.6352 1.9926 -3.2773999999999996 +8.2944 1.1974 -2.3378 +8.2944 0.2572 -2.3378 +4.1728000000000005 -6.755800000000001 4.1692 +2.2207999999999997 5.6075 -4.4351 +2.2207999999999997 5.1735999999999995 -4.4351 +2.2207999999999997 3.8729 -7.9767 +2.2207999999999997 3.4388 -8.0496 +2.944 -6.755800000000001 -3.6391 +3.6672000000000002 2.2819 -10.145800000000001 +1.6424999999999998 -4.0081999999999995 -8.556 +1.6424999999999998 -4.0081999999999995 -9.4954 +3.0888999999999998 -6.755800000000001 3.7354 +-1.0327 -3.8636999999999997 -7.2543 +8.2217 3.15 -2.4101 +-2.9846999999999997 -3.1403 -8.194700000000001 +-2.9846999999999997 3.8004000000000002 -4.2171 +8.9449 1.1249 -2.0484999999999998 +4.3177 0.9804999999999999 -4.3628 +4.3177 0.9804999999999999 -7.6877 +4.3177 -0.17650000000000002 -9.1335 +4.3177 0.11280000000000001 -10.1464 +4.3177 0.619 -4.3628 +5.7641 4.2337 4.0245999999999995 +5.7641 6.547699999999999 2.579 +6.4873 5.7525 -2.0484999999999998 +4.4626 4.7394 -4.3622000000000005 +0.34099999999999997 -3.3576 -6.3142000000000005 +0.34099999999999997 -4.225099999999999 -8.1219 +1.0642 -2.5623 -0.8918 +1.0642 5.3906 -4.3626 +1.0642 4.3067 -8.0496 +1.0642 -6.7553 -0.8918 +1.0642 -2.5627 -0.8918 +1.0642 1.0528 1.2772999999999999 +1.0642 4.4512 -6.4587 +1.0642 5.752199999999999 -4.4351 +1.0642 5.9693000000000005 0.9880999999999999 +1.0642 3.9448999999999996 -8.0496 +-1.611 0.9083000000000001 -1.4701 +-1.611 4.5955 -4.1452 +-1.611 -1.6222 -4.3622000000000005 +-1.611 -0.8268 -4.0004 +-1.611 2.5711 -0.4581 +-1.611 -0.6097 -3.7836000000000003 +-1.611 4.668 -1.2533 +-1.611 1.1969 -1.7597 +-1.611 0.8357 -1.5427 +-1.611 2.4987 0.0482 +-1.611 4.6678 -4.1452 +-1.611 -1.1882 -4.3622000000000005 +-1.611 5.2463999999999995 -3.4943 +-1.611 1.2697 -1.1809999999999998 +-1.611 1.2697 -1.6873 +-1.611 2.2095 -0.0967 +-1.611 -1.6223 -4.3622000000000005 +-1.611 1.3422 -1.6143 +-1.611 1.3422 -1.5425 +6.9202 5.4633 3.0846 +6.9202 2.7883999999999998 3.88 +6.9202 5.174 3.2295 +-3.563 2.5711 -4.3622000000000005 +-3.563 0.6913 -4.3628 +-3.563 -1.3331000000000002 -5.5195 +8.3666 2.7157 -2.4101 +4.9681999999999995 6.6198999999999995 2.723 +2.4379 -6.7553 1.2772999999999999 +2.4379 -2.5627 1.2772999999999999 +2.4379 -2.5627 1.2049 +-0.9605 4.3789 0.4095 +-0.9605 -3.5023 -7.2543 +-0.9605 4.2339 -8.3388 +-0.9605 -3.9357999999999995 -7.327 +8.2939 2.7882000000000002 -2.4827 +9.0171 2.7157 1.4219000000000002 +-2.1893 2.8606 -0.3132 +-1.4661 1.2697 -1.6151 +-1.4661 1.2697 -1.5427 +2.3651999999999997 6.4754000000000005 2.2171 +3.8116 -1.2608 -10.1464 +3.8116 -1.8391000000000002 -8.1213 +3.8116 0.7634 -4.3628 +3.8116 0.5466000000000001 -5.375 +3.8116 -1.9837 -8.1212 +3.8116 -1.9115 -10.1464 +3.8116 -1.0439 -10.1464 +3.8116 -2.0561 -10.1464 +3.8116 -1.9839 -8.3388 +3.8116 -1.3334000000000001 -8.3388 +3.8116 0.3294 -4.3626 +3.8116 -1.1884000000000001 -8.266 +3.8116 0.3297 -4.3628 +1.8596000000000001 -2.4181 2.7231 +2.5828 -6.755800000000001 3.3742 +2.5828 -1.9842 -3.4222 +-1.5388000000000002 5.1014 -4.4350000000000005 +-1.5388000000000002 3.8 0.5541 +-0.0924 5.6800999999999995 -4.3622000000000005 +8.4388 -2.2008 -2.4103 +5.0404 5.608 -2.3376 +5.0404 6.619999999999999 -1.0364 +5.0404 6.9091 0.6262 +4.4621 3.5108 4.1693 +6.6317 0.7632 -4.0006 +6.6317 -2.1999 -3.7115 +3.9565 -0.8992999999999999 3.7355 +3.9565 1.9202000000000001 4.1693 +8.5837 -2.4899999999999998 2.7233 +8.5837 0.9802 2.7233 +3.8838 -6.755800000000001 -4.073 +-0.0202 -4.2975 -8.3391 +7.787800000000001 2.4266 -3.1334 +7.787800000000001 3.8003 -2.4101 +8.511000000000001 -6.755800000000001 2.7954 +8.511000000000001 2.7883999999999998 1.7833999999999999 +-2.6954 1.2697999999999998 -2.4101 +-2.6954 2.5711 -1.9038 +-2.6954 1.2697 -2.4829 +9.2342 2.7157 0.4821 +9.2342 0.7636000000000001 1.5667 +2.5823 -3.3571999999999997 -8.0496 +0.6303 6.4754000000000005 -1.3981000000000001 +1.3535 0.32980000000000004 -0.8918 +1.3535 -2.4181 1.9281 +1.3535 0.3297 -0.8918 +2.0767 -1.55 -2.4103 +9.1615 -6.755800000000001 -1.7590999999999999 +9.1615 2.7157 -0.38570000000000004 +-2.0448999999999997 -3.7914000000000003 -10.1464 +-2.0448999999999997 -3.5020999999999995 -7.2543 +-1.3216999999999999 5.463 -1.2533 +-1.3216999999999999 4.523499999999999 0.5543 +-0.5985 4.3787 1.422 +9.3064 1.1249 1.2772000000000001 +9.3064 -2.2005 -1.4702 +9.3064 -2.4899999999999998 1.4219000000000002 +9.3064 2.2092 -0.5303 +6.6312 5.3187 -2.4101 +6.6312 2.7157 3.5909000000000004 +6.6312 2.571 4.0247 +5.4024 -2.4899999999999998 3.9523999999999995 +2.004 6.0416 -3.639 +2.004 -2.5623 -2.2653 +2.004 -2.5623 -2.4101 +2.004 -3.6468 -8.1219 +2.004 0.3297 -2.3373999999999997 +-0.6712 5.6077 -4.0725 +-0.6712 0.5462 -1.6875999999999998 +-0.6712 5.8969000000000005 -1.2533 +-0.6712 5.1018 -4.2171 +0.052 3.8004000000000002 -10.146099999999999 +0.052 4.0171 -8.0498 +1.4984000000000002 4.595599999999999 2.9402999999999997 +7.86 4.9565 -1.47 +-3.3464 2.2819 -4.3628 +-3.9246999999999996 -1.7669000000000001 -8.0489 +-3.9246999999999996 0.6913 -10.1452 +-3.9246999999999996 -1.8392 -10.1452 +8.0049 2.7883999999999998 3.157 +8.0049 -2.4899999999999998 2.7957 +8.0049 2.2816 3.2295 +8.0049 5.174 1.9282000000000001 +-3.2015000000000002 2.5711 -4.3622000000000005 +-3.2015000000000002 2.5711 -2.1209 +-3.2015000000000002 2.2819 -10.146099999999999 +8.7281 -6.7553 -2.4103 +8.7281 -2.2008 -2.4103 +8.7281 -2.3461 -2.5547 +2.6545 6.4031 -2.5549 +2.6545 4.5957 3.5184 +3.3777 5.3184000000000005 -4.4350000000000005 +3.3777 2.2819 -7.904400000000001 +-0.0207 6.2584 -1.2533 +1.4257 -3.6467 -8.1944 +1.4257 3.583 2.868 +1.4257 3.583 2.7956000000000003 +1.4257 6.6922 -0.7469 +1.4257 -3.5742999999999996 -8.1219 +2.1489000000000003 -3.6467 -8.1219 +-1.2494999999999998 4.523499999999999 0.5543 +-2.551 -3.5020999999999995 -8.3394 +-2.551 -3.5020999999999995 -10.1464 +-1.8277999999999999 -3.1408 -7.327 +6.703399999999999 -6.755800000000001 2.651 +6.703399999999999 -2.5625999999999998 2.651 +6.703399999999999 5.969399999999999 1.7833999999999999 +4.7514 0.9077999999999999 4.313899999999999 +4.7514 -6.755800000000001 -2.9886 +4.7514 -2.5625 -2.9886 +2.0762 -3.7914999999999996 -10.145999999999999 +0.1242 2.5711 0.6988 +0.1242 1.4867 -0.0967 +0.1242 0.7638 -1.4701 +0.1242 1.1253000000000002 -1.5425 +0.1242 2.4985 0.6262 +0.1242 1.9202000000000001 0.6262 +0.1242 0.7636000000000001 -1.5425 +0.1242 2.4988 1.205 +-0.4541 5.5355 0.5543 +8.8003 2.7157 -0.6026 +8.8003 2.7157 -1.7590999999999999 +6.1251 -2.4899999999999998 4.2415 +7.5715 1.92 -3.4221000000000004 +3.4499000000000004 2.7883 -8.0498 +4.1731 0.9804999999999999 -10.1464 +4.1731 -1.1161 -8.1938 +5.6195 5.7527 3.5183 +0.7747 0.1848 -3.205 +2.9443 6.9091 0.9880999999999999 +0.9196 4.812799999999999 2.5063999999999997 +0.9196 6.186 -1.2533 +0.9196 6.330900000000001 0.9880999999999999 +0.9196 1.0527 -1.6151 +0.9196 6.4031 -2.3376 +0.9196 6.475300000000001 -1.2533 +0.9196 6.475300000000001 0.40930000000000005 +0.9196 -4.0806000000000004 -8.1219 +0.9196 0.6910000000000001 -1.5427 +0.9196 -3.7191 -8.0496 +0.9196 -0.899 -4.2894000000000005 +0.9196 4.3787 2.1447000000000003 +0.9196 -2.7788 -6.386500000000001 +0.9196 6.402900000000001 0.6267 +0.9196 6.402900000000001 0.5543 +0.9196 2.5711 1.9999 +0.9196 2.5711 1.4938 +0.9196 2.5711 1.4218 +0.9196 -3.2132 -6.386699999999999 +0.9196 6.1861 -1.2533 +0.9196 0.8357 -2.2658 +0.9196 6.4754000000000005 -1.2533 +0.9196 -2.1285 -4.9408 +0.9196 0.6916 -1.5425 +0.9196 6.547600000000001 -0.2417 +0.9196 5.9693000000000005 0.9880999999999999 +0.9196 -1.1882 0.4095 +0.9196 6.0415 0.5543 +0.9196 -3.7190000000000003 -8.0496 +0.9196 1.0531000000000001 -1.5425 +0.9196 -1.1165 -4.3622000000000005 +0.9196 0.9804 -1.8318 +0.9196 6.4030000000000005 0.5543 +0.9196 2.4263 1.928 +0.9196 0.4743 -2.8443 +0.9196 4.3783 2.5063999999999997 +0.9196 4.3783 2.1447000000000003 +0.9196 1.1248 -0.8918 +0.9196 0.6192 -0.0236 +0.9196 -1.8384 -4.6518 +0.9196 5.8969000000000005 -4.0725 +0.9196 6.0418 -2.4101 +0.9196 -3.1404 -6.2418000000000005 +0.9196 6.041300000000001 1.5664999999999998 +0.9196 6.041300000000001 0.5543 +0.9196 2.1372999999999998 1.2772999999999999 +0.9196 -2.996 -6.0975 +0.9196 -2.9238 -5.9524 +0.9196 -2.9238 -6.097 +0.9196 -1.4774 -4.3622000000000005 +0.9196 1.1251 -0.8918 +0.9196 -2.8516 -6.386699999999999 +0.9196 -4.0804 -7.904999999999999 +0.9196 5.3911 -4.3622000000000005 +0.9196 -2.6345 -6.2423 +1.6428000000000003 6.6198999999999995 1.0605 +-1.0324 -1.7666000000000002 -4.2894000000000005 +-1.0324 0.6910000000000001 -1.5427 +6.7756 6.1137 2.5066 +8.222 5.0287 -0.38570000000000004 +8.222 5.0287 -0.4581 +4.1004 -6.755800000000001 2.7956000000000003 +4.1004 -2.4181 4.1692 +4.1004 -2.5629 2.7956000000000003 +6.9932 6.0414 -0.8194999999999999 +6.9932 0.9077 -3.8559 +3.0165 -1.55 -3.5669 +3.0165 0.3296 -4.3622000000000005 +3.0165 -5.7432 -3.7113 +4.4629 4.8125 -4.3622000000000005 +1.0645 -0.6823 -3.5669 +8.8725 4.016900000000001 0.6989000000000001 +8.8725 2.7157 1.7833999999999999 +8.8725 2.7157 -0.3856 +8.8725 2.716 1.9282000000000001 +8.8725 -2.4899999999999998 2.3617 +8.8725 1.4146 -2.1208 +-2.3339 4.5955 -3.7837 +6.1973 1.2696 4.2415 +7.643700000000001 1.6303999999999998 3.5908 +4.245299999999999 0.6911999999999999 -10.1464 +4.245299999999999 -0.7543 -10.1464 +4.245299999999999 -0.7543 -8.1938 +5.6917 1.3419999999999999 4.314 +5.6917 -2.6349 4.314 +5.6917 -2.4899999999999998 4.314 +6.414899999999999 5.174 3.5183 +1.5701 0.6188 -3.0606 +2.2933 1.4866000000000001 2.7231 +2.2933 1.0528 2.7231 +-0.9601999999999999 3.0051 0.9161 +-0.9601999999999999 4.3783 0.48219999999999996 +-0.23700000000000002 -2.7788 -5.4465 +7.571 5.0294 -1.6865 +7.571 5.174 1.7836 +-3.6353999999999997 2.2819 -7.3266 +-3.6353999999999997 2.3544 -9.423 +-2.9122 3.728 -2.4823999999999997 +-2.9122 3.728 -4.3622000000000005 +-2.9122 3.8726999999999996 -2.6994000000000002 +9.0174 2.7157 1.4219000000000002 +9.0174 -2.4899999999999998 1.4219000000000002 +2.9438 0.6188 -3.8562 +2.9438 0.6188 -3.5669 +2.9438 0.2571 -3.5669 +3.6670000000000003 4.7401 -4.3622000000000005 +3.6670000000000003 4.7401 -4.2896 +4.3902 2.5713 -6.314 +4.3902 1.4873 -6.8202 +4.3902 0.909 -6.7478 +1.1367 6.4031 -2.4101 +1.1367 -6.7553 1.2772999999999999 +1.1367 -2.5627 1.2772999999999999 +1.1367 5.8972 2.0728 +-2.2617000000000003 3.7279 -1.2533 +6.9927 -6.7553 -3.9284 +7.7159 4.9567 1.7833999999999999 +8.4391 4.8845 0.2653 +8.4391 -2.4899999999999998 -2.4101 +8.4391 -2.4899999999999998 -2.3378 +8.4391 2.6433999999999997 2.7233 +4.3175 4.0172 -5.1579 +4.3175 4.0168 -5.230300000000001 +4.3175 4.0168 -4.7241 +4.3175 4.3066 -4.3622000000000005 +4.3175 2.2819 -5.7364 +4.3175 2.2819 -6.603299999999999 +4.3175 4.8125 -4.3622000000000005 +5.0407 1.1259 -4.4349 +6.4871 -2.5628 -4.1453 +3.016 -2.4177 3.7354 +3.7392000000000003 -1.2608 -8.6281 +3.7392000000000003 -0.4659 -7.2537 +5.1856 6.4031 -0.1687 +5.1856 6.8368 0.2652 +2.5104 -2.4177 3.3742 +-0.1648 -4.0081 -7.3263 +8.3664 2.7157 2.7234000000000003 +8.3664 4.5229 -1.0363 +9.0896 2.7883999999999998 1.3494000000000002 +9.0896 0.1842 1.928 +9.0896 2.2092 1.6388 +6.4144000000000005 -2.2008 -4.1453 +3.1609 6.9092 0.9880999999999999 +3.1609 5.7526 2.8679 +3.1609 6.7645 2.0728 +3.1609 5.8972 3.2291 +3.1609 6.6198999999999995 0.9880999999999999 +3.8841 -2.4177 3.7355 +5.3305 3.945 -4.3622000000000005 +0.4857 -3.5742999999999996 -6.6761 +1.2089 -2.4177 1.5667 +-2.1895000000000002 3.728 -1.2533 +-2.1895000000000002 4.6678 -1.5427 +-1.4663000000000002 1.6313000000000002 -0.5299 +-1.4663000000000002 4.668 -4.3622000000000005 +7.064900000000001 -2.5628 -2.4103 +7.064900000000001 -6.7553 -2.4103 +-4.1415 -1.1885 -8.1212 +7.788100000000001 5.0295 -0.1687 +7.788100000000001 -0.0313 3.5185 +-3.4183 1.3421 -2.7 +7.933 -5.8158 3.3737999999999997 +7.933 -6.755800000000001 1.4219000000000002 +7.933 -2.5625999999999998 1.4219000000000002 +5.981 5.1013 3.7354 +1.8594 4.0171 -8.0498 +-0.8158000000000001 5.8246 -2.5551999999999997 +-0.0926 -1.7669000000000001 -4.2894000000000005 +7.7154 5.0294 -0.24109999999999998 +8.438600000000001 -2.4899999999999998 2.9402999999999997 +8.438600000000001 -2.4899999999999998 2.9398 +9.161800000000001 2.7157 -0.5303 +9.161800000000001 1.7760000000000002 -1.398 +9.161800000000001 2.2816 1.4219000000000002 +-2.0446 4.957199999999999 -2.7721 +-2.0446 4.6677 -4.7966 +-2.0446 3.8004000000000002 -8.3384 +-2.0446 4.668 -1.2533 +-2.0446 4.3066 -4.3626 +-2.0446 4.3783 -0.5301 +-2.0446 -2.6342999999999996 -5.664000000000001 +-2.0446 4.7403 -4.3622000000000005 +-2.0446 3.4388 -8.3384 +6.486599999999999 2.1367000000000003 -3.4945999999999997 +4.4619 6.9091 -0.0241 +5.9083 6.619700000000001 -0.1687 +3.2331 2.2819 -8.1945 +3.2331 2.2819 -10.146099999999999 +3.9563 0.9804999999999999 -4.6521 +5.4027 3.8003 -3.7838 +2.0042999999999997 -6.755800000000001 -2.8441 +2.0042999999999997 4.595599999999999 3.2295 +2.0042999999999997 4.595599999999999 2.7956000000000003 +2.0042999999999997 -2.4177 2.868 +2.0042999999999997 -2.4177 2.7956000000000003 +8.3659 2.3542 -2.4101 +-2.1173 4.6678 -4.3622000000000005 +-0.6708999999999999 5.8971 -0.8194 +7.1371 4.9567 3.2295 +-3.3461 2.9328 -2.8434 +-3.3461 2.5711 -2.5551999999999997 +4.6068 -1.1881 4.313899999999999 +1.9316 4.0173 -8.0496 +1.9316 -2.4177 2.7956000000000003 +-0.0204 5.6799 -4.4351 +-0.0204 4.2343 -7.398499999999999 +-0.0204 4.3787 -8.0498 +-0.0204 3.8726 -8.5557 +-0.0204 3.8726 -10.1464 +-0.0204 3.8726 -10.146099999999999 +-0.0204 5.6078 -4.3626 +-0.0204 4.306299999999999 -10.146099999999999 +-0.0204 4.4512 -7.9045000000000005 +-0.0204 5.2461 -4.4351 +-0.0204 4.3788 -8.266 +-0.0204 4.5959 -6.2425 +-0.0204 4.089799999999999 -8.0496 +-0.0204 4.0171 -8.3388 +-0.0204 5.463 0.48190000000000005 +-0.0204 4.3064 -8.3388 +-0.0204 4.3064 -10.1464 +-0.0204 5.2462 -4.3626 +-0.0204 4.0174 -8.1212 +1.426 -2.6353 -2.0484999999999998 +8.5108 3.4392 -1.8315000000000001 +9.234 2.4988 -0.6026 +-1.9724 3.5111000000000003 -7.7601 +-1.9724 3.8726 -8.3384 +-1.9724 4.2344 -4.4350000000000005 +7.932500000000001 2.3542 -2.4101 +7.932500000000001 2.716 3.2295 +7.932500000000001 5.174 1.7836 +-3.2739 2.9329 -7.3266 +-3.2739 2.2819 -7.3266 +-2.5507 3.728 -4.3622000000000005 +-2.5507 3.8726999999999996 -1.2533 +-2.5507 4.3786 -2.5551999999999997 +7.4269 5.9692 -0.0241 +3.3053 -1.6948 -3.856 +3.3053 0.5465 -3.4944999999999995 +1.3533 0.329 -0.8918 +2.0765 -1.55 -2.4103 +2.0765 0.4019 -2.4103 +-1.9002000000000001 4.2338000000000005 -1.2533 +-3.8522 1.7035000000000002 -4.3628 +4.679 -0.9714999999999999 -3.8562 +7.5718 4.6673 -2.1931 +0.0518 4.3783 1.9999 +1.4982 -6.7553 -2.1207 +-2.6234 3.4386 -10.146099999999999 +8.0047 5.1019000000000005 -0.8921 +8.7279 -6.755800000000001 -2.4101 +8.7279 -2.1999 -2.4825 +9.4511 -2.4899999999999998 -0.5303 +9.4511 -2.4899999999999998 -0.9641000000000001 +9.4511 0.11280000000000001 -0.6026 +-1.7552999999999999 4.957199999999999 -4.3622000000000005 +3.3775 -1.55 -3.5666999999999995 +6.2703 5.0294 -2.3377 +6.2703 6.0414 3.0123 +6.2703 6.1859 -1.3976 +6.2703 6.4752 -0.5303 +6.2703 5.174 3.1571000000000002 +2.1487 -0.9712999999999999 -2.4103 +2.8719 6.9091 -0.2409 +-1.828 -1.6223 -4.3622000000000005 +-1.828 -1.6223 -4.2894000000000005 +-1.1048 2.5711 0.4818 +-1.1048 0.7636000000000001 -1.4701 +-1.1048 0.7636000000000001 -1.5425 +7.426399999999999 2.716 3.1571000000000002 +8.1496 -2.4899999999999998 2.7234000000000003 +8.8728 -2.4899999999999998 -2.3378 +3.5223999999999998 -0.9712999999999999 -3.4944999999999995 +3.5223999999999998 4.5957 3.8076 +3.5223999999999998 -0.1042 -3.4944999999999995 +0.8472000000000001 5.462899999999999 2.2171 +0.8472000000000001 -1.6226 -4.3622000000000005 +0.8472000000000001 0.6192 0.26480000000000004 +0.8472000000000001 0.6192 -0.0236 +0.8472000000000001 3.9448999999999996 -8.0496 +0.8472000000000001 1.3422 1.1324 +2.2936 4.089700000000001 -7.3986 +0.2689 5.3184000000000005 -4.3626 +0.2689 2.5711 0.771 +0.9921 0.3297 -0.8918 +-3.1295 1.2696 -2.266 +-3.1295 0.2575 -3.061 +8.8001 2.7887 -0.38570000000000004 +8.8001 3.7282999999999995 -0.8918 +8.8001 3.2944 1.7833999999999999 +-2.4063 3.0051 -0.6025 +-2.4063 3.8 -7.3266 +9.523299999999999 -1.9828999999999999 -0.3856 +9.523299999999999 -2.4899999999999998 0.6262 +6.8481 -6.755800000000001 3.9523999999999995 +6.8481 -6.755800000000001 2.651 +6.8481 5.897 -0.1687 +6.8481 2.7157 3.8802000000000003 +6.8481 2.7157 3.5909000000000004 +6.8481 -2.4899999999999998 4.0247 +6.8481 -2.4899999999999998 4.024500000000001 +6.8481 -2.4899999999999998 3.6633 +6.8481 6.331 1.7833999999999999 +6.8481 1.4143 4.0247 +6.8481 -2.5625999999999998 2.651 +6.8481 5.969399999999999 1.7833999999999999 +8.294500000000001 -6.755800000000001 -0.5303 +4.1729 5.7526 3.5186 +4.8961 3.6554999999999995 -4.3622000000000005 +4.8961 3.8003 -4.3622000000000005 +5.6193 2.7157 4.2415 +2.9440999999999997 5.6077 2.7958 +3.6672999999999996 0.3296 -3.5669 +1.6426 -6.755800000000001 2.3616 +2.3657999999999997 -2.4181 2.7956000000000003 +2.3657999999999997 0.6189 -3.5666999999999995 +-1.0326 4.2338000000000005 1.0606 +-1.0326 2.5711 0.5546 +-1.0326 2.5711 0.048 +-1.0326 2.716 0.6265 +-1.0326 2.716 0.1207 +-1.0326 4.2341 -8.3384 +-1.0326 4.3783 0.9157000000000001 +-1.0326 4.3783 0.3374 +-0.3094 6.1139 -1.3256999999999999 +7.4986 4.3786 -2.4101 +8.2218 5.1019000000000005 -0.1687 +-2.9846 3.7279 -2.6994000000000002 +-2.9846 -1.7675 -5.2301 +-2.9846 3.1495 -1.7597 +8.945 -2.4899999999999998 1.4219000000000002 +4.8233999999999995 -2.6351 4.314 +7.7162 4.9565 -0.4581 +3.5946 2.2819 -10.146099999999999 +4.3178 4.885 -4.3622000000000005 +4.3178 0.909 -6.7478 +4.3178 4.8125 -4.3622000000000005 +3.0162999999999998 6.0416 -2.4101 +3.0162999999999998 6.1861 -2.9884999999999997 +3.0162999999999998 5.0295 -4.3622000000000005 +3.0162999999999998 5.0295 -4.2896 +0.3411 4.0892 2.2168 +1.0643 -2.5623 -0.8918 +1.0643 -4.0806000000000004 -8.1219 +1.0643 -3.7191 -7.1816 +1.0643 0.32980000000000004 -0.8918 +1.0643 -0.6101 -3.5666999999999995 +2.5107 -2.4181 3.3742 +-1.6108999999999998 -4.0081 -8.3394 +-4.2861 0.5466000000000001 -8.4104 +-4.2861 -0.3936 -10.1452 +-4.2861 -0.466 -8.1212 +7.6435 0.7632 -3.4944 +7.6435 5.0292 1.7833999999999999 +7.6435 5.174 2.5786 +-3.5629 2.2819 -10.146099999999999 +-3.5629 2.7161 -4.3625 +4.2451 4.0168 -4.7241 +4.2451 2.2819 -5.7364 +4.2451 4.8847000000000005 -4.4350000000000005 +6.4147 5.0292 3.0846999999999998 +6.4147 4.9565 -2.3376 +6.4147 5.0287 -2.4101 +6.4147 5.174 3.157 +7.1379 -6.755800000000001 -2.4101 +7.1379 -6.755800000000001 -2.3378 +7.1379 -2.5625999999999998 -2.4101 +7.1379 -2.5625999999999998 -2.3378 +2.2931 -6.7553 -0.8918 +2.2931 -2.5627 -0.8918 +2.2931 1.0528 2.7231 +2.2931 1.0528 2.7956000000000003 +5.1132 6.0414 -2.3377 +5.1132 6.7646 -0.3135 +5.1132 2.3533 -4.217499999999999 +5.1132 5.6081 -2.3377 +5.1132 5.6081 -2.4101 +5.1132 6.4030000000000005 -0.24109999999999998 +5.1132 6.4750000000000005 -0.1687 +1.7148 -0.24849999999999997 -3.4944 +1.7148 0.2575 -3.5666999999999995 +-0.2372 4.7405 1.7108999999999999 +-0.2372 -4.2975 -10.145999999999999 +-3.6356 2.2819 -10.1464 +8.294 -2.3461 -3.0609 +9.0172 -2.4899999999999998 1.4219000000000002 +7.065200000000001 4.8125 -2.4101 +7.788399999999999 4.9567 -0.3856 +7.788399999999999 5.0289 -0.3856 +7.788399999999999 -2.4899999999999998 3.5185 +3.0885 -2.0562 -6.6036 +3.8116999999999996 1.053 -8.4825 +1.1365 -2.5623 1.2772999999999999 +1.1365 -2.6351 1.2772999999999999 +1.8597 -1.55 -2.6995 +1.8597 -2.6349 -2.6995 +7.7157 5.0295 1.7833999999999999 +7.7157 2.3533 -3.2056 +7.7157 5.7523 1.3494000000000002 +-3.4907 2.5711 -3.2776 +-3.4907 2.8604000000000003 -4.1452 +4.3173 5.3908 3.7354 +5.9086 6.7645 1.5663 +1.7870000000000001 0.6913 -2.4099 +2.5101999999999998 6.475300000000001 -2.3376 +2.5101999999999998 -6.755800000000001 1.2772999999999999 +2.5101999999999998 6.8368 -0.6747000000000001 +2.5101999999999998 6.8368 0.9880999999999999 +2.5101999999999998 6.5478 0.9880999999999999 +2.5101999999999998 6.6922 -1.4701 +2.5101999999999998 6.764399999999999 -1.0364 +2.5101999999999998 6.4030000000000005 -2.4101 +2.5101999999999998 6.4030000000000005 -1.1088 +2.5101999999999998 6.114 -2.1931 +2.5101999999999998 6.114 -2.4101 +2.5101999999999998 6.475499999999999 -1.0364 +2.5101999999999998 6.475499999999999 -0.6023999999999999 +3.2334 6.619800000000001 -1.7593 +3.9566 6.330900000000001 3.0846999999999998 +3.9566 6.6922 2.5786 +-0.165 5.8245 0.6267 +0.5582 4.3787 -8.0498 +2.0046 -6.755800000000001 2.7956000000000003 +9.0894 1.1974 -0.5303 +6.4142 -2.4899999999999998 4.1691 +-4.069 0.6913 -5.303100000000001 +5.1127 -6.755800000000001 3.0848 +5.1127 -6.755800000000001 4.2414 +5.1127 -2.4181 4.314 +5.1127 -2.5629 3.0848 +6.5591 1.92 -3.4944 +6.5591 2.2811000000000003 -3.8559 +6.5591 2.3533 -3.4944 +6.5591 -2.1999 -3.7836000000000003 +6.5591 -2.1999 -4.073 +3.1607000000000003 -2.4179 -10.145999999999999 +3.1607000000000003 5.7526 2.7955 +3.1607000000000003 -2.2008 -8.1219 +3.1607000000000003 -0.6105 -5.808 +3.1607000000000003 6.6922 2.2171 +3.1607000000000003 5.8249 3.2294000000000005 +3.1607000000000003 -0.8996999999999999 -6.097 +3.1607000000000003 -0.9716 -6.2423 +3.1607000000000003 -2.2731000000000003 -8.2668 +3.1607000000000003 6.6198999999999995 0.9880999999999999 +3.8838999999999997 -6.755800000000001 2.7231 +3.8838999999999997 -6.755800000000001 2.7956000000000003 +3.8838999999999997 0.9808000000000001 -10.1464 +3.8838999999999997 -2.5629 2.7231 +3.8838999999999997 -2.5629 2.7956000000000003 +1.9319 0.40169999999999995 -3.6394999999999995 +1.9319 -2.0558 -5.3743 +-2.1897 3.9447 -7.3263 +-0.7433000000000001 3.7278 1.3493 +-3.9967999999999995 1.4866000000000001 -5.2307 +7.932799999999999 2.7157 -2.4101 +7.932799999999999 2.4988 -2.3378 +8.656 1.1974 -2.4101 +4.534400000000001 -6.755800000000001 -4.217499999999999 +3.3056 -2.7069 -8.3384 +3.3056 -1.6943 -6.3861 +3.3056 -2.7792 -8.411200000000001 +1.3536 1.4144999999999999 1.2772999999999999 +1.3536 1.0528 1.2772999999999999 +1.3536 1.1253000000000002 2.1448 +2.0768 -6.755800000000001 2.7956000000000003 +2.0768 -6.755800000000001 2.8681 +-2.0448 3.4386 -7.9776 +-2.0448 3.3661999999999996 -10.146099999999999 +-2.0448 3.5832999999999995 -7.3266 +-2.0448 4.2338000000000005 -4.3625 +-2.0448 3.7276999999999996 -10.146099999999999 +-2.0448 4.1613999999999995 -4.5073 +-2.0448 4.3783 -5.8086 +-2.0448 3.9448999999999996 -7.3266 +-2.0448 3.4388 -8.3388 +-2.0448 3.4388 -10.1464 +-2.0448 3.5832 -7.3263 +-2.0448 3.8003 -10.1464 +9.3065 1.1974 -1.1088 +9.3065 -2.4899999999999998 1.4219000000000002 +-1.8999 3.4388 -10.0014 +1.2809 4.2339 -8.1222 +2.0040999999999998 -2.4893 -6.0247 +2.0040999999999998 -2.4181 2.8681 +2.0040999999999998 -2.5617 -6.0975 +2.0040999999999998 -2.6351 2.7956000000000003 +2.7273 3.3664 -10.146099999999999 +2.7273 3.5109000000000004 -8.1222 +-1.3943 2.5711 0.3374 +-2.6231 3.5109000000000004 -1.1085 +7.2818 3.8728 3.5187999999999997 +8.004999999999999 -2.635 -3.35 +7.4994000000000005 2.716 3.157 +7.4994000000000005 2.716 3.0846999999999998 +2.6546 6.7645 1.7111999999999998 +4.101 -2.4177 4.1693 +4.8242 -2.5628 -3.0610999999999997 +4.8242 -6.7553 -3.0610999999999997 +4.8242 -6.7553 -4.2174000000000005 +4.8242 -2.2008 -4.0007 +4.8242 -2.4183 -4.2899 +0.7026 4.3788 -8.0496 +1.4258 -2.5623 -2.0484999999999998 +1.4258 -2.5623 -0.8918 +1.4258 -2.4181 1.2772999999999999 +1.4258 0.8357 1.2772999999999999 +1.4258 -1.1162 2.1448 +1.4258 -1.044 -0.8918 +-3.2741 2.5711 -4.3618999999999994 +8.6555 -6.7553 -2.6270000000000002 +8.6555 1.197 -2.4101 +9.3787 0.9804999999999999 -0.9641000000000001 +9.3787 1.1974 -0.5303 +9.3787 1.1974 -0.8194999999999999 +9.3787 2.0645000000000002 0.4097 +-1.8277 -1.695 -4.3625 +-3.7796999999999996 0.11280000000000001 -4.3616 +3.3050999999999995 -2.5627 -2.4101 +3.3050999999999995 -2.5627 -2.3376 +4.0283 -2.1289 -4.1451 +2.0763 0.32980000000000004 -2.3376 +3.5227 -1.55 -3.9285 +3.5227 -1.55 -3.5669 +-0.5989 5.5353 0.48190000000000005 +-1.1772 4.8845 -4.3626 +-1.1772 3.8004000000000002 -8.3384 +-1.1772 3.8004000000000002 -8.1212 +-1.1772 5.246300000000001 -4.3626 +-1.1772 4.1619 -8.3384 +-1.1772 4.8125 -4.3626 +-1.1772 3.8003 -8.3384 +-1.1772 5.2462 -4.5798 +7.353999999999999 3.6554999999999995 -2.4101 +7.353999999999999 5.5357 -1.3976 +-3.8524000000000003 0.6913 -4.3628 +8.0772 5.1019000000000005 1.7833999999999999 +8.0772 1.197 -3.1333 +-3.1292 -2.4179 -10.1464 +-3.1292 -0.2486 -4.4350000000000005 +-3.1292 -0.2486 -4.3625 +-3.1292 -2.0557 -7.2543 +-3.1292 -2.0562 -7.2543 +8.8004 4.016900000000001 -0.3856 +8.8004 1.1972 2.434 +8.8004 3.4389999999999996 1.7833999999999999 +5.402 3.5827999999999998 -4.4349 +5.402 1.9212 -4.3622000000000005 +6.848400000000001 2.7157 3.5185 +6.848400000000001 5.8968 -0.1687 +6.848400000000001 5.8968 1.7833999999999999 +6.848400000000001 -2.4899999999999998 3.9523 +6.848400000000001 -2.4899999999999998 3.6630999999999996 +6.848400000000001 6.2583 1.7833999999999999 +6.848400000000001 6.3308 0.4097 +6.848400000000001 1.9927000000000001 3.9523 +3.45 0.3297 -3.5666999999999995 +0.05159999999999999 5.5355 0.5543 +0.7747999999999999 4.3787 2.5063999999999997 +0.7747999999999999 -2.8516 -6.5316 +2.2212 4.0172 -7.3986 +2.2212 5.246300000000001 -4.3622000000000005 +2.2212 5.6078 -4.3622000000000005 +2.2212 4.0168 -7.6154 +2.2212 3.4385 -8.049299999999999 +2.2212 3.4385 -7.8322 +2.2212 4.1617 3.3742 +2.2212 4.3066 -5.9526 +2.2212 3.9447 -6.7478 +0.9197000000000001 2.2825 1.2772999999999999 +0.9197000000000001 1.4866000000000001 1.2772999999999999 +0.9197000000000001 5.7524 2.0006 +0.9197000000000001 4.595599999999999 2.5785 +0.9197000000000001 0.11280000000000001 -3.3495999999999997 +0.9197000000000001 2.6439 2.1448 +0.9197000000000001 3.8722 2.5785 +0.9197000000000001 -0.6101 -3.5666999999999995 +0.9197000000000001 4.5957 2.5786 +1.6429 -2.5627 -2.4101 +-2.4787 -1.4057 -4.3625 +9.450899999999999 -6.755800000000001 -0.5303 +9.450899999999999 -6.755800000000001 0.8435 +9.450899999999999 -2.4899999999999998 -0.5303 +-3.7074999999999996 0.3297 -3.9279 +8.222100000000001 -4.8028 -0.5303 +8.222100000000001 5.0289 1.5664 +8.222100000000001 -2.4899999999999998 2.6508 +8.222100000000001 -2.5625999999999998 -0.5303 +4.8237000000000005 -1.55 -4.217499999999999 +4.8237000000000005 -1.55 -4.0006 +4.8237000000000005 0.6910999999999999 -3.9285 +4.8237000000000005 0.9082 -4.0006 +4.8237000000000005 1.6312 -4.3622000000000005 +2.1485 5.6802 -4.3622000000000005 +2.1485 4.0173 -6.6031 +2.1485 -3.6468 -10.145999999999999 +2.1485 3.4388 -8.0496 +2.1485 6.7645 -1.1085 +2.1485 -3.7192000000000003 -8.3391 +2.8717 4.885 3.5184 +2.8717 5.6077 3.3018 +2.8717 5.7524 2.7958 +2.8717 5.7524 2.7231 +2.8717 4.5957 3.2295 +2.8717 4.5957 3.5908 +3.5949 4.8125 -4.2174000000000005 +4.318099999999999 4.7394 -4.3622000000000005 +4.318099999999999 4.1611 -5.0853 +4.318099999999999 0.6194 -4.3622000000000005 +-1.105 3.5109000000000004 0.9880999999999999 +1.0646 -4.2979 -0.9643 +1.0646 -2.5627 -0.8918 +7.4262 5.8968 -0.1687 +8.1494 4.0168 -1.9761000000000002 +-2.3338 2.5711 -1.2533 +-2.3338 1.1972 -1.5428000000000002 +-2.3338 4.3061 -1.1809 +-2.3338 -1.1162 -3.9281 +5.4742 2.3547 -4.4349 +5.4742 3.2936 -4.3622000000000005 +6.9206 5.1019000000000005 -2.4101 +7.643800000000001 -6.755800000000001 3.5908 +4.9686 6.0416 -2.4827 +5.691800000000001 -2.5628 -4.2899 +2.2934 -3.6467 -10.145999999999999 +5.1135 2.3542 -4.2174000000000005 +0.2687 6.2585 -2.4103 +0.2687 2.6437 0.8437 +0.9919000000000001 -2.5623 -0.747 +0.9919000000000001 -2.5623 0.7711 +0.9919000000000001 -6.7553 0.4095 +0.9919000000000001 -6.7553 -0.3856 +0.9919000000000001 -2.5627 0.7711 +0.9919000000000001 2.1372999999999998 1.2772999999999999 +0.9919000000000001 -2.6353 -0.747 +1.7151 -6.7553 -2.4101 +1.7151 -3.5742999999999996 -10.145999999999999 +2.4383 -2.4181 2.7956000000000003 +-2.4065 2.5711 -1.2533 +-2.4065 2.5711 -1.3981000000000001 +-3.6353000000000004 -1.7669000000000001 -6.530900000000001 +-3.6353000000000004 -2.0556 -7.470899999999999 +-3.6353000000000004 2.3546 -7.3263 +-3.6353000000000004 2.2822 -7.3263 +-3.6353000000000004 2.2822 -4.3625 +8.2943 4.9567 -0.3856 +8.2943 -6.755800000000001 -0.5303 +8.2943 5.1019000000000005 0.5543 +8.2943 1.1974 -2.4101 +8.2943 5.0295 0.5543 +1.4975 -3.6468 -10.145999999999999 +1.6424 -2.5623 -2.4101 +1.6424 0.32980000000000004 -2.4101 +2.3656 -0.8992 2.7231 +2.3656 -2.4177 2.7231 +3.0888 5.5357 -4.2174000000000005 +-0.3096 5.6078 -4.4350000000000005 +1.1368 -6.7553 -0.8918 +1.1368 -6.7553 -1.3256999999999999 +1.1368 -2.5627 -1.3981000000000001 +7.498399999999999 3.8003 -2.844 +8.9448 -2.6349 -2.2653 +8.9448 -2.4899999999999998 1.4219000000000002 +-2.2616 1.2697999999999998 -1.3978000000000002 +-1.5384 5.3185 -1.3256999999999999 +-1.5384 -1.6941000000000002 -4.2894000000000005 +3.5944 2.788 4.024500000000001 +4.3176 0.9808000000000001 -7.6152 +4.3176 0.9808000000000001 -4.3628 +4.3176 2.2819 -6.6766000000000005 +3.0161000000000002 6.0416 -2.4101 +3.0161000000000002 6.186 -2.9884999999999997 +3.0161000000000002 5.1017 -4.2174000000000005 +3.0161000000000002 5.4632 -4.3622000000000005 +3.7393 6.9092 1.7836999999999998 +3.7393 3.5108 4.0247 +3.7393 1.9929999999999999 3.7356 +3.7393 2.3545 -8.0498 +3.7393 -1.0431 4.0969999999999995 +3.7393 4.595599999999999 3.8802000000000003 +3.7393 4.595599999999999 3.5187000000000004 +3.7393 2.2819 -8.0498 +3.7393 -2.4177 3.7355 +3.7393 1.9927000000000001 4.0247 +3.7393 1.9927000000000001 3.7355 +2.5105 4.0172 -6.2418000000000005 +-0.8879 4.3787 0.5543 +-0.8879 2.5711 0.1207 +7.6433 5.2463999999999995 2.5066 +-3.5631000000000004 0.6913 -4.3628 +9.0897 -2.4899999999999998 -0.5303 +4.968100000000001 6.2585 -0.8916999999999999 +4.968100000000001 6.619800000000001 -1.0364 +7.1377 6.186 1.711 +7.1377 6.2583 0.7712 +7.1377 1.6303999999999998 3.88 +5.113 6.9092 0.9880999999999999 +5.113 5.6077 3.6630999999999996 +5.113 5.7526 3.157 +5.113 5.7526 3.5186 +5.113 4.9567 3.5187999999999997 +5.113 5.6799 3.1572000000000005 +5.113 -6.755800000000001 4.2415 +5.113 -6.755800000000001 3.085 +5.113 2.7157 3.9523999999999995 +5.113 2.7157 4.2415 +5.113 6.8368 1.7833999999999999 +5.113 3.656 4.1692 +5.113 5.7524 3.5186 +5.113 2.716 3.9523 +5.113 2.716 4.2416 +5.113 -2.4899999999999998 4.0247 +5.113 -2.4899999999999998 4.314 +5.113 5.8249 3.5183 +5.113 5.8249 3.5186 +5.113 6.547600000000001 1.7833999999999999 +5.113 6.8369 1.7836 +5.113 4.6681 3.5908 +5.113 6.7645 -0.1687 +5.113 6.7645 2.289 +5.113 -2.5625999999999998 3.085 +5.113 1.5585 4.314 +5.113 6.4028 3.0123 +5.113 5.174 3.4461 +5.113 5.174 3.7355 +5.113 5.174 3.8077 +5.113 4.5957 3.9522000000000004 +5.113 6.547699999999999 1.7836 +5.113 6.6198999999999995 0.9880999999999999 +5.8362 -6.755800000000001 4.2415 +5.8362 6.6922 -0.0241 +2.4378 6.475300000000001 0.9880999999999999 +2.4378 6.8368 0.9880999999999999 +-0.23739999999999997 4.3064 -10.0014 +1.209 4.3065 -7.9767 +-2.1894 4.3789 -1.2533 +-2.1894 4.3789 -1.0363 +-2.1894 -2.273 -5.3026 +-2.1894 -1.9120000000000001 -4.7964 +-2.1894 -1.0439 -4.4350000000000005 +-2.1894 3.7276999999999996 -10.146099999999999 +-2.1894 4.668 -3.5664000000000002 +-2.1894 -2.9956 -7.2543 +-2.1894 -1.0441 -4.3625 +-2.1894 -2.9236 -7.2543 +-2.1894 -3.3575 -7.109400000000001 +-2.1894 4.7403 -1.9042 +-4.1414 1.2696 -8.1213 +3.6666 4.450699999999999 3.88 +3.6666 4.595599999999999 3.4462 +3.0883000000000003 5.8249 3.2294000000000005 +5.2579 6.2583 -1.9039000000000001 +5.2579 6.547600000000001 -1.1813 +1.8595000000000002 1.0528 2.7956000000000003 +-0.8157 -3.8638 -8.1219 +-0.8157 -3.0686 -6.5316 +-0.8157 -3.4298 -6.3864 +-0.8157 -3.3576 -6.3142000000000005 +-0.8157 -3.8636999999999997 -7.2543 +-0.8157 -3.7914999999999996 -8.556 +-0.8157 -3.7914999999999996 -10.145999999999999 +-0.8157 -2.9234 -6.3142000000000005 +-0.8157 -4.1527 -8.1219 +-0.8157 -4.1527 -7.976999999999999 +-0.8157 -3.4299999999999997 -6.386699999999999 +-0.8157 -1.4058 -4.4348 +-0.8157 -3.7912 -8.0496 +-0.8157 -4.225099999999999 -10.145999999999999 +-0.8157 -4.225099999999999 -8.2668 +-0.8157 -1.4055 -4.4350000000000005 +-0.8157 -1.8394000000000001 -4.3622000000000005 +-0.8157 -1.8394000000000001 -4.3625 +-0.8157 -3.5020999999999995 -7.2543 +-3.4909000000000003 -2.5621 -8.194700000000001 +8.4387 2.716 2.6509 +-2.7677 1.2697999999999998 -2.4101 +-2.7677 -0.6822 -4.3622000000000005 +-2.7677 2.5711 -1.3251000000000002 +-2.7677 1.4144999999999999 -1.7592 +-2.7677 0.8357 -2.2656 +-2.7677 1.2697 -2.4829 +-2.7677 -2.5621 -6.2418000000000005 +-2.7677 -1.1162 -4.2171 +7.3548 4.7399 3.157 +1.7868 3.9447 -10.146099999999999 +3.2332 0.1846 -4.7962 +3.2332 -2.7069 -8.3384 +3.2332 -0.0322 -4.3626 +3.2332 -2.7066 -8.1219 +3.2332 -0.1046 -4.3622000000000005 +3.2332 3.0775 -8.049299999999999 +3.2332 0.2569 -4.7966 +3.2332 -0.9716 -6.0975 +3.2332 -2.7792 -10.1464 +3.2332 -2.2728 -8.3388 +3.2332 -2.2728 -10.1464 +3.2332 -2.2006 -8.266 +3.2332 -1.4774 -6.097 +3.2332 -1.5500999999999998 -6.0975 +0.5579999999999999 1.1253000000000002 -1.5425 +1.2812000000000001 -2.9236 -6.0975 +1.2812000000000001 3.7276 2.7956000000000003 +-2.8404 2.5711 -1.3979 +-2.8404 -0.8989 -4.0001 +-2.8404 0.6914 -2.4105000000000003 +9.0892 2.8609 -0.8918 +-2.1172 2.5711 -0.38570000000000004 +-2.1172 4.6678999999999995 -4.4351 +-4.0691999999999995 -0.1041 -5.6643 +-4.0691999999999995 0.6913 -5.3027999999999995 +6.5588999999999995 -6.755800000000001 4.0968 +6.5588999999999995 6.547600000000001 0.5543 +6.5588999999999995 2.3533 -3.4945999999999997 +6.5588999999999995 2.3533 -3.8562 +6.5588999999999995 -2.1999 -3.7838999999999996 +6.5588999999999995 -2.1999 -4.0729 +6.5588999999999995 1.2692 -4.0006 +3.8837 1.9203999999999999 -10.145800000000001 +6.053299999999999 -6.7553 -4.2174000000000005 +6.053299999999999 2.716 4.1692 +8.510900000000001 4.016900000000001 2.0726999999999998 +8.510900000000001 2.716 1.7833999999999999 +8.510900000000001 1.4136 -2.6271 +-2.6955 2.5711 -1.2533 +9.234100000000002 -6.755800000000001 1.4219000000000002 +9.234100000000002 2.7157 0.6262 +-1.9723000000000002 -3.5023 -10.1464 +-1.9723000000000002 -3.5023 -7.2543 +-1.9723000000000002 -3.8635 -10.1464 +-1.9723000000000002 -3.7913 -8.0498 +-1.9723000000000002 -3.1408 -7.4714 +7.2094000000000005 -2.2739 -3.8559 +7.2094000000000005 3.8003 -3.0610999999999997 +7.2094000000000005 3.8003 -2.4827 +-3.997 -0.8266000000000001 -6.1705000000000005 +7.932599999999999 2.7157 2.7234000000000003 +-3.2738000000000005 2.933 -7.3263 +-3.2738000000000005 3.2945 -4.6518 +-3.2738000000000005 2.2822 -7.3263 +8.6558 2.7157 1.4944000000000002 +8.6558 1.1974 -2.4101 +8.6558 -2.4899999999999998 2.6508 +8.6558 4.2339 1.494 +2.5822000000000003 5.7524 3.0846 +2.7998 -2.4181 3.5908 +-1.3218 5.5354 -2.3379 +9.3063 -2.4899999999999998 1.4945 +5.9079 5.463500000000001 -2.844 +-3.8521 1.0527 -4.0724 +-3.8521 1.6313000000000002 -4.3618999999999994 +3.9558999999999997 6.3307 -2.3376 +3.4503 5.3187 -4.3622000000000005 +-0.6713 5.5353 -1.2533 +-0.6713 5.463 -1.2533 +0.0519 2.0649 0.7708999999999999 +8.5831 -1.4773 -2.6993 +-2.6233 3.7279 -4.3622000000000005 +-2.6233 3.5832 -4.3622000000000005 +0.9199999999999999 6.330900000000001 0.9880999999999999 +0.9199999999999999 5.7526 1.9282000000000001 +0.9199999999999999 5.8972 0.9880999999999999 +8.0048 2.0645000000000002 -2.4101 +-3.2016000000000004 -2.5623 -7.2543 +-3.2016000000000004 -2.3452 -10.1464 +-3.2016000000000004 -2.0559000000000003 -7.6884999999999994 +-3.2016000000000004 -0.1766 -4.4350000000000005 +-3.2016000000000004 -0.9717 -4.5072 +-3.2016000000000004 -2.4899999999999998 -7.470899999999999 +-3.2016000000000004 -1.6220999999999999 -5.447 +-3.2016000000000004 -1.9833 -7.470899999999999 +-3.2016000000000004 -2.7792 -8.0496 +-3.2016000000000004 -2.7792 -7.8332 +-3.2016000000000004 -2.7792 -10.1464 +-3.2016000000000004 -2.5621 -7.181500000000001 +-3.2016000000000004 -0.2486 -4.4350000000000005 +-3.2016000000000004 -2.0557 -6.0249 +-3.2016000000000004 -2.8516 -10.1464 +-3.2016000000000004 -2.0562 -7.399 +6.0527999999999995 -2.1999 -4.217499999999999 +3.3776 2.7159 -10.146099999999999 +0.7024 6.4030000000000005 0.3374 +1.4256 -2.5623 -0.8918 +1.4256 -2.5623 1.2772999999999999 +1.4256 -1.0437 -0.8918 +1.4256 0.6906 1.2772999999999999 +-1.2496 4.1621 -8.3384 +-1.2496 -3.4298 -6.458600000000001 +-1.2496 5.1739 -4.7242 +-2.5511 3.7279 -1.2533 +9.378499999999999 -2.4899999999999998 -1.2534 +-1.8279 4.3783 -1.1809 +-1.1047 4.8121 -4.5798 +-1.1047 4.1619 -6.8201 +-1.1047 4.1617 -10.1464 +-1.1047 4.8849 0.6267 +-3.7799 0.040499999999999994 -4.3628 +-3.7799 0.6913 -5.881 +-3.7799 -1.1162999999999998 -10.1464 +-3.7799 -0.827 -7.6160000000000005 +-3.7799 2.2095 -4.724600000000001 +8.1497 5.0294 -0.1687 +8.1497 5.0289 1.7833999999999999 +8.8729 2.7157 -0.5303 +8.8729 2.4263 -0.5303 +4.7513 0.6910999999999999 -4.3622000000000005 +6.9209000000000005 2.7157 3.88 +6.9209000000000005 -2.4899999999999998 3.5908 +2.0761000000000003 5.8249 2.7955 +0.12409999999999999 -2.2729 -4.8685 +0.8472999999999999 4.2339 -10.146099999999999 +-1.1774 -2.7064 -5.374700000000001 +-0.4542 5.6079 -1.2533 +0.9922 5.7526 1.2775 +0.9922 5.6799 1.4221 +0.9922 5.7524 1.4221 +0.9922 4.5957 2.145 +8.077 3.7282 2.8678 +8.077 5.0292 2.0004999999999997 +8.8002 -5.8158 2.4345 +8.8002 -2.4899999999999998 -2.4101 +8.8002 -6.2493 -2.4101 +9.5234 -2.4899999999999998 0.6262 +9.5234 -2.4899999999999998 -0.4578 +7.571400000000001 2.7157 3.5185 +7.571400000000001 -2.4899999999999998 3.6630999999999996 +3.4498 -6.755800000000001 -2.4103 +4.173 0.9808000000000001 -10.1464 +4.173 1.1252 -10.1464 +2.221 3.3664 -8.0498 +2.221 3.3667000000000002 -10.146099999999999 +2.221 3.8004000000000002 -8.0498 +2.221 3.6558 -10.146099999999999 +2.221 3.2941 -10.146099999999999 +2.9442 -0.1758 -4.3622000000000005 +2.9442 -0.1758 -4.2898 +2.9442 0.6189 -3.9285 +2.9442 0.6189 -3.5669 +1.6427 -1.7663000000000002 -4.8685 +1.6427 5.1018 2.94 +2.3659 5.6078 -4.4350000000000005 +2.3659 1.5585 2.7956000000000003 +9.4507 -6.755800000000001 -0.5303 +9.4507 -6.755800000000001 -0.8194999999999999 +9.4507 -2.4899999999999998 -0.5303 +-1.7557 4.4509 -4.3622000000000005 +7.4986999999999995 5.8249 1.9282000000000001 +7.4986999999999995 4.2337 3.1571000000000002 +-3.7077 2.3546 -6.2418000000000005 +-3.7077 2.2819 -4.3628 +6.993099999999999 -2.4899999999999998 3.9523999999999995 +6.993099999999999 -2.4899999999999998 3.9523 +2.8715 -1.6217 -5.6633000000000004 +4.3179 1.9929999999999999 4.2416 +3.7396 6.7645 -1.0364 +0.3412 -1.6944000000000001 -4.2894000000000005 +1.0644 5.6077 2.2897 +1.0644 4.2343 -8.0496 +1.0644 1.0528 1.4944000000000002 +1.0644 4.4512 -6.4587 +1.0644 5.752199999999999 -4.4351 +1.0644 3.9451 -7.8323 +1.0644 4.595599999999999 2.217 +1.7875999999999999 -6.755800000000001 -2.4103 +8.872399999999999 -2.4899999999999998 2.3619000000000003 +4.2452 1.1976 -4.4353 +4.2452 2.2819 -5.8092999999999995 +4.9684 4.2333 -4.5071 +0.8468 -4.225099999999999 -8.411399999999999 +2.2932 -6.7553 -0.8918 +2.2932 -2.5627 -0.8918 +1.7149 -1.55 -2.4825 +1.7149 -1.55 -2.4103 +1.7149 0.6913 -2.4103 +1.7149 0.3297 -3.5666999999999995 +1.7149 -0.1764 -3.5666999999999995 +2.4381 -0.8984000000000001 2.7956000000000003 +2.4381 -2.5629 1.2772999999999999 +2.4381 3.7278 -8.049299999999999 +2.4381 -2.4177 2.7956000000000003 +2.4381 3.9447 -6.458800000000001 +-1.6835 1.2697999999999998 -1.1088 +-1.6835 4.5955 -1.2533 +-1.6835 1.1972 -1.1809999999999998 +-1.6835 -1.1162 -4.3622000000000005 +-1.6835 2.2817 -0.0965 +8.2941 4.7399 1.7833999999999999 +2.9437 6.3308 -2.6272 +3.6669 -2.2006 -8.049199999999999 +0.919 -4.1528 -8.1219 +0.919 -4.225099999999999 -10.145999999999999 +2.3654 -2.5627 -0.9643 +3.8118 1.9929999999999999 3.7356 +3.8118 1.9929999999999999 4.0969 +5.2581999999999995 3.8003 -3.9282999999999997 +0.4134 5.752199999999999 1.5664999999999998 +1.1365999999999998 -2.5623 -1.3981000000000001 +1.1365999999999998 0.9081 1.6389 +1.1365999999999998 0.32980000000000004 -1.4702 +1.1365999999999998 5.752199999999999 -4.3626 +1.1365999999999998 5.3183 -4.4351 +1.1365999999999998 0.9804 -0.8918 +1.1365999999999998 -2.4177 1.2772999999999999 +-2.2618 -0.9717 -4.4350000000000005 +-2.2618 -3.3576 -7.181500000000001 +-1.5386 2.5711 -0.3852 +-4.2138 -0.9714999999999999 -10.1452 +-4.2138 0.7636999999999999 -7.6877 +-4.2138 0.9808000000000001 -10.1464 +-4.2138 0.6913 -10.1452 +-4.2138 0.6913 -10.1464 +-3.4906 -0.46509999999999996 -4.2894000000000005 +4.3174 -2.4178 -4.217499999999999 +3.0159 6.9092 0.9880999999999999 +3.0159 6.330900000000001 2.7955 +3.7391 3.2939999999999996 4.024500000000001 +3.7391 4.595599999999999 3.8077 +3.7391 2.4268 -8.049299999999999 +3.7391 -2.4177 4.024500000000001 +3.7391 -2.4177 3.6630999999999996 +1.7871000000000001 -2.3453 2.6509 +3.2335000000000003 6.4030000000000005 2.7952999999999997 +-1.6113 4.2338000000000005 0.3374 +-0.8881 5.5353 -0.0243 +-2.8401 3.9447 -4.3625 +9.089500000000001 -6.755800000000001 1.928 +9.089500000000001 1.1974 -0.5303 +9.089500000000001 -2.4899999999999998 -0.5303 +9.089500000000001 0.3297 -1.8316 +-2.1169000000000002 -2.9236 -7.181500000000001 +5.6911000000000005 5.8246 -2.4827 +5.1128 6.0416 -2.4101 +5.1128 6.475300000000001 -1.4703000000000002 +5.1128 1.9929999999999999 4.2416 +5.1128 4.4506 3.6634 +5.1128 5.608 -2.4101 +5.1128 6.2585 -1.0364 +5.1128 6.5478 0.8432000000000001 +5.1128 2.0653 3.9523999999999995 +5.1128 6.9091 0.9880999999999999 +5.1128 3.0051 4.2416 +5.1128 6.1862 -1.1088 +5.1128 -2.4177 4.313899999999999 +5.1128 -2.4177 4.0247 +5.1128 4.523 4.0247 +5.1128 1.9927000000000001 4.0247 +5.1128 1.9927000000000001 4.2416 +5.836 5.8248 -2.4101 +7.2824 -1.6939 -3.7836000000000003 +3.884 -1.8391000000000002 -8.1213 +3.884 0.9804999999999999 -10.1464 +3.884 -1.9115 -10.1464 +1.2087999999999999 -6.755800000000001 1.2772999999999999 +1.2087999999999999 -6.538399999999999 1.4944000000000002 +7.0648 6.186 1.856 +-3.4184 2.6436 -10.146099999999999 +8.511199999999999 -2.4899999999999998 2.7234000000000003 +8.511199999999999 1.4143 2.7957 +3.8113 -2.4181 4.0968 +1.8592999999999997 1.0528 2.7956000000000003 +1.8592999999999997 4.595599999999999 2.7231 +1.8592999999999997 4.595599999999999 2.7956000000000003 +3.3057000000000003 2.1371 -10.145800000000001 +3.3057000000000003 2.2819 -8.193200000000001 +3.3057000000000003 2.2095 -8.193200000000001 +-0.8159 -4.2252 -8.3394 +-0.8159 -4.2252 -10.1464 +-0.8159 -3.7190000000000003 -10.1464 +-0.8159 -3.5746 -7.2543 +-0.0927 5.6078 -4.5798 +8.4385 2.3533 -2.4101 +8.4385 -2.1999 -2.4101 +-2.7679 -0.6094999999999999 -4.3616 +-2.7679 1.6313000000000002 -1.6874 +-2.7679 2.5711 -1.2533 +-2.7679 2.5711 -2.0492 +-2.7679 2.5711 -1.3979 +-2.7679 -1.1162 -4.3616 +9.1617 2.7157 -0.3856 +9.1617 3.0776000000000003 -0.0963 +6.4865 4.885 -2.9884999999999997 +6.4865 4.8125 -2.4101 +7.3546 -0.5373 3.8077 +3.2329999999999997 3.2939999999999996 3.88 +3.2329999999999997 -2.7793 -8.1219 +3.2329999999999997 -2.2731000000000003 -8.1219 +3.2329999999999997 -2.8516 -10.145999999999999 +5.4026 3.8003 -4.3622000000000005 +1.281 1.5586 1.2049 +1.281 0.6906 -0.8918 +2.7274 -1.55 -3.4944 +7.1370000000000005 3.5108 -3.2779999999999996 +7.1370000000000005 2.3542 -3.5665000000000004 +7.860200000000001 -6.7553 -3.4221000000000004 +7.860200000000001 -2.2008 -3.4221000000000004 +7.860200000000001 -2.1999 -3.4221000000000004 +-3.3462 2.2822 -4.3625 +6.558700000000001 4.8125 -2.4101 +6.558700000000001 4.2337 3.8077 +-3.9245 0.6913 -10.1464 +-3.9245 1.8481999999999998 -10.1464 +8.0051 -6.755800000000001 1.2047999999999999 +8.0051 -6.755800000000001 1.4219000000000002 +8.0051 2.7157 2.6508 +8.0051 2.2816 2.6508 +8.0051 2.2816 2.7233 +8.0051 -2.5625999999999998 1.4219000000000002 +8.7283 2.7157 1.4219000000000002 +8.7283 2.6433999999999997 1.2047999999999999 +6.7763 2.3533 -3.7836000000000003 +1.2083 -3.6468 -8.1219 +4.8243 3.8003 -4.3622000000000005 +0.7027 -1.1165 -4.3622000000000005 +0.7027 -1.1165 -4.4348 +-1.9725 3.8726 -8.3388 +-1.9725 -3.4298 -10.1464 +-1.9725 -3.0683 -7.2543 +-1.9725 -3.7914000000000003 -8.194700000000001 +-1.9725 -3.7914000000000003 -10.1464 +-1.2493 4.8849 0.4095 +7.9324 2.7157 -2.4101 +7.9324 2.7157 -2.2651999999999997 +-3.274 -0.7551 -4.3628 +-3.274 -2.2007 -6.458500000000001 +-3.274 2.2819 -8.1938 +-3.274 -2.7792 -10.1464 +-3.274 -2.5621 -7.4712 +-3.274 2.2095 -10.1464 +9.3788 1.1974 -0.5303 +9.3788 -2.6349 1.2772000000000001 +-1.8276000000000001 4.3789 -1.2533 +5.9804 2.3533 -3.7116000000000002 +4.0284 0.9808000000000001 -4.6527 +4.0284 5.7524 3.5186 +6.198 6.619800000000001 1.7836 +2.0764 -3.6466 -7.977099999999999 +3.5228 6.3308 -2.4101 +-0.5988 5.5355 -1.2533 +-0.5988 5.4631 -4.3622000000000005 +-0.5988 5.6802 0.265 +-0.5988 5.1741 -4.3622000000000005 +-0.5988 5.5354 -1.2533 +-0.5988 5.8969000000000005 -1.2533 +-0.5988 5.8969000000000005 -2.6994000000000002 +-0.5988 5.6079 -1.2533 +-0.5988 5.6800999999999995 -3.8558000000000003 +-0.5988 5.174 -4.3622000000000005 +-3.8523 -1.1159000000000001 -6.3874 +-3.8523 -0.5381 -5.158 +-3.8523 -1.9837 -8.2667 +-3.8523 -1.9837 -10.1464 +-3.8523 -0.7551 -7.470899999999999 +-3.8523 0.6913 -4.5068 +-3.8523 0.6913 -5.881 +-3.8523 0.6913 -7.470400000000001 +-3.8523 0.6913 -4.3628 +-3.8523 -1.1162999999999998 -10.1464 +-3.8523 -0.8992 -10.1452 +-3.8523 -0.827 -7.4712 +-3.8523 -1.8392 -10.1452 +-3.8523 -1.6220999999999999 -7.3260000000000005 +-3.8523 -1.6948 -7.4712 +-3.8523 -0.1764 -5.0135 +6.8485000000000005 -6.755800000000001 3.9523999999999995 +6.8485000000000005 -6.755800000000001 2.5789 +6.8485000000000005 -2.4899999999999998 3.9523999999999995 +6.8485000000000005 -2.5625999999999998 2.5789 +2.7269 -3.3574 -8.483699999999999 +2.7269 -1.55 -3.4944999999999995 +3.4500999999999995 0.5466000000000001 -4.3626 +4.8965000000000005 -6.7553 -4.2899 +5.6197 2.4266 -4.3622000000000005 +0.7749 6.2585 -2.9161 +1.4981 -1.9115 1.2772999999999999 +1.4981 -2.4177 1.3497999999999999 +-2.6235 4.0892 -5.0855 +-2.6235 3.6553000000000004 -7.253800000000001 +0.9198 6.0416 -2.4101 +0.9198 5.7524 -4.3622000000000005 +0.9198 6.2583 -2.9884999999999997 +0.9198 -0.1767 -3.6394999999999995 +0.9198 -0.1767 -3.5669 +0.9198 5.3911 -4.3622000000000005 +0.9198 5.3911 -4.2896 +8.7278 4.1613 -0.38570000000000004 +8.7278 2.7157 -1.8315000000000001 +9.451 1.0525 0.5542 +9.451 1.2696 -0.2409 +9.451 -2.4899999999999998 -0.5303 +6.7758 6.331 -0.1687 +3.3773999999999997 -6.7553 -2.3376 +3.3773999999999997 -5.7433 -2.4101 +3.3773999999999997 -2.5625 -2.4103 +3.3773999999999997 -1.1161 3.9523 +4.1006 4.0172 -4.7242 +4.1006 3.9447 -4.7967 +4.8238 -6.755800000000001 -4.217499999999999 +4.8238 -6.755800000000001 -3.061 +4.8238 0.6910000000000001 -3.9284 +4.8238 -2.5625 -3.061 +4.8238 -1.55 -4.217499999999999 +4.8238 -1.55 -4.0006 +4.8238 1.7752000000000001 -4.3621 +4.8238 -2.1999 -4.217499999999999 +4.8238 -2.1999 -4.0006 +4.8238 0.8354999999999999 -4.3621 +4.8238 -0.9712999999999999 -3.9284 +5.547 2.3533 -4.3621 +6.993399999999999 5.0287 -2.4101 +2.1486 3.3667000000000002 -8.1222 +0.1966 3.8004000000000002 -8.5558 +0.1966 2.5711 1.3495 +-1.1049 5.5355 -1.2533 +-1.1049 5.5355 -0.964 +-0.3817 5.462899999999999 0.9882 +6.703099999999999 4.5955 -3.0610999999999997 +-3.0568999999999997 3.6554999999999995 -4.3622000000000005 +6.9207 -6.755800000000001 3.9523999999999995 +6.9207 6.2583 -0.1687 +2.7990999999999997 4.885 3.5184 +2.7990999999999997 4.5957 3.1569 +4.9687 -2.2008 -4.2899 +0.8471 4.3783 2.5063999999999997 +0.8471 3.222 2.3614 +0.8471 2.6437 2.0723 +1.5703000000000003 1.0528 2.434 +2.2935 3.6554999999999995 -10.146099999999999 +2.2935 3.8003 -8.0498 diff --git a/assets/xarm7/contacts/link4_vhacd.txt b/assets/xarm7/contacts/link4_vhacd.txt new file mode 100644 index 0000000..5fe6303 --- /dev/null +++ b/assets/xarm7/contacts/link4_vhacd.txt @@ -0,0 +1,1472 @@ +1471 +11.6032 -9.9468 8.4875 +11.6032 -6.3994 -0.6687000000000001 +11.6032 -7.1419999999999995 6.590400000000001 +11.6032 -12.67 1.1457 +10.0352 -4.5846 2.6308000000000002 +5.5808 -5.41 -2.6492 +5.5808 -4.7496 -0.752 +3.3536 2.7579 6.6732 +3.3536 -3.4296 6.9205000000000005 +3.3536 -2.7695999999999996 8.6528 +3.3536 1.7677999999999998 9.395199999999999 +3.3536 1.7677999999999998 9.3124 +3.3536 2.5929 9.0651 +3.3536 -2.1924 6.6731 +-0.3584 2.8398 10.385 +6.4064 -0.7073 8.4875 +6.4064 -5.9045 -3.6388 +7.0656 -4.089799999999999 2.6306 +4.8384 -16.9589 -3.1441 +4.8384 -12.67 -3.2263 +5.9113 -6.976699999999999 -3.3914 +5.9113 -6.5642000000000005 -3.7212 +5.9113 -5.4096 -1.9893999999999998 +5.9113 -4.9974 -1.9893999999999998 +3.6841 -9.533800000000001 6.590400000000001 +-2.3383000000000003 3.6647 8.57 +11.1081 -10.2771 4.2805 +11.1081 -11.0195 4.2805 +11.1081 -10.029499999999999 2.6308000000000002 +11.1081 -12.6686 -2.8143000000000002 +11.1081 -16.9589 -2.7314000000000003 +11.1081 -5.4923 6.5906 +11.1081 -12.339 2.7958 +11.1081 -12.339 2.6308000000000002 +11.1081 -12.67 -2.8137 +11.8505 -7.059200000000001 7.6627 +9.6233 -12.6686 -3.8865 +9.6233 -12.6686 -3.5567 +9.6233 -16.9589 -2.4840999999999998 +9.6233 -12.7523 -2.4840999999999998 +9.6233 -6.895 -3.3917999999999995 +9.6233 -6.895 -3.8042 +9.6233 -12.67 -3.8864 +9.6233 -12.67 -3.5564 +9.6233 -16.875799999999998 -3.8864 +-0.8534999999999999 4.2423 8.4879 +-4.3182 -0.4598 7.4979000000000005 +6.901 -5.4921999999999995 -3.5564 +4.6738 -8.957600000000001 -3.0616999999999996 +4.6738 -7.0605 -2.7316 +4.757 -7.1419999999999995 10.2203 +4.757 -8.7919 10.0553 +4.757 -8.7919 10.3851 +4.757 -8.3792 10.0553 +9.8706 -12.0916 4.2805 +-2.8334 -0.21220000000000003 10.3849 +-2.8334 1.8501 10.0549 +6.1586 -1.0373 8.6528 +6.1586 -4.5839 6.7555000000000005 +6.1586 -16.9589 2.5479000000000003 +6.1586 -16.9589 2.6306 +6.1586 -12.7523 2.5479000000000003 +6.1586 -12.7523 2.6306 +6.1586 -4.5846 6.6731 +6.1586 -4.1719 7.168099999999999 +6.1586 -3.8419000000000003 7.333 +6.1586 -4.1711 7.167999999999999 +6.1586 -4.1711 6.5906 +6.1586 -0.7901 8.0752 +6.1586 -1.3676000000000001 7.745299999999999 +6.1586 -0.4593 8.6528 +6.1586 -1.4500000000000002 7.745 +7.148300000000001 -8.9574 10.137699999999999 +7.148300000000001 -12.173499999999999 9.3127 +7.148300000000001 -8.7919 10.4677 +7.148300000000001 -11.018799999999999 10.137699999999999 +11.6859 -8.3793 4.2805 +11.6859 -8.8749 1.1457 +9.4587 -8.7918 10.22 +3.4362999999999997 -9.3696 8.982800000000001 +3.4362999999999997 0.4475 10.3027 +3.4362999999999997 2.5096 9.0653 +3.4362999999999997 1.6021 9.8901 +3.4362999999999997 2.675 6.672899999999999 +3.4362999999999997 2.4272 9.2304 +3.4362999999999997 -0.29550000000000004 10.467600000000001 +3.4362999999999997 -8.4619 10.1378 +3.4362999999999997 2.5922 8.899899999999999 +-2.5861 -3.0171 6.672899999999999 +-2.5861 -3.5120999999999998 8.0752 +-2.5861 -2.8521 8.9003 +10.8603 -6.151800000000001 8.982800000000001 +6.405900000000001 -4.254899999999999 4.2805 +4.1787 -1.1202 8.652600000000001 +4.1787 1.273 6.672899999999999 +4.1787 -1.2849 6.6731 +10.9435 -12.6686 -2.4840999999999998 +10.9435 -12.6686 -2.3189 +11.9332 -8.7091 8.1576 +11.9332 -8.1318 -0.9989 +11.9332 -7.1421 -0.0093 +11.9332 -9.369299999999999 6.590400000000001 +11.9332 -16.9589 -1.1642 +11.9332 -7.0596000000000005 6.590400000000001 +11.9332 -7.1419999999999995 6.590400000000001 +11.9332 -7.554900000000001 7.9108 +11.9332 -8.1319 -1.0815 +11.9332 -12.67 -1.1642 +11.9332 -12.67 1.1457 +11.9332 -12.6687 -1.1642 +11.9332 -12.6687 1.1457 +9.706 -12.6686 -3.8865999999999996 +9.706 -8.0503 -3.8865999999999996 +1.4564000000000001 3.6649000000000003 8.4879 +1.4564000000000001 -7.9667 8.9002 +1.4564000000000001 4.0774 8.487599999999999 +1.4564000000000001 3.7475 6.6732 +1.4564000000000001 3.7475 8.487599999999999 +1.4564000000000001 3.7473 9.395199999999999 +1.4564000000000001 3.0876 9.395199999999999 +1.4564000000000001 4.077299999999999 8.4879 +-2.3388 -0.4602 9.9726 +10.4484 -5.3271 4.2805 +10.4484 -5.4097 4.2805 +10.4484 -5.4097 6.590400000000001 +8.2212 -12.6686 -4.299 +5.994 -16.958599999999997 3.9503000000000004 +4.426 -12.6692 -2.7315 +4.426 -7.720200000000001 -2.7315 +4.426 0.11750000000000001 10.0553 +11.1908 -10.2771 4.2805 +11.1908 -12.0089 2.6308000000000002 +11.1908 -16.9589 2.6306 +11.1908 -10.9367 6.507899999999999 +11.1908 -10.4421 2.6308000000000002 +11.1908 -12.67 2.6306 +5.1684 -16.3808 -3.4736000000000002 +-0.5235 1.7676 10.6326 +-2.7507 -0.4598 10.3852 +10.6957 -9.947000000000001 9.5601 +0.21889999999999998 3.8297999999999996 9.642900000000001 +11.4381 -6.8943 -1.7416999999999998 +11.4381 -16.9589 -2.3194 +11.4381 -9.947000000000001 8.7355 +11.4381 -9.947000000000001 8.5703 +11.4381 -5.9045 0.4038 +11.4381 -7.141699999999999 8.6528 +3.1884999999999994 -7.7194 7.9103 +3.1884999999999994 1.1076000000000001 9.7253 +-1.2659 4.1598999999999995 6.6732 +6.4886 -12.4214 7.9111 +2.6934 3.0047 9.395199999999999 +-3.9882 1.7670000000000001 6.6731 +-3.9882 -0.4598 6.6731 +8.799 -12.9167 4.1978 +9.4582 -12.6686 -3.5567 +9.4582 -16.9589 -2.4840999999999998 +9.4582 -12.7523 -2.4840999999999998 +9.4582 -4.3373 2.6306 +9.4582 -6.977600000000001 -3.3917999999999995 +9.4582 -12.339 4.2805 +5.7462 -12.0916 8.4875 +10.943 -5.4094999999999995 2.6308000000000002 +10.943 -5.327 4.2806999999999995 +10.943 -7.1419999999999995 8.6528 +11.2735 -11.3492 2.6308000000000002 +7.5615000000000006 -12.834200000000001 4.363 +10.4479 -5.4094999999999995 4.2806999999999995 +10.4479 -5.4094999999999995 2.6308000000000002 +3.7663 -6.977 -0.1743 +3.7663 -6.977 2.6306 +3.7663 -9.6993 2.6306 +4.5087 -7.6377 -2.8142 +4.5087 -12.6692 -2.8142 +4.5087 -12.6692 -2.7316 +6.2408 -12.3389 6.507899999999999 +4.013599999999999 -6.977 1.2282 +4.013599999999999 -6.977 2.6306 +4.013599999999999 -6.9775 1.2282 +4.013599999999999 -10.3594 1.2282 +1.7864000000000002 2.9223 10.0551 +-0.44079999999999997 4.3249 6.6732 +11.520800000000001 -6.977 6.590400000000001 +11.520800000000001 -7.1421 4.2805 +11.520800000000001 -7.1421 6.590400000000001 +11.520800000000001 -12.6686 -1.2468 +11.520800000000001 -6.894500000000001 2.6306 +11.520800000000001 -9.6168 2.6306 +11.520800000000001 -7.1419999999999995 1.146 +11.520800000000001 -8.1319 -1.1642 +-2.4207 -3.7600000000000002 8.8176 +-2.4207 -3.1 6.672899999999999 +11.025699999999999 -6.8943 -1.7416999999999998 +4.3441 -5.8225 -0.5871000000000001 +9.457699999999999 -4.337400000000001 2.6308000000000002 +2.7761 -9.2863 8.4877 +11.768099999999999 -6.5645999999999995 2.6308000000000002 +11.768099999999999 -16.9589 1.6407999999999998 +9.540899999999999 -4.3369 6.5906 +7.313699999999999 -11.8443 9.3127 +7.313699999999999 -12.5867 6.590400000000001 +7.313699999999999 -12.504000000000001 8.8176 +7.313699999999999 -12.2567 9.3127 +7.313699999999999 -12.2567 6.590400000000001 +1.2913000000000001 4.1598999999999995 6.6732 +-3.1631 2.0976000000000004 8.7353 +-3.1631 2.0976000000000004 6.9206 +-3.1631 -1.2026999999999999 10.0551 +10.283299999999999 -11.844100000000001 4.2805 +8.056099999999999 -2.4400999999999997 8.6528 +11.273 -5.987 -1.1639 +9.0458 -16.9589 -4.1338 +4.5914 -5.2444 6.590400000000001 +4.5914 -11.1021 4.2805 +4.5914 -5.409400000000001 4.2805 +4.5914 -11.1845 6.590400000000001 +4.5914 -5.9045 6.590400000000001 +-1.431 -0.4598 10.22 +-3.6582000000000003 -0.4598 8.8176 +-3.6582000000000003 -0.4598 8.9003 +9.7882 -5.9046 -2.5668 +9.7882 -4.9967999999999995 8.6528 +9.7882 -5.0796 -0.2566 +9.7882 -5.0793 -0.5042 +5.3338 -4.5022 6.507899999999999 +10.5306 -6.895 -2.4840999999999998 +10.5306 -11.5964 8.157499999999999 +2.281 -3.7598 6.673 +7.8083 -4.832 -1.9892 +7.8083 -4.4198 2.6306 +7.8083 -5.8219 -3.8863000000000003 +7.8083 -4.089799999999999 0.40299999999999997 +7.8083 -4.089799999999999 2.6306 +7.8083 -6.976699999999999 -3.8863000000000003 +7.8083 -6.976699999999999 -4.216600000000001 +7.8083 -5.1624 -3.3087999999999997 +7.8083 -4.9148 -1.9893999999999998 +7.8083 -4.5020999999999995 -1.9892 +7.8083 -4.5023 -2.072 +7.8083 -4.5023 -1.9893999999999998 +5.5811 -4.5846 2.6306 +-0.4413 -5.7395000000000005 8.9003 +-0.4413 -4.0074 8.6524 +-0.4413 -4.0071 6.672899999999999 +-0.4413 -5.244 8.9003 +-0.4413 -4.2545 6.672899999999999 +10.1187 -16.9589 -3.639 +8.550699999999999 -12.751499999999998 4.363 +4.0963 -5.9879 2.6308000000000002 +1.8691 3.9121 8.5703 +9.2931 -12.4218 4.363 +9.2931 -12.3393 6.590400000000001 +7.0659 -12.4214 8.9823 +4.8387 -6.977 -2.9787 +4.8387 -6.069100000000001 -2.4843 +4.8387 -12.6692 -3.2268 +4.8387 -12.6692 -2.6489 +3.2707 2.1801 6.6732 +3.2707 1.7677999999999998 9.3124 +8.1388 -4.419300000000001 6.5906 +6.5708 -12.0089 6.590400000000001 +4.3436 -12.668899999999999 2.6306 +-0.11080000000000001 -5.574599999999999 8.9002 +11.1084 -9.9468 9.2304 +11.1084 -9.9468 8.405100000000001 +11.1084 -12.9169 2.6307 +11.1084 -12.9169 2.7134 +11.1084 -16.958599999999997 2.6307 +11.1084 -16.958599999999997 2.7134 +11.1084 -7.1419999999999995 8.4875 +11.1084 -7.1419999999999995 8.5703 +11.1084 -7.1419999999999995 9.1479 +11.1084 -8.9565 9.3127 +11.1084 -7.9670000000000005 9.313 +6.654 -4.4199 -1.3289 +6.654 -4.1723 1.7226000000000001 +7.3132 -12.256499999999999 6.590400000000001 +7.3132 -11.8443 9.3127 +7.3132 -12.504000000000001 8.735 +7.3132 -12.504000000000001 6.590400000000001 +7.3132 -12.1739 6.7556 +7.3132 -4.9974 -3.0618 +-3.1635999999999997 -2.8521 8.9003 +11.8508 -6.977 4.2805 +11.8508 -6.977 6.590400000000001 +11.8508 -6.894500000000001 1.146 +11.8508 -6.894500000000001 2.6306 +11.8508 -9.6168 2.6306 +11.8508 -6.8117 4.2805 +7.3964 -16.958599999999997 4.2805 +5.8284 -16.9589 -3.7213999999999996 +5.8284 -16.9589 -2.3195 +5.8284 -12.7523 -2.3195 +5.8284 -12.67 -3.8041 +3.6012000000000004 -12.834599999999998 1.146 +-0.8532 -0.3771 10.7151 +9.045300000000001 -3.5113 8.8178 +11.3557 -5.822 2.6306 +11.3557 -10.6893 4.2805 +9.1285 -12.3392 6.5906 +9.1285 -8.7093 9.8903 +9.1285 -11.9264 8.3226 +9.1285 -7.1419999999999995 10.2203 +9.1285 -12.0088 6.5906 +9.1285 -12.256300000000001 8.5703 +5.3332999999999995 -4.832199999999999 -0.1743 +5.3332999999999995 -12.6692 3.6203 +0.8789 3.1697999999999995 9.3954 +0.8789 3.7472 9.3954 +0.8789 1.1081 10.3025 +0.8789 3.2522 10.0551 +0.8789 2.0979 10.549999999999999 +-1.3483 3.0873999999999997 9.3954 +-1.3483 3.3345 9.8903 +-1.3483 1.1076000000000001 10.3025 +-1.3483 1.1076000000000001 10.6326 +9.8709 -4.9971000000000005 8.4875 +9.8709 -6.8943 -3.1439000000000004 +9.8709 -6.8943 -3.2268 +9.8709 -6.8943 -3.5564 +9.8709 -5.4097 -1.7416999999999998 +9.8709 -6.317200000000001 -3.4739 +9.8709 -5.1623 8.6528 +9.8709 -5.1623 8.57 +9.8709 -5.822 -3.0612 +9.8709 -5.822 -3.1443 +7.643700000000001 -10.029499999999999 4.197900000000001 +7.643700000000001 -10.1946 4.0329999999999995 +7.643700000000001 -12.339 4.2805 +7.643700000000001 -12.339 4.0329999999999995 +7.643700000000001 -12.6692 4.2805 +7.643700000000001 -12.6692 3.9503000000000004 +5.4165 -8.9574 10.4677 +-2.8331 3.1697999999999995 8.9004 +-2.8331 2.5101999999999998 9.725 +7.148599999999999 -12.173499999999999 9.3127 +7.148599999999999 -11.6786 9.3127 +7.148599999999999 -10.1121 10.3852 +7.148599999999999 -8.7919 10.4677 +7.148599999999999 -8.7919 10.22 +7.148599999999999 -11.018799999999999 10.137699999999999 +4.9214 -11.514299999999999 4.2805 +4.9214 -11.514299999999999 6.590400000000001 +4.9214 -4.6659 6.5906 +10.1182 -11.4318 4.2805 +7.890999999999999 -4.0069 6.5906 +7.890999999999999 -4.3366 6.9206 +7.890999999999999 -2.4404 8.24 +7.890999999999999 -2.7695999999999996 8.6528 +7.890999999999999 -2.275 8.6528 +7.890999999999999 -2.3574 8.6528 +7.890999999999999 -4.1719 7.2507 +7.890999999999999 -4.0066999999999995 6.5906 +7.890999999999999 -4.089099999999999 7.4158 +7.890999999999999 -4.3369 6.5906 +5.6638 -5.4919 -1.9892 +5.6638 -4.5846 2.6306 +5.6638 -4.9145 2.6306 +5.6638 -4.6672 -0.5046 +1.8686 -8.3779 9.1479 +4.179 -12.67 -2.4840999999999998 +9.2926 -16.2985 4.0328 +2.611 3.4995 8.4875 +-4.0706 -1.5324 8.4875 +-4.0706 -1.6152 6.672899999999999 +-4.0706 -1.1198 8.9003 +9.706299999999999 -11.9264 9.0655 +5.911099999999999 -4.4197 2.6308000000000002 +3.6838999999999995 -12.668899999999999 1.2282 +3.6838999999999995 -12.668899999999999 1.4758 +3.6838999999999995 -16.9589 -1.1642 +3.6838999999999995 -9.4519 2.6308000000000002 +3.6838999999999995 -8.4619 7.8278 +3.6838999999999995 -12.67 -1.4947 +3.6838999999999995 -12.67 -1.1642 +8.7975 -16.958599999999997 4.1978 +11.107899999999999 -12.3392 2.6308000000000002 +11.107899999999999 -12.9167 2.6308000000000002 +8.8807 -12.0084 -4.2164 +8.8807 -12.67 -4.2162999999999995 +4.4262999999999995 -10.0293 2.6306 +4.4262999999999995 -16.9589 2.6306 +4.4262999999999995 -12.6692 2.7958 +4.4262999999999995 -12.6692 2.6306 +2.1991 3.4995 9.229999999999999 +11.1911 -11.3492 2.6308000000000002 +11.1911 -10.1115 4.2806999999999995 +11.1911 -10.1115 2.8784 +7.395899999999999 -5.9868 -3.9687 +5.168699999999999 -7.8026 -3.474 +5.168699999999999 -6.9775 -3.3089 +5.168699999999999 -6.9775 -2.7316 +1.704 3.5821 9.3954 +10.696 -11.4317 4.2805 +10.696 -11.4317 6.590400000000001 +8.4688 -4.089700000000001 2.6306 +-1.3488 1.7673 10.549999999999999 +-1.3488 -0.4598 10.6327 +-1.3488 1.8501 10.4674 +-1.3488 1.8501 10.137500000000001 +11.4384 -7.8842 -1.1642 +9.2112 -9.7815 10.22 +9.2112 -11.5965 9.6425 +9.2112 -9.9468 9.725100000000001 +9.8704 -4.5023 6.590400000000001 +0.9616 -7.2244 8.240400000000001 +9.9536 -5.6573 -2.9789 +9.9536 -4.9973 -1.8245 +9.9536 -4.9973 -1.7416999999999998 +6.1584 -4.1723 6.590400000000001 +3.9312 -6.316800000000001 0.4858 +3.9312 -9.6993 1.2282 +3.9312 -6.9775 -1.1642 +3.9312 -8.2149 -1.989 +3.9312 -12.6692 -1.1643999999999999 +7.1481 -4.1721 -0.3391 +11.6857 -8.2972 2.6308000000000002 +11.6857 -8.2147 4.2806999999999995 +11.6857 -8.2144 2.6308000000000002 +11.6857 -8.2144 4.2805 +11.6857 -6.8946 -1.0815 +7.2313 -8.875 10.137699999999999 +5.6633000000000004 -5.079899999999999 -0.1743 +10.2009 -11.4317 6.590400000000001 +10.2009 -11.349 4.2805 +7.9737 -16.9589 -4.2987 +7.9737 -2.3574 8.6528 +7.9737 -2.5225 8.2398 +7.9737 -4.089700000000001 0.40340000000000004 +7.9737 -9.8648 10.3852 +7.9737 -3.0172999999999996 8.6528 +5.7465 -4.832 -1.5762999999999998 +5.7465 -4.5023 1.0632000000000001 +1.9512999999999998 1.1076000000000001 10.5501 +-1.8439 -4.2541 9.2303 +8.7161 -7.6377 -4.2164 +8.7161 -4.089099999999999 6.5906 +8.1378 -8.7919 10.467600000000001 +5.3346 -0.5425 9.8903 +10.4482 -11.6793 6.507899999999999 +1.5393999999999999 4.0771 6.6732 +8.8802 -7.1419999999999995 9.8903 +6.7362 -6.976699999999999 -4.1337 +2.941 -8.626000000000001 9.8901 +7.809099999999999 -4.254899999999999 -0.5042 +7.809099999999999 -4.5023 -0.5042 +8.4683 -4.4195 4.2805 +8.4683 -4.4195 6.590400000000001 +8.4683 -4.089700000000001 4.2805 +8.4683 -4.089700000000001 6.590400000000001 +4.0139000000000005 -0.0471 8.652600000000001 +4.0139000000000005 -0.0476 6.6731 +4.0139000000000005 -0.0473 8.652600000000001 +4.0139000000000005 -3.1003 7.332800000000001 +4.0139000000000005 -10.3591 6.590400000000001 +4.0139000000000005 1.5195999999999998 9.6427 +4.0139000000000005 -12.6692 -1.2469 +-2.6677 -1.9449999999999998 10.0553 +-2.6677 -1.9449999999999998 10.1378 +2.4459 -4.5846 7.002999999999999 +-4.2357 0.943 8.487599999999999 +-4.2357 1.0257 7.0031 +-4.2357 -0.4598 8.7353 +10.778699999999999 -5.1623 7.6627 +10.778699999999999 -5.4098 8.4875 +8.551499999999999 -4.254899999999999 -0.752 +4.7563 -12.67 2.6306 +3.1883000000000004 3.005 8.2399 +3.1883000000000004 3.005 6.6732 +-1.1828999999999998 -5.0809 8.9003 +4.2612 -10.1944 2.6306 +4.2612 -6.9775 -0.8340000000000001 +4.2612 -11.1846 2.6306 +4.2612 -7.224899999999999 -1.1642 +4.2612 -10.6898 4.2803 +0.466 4.3249 6.6732 +11.026 -5.4094999999999995 2.6308000000000002 +11.026 -5.4094999999999995 4.2805 +6.5716 -1.5327 8.6528 +9.458 -6.069 9.9728 +7.2307999999999995 -11.7617 9.3127 +5.0036 -14.732000000000001 1.146 +5.0036 -16.9589 1.146 +-3.2460000000000004 -2.9346 8.3227 +11.7684 -8.1319 1.1457 +5.086799999999999 -16.958599999999997 3.3734 +5.086799999999999 -0.873 10.1378 +3.5187999999999997 -3.3472 10.3027 +3.5187999999999997 -7.802099999999999 1.2282 +3.5187999999999997 -7.9670000000000005 -0.1741 +3.5187999999999997 -2.6043 6.6731 +1.9508 -3.4298 8.652700000000001 +10.2836 -4.7499 0.8980999999999999 +10.2836 -5.1625 -1.7416999999999998 +11.2733 -8.4623 -2.5666 +11.2733 -8.4623 -2.4840999999999998 +11.2733 -7.142600000000001 -1.1642 +11.2733 -12.6686 -2.4840999999999998 +11.2733 -9.947000000000001 6.5906 +6.8189 -6.4808 10.6327 +7.4781 -4.3373 -1.4935 +3.0237 -0.4598 10.5501 +12.0157 -8.3795 6.590400000000001 +5.3341 -12.6692 3.6203 +-2.2563 2.4278999999999997 10.137500000000001 +10.5309 -5.4921999999999995 2.6308000000000002 +10.5309 -4.9144 6.6731 +10.5309 -5.4094999999999995 4.2805 +8.3037 -5.326899999999999 -3.4736000000000002 +6.7357 -10.3597 10.3026 +4.5085 -5.3273 6.590400000000001 +0.0541 -4.5846 7.9103 +0.0541 -4.668 7.993 +10.0358 -11.4318 6.590400000000001 +-0.441 -5.2454 7.910399999999999 +-0.441 -4.5844000000000005 8.0752 +-0.441 -5.3273 8.9002 +-0.441 -4.2543999999999995 6.673 +-0.441 -4.0071 6.673 +-0.441 -4.0071 8.652700000000001 +-0.441 -4.5846 7.910399999999999 +-0.441 -4.5846 7.580299999999999 +-0.441 -5.9053 8.652700000000001 +-0.441 -5.9053 8.7352 +-0.441 -5.8228 8.9002 +-0.441 -5.0804 7.9103 +-0.441 -5.0804 7.8277 +10.7782 -5.9868999999999994 -2.3194 +6.3238 -4.7499 -2.072 +4.0966000000000005 -6.977 -0.1743 +4.0966000000000005 -6.3994 -1.1642 +-4.153 0.6131 8.982999999999999 +11.5206 -10.0297 8.5703 +7.0662 -4.089700000000001 4.2805 +4.839 -11.4314 4.2803 +4.839 -10.1944 2.6306 +4.839 -12.6692 2.6306 +3.2710000000000004 -9.6167 9.4777 +3.2710000000000004 -1.8622 8.4875 +3.2710000000000004 -1.8622 7.4155 +3.2710000000000004 -9.7818 8.9003 +11.025500000000001 -11.0195 8.4875 +11.025500000000001 -9.947000000000001 8.5703 +11.025500000000001 -7.141699999999999 8.6528 +11.025500000000001 -10.9371 8.5703 +4.3439 -6.9775 -1.2469 +4.3439 -6.9775 -2.3189 +4.3439 -8.2149 -2.6489 +-1.6785 -3.9239 8.9003 +-1.6785 -3.0993 10.0551 +-1.6785 -1.7801 10.0551 +-1.6785 -4.338299999999999 9.3954 +-1.6785 -3.1832 10.0551 +-1.6785 -4.502599999999999 8.9003 +-1.6785 -3.4297 9.9726 +-1.6785 -1.8622 10.0551 +9.540700000000001 -4.5022 -0.5042 +9.6239 -4.914700000000001 8.6528 +10.283100000000001 -4.9967999999999995 8.6528 +1.3743 2.5100000000000002 10.385 +8.715100000000001 -3.4288 9.3126 +4.5912 -3.3472 10.6326 +4.5912 -5.9873 6.590400000000001 +4.5912 -10.4411 4.2806999999999995 +4.5912 -10.4411 6.590400000000001 +4.5912 -8.7924 10.3852 +4.5912 -11.0193 4.2806999999999995 +4.5912 -11.0193 6.590400000000001 +-2.0904 -1.9449999999999998 10.3852 +-2.0904 -1.1202999999999999 10.5501 +0.796 3.8297999999999996 9.3954 +0.796 4.2423 8.5704 +0.796 4.2423 8.4879 +11.356 -9.9468 6.590400000000001 +11.356 -9.9467 6.590400000000001 +9.788 -4.9973 9.395199999999999 +9.788 -4.9973 -2.1542 +9.788 -5.822 -2.4019 +5.333600000000001 -4.8324 -0.1743 +-1.348 1.1076000000000001 10.6325 +-1.348 1.1076000000000001 10.3026 +-1.348 -0.4598 10.6325 +-1.348 -0.4598 10.3026 +1.5384 -0.4598 10.7151 +9.8712 -9.9468 9.9725 +3.8488 -8.214599999999999 2.6308000000000002 +10.6136 -4.9971000000000005 6.5906 +10.6136 -16.9589 -1.1642 +10.6136 -16.9589 1.146 +10.6136 -12.7523 1.146 +11.603299999999999 -6.2344 4.2805 +3.3537 -1.6151 10.6326 +3.3537 -6.646000000000001 10.0553 +3.3537 -8.2969 10.0553 +3.3537 -3.7608 10.7151 +3.3537 -0.4598 10.467600000000001 +3.3537 -0.4598 10.1378 +1.1265 1.1081 10.6326 +1.1265 -4.6674 7.167999999999999 +-2.6687 -3.4294 6.672899999999999 +-2.6687 -3.4294 8.9003 +10.1185 -11.8439 8.5703 +8.5505 -4.337 9.8079 +10.860899999999999 -5.6569 -1.6587 +6.406499999999999 -4.3373 -0.2568 +7.0657 -11.5962 9.3127 +4.8385 -5.1621 2.6308000000000002 +10.3658 -4.832 8.4049 +5.9114 -6.9775 -3.3092 +5.9114 -7.4728 -3.8865 +5.9114 -12.6692 3.4555000000000002 +5.9114 -12.6692 -3.4742 +8.7978 -4.5015 9.8077 +4.3434 -10.8536 6.590400000000001 +6.6538 -4.7499 -2.4019 +4.4266 -6.6467 -2.319 +-3.823 -1.0376 9.4777 +11.8506 -6.7292000000000005 0.8980999999999999 +11.8506 -6.8943 2.6306 +11.8506 -8.1328 -1.3295 +11.8506 -12.6686 -1.4118 +11.8506 -16.9589 -1.3294000000000001 +11.8506 -16.9589 -1.1642 +11.8506 -16.9589 1.1457 +11.8506 -12.67 -1.1642 +11.8506 -12.67 -1.4120000000000001 +9.6234 -12.6686 -3.4741 +9.6234 -12.6686 -3.8865999999999996 +9.6234 -16.9589 -2.402 +9.6234 -16.9589 -3.804 +9.6234 -12.7523 -2.402 +9.6234 -6.895 -3.309 +9.6234 -6.977600000000001 -3.8039000000000005 +9.6234 -12.67 -3.4737999999999998 +9.6234 -12.67 -3.8865999999999996 +9.1283 -11.2665 9.3127 +9.1283 -11.926200000000001 9.395299999999999 +9.1283 -9.8648 10.22 +9.1283 -10.9364 9.9725 +4.673900000000001 -5.3271 -0.1743 +0.8786999999999999 3.1697999999999995 9.3954 +0.8786999999999999 1.1076000000000001 10.3025 +0.8786999999999999 1.1076000000000001 10.6326 +0.8786999999999999 3.2522 10.0551 +0.8786999999999999 2.0979 10.549999999999999 +-1.3485 4.0771 6.6731 +-1.3485 3.1701 9.395199999999999 +-1.3485 3.1701 9.2301 +-1.3485 3.9947000000000004 8.7353 +-1.3485 3.5821 8.7353 +-1.3485 3.7475 6.6732 +-1.3485 3.7475 8.487599999999999 +-1.3485 -4.4204 9.6426 +-1.3485 3.7473 9.395199999999999 +-1.3485 3.7473 6.6731 +-1.3485 3.7473 8.4879 +-1.3485 4.077299999999999 8.652899999999999 +9.211500000000001 -12.9167 2.6308000000000002 +9.870700000000001 -4.9967999999999995 6.5906 +9.870700000000001 -4.9969 2.6306 +7.6435 -4.0896 4.2806999999999995 +7.6435 -4.0896 2.6308000000000002 +7.6435 -4.0896 4.2805 +7.6435 -12.3392 4.2805 +7.6435 -12.3392 3.9503000000000004 +7.6435 -12.7516 3.0434 +7.6435 -12.9167 3.0434 +7.6435 -12.9167 4.2805 +7.6435 -4.4197 2.6308000000000002 +7.6435 -4.4197 4.2805 +7.6435 -4.4196 4.2806999999999995 +7.6435 -4.4196 2.6308000000000002 +8.3027 -4.005800000000001 9.8903 +10.613100000000001 -10.8545 9.313 +3.9315 -12.67 -1.1642 +9.3756 -7.142600000000001 -3.9690000000000003 +4.9212 -16.9589 -1.1642 +4.9212 -16.9589 1.1457 +4.9212 -12.7523 -1.1642 +4.9212 -12.7523 1.1457 +4.9212 -5.5752999999999995 4.2806999999999995 +4.9212 -5.5752999999999995 2.6308000000000002 +4.9212 -5.1621 4.2806999999999995 +4.9212 -5.1621 2.6308000000000002 +4.9212 -5.0794 2.6308000000000002 +4.9212 -5.0794 4.2805 +4.9212 -5.4918000000000005 2.6308000000000002 +4.9212 -12.6692 -2.7316 +5.0043999999999995 -7.1419999999999995 10.6327 +10.118 -12.9167 3.6203 +5.6636 -4.6673 0.1558 +5.6636 -5.079899999999999 -0.1743 +5.6636 -4.9972 2.6306 +5.6636 -12.3382 -3.804 +5.6636 -7.720200000000001 -3.804 +3.4364 -8.2966 7.9928 +3.4364 -6.5645 7.497800000000001 +4.1788 -9.6996 2.6306 +1.9515999999999998 1.1905000000000001 10.549999999999999 +11.9333 -9.6171 1.146 +11.9333 -12.091000000000001 -1.1642 +11.9333 -9.2875 -1.2468 +11.9333 -12.67 1.146 +11.9333 -12.834599999999998 1.3109000000000002 +11.9333 -12.6692 1.146 +11.9333 -12.6692 1.3109000000000002 +10.3653 -13.412299999999998 3.4556000000000004 +10.3653 -16.6285 3.4556000000000004 +3.6837 -6.8943 0.8984000000000001 +3.6837 -7.8851 -1.2469 +3.6837 -12.6692 -1.4944000000000002 +3.6837 -12.6692 -1.1643999999999999 +1.4565 3.7470999999999997 6.6732 +1.4565 3.087 9.3124 +1.4565 3.9947999999999997 8.7353 +1.4565 3.6645999999999996 9.395199999999999 +-2.3387000000000002 3.4172000000000002 9.2304 +8.2213 -10.029499999999999 4.2805 +6.6533 -11.8438 9.6427 +8.9637 -4.7496 9.8077 +4.5093000000000005 -16.958599999999997 2.6309 +9.6229 -12.0918 6.590400000000001 +-1.5131000000000001 -0.4598 10.6326 +-2.7506 3.4172000000000002 6.6731 +-2.7506 1.8501 10.055 +10.6958 -10.2771 2.6308000000000002 +10.6958 -5.5748 -1.7416999999999998 +10.6958 -8.5449 -3.2264 +10.6958 -12.339 2.6308000000000002 +6.2414 -7.6377 -4.0515 +6.2414 -12.6692 -4.0515 +11.4382 -9.6171 2.6306 +11.4382 -6.894400000000001 4.2805 +4.7566 -1.4496 7.2505 +4.7566 -5.5735 6.5906 +4.7566 -0.21259999999999998 7.5806 +4.7566 -5.4908 6.8381 +4.7566 -4.831300000000001 7.0856 +4.7566 1.0245 8.6528 +-3.4930000000000003 -2.3575 8.9829 +9.9534 -4.7498 -0.5042 +9.9534 -4.5846 0.8984000000000001 +9.9534 -4.5846 2.6306 +9.9534 -5.4921 -1.7416999999999998 +9.9534 -4.9972 -1.6587 +9.9534 -4.9972 2.6306 +9.9534 -5.0796 -0.5042 +10.6126 -4.997 2.6308000000000002 +7.8903 -4.584 9.725200000000001 +-3.2457 -1.9452 9.725100000000001 +-3.2457 2.7578 8.7353 +-3.2457 2.0976000000000004 6.9206 +-3.2457 2.9227 6.6731 +-3.2457 2.3452 6.6731 +10.2007 -7.7196 9.89 +5.7463 -10.1944 3.4555000000000002 +5.7463 -11.679200000000002 4.2805 +5.7463 -12.6692 3.4555000000000002 +5.7463 -12.0914 4.2805 +1.9511 -3.4298 6.673 +9.7056 -12.0918 4.2805 +8.2208 -12.5866 6.590400000000001 +3.7664000000000004 -9.782200000000001 2.5481 +10.5312 -16.9589 1.2284 +10.5312 -12.7523 -1.1642 +6.736000000000001 -10.0293 4.197900000000001 +2.2816 3.7470999999999997 6.6732 +-2.7511 -2.0274 10.0551 +10.036100000000001 -8.1328 -3.7216 +10.036100000000001 -4.5846 2.6306 +10.036100000000001 -4.7499 -0.7509 +7.8089 -4.5022 -0.5042 +7.8089 -12.6686 -4.299 +7.8089 -12.6686 -3.9690000000000003 +7.8089 -16.9589 -4.2987 +7.8089 -16.9589 -3.0618 +7.8089 -12.7523 -3.0618 +7.8089 -6.895 -3.8865 +7.8089 -4.4197 2.6306 +7.8089 -4.089700000000001 2.6306 +7.8089 -7.3076 -4.299 +7.8089 -12.67 -4.2987 +7.8089 -12.67 -3.9688 +7.8089 -4.1723 -0.3392 +4.0137 -10.6061 2.7133000000000003 +-4.2359 -0.2947 8.7353 +10.778500000000001 -10.2771 2.5479000000000003 +10.778500000000001 -12.6692 2.6306 +4.7561 -12.668899999999999 2.6306 +4.7561 -10.1946 2.5481 +11.520900000000001 -8.1318 -1.1642 +11.520900000000001 -7.1421 1.1457 +11.520900000000001 -8.9565 8.9823 +11.520900000000001 -6.8946 1.1457 +1.0441 1.1081 10.2201 +4.261 -0.0473 8.652600000000001 +4.261 -6.5645 6.590400000000001 +4.261 -10.7715 8.982800000000001 +-0.1934 3.9947999999999997 9.395199999999999 +11.0258 -6.8943 -1.7416999999999998 +11.0258 -6.8943 -1.5765000000000002 +8.798599999999999 -5.822 -3.7213999999999996 +6.5714 -16.9589 -4.1338 +5.0034 -16.9589 -1.1642 +5.0034 -12.7523 -1.1642 +11.7682 -8.1318 1.1457 +11.7682 -9.6171 2.6306 +11.7682 -8.0496 8.569799999999999 +11.7682 -9.9472 2.6306 +11.7682 -9.9464 2.6308000000000002 +11.7682 -9.864199999999999 7.663200000000001 +5.0866 -11.2665 9.3127 +5.7458 -6.977 -3.7213999999999996 +5.7458 -12.0915 6.590400000000001 +5.829 -10.0293 3.868 +5.829 -6.9775 -3.7217000000000002 +5.829 -5.4919 -1.9064 +5.829 -16.9589 -3.8038000000000003 +5.829 -16.9589 -2.4015999999999997 +5.829 -12.7523 -2.4015999999999997 +5.829 -7.142999999999999 -3.3092 +5.829 -4.9145 2.6306 +5.829 -12.67 -3.8864 +5.829 -12.6692 -3.8865 +7.4779 -7.1419999999999995 10.5501 +-2.9156999999999997 3.2523000000000004 8.487599999999999 +3.8491 -6.977 -0.9169999999999999 +3.8491 -7.9671 4.2806999999999995 +3.8491 -7.9671 6.590400000000001 +3.8491 -6.6469000000000005 -0.1743 +-0.6053000000000001 -0.7904 10.7151 +9.3764 -12.3392 4.2805 +7.8084 -2.7695999999999996 8.6528 +7.8084 -3.6765 7.8275999999999994 +8.5508 -10.5239 10.22 +4.0964 -16.9589 2.3004000000000002 +4.0964 -10.1121 1.3107 +11.5204 -6.8943 2.6306 +4.8388 -10.7722 6.590400000000001 +4.8388 -10.5243 9.3127 +4.8388 -11.4315 8.4875 +9.9524 -6.976699999999999 9.8903 +9.9524 -7.1419999999999995 9.8079 +3.2708 -8.2969 10.1378 +3.2708 -6.152 10.5501 +3.2708 -6.8117 10.467600000000001 +10.3661 -4.9971000000000005 8.6528 +8.7981 -12.9169 4.1978 +4.3437 -0.0471 6.672899999999999 +4.3437 -0.9541 9.8901 +4.3437 -0.0476 6.6731 +4.3437 -8.4619 10.3851 +4.3437 -12.67 2.6306 +4.4269 -16.1335 2.7134 +10.2829 -4.7496 6.342299999999999 +3.6013 -3.3472 10.3026 +3.6013 -9.6993 1.2282 +3.6013 2.5096 8.405100000000001 +3.6013 -7.224500000000001 1.2282 +3.6013 -0.047 9.8901 +3.6013 -9.1222 6.590400000000001 +3.6013 -8.4619 9.7253 +3.6013 -12.6687 -1.1642 +3.6013 -12.6687 1.2282 +9.0454 -7.1419999999999995 9.8079 +9.0454 -8.7919 10.3026 +6.818200000000001 -9.5347 10.4677 +6.818200000000001 -16.958599999999997 4.1978 +6.818200000000001 -12.6692 4.2805 +-1.4314 1.8501 10.055 +-1.4314 3.0871 10.055 +11.3558 -6.8943 -1.9895 +11.3558 -6.564300000000001 -1.8245 +11.3558 -6.8942000000000005 8.6528 +9.1286 -7.3072 10.22 +9.1286 -9.9468 9.8074 +9.1286 -7.1419999999999995 9.8074 +7.560600000000001 -5.5739 10.467600000000001 +9.871 -12.0914 4.2805 +5.4166 0.447 9.0653 +5.4166 -4.6672 4.2805 +6.0758 -0.9547999999999999 8.6528 +3.8486 -8.4615 7.497800000000001 +3.8486 -8.4615 6.590400000000001 +3.8486 -6.5645 6.590400000000001 +10.6134 -16.9589 -1.1642 +10.6134 -16.9589 1.1457 +10.6134 -12.7523 -1.1642 +10.6134 -12.7523 1.1457 +10.6134 -7.060099999999999 -2.4840999999999998 +10.6134 -7.060099999999999 -2.4015999999999997 +10.6134 -11.4318 4.2805 +10.6134 -11.4318 6.590400000000001 +8.3862 -6.895 -4.2164 +11.6031 -6.2345999999999995 4.2805 +11.6031 -7.6377 -1.9066 +11.6031 -6.976699999999999 8.405100000000001 +11.6031 -12.6686 -1.1642 +11.6031 -12.67 2.053 +9.3759 -16.9589 2.5479000000000003 +9.3759 -16.9589 2.6306 +9.3759 -12.7523 2.5479000000000003 +9.3759 -12.7523 2.6306 +4.9215 -10.9364 9.6427 +-3.3280999999999996 -0.4602 10.0551 +10.8607 -7.142600000000001 -2.8967 +10.8607 -12.6686 -2.4840999999999998 +10.8607 -5.2443 6.590400000000001 +10.8607 -5.326899999999999 6.590400000000001 +10.8607 -9.3691 9.56 +6.4063 -12.6692 4.197900000000001 +10.3656 -5.326899999999999 6.590400000000001 +8.138399999999999 -11.7614 9.8079 +8.138399999999999 -8.9574 10.4677 +6.6536 -4.1722 4.2805 +6.6536 -12.4218 6.590400000000001 +6.6536 -12.0918 6.590400000000001 +6.6536 -12.0918 4.363 +6.6536 -12.0915 4.2805 +6.6536 -12.0915 6.590400000000001 +6.6536 -12.5866 4.2805 +6.6536 -12.5866 4.363 +6.6536 -4.5847999999999995 4.2805 +6.6536 -4.5847999999999995 6.4253 +6.6536 -12.4214 6.590400000000001 +6.6536 -4.1723 6.590400000000001 +-3.8232000000000004 -2.1094 7.745399999999999 +-3.8232000000000004 0.3657 9.6426 +-3.8232000000000004 -0.4598 8.7353 +-3.8232000000000004 -0.4598 9.5603 +-3.8232000000000004 1.8501 8.7353 +-3.8232000000000004 2.0974 8.487599999999999 +11.8504 -16.9589 1.146 +8.0552 -4.749 9.8077 +-4.3183 0.36519999999999997 7.910100000000001 +-4.3183 -0.4598 6.6731 +9.1281 -12.0092 9.3127 +9.1281 -12.0092 6.590400000000001 +9.1281 -11.4317 9.3127 +4.6737 -11.2667 8.0748 +4.6737 -11.2667 6.590400000000001 +4.6737 0.5303 9.0653 +4.6737 -10.6889 9.642900000000001 +4.6737 -1.6140999999999999 9.9728 +-1.3487 3.7474 9.3954 +-1.3487 3.995 8.818 +-1.3487 3.995 8.7354 +-1.3487 3.4997 8.7354 +-1.3487 1.8501 10.467500000000001 +9.8705 -4.6673 -0.5042 +7.6433 -10.0293 4.197900000000001 +7.6433 -12.6692 3.9505 +7.6433 -12.6692 4.2805 +1.6209000000000002 -4.0071 8.652700000000001 +9.9537 -12.67 -3.804 +3.9313000000000002 0.1181 6.672899999999999 +3.9313000000000002 -6.5645 7.2503 +3.9313000000000002 -12.67 -1.1642 +3.9313000000000002 -12.67 1.1457 +3.9313000000000002 -9.6996 1.2282 +3.9313000000000002 -3.0994 7.3327 +6.489000000000001 -4.6672 -1.9892 +-0.1926 -2.2756 10.6326 +4.920999999999999 -5.4921999999999995 -1.7416 +4.920999999999999 -12.7523 1.146 +-3.3286000000000002 -2.8521 6.672899999999999 +11.6858 -12.6686 -1.9066 +11.6858 -9.9468 4.2805 +11.6858 -9.9468 6.590400000000001 +11.6858 -10.1119 6.0952 +11.6858 -9.947000000000001 6.5906 +11.6858 -9.947000000000001 7.8277 +11.6858 -7.1419999999999995 8.322799999999999 +11.6858 -8.3795 6.590400000000001 +11.6858 -9.9467 6.590400000000001 +11.6858 -9.2875 -1.9066 +11.6858 -6.977600000000001 -1.1642 +9.4586 -12.256300000000001 8.3226 +7.231400000000001 -12.5866 6.590400000000001 +5.663399999999999 -16.9589 -3.7213999999999996 +3.4361999999999995 -9.8646 -0.0092 +4.178599999999999 -6.5645 6.9205000000000005 +4.178599999999999 -10.9367 2.6308000000000002 +4.178599999999999 -6.8122 6.590400000000001 +-0.2758 4.3249 8.487599999999999 +-0.2758 -4.336799999999999 6.673 +10.9434 -5.3271 6.590400000000001 +11.933100000000001 -7.0593 3.3733 +11.933100000000001 -7.141699999999999 6.5906 +9.7059 -10.029499999999999 3.7854 +9.7059 -10.029499999999999 3.8681 +9.7059 -10.1946 3.4556000000000004 +9.7059 -5.6575 9.725200000000001 +9.7059 -11.7615 4.2805 +9.7059 -12.1739 4.2805 +9.7059 -12.339 3.5380000000000003 +9.7059 -12.339 3.4556000000000004 +9.7059 -12.339 3.9503000000000004 +9.7059 -11.679 4.2805 +8.1379 -4.9140999999999995 10.2202 +5.9939 -5.3273 -2.897 +5.9939 -16.9589 -2.4015999999999997 +5.9939 -12.7523 -2.4015999999999997 +8.9635 -12.0091 4.6106 +8.9635 -12.0091 6.590400000000001 +6.736300000000001 -6.9775 -4.1339 +6.736300000000001 -8.05 -4.2164 +6.736300000000001 -12.67 -4.2162 +6.736300000000001 -12.6692 -4.2164 +6.2412 -4.0892 6.5906 +6.2412 -0.8723 8.0751 +6.2412 -0.5423 8.6528 +-4.2356 -0.4598 6.672899999999999 +-4.2356 -0.4598 8.6524 +1.6204 -0.4598 10.7151 +4.8396 -12.834200000000001 3.2084 +4.8396 -2.6884 10.5501 +4.8396 -1.6154000000000002 10.3851 +4.261299999999999 -6.9775 -1.1643999999999999 +7.9733 -12.9169 4.2805 +5.7461 -12.0087 4.2803 +5.7461 -10.1944 3.7855 +5.7461 -10.2769 3.373 +5.7461 -12.6692 3.4555000000000002 +5.7461 -11.5963 4.2803 +3.5189 -8.4615 6.590400000000001 +3.5189 -12.6687 -0.8340000000000001 +3.5189 -12.6687 0.8155000000000001 +3.5189 -8.545300000000001 -0.5867 +3.5189 -9.205 -0.8340000000000001 +1.2917 3.0047 10.137599999999999 +11.2734 -6.8946 -1.1642 +12.0158 -8.875 2.6308000000000002 +12.0158 -8.215 -0.6688000000000001 +12.0158 -8.1318 1.1457 +12.0158 -8.873899999999999 2.6306 +12.0158 -8.2147 4.2806999999999995 +12.0158 -8.2147 2.6308000000000002 +12.0158 -8.3793 4.2805 +12.0158 -8.3793 6.590400000000001 +12.0158 -7.389600000000001 1.3933 +12.0158 -7.389600000000001 2.6306 +12.0158 -9.6168 1.146 +12.0158 -7.471500000000001 2.6308000000000002 +12.0158 -8.2144 2.6308000000000002 +12.0158 -8.2144 4.2805 +12.0158 -7.4719999999999995 6.590400000000001 +12.0158 -7.4719999999999995 0.8156 +12.0158 -8.9565 7.0855 +12.0158 -8.1319 1.1457 +12.0158 -7.5541 4.2805 +12.0158 -7.554600000000001 4.2805 +12.0158 -12.6687 -0.9164 +12.0158 -12.6687 0.9806 +9.7886 -10.8545 9.807599999999999 +10.4478 -12.3392 3.4556000000000004 +10.531 -6.811599999999999 -3.1439000000000004 +8.3038 -8.1328 -4.299 +-1.5138 4.0771 8.487599999999999 +7.8087 -6.2345999999999995 -4.0514 +7.8087 -6.8943 -3.8863000000000003 +7.8087 -6.8943 -4.2164 +7.8087 -4.5022 -2.0721 +7.8087 -5.822 -3.4739 +7.8087 -5.822 -3.3912999999999998 +7.8087 -5.7393 -3.8041 +7.8087 -4.914700000000001 -2.9787999999999997 +-2.0089 -3.5942000000000003 9.725100000000001 +10.7783 -7.1419999999999995 9.395199999999999 +2.5287 -3.5124000000000004 8.652700000000001 +0.3015 -4.5844000000000005 7.2505 +-1.2665 -4.1721 6.672899999999999 +11.5207 -6.977 4.2805 +11.5207 -6.977 6.590400000000001 +11.5207 -10.1122 1.2284 +11.5207 -6.0696 6.590400000000001 +11.5207 -12.6692 1.2284 +4.8391 -10.4421 9.3127 +9.9527 -4.6665 8.982800000000001 +7.7255 -2.6868 9.6427 +5.4982999999999995 -6.069100000000001 -3.2263 +3.2710999999999997 1.1081 10.137599999999999 +11.0256 -9.9468 8.5703 +11.0256 -6.895 -2.4840999999999998 +11.0256 -7.1419999999999995 8.5703 +11.0256 -5.4096 0.23900000000000002 +4.344 -16.9589 -2.6487 +4.344 -5.657100000000001 0.1558 +-3.9056 -0.4598 6.672899999999999 +11.768 -6.8943 -0.4209 +5.0864 -5.4918000000000005 4.2805 +-1.5952000000000002 -4.0072 8.9003 +8.056000000000001 -4.832199999999999 9.725200000000001 +8.056000000000001 -4.7496 9.8077 +11.2729 -16.9589 2.5479000000000003 +9.0457 -8.875 9.8902 +9.0457 -12.4216 6.590400000000001 +9.0457 -6.8943 -4.0514 +9.0457 -8.7919 10.3026 +4.5913 -5.4098 -0.1743 +8.3033 -12.5867 6.7556 +6.0761 -12.256499999999999 6.590400000000001 +3.8489000000000004 -2.027 8.652600000000001 +3.8489000000000004 -6.4814 6.590400000000001 +3.8489000000000004 -7.9667 6.590400000000001 +3.8489000000000004 -9.6171 9.8902 +3.8489000000000004 -8.2144 4.2806999999999995 +3.8489000000000004 -8.2144 2.6308000000000002 +3.8489000000000004 -8.4619 7.4982999999999995 +3.8489000000000004 -8.4619 6.590400000000001 +3.8489000000000004 -5.9860999999999995 10.6325 +3.8489000000000004 -9.6996 2.6306 +3.8489000000000004 -6.4826999999999995 6.590400000000001 +2.2809 -5.9041999999999994 9.9726 +10.6137 -5.0797 -0.3388 +10.6137 -4.9972 2.3828 +11.6034 -9.8647 1.1457 +11.6034 -9.6168 1.3109000000000002 +11.6034 -12.6687 -1.1642 +11.6034 -12.6687 1.1457 +9.376199999999999 -9.947000000000001 10.137400000000001 +10.0354 -4.6665 8.6528 +5.5809999999999995 -10.0293 3.4555000000000002 +3.3537999999999997 -3.3472 10.6326 +3.3537999999999997 -3.3472 10.3851 +3.3537999999999997 -2.027 6.6731 +3.3537999999999997 0.2829 9.8901 +3.3537999999999997 0.2829 9.9726 +3.3537999999999997 -0.21220000000000003 10.467600000000001 +3.3537999999999997 -5.9878 7.002999999999999 +3.3537999999999997 -4.5844000000000005 7.2505 +3.3537999999999997 -4.5844000000000005 7.002999999999999 +3.3537999999999997 2.675 8.57 +3.3537999999999997 -1.7794 8.4875 +3.3537999999999997 0.9424 9.7253 +3.3537999999999997 -1.6972 10.6326 +3.3537999999999997 2.0148 9.0653 +3.3537999999999997 1.6029000000000002 9.3954 +3.3537999999999997 -9.6995 9.4778 +3.3537999999999997 -3.4298 7.2505 +3.3537999999999997 -3.4298 6.9204 +3.3537999999999997 -3.4298 10.7151 +3.3537999999999997 -9.8641 8.982800000000001 +3.3537999999999997 0.86 10.2202 +3.3537999999999997 -7.389600000000001 7.1679 +3.3537999999999997 -1.7791000000000001 6.9207 +3.3537999999999997 -4.5846 7.002999999999999 +3.3537999999999997 -8.2966 7.9928 +3.3537999999999997 -8.2134 7.910399999999999 +3.3537999999999997 -6.5645 7.415299999999999 +3.3537999999999997 -6.5645 7.0854 +3.3537999999999997 -6.5645 7.0853 +3.3537999999999997 -3.1003 7.2503 +3.3537999999999997 -3.1003 6.9204 +3.3537999999999997 1.1081 9.725399999999999 +3.3537999999999997 1.1076000000000001 10.1378 +3.3537999999999997 -9.8643 8.982800000000001 +3.3537999999999997 -9.8643 8.4875 +3.3537999999999997 -8.6273 10.055 +3.3537999999999997 -8.2136 9.7253 +3.3537999999999997 -7.1407 9.9726 +3.3537999999999997 -7.1407 10.0551 +3.3537999999999997 -7.3885000000000005 10.3851 +3.3537999999999997 -0.0477 9.9728 +3.3537999999999997 -4.7499 7.3329 +3.3537999999999997 -8.4619 8.0748 +3.3537999999999997 -8.4619 7.4982999999999995 +3.3537999999999997 -8.4619 9.7253 +3.3537999999999997 -9.2857 8.9003 +3.3537999999999997 -2.6046 8.652600000000001 +3.3537999999999997 -8.5438 10.0551 +3.3537999999999997 2.1803 9.642900000000001 +3.3537999999999997 1.3547 9.9726 +3.3537999999999997 2.0971 6.672899999999999 +3.3537999999999997 1.1901 9.9728 +3.3537999999999997 -9.0394 7.9103 +3.3537999999999997 -9.0394 7.8277 +3.3537999999999997 -9.7818 8.4877 +3.3537999999999997 1.932 9.0653 +3.3537999999999997 -0.4598 10.1378 +3.3537999999999997 -8.4621 9.642900000000001 +3.3537999999999997 -3.0994 6.9207 +6.3233999999999995 -10.854 10.137699999999999 +4.0962 -9.6993 2.6306 +4.0962 -9.6164 2.0531 +0.301 4.3249 8.3226 +-1.9262000000000001 3.9122 6.6731 +8.633799999999999 -4.2547 -0.5042 +8.633799999999999 -4.7498 -2.5666 +8.633799999999999 -5.822 -3.7211000000000003 +7.065799999999999 -4.0896 2.6308000000000002 +2.6113999999999997 -3.4296 8.6528 +-3.411 2.7573 6.6731 +8.1387 -12.5867 8.2399 +8.1387 -12.834200000000001 4.2805 +8.1387 -12.339 9.2299 +2.1163000000000003 -3.4296 8.6528 +2.1163000000000003 -3.4296 6.6731 +2.1163000000000003 -3.347 6.6731 +-1.6788999999999998 0.6950999999999999 10.6327 +11.1083 -11.0195 6.5906 +11.1083 -9.947000000000001 8.5703 +8.8811 -4.4198 -1.4119 +8.8811 -4.1723 0.8984000000000001 +6.6539 -4.502 4.2805 +6.6539 -4.502 6.590400000000001 +6.6539 -4.1722 4.2805 +6.6539 -4.089700000000001 6.590400000000001 +9.5403 -4.749 8.6528 +9.5403 -4.749 9.395199999999999 +5.0859000000000005 -4.915 2.6306 +5.0859000000000005 -4.915 1.0634 +11.8507 -9.6168 6.590400000000001 +11.8507 -9.6999 2.4653 +11.8507 -6.8946 1.1457 +5.8283000000000005 -4.9975 -2.0718 +5.8283000000000005 -5.9868999999999994 -3.3911999999999995 +11.3556 -10.6896 7.745100000000001 +4.6739999999999995 -10.6068 4.2805 +4.6739999999999995 -10.6068 6.590400000000001 +4.6739999999999995 -5.9045 4.2805 +4.6739999999999995 -5.9045 6.590400000000001 +-3.5756 -0.5427000000000001 8.9003 +9.870800000000001 -12.9169 3.7854 +9.870800000000001 -16.958599999999997 3.7854 +5.416399999999999 -11.9264 4.2805 +5.416399999999999 -4.6672 4.2805 +9.3757 -5.5743 -3.3089 +-3.3283 0.6950999999999999 10.0549 +-3.3283 1.7673 9.725 +-3.3283 1.8501 8.7353 +10.1181 -6.9765999999999995 9.8077 +10.1181 -4.7496 8.7353 +-2.5859 -2.9347000000000003 8.9003 +-2.5859 -3.5129 8.9003 +-2.5859 -3.5126 6.672899999999999 +4.1789 -12.6692 -2.4839 +-4.0707 1.3545 8.7353 +5.9110000000000005 -6.977 -3.7213999999999996 +5.9110000000000005 -6.977 -3.3085999999999998 +5.9110000000000005 -4.9975 -1.9892 +3.6838 -7.802099999999999 -1.1642 +3.6838 -6.977 2.6306 +3.6838 -6.8938 3.1260999999999997 +3.6838 -6.9775 0.23809999999999998 +3.6838 -6.9775 1.2282 +3.6838 -16.9589 -1.1642 +3.6838 -16.9589 1.146 +3.6838 -16.9589 1.3109000000000002 +3.6838 -12.67 1.4759 +-2.3386 1.1901 10.4674 +4.426200000000001 -12.6692 2.7959 +4.426200000000001 -12.6692 2.6309 +0.631 4.077299999999999 9.2301 +11.190999999999999 -7.142600000000001 -2.4840999999999998 +11.190999999999999 -9.9468 9.1475 +11.190999999999999 -6.895 -1.2468 +11.190999999999999 -7.1419999999999995 9.065199999999999 +11.190999999999999 -8.9565 9.3127 +7.3957999999999995 -10.0293 4.2805 +7.3957999999999995 -7.4728 -4.299 +7.3957999999999995 -12.6692 -4.299 +0.7142 -4.2543999999999995 8.652700000000001 +-1.513 -1.9452 9.9726 +8.4687 -4.0896 2.6308000000000002 +8.4687 -4.4199 6.590400000000001 +4.6735 -12.668899999999999 2.3829 +2.4463 1.7680000000000002 10.3025 +11.4383 -8.4623 -2.3189 +4.7566999999999995 0.5295 8.6528 +4.7566999999999995 -0.7901 9.725200000000001 +4.7566999999999995 0.19940000000000002 9.8077 +7.6431 -8.4618 10.5501 +-1.2657 1.1903000000000001 10.2201 +-1.2657 3.7475 9.3954 +-1.2657 2.2627 10.467500000000001 +9.9535 -12.6686 -3.8039000000000005 +9.9535 -12.0088 6.5906 +5.499099999999999 -8.4618 10.5501 +6.1583 -11.8438 9.4778 +3.9311 -12.6687 -1.1642 +3.9311 -12.6687 1.2282 +2.6936 2.9223 9.478 +-3.988 1.0250000000000001 9.2304 +11.6856 -6.3991999999999996 6.5906 +11.6856 -9.6171 1.146 +11.6856 -12.67 -1.9068999999999998 +-3.2456 1.8501 8.7354 +1.8679999999999999 -2.9354 10.7151 +10.200800000000001 -4.832199999999999 8.7353 +-0.9351999999999999 -4.6685 8.9003 +-0.27599999999999997 1.0251 10.7151 +-2.5031999999999996 -2.9347000000000003 8.9003 +10.943200000000001 -7.059200000000001 8.57 +5.2513 -11.7617 6.590400000000001 +3.7664999999999997 -16.9589 -1.5771 +8.8801 -7.1419999999999995 10.3026 +8.9633 -12.4216 8.405100000000001 +8.9633 -11.4317 9.2299 +-2.1727 -0.4598 10.0553 +-3.7407000000000004 -0.4598 8.7353 +-0.5237999999999999 -5.7395000000000005 8.4875 +10.036200000000001 -5.0798000000000005 6.5906 +10.6954 -12.3392 2.6308000000000002 +8.4682 -12.173499999999999 9.3127 +4.0138 -12.668899999999999 2.2180999999999997 +4.0138 -12.668899999999999 1.2282 +4.0138 -10.3592 6.590400000000001 +4.0138 -12.67 2.218 +6.9834 -16.9589 -4.2162 +4.7562 1.1904 8.9824 +4.7562 1.1904 8.57 +4.7562 -3.3472 10.3026 +4.7562 -0.0471 7.663 +4.7562 -6.8938 10.6325 +4.7562 -11.184099999999999 8.899899999999999 +4.7562 0.6124 9.6427 +4.7562 -3.1828000000000003 7.0028999999999995 +4.7562 -0.3778 7.497800000000001 +4.7562 -0.0473 9.8079 +4.7562 -0.0473 8.0753 +4.7562 -1.4489 10.3851 +4.7562 -6.976699999999999 10.6327 +4.7562 1.1073 9.0653 +4.7562 -10.5243 9.3127 +4.7562 -9.9465 10.055 +4.7562 -9.782399999999999 10.137699999999999 +4.7562 -4.9143 6.590400000000001 +4.7562 -0.12940000000000002 9.9726 +4.7562 -7.1419999999999995 10.2202 +4.7562 -3.0162999999999998 7.4155 +4.7562 -3.5946 10.6327 +4.7562 -11.1018 9.2299 +4.7562 -3.2641000000000004 10.2202 +4.7562 -8.7919 9.9725 +4.7562 -8.7919 10.3852 +4.7562 0.5306 9.0653 +4.7562 -3.5124000000000004 10.6325 +4.7562 -5.4091000000000005 6.9204 +4.7562 -0.29550000000000004 9.9728 +4.7562 -8.4619 10.0553 +4.7562 -8.4619 10.3851 +4.7562 -10.6891 8.982800000000001 +4.7562 -10.6891 6.590400000000001 +4.7562 -2.6041000000000003 10.5501 +4.7562 -10.6064 8.982800000000001 +4.7562 -3.6775 7.332800000000001 +4.7562 -11.3493 6.590400000000001 +4.7562 -1.2844 9.8901 +4.7562 -11.018799999999999 9.3127 +4.7562 -1.1202999999999999 9.8079 +4.7562 -8.4621 10.3852 +4.7562 -8.4621 10.055 +4.7562 -3.0994 7.0855 +9.293800000000001 -7.1419999999999995 9.725200000000001 +9.293800000000001 -7.1419999999999995 9.8077 +4.8394 1.0246 8.6528 +4.8394 0.5295 9.6427 +5.4986 -8.6277 -3.7215 +6.4883 -12.504000000000001 4.2805 +4.2611 -9.9467 2.6308000000000002 +-0.1933 -4.6674 7.497800000000001 +-1.7613 -4.4192 8.9003 +5.9123 -12.6692 3.9503000000000004 +11.0259 -6.895 -2.4840999999999998 +-3.2460999999999998 2.675 8.7353 +-3.2460999999999998 1.9324000000000001 8.7353 +-3.2460999999999998 1.9324000000000001 6.9206 +-3.2460999999999998 2.7573 8.57 +-3.2460999999999998 2.8400000000000003 6.6731 +-3.2460999999999998 -0.4598 10.1373 +11.7683 -8.3793 6.590400000000001 +5.745900000000001 -12.834599999999998 -3.8041 +3.5187000000000004 -7.802099999999999 4.2806999999999995 +3.5187000000000004 -7.802099999999999 6.590400000000001 +3.5187000000000004 -8.545 2.6308000000000002 +3.5187000000000004 -7.7199 2.6306 +3.5187000000000004 -8.544699999999999 6.590400000000001 +3.5187000000000004 -16.9589 -0.504 +3.5187000000000004 -16.7935 0.4031 +3.5187000000000004 -7.7193 2.6308000000000002 +3.5187000000000004 -8.2144 4.2806999999999995 +3.5187000000000004 -8.2144 2.6308000000000002 +3.5187000000000004 -8.5441 2.6306 +3.5187000000000004 -9.3689 1.3107 +3.5187000000000004 -12.67 -0.8338999999999999 +3.5187000000000004 -12.67 0.8156 +10.2835 -6.895 -3.3914 +10.2835 -11.6791 8.7355 +11.2732 -9.9468 4.2805 +11.2732 -9.9468 6.590400000000001 +9.046 -12.0916 4.363 +-3.6580000000000004 2.1801 8.7354 +-3.6580000000000004 1.9325999999999999 9.2304 +12.0156 -16.9589 -0.6688000000000001 +12.0156 -12.67 0.9806 +12.0156 -12.834599999999998 -0.9164 +12.0156 -16.875799999999998 0.8156 +9.7884 -12.0916 6.590400000000001 +6.0764 -6.976699999999999 -3.3914 +8.9628 -7.3072 10.3026 +4.5084 -11.0193 4.2806999999999995 +4.9221 0.8595 9.3126 +4.9221 -1.0377 9.725200000000001 +4.9221 -1.0377 9.8077 +7.8085 -6.9775 -3.8865 +7.8085 -6.9775 -4.2164 +7.8085 -16.9589 -4.2162 +7.8085 -16.9589 -3.0618 +7.8085 -12.7523 -3.0618 +7.8085 -12.67 -4.2989 +7.8085 -12.6692 -4.299 +7.8085 -12.6692 -3.9689 +5.581300000000001 -11.018799999999999 9.8902 +6.3237000000000005 -12.009 9.3127 +4.0965 -6.977 -0.1743 +4.0965 -6.977 2.6306 +4.0965 -5.9868999999999994 2.6306 +-4.1531 -0.5427000000000001 8.9829 +-4.1531 -0.5427000000000001 8.9003 +8.6341 -4.089700000000001 6.5078 +6.4069 -7.1419999999999995 10.6327 +11.5205 -7.141699999999999 6.5906 +11.5205 -6.1517 7.498100000000001 +4.8389 0.3643 8.6528 +4.8389 0.6944 8.0752 +4.8389 -0.21259999999999998 7.5806 +4.8389 -5.1617999999999995 4.2805 +4.8389 1.0245 8.6528 +3.2709 -9.121 7.910399999999999 +3.2709 -8.0486 7.993 +3.2709 -0.2946 10.0553 +3.2709 -9.203899999999999 8.9002 +3.2709 -8.3787 7.497800000000001 +3.2709 -7.223599999999999 7.167999999999999 +3.2709 -9.7818 8.9002 +-1.1835 4.1598999999999995 8.487599999999999 +10.366200000000001 -15.8862 -3.4737999999999998 +4.3438 -10.0296 4.2803 +11.108600000000001 -5.4921 4.2805 +9.540600000000001 -10.2771 3.5380000000000003 +9.540600000000001 -8.0503 -3.9690000000000003 +5.0862 -6.9775 -2.7315 +5.0862 -7.0605 -2.5664 +-3.1634 -0.7904 10.0553 +-3.1634 -0.7904 10.1378 +9.623800000000001 -7.1419999999999995 10.055 +8.0558 -4.0072 6.590400000000001 +5.8286 -6.9775 -3.7215 +5.8286 -7.0605 -3.2268 +5.8286 -12.6692 -3.804 +5.8286 -12.6692 -3.474 +3.6014 -7.9667 6.590400000000001 +3.6014 -7.306699999999999 6.590400000000001 +3.6014 -16.9589 -0.9164 +3.6014 -16.9589 1.1457 +3.6014 -9.2044 3.6207000000000003 +3.6014 -12.67 -1.1642 +3.6014 -12.67 1.1457 +3.6014 -9.6996 1.2282 +11.3559 -12.6692 2.4653 +9.128699999999998 -12.256499999999999 8.5703 +9.128699999999998 -10.607 10.055 +9.128699999999998 -9.947000000000001 9.807599999999999 +9.128699999999998 -11.8439 8.5703 +7.5607 -10.2769 3.9505 +12.0983 -8.8749 0.9806 +12.0983 -9.370000000000001 -0.25639999999999996 +12.0983 -12.67 0.073 +12.0983 -12.6687 -0.25639999999999996 +3.8487 -7.142999999999999 -1.1643999999999999 diff --git a/assets/xarm7/contacts/link5_vhacd.txt b/assets/xarm7/contacts/link5_vhacd.txt new file mode 100644 index 0000000..7b80f28 --- /dev/null +++ b/assets/xarm7/contacts/link5_vhacd.txt @@ -0,0 +1,1586 @@ +1585 +-3.5648 6.6951 -4.2168 +-0.9408 5.2771 -7.8334 +-1.7919999999999998 6.1281 -11.521 +-2.6432 5.5602 2.3778 +-0.8704 -3.4450000000000003 -13.2933 +2.6752000000000002 5.2062 -9.1807 +2.6752000000000002 5.2774 -11.8751 +1.8239999999999998 8.1136 -4.2168 +3.5968 6.8371 -4.2172 +-2.2870999999999997 5.2061 -12.2992 +-2.9975 8.113299999999999 -2.9409 +-0.3735 5.9155 -6.9825 +-0.3735 5.8446 -7.407800000000001 +-1.2247 -4.154100000000001 -14.7123 +-1.2247 8.6099 -2.9405 +1.3993 8.254999999999999 -5.4222 +1.3993 8.4681 -4.217 +1.3993 8.4681 -5.4222 +0.5481 5.9860999999999995 -12.0166 +0.5481 8.4679 -6.9825 +-0.3031 5.5602 3.7960000000000003 +-0.3031 0.4556 -3.7914999999999996 +3.2425 0.4556 -1.4516 +3.2425 1.8027000000000002 -1.3096 +2.3913 5.5612 -7.8334 +2.3913 5.2062 -8.4007 +3.3833 6.6953 -7.6916 +1.1154000000000002 5.9155 -5.4224000000000006 +1.1154000000000002 5.5607 -3.6494999999999997 +2.8882000000000003 6.1278 -10.5277 +1.1858 8.6099 -4.2168 +1.1858 8.6099 -4.501 +3.8098 0.4556 0.3215 +3.8098 1.8027000000000002 -0.246 +3.8098 4.2844 -11.2392 +2.9586 2.3699000000000003 -11.5915 +2.9586 2.299 -11.5915 +2.9586 2.299 -11.166 +2.9586 3.4331 -2.4443 +2.9586 -2.1683999999999997 -13.8609 +2.1073999999999997 5.5609 -7.6916 +-3.3518 6.1986 -6.9825 +-3.3518 6.6247 -6.9825 +-4.202999999999999 -1.0344 -14.57 +-4.202999999999999 2.299 -12.2299 +-4.202999999999999 2.2988 -12.0174 +-4.202999999999999 1.6605999999999999 -13.364500000000001 +-4.202999999999999 2.6539 -12.2299 +-4.202999999999999 -0.9631000000000001 -14.357600000000001 +-4.202999999999999 0.7388 -17.3349 +-2.4302 8.0426 1.3145 +-3.2814 7.5457 -2.9402999999999997 +-3.2814 0.4556 -1.3805 +-3.2814 -1.9559 -15.1376 +-3.2814 -1.1052 -13.364500000000001 +-3.2814 -2.0977 -17.3353 +-2.3598 6.1281 -5.4222 +-3.6357 5.9154 1.2437 +-3.6357 7.6173 -1.6634 +-3.6357 7.5463000000000005 -2.9405 +-1.8629 0.5266 -3.3659000000000003 +-1.8629 6.340800000000001 -4.2173 +-1.8629 6.340800000000001 -5.4224000000000006 +-2.7140999999999997 7.333399999999999 2.0937 +-2.7140999999999997 7.475099999999999 0.8182999999999999 +-2.7140999999999997 0.4556 2.3067 +-2.7140999999999997 0.4556 -2.7277 +-2.7140999999999997 1.8027000000000002 2.165 +-0.9412999999999999 7.758900000000001 -9.1807 +-1.7925 -3.3741 -17.335 +2.5339 4.2132000000000005 -12.4431 +1.6827 4.000299999999999 3.4415 +1.6827 4.5674 -3.4368000000000003 +1.6827 5.7028 -6.9825 +0.8314999999999999 5.4183 3.7249999999999996 +2.6043 6.1992 -5.4224000000000006 +3.5259 6.6952 -2.9405 +3.5963000000000003 6.837400000000001 -8.117099999999999 +-1.2956 3.5753 -15.1376 +-1.2956 8.2554 -2.9405 +-2.1468000000000003 1.3056999999999999 -11.9463 +-2.1468000000000003 2.1564 -11.5212 +-2.1468000000000003 2.2988 -11.3792 +-2.1468000000000003 2.2988 -11.0953 +-2.1468000000000003 -2.2388000000000003 -13.364300000000002 +-2.1468000000000003 -2.8777 -13.293199999999999 +-0.374 8.6808 -4.2168 +-0.374 5.9155 -6.9825 +-0.374 8.184 -6.9825 +2.25 6.128 -4.2172 +2.25 6.128 -5.4224000000000006 +3.1716 5.5607 -1.4514 +3.1716 6.2696000000000005 -1.4514 +3.1716 6.9081 0.7469 +4.0932 2.5826000000000002 -12.5142 +4.0932 2.5826000000000002 -11.805200000000001 +4.0932 2.3699000000000003 -11.805200000000001 +4.0932 2.299 -12.726799999999999 +2.3908 5.9156 -6.840599999999999 +1.9661000000000002 3.7171999999999996 -13.6485 +1.1149 8.3263 -4.2172 +3.7388999999999997 6.7661 -0.1754 +3.7388999999999997 6.1279 -8.4007 +3.7388999999999997 5.9860999999999995 -8.4007 +3.7388999999999997 6.765899999999999 -7.0535 +3.7388999999999997 6.765899999999999 -7.407800000000001 +3.7388999999999997 -0.6084 -15.1377 +3.7388999999999997 6.411899999999999 -8.4007 +3.7388999999999997 5.5607 0.5341 +3.7388999999999997 5.5607 -0.6003999999999999 +3.7388999999999997 7.191699999999999 -1.4513 +3.7388999999999997 6.766500000000001 -6.9825 +3.7388999999999997 6.4117 -7.904400000000001 +3.7388999999999997 6.4117 -8.117099999999999 +3.7388999999999997 6.979 -1.4513 +3.7388999999999997 6.9081 -1.3804 +3.7388999999999997 -0.9631000000000001 -17.3356 +3.7388999999999997 5.4190000000000005 -9.1807 +2.8877 8.113299999999999 -5.4222 +2.8877 -3.0907 -14.144699999999998 +-0.7987 8.3971 -7.337000000000001 +-1.6499 5.915299999999999 -6.4152000000000005 +-3.3522999999999996 -1.743 -17.3353 +-3.3522999999999996 2.299 -11.3077 +-3.3522999999999996 2.299 -11.6622 +-3.3522999999999996 0.4556 1.3141999999999998 +-3.3522999999999996 4.2132000000000005 -9.9608 +-1.5795 -3.8701 -14.0027 +-1.5795 8.539 -5.4224000000000006 +2.8173 5.2063 -9.1807 +2.8173 6.9081 -9.251900000000001 +-3.7066000000000003 6.1282000000000005 0.8178 +-3.7066000000000003 7.5457 -2.9402999999999997 +-3.7066000000000003 5.5607 0.8178 +-3.7066000000000003 2.2276000000000002 -17.2642 +-3.7066000000000003 7.4749 -1.3806 +-1.9338000000000002 8.1135 -4.2168 +-1.9338000000000002 8.1135 -2.9407 +-1.9338000000000002 6.0571 -4.2173 +-2.785 -3.3029 -14.5701 +-2.785 -3.3029 -17.3353 +1.6118000000000001 0.4556 -3.4368000000000003 +1.6118000000000001 0.4556 -3.1531000000000002 +2.5334 6.553599999999999 -4.2168 +2.5334 6.4826999999999995 -2.9407 +2.5334 4.7802999999999995 -2.3731999999999998 +2.5334 5.5602 -2.3021 +2.5334 6.0574 -3.0116 +4.3062000000000005 0.384 -14.215800000000002 +4.3062000000000005 -0.3959 -14.6418 +1.7526 8.1842 -7.407800000000001 +-4.0609 3.2205 -12.2304 +-3.1392999999999995 5.5607 -2.2315 +-3.1392999999999995 1.8027000000000002 -1.5225 +-1.3665 8.1135 1.0301 +-1.3665 8.6099 -0.8137 +-2.2177 -3.7283999999999997 -14.7123 +2.1791 3.7168 -17.3353 +1.3278999999999999 7.6168 -9.251900000000001 +1.3278999999999999 -3.7286 -14.427999999999999 +1.3278999999999999 -3.9412999999999996 -13.9319 +1.3278999999999999 -4.083 -14.924599999999998 +1.3278999999999999 -3.7283999999999997 -14.924599999999998 +1.3278999999999999 2.2277 -10.9538 +0.4767 -4.2959 -14.8543 +3.1007 2.1568 -15.137999999999998 +3.1007 2.1568 -17.3356 +3.1007 3.5753 -10.882200000000001 +3.1007 4.2842 -9.8901 +3.1007 2.2987 -17.3356 +3.1007 2.299 -11.2369 +3.1007 0.4556 2.2358 +2.2495000000000003 6.1279 -4.2168 +3.1711000000000005 6.1282000000000005 -9.1807 +3.7384 6.4829 -7.8334 +-3.7752 4.2844 -10.1756 +-3.4936000000000003 6.412 -8.117099999999999 +-3.4936000000000003 6.412 -7.8334 +-1.7208 6.199000000000001 3.3703999999999996 +-2.572 -3.3737999999999997 -14.3573 +-2.572 -2.0977 -13.364500000000001 +-3.4232 5.5609 0.8178 +-3.4232 -2.0977 -14.57 +-2.5016 6.1988 -10.953 +-2.5016 5.2063 -12.0879 +-2.5016 5.5607 -2.9402999999999997 +-0.7288 -4.0120000000000005 -13.790099999999999 +-0.7288 -2.9489 -13.364500000000001 +2.7464 0.4556 -2.3731999999999998 +1.8952 5.8446 -2.9405 +1.8952 5.5607 -2.9405 +3.6679999999999997 5.8445 0.8892000000000001 +3.6679999999999997 7.191599999999999 -5.9189 +3.6679999999999997 5.5607 0.7476 +3.6679999999999997 7.2626 -4.2168 +3.6679999999999997 7.4756 -5.4224000000000006 +3.6679999999999997 6.9078 -5.4224000000000006 +3.6679999999999997 2.2277 -17.3356 +3.6679999999999997 6.9079 -2.9407 +-3.2079000000000004 4.922499999999999 -11.8742 +-3.7775000000000003 3.5753 -12.5139 +-3.7775000000000003 5.6318 -0.8128 +-3.7775000000000003 5.5609 0.8178 +-3.7775000000000003 3.5041999999999995 -12.584699999999998 +-3.7775000000000003 6.694999999999999 -1.3805 +-3.7775000000000003 6.9078 0.0373 +-3.7775000000000003 -2.0977 -14.57 +-3.7775000000000003 3.788 -12.2304 +-2.8559 3.2203000000000004 -17.3356 +-1.9343 7.5461 2.6612 +0.6897 8.3971 1.9526999999999999 +-0.16149999999999998 2.2988999999999997 -10.8824 +-0.16149999999999998 2.2988999999999997 -11.236699999999999 +-0.16149999999999998 3.5039000000000002 -10.5282 +-0.16149999999999998 2.5117000000000003 -11.165799999999999 +-0.16149999999999998 4.2841 -9.8195 +-0.16149999999999998 4.2132000000000005 -9.3937 +3.3137 2.2987 -13.9319 +1.6113 -1.9556 -12.6553 +4.2353000000000005 0.7389 -12.9389 +4.2353000000000005 1.3061 -13.1518 +3.3841 7.1204 -6.4151 +3.3841 7.1921 -5.4224000000000006 +3.3841 7.191599999999999 -5.4224000000000006 +3.3841 5.5607 0.7476 +3.3841 2.7245 -14.641599999999999 +2.5329 7.5464 0.8888999999999999 +-3.2102 6.2698 -9.0388 +-3.2102 6.2698 -9.1807 +-3.2102 7.5463000000000005 -2.9405 +-3.2102 7.9718 -1.167 +-3.2102 -2.0977 -15.1376 +-3.2102 -2.0977 -17.3353 +-3.2102 7.5461 0.8182999999999999 +-2.2886 3.5041999999999995 -13.7898 +-2.2886 -3.6575999999999995 -16.909399999999998 +1.1865999999999999 8.3971 -6.9825 +0.33540000000000003 4.4255 3.7961 +0.33540000000000003 5.5602 -3.437 +0.33540000000000003 0.4556 -3.7914999999999996 +-1.367 -3.3028000000000004 -13.364400000000002 +2.1082 3.7876 -14.641599999999999 +2.1082 3.1496999999999997 -15.137800000000002 +3.0298 8.0425 -5.4224000000000006 +3.0298 7.5464 1.0308 +2.1786 -3.0906 -15.137900000000002 +2.1786 -3.0906 -17.3356 +3.9514 1.7315 -17.193 +-0.7974 5.2061 -12.8662 +-3.351 7.3332 -7.6916 +-3.6349 6.765599999999999 -8.4007 +-0.0893 8.042399999999999 -7.6916 +-2.6429 8.2552 -5.4222 +-3.4941 4.7802999999999995 -0.0332 +-3.4941 4.4963999999999995 -0.0332 +-3.4941 0.4556 -1.4514 +-3.4941 3.1493 -0.0332 +-0.8701000000000001 4.213299999999999 -17.3353 +-0.8701000000000001 4.2843 -14.499600000000001 +-1.7212999999999998 4.6383 3.4415 +-1.7212999999999998 -3.5158 -14.3573 +-1.7212999999999998 -3.8703000000000003 -17.335 +-1.7212999999999998 -3.8703000000000003 -14.3573 +-1.7212999999999998 -3.4448 -15.1376 +-2.5725000000000002 6.624099999999999 -10.245 +-0.7997000000000001 5.2064 -12.7972 +-0.7997000000000001 7.0496 -10.5989 +1.8242999999999998 6.8373 -10.386099999999999 +1.8242999999999998 7.9719 0.8883 +1.8242999999999998 5.5609 3.2994999999999997 +1.8242999999999998 5.2066 -12.1587 +1.8242999999999998 5.2066 -12.3718 +1.8242999999999998 7.4044 -9.1807 +1.8242999999999998 5.5607 2.9448 +1.8242999999999998 7.0496 -9.1807 +1.8242999999999998 8.3972 0.3208 +1.8242999999999998 7.475099999999999 2.0942 +1.8242999999999998 5.2067000000000005 -12.371400000000001 +1.8242999999999998 5.2067000000000005 -11.9458 +1.8242999999999998 7.3332999999999995 -9.1807 +1.8242999999999998 6.9081 3.0867999999999998 +1.8242999999999998 5.2774 -12.3718 +1.8242999999999998 7.5461 2.6616999999999997 +0.9731 8.3263 -5.4224000000000006 +0.12190000000000001 8.3968 -5.4224000000000006 +0.12190000000000001 5.9155 -5.4224000000000006 +0.12190000000000001 8.326 -5.4224000000000006 +0.12190000000000001 6.1992 -5.4224000000000006 +3.5971 6.837 -4.2168 +3.5971 6.8371 -2.9405 +3.5971 0.4556 1.3143 +3.5971 7.5463000000000005 -2.9405 +1.0434999999999999 5.2061 -12.795100000000001 +3.6675 7.1212 -5.4222 +3.6675 6.6953 -7.6916 +3.6675 7.4756 -5.4222 +3.6675 7.1915000000000004 -6.8407 +3.6675 7.1915000000000004 -6.9825 +2.8163 7.900500000000001 -6.8407 +-3.8484 -0.9631000000000001 -14.57 +-2.0756 1.447 -11.8753 +-2.9268 0.4556 2.3778 +-2.0052 8.4681 -4.217 +2.3916 4.6383 2.5194 +2.3916 4.6383 2.4486 +2.3916 5.5602 2.4486 +1.5404 4.7802999999999995 -3.5077999999999996 +1.5404 5.5602 -3.437 +1.5404 5.5602 -3.1532999999999998 +1.5404 0.4556 -3.2952000000000004 +1.5404 0.4556 -3.437 +4.1644 -0.9631000000000001 -14.0745 +4.1644 -0.9631000000000001 -17.3356 +3.3132 5.6319 0.7476 +1.1157 8.254999999999999 -4.217 +0.2645 -2.2389 -12.6553 +2.0372999999999997 6.1282000000000005 -2.8694 +2.0372999999999997 4.2843 -13.2224 +2.0372999999999997 3.4334000000000002 -14.285700000000002 +2.0372999999999997 3.4334000000000002 -14.428199999999999 +2.0372999999999997 3.7168 -13.5767 +2.1077 -3.7994 -14.9247 +-2.4299 5.8447 -6.9825 +-1.5083 5.5602 3.5123 +-1.5083 1.8027000000000002 3.1579 +2.8861999999999997 7.403700000000001 -8.117099999999999 +-3.6353999999999997 6.6955 -8.5426 +-2.7138 5.2063 -9.1807 +-1.7922 7.5463000000000005 -9.1807 +-2.6433999999999997 -3.3736 -14.57 +0.8318000000000001 -4.2250000000000005 -14.499899999999998 +0.8318000000000001 8.113199999999999 -6.840599999999999 +0.8318000000000001 5.9865 -6.840599999999999 +0.8318000000000001 5.9156 -6.840599999999999 +-0.0194 5.5602 3.5124000000000004 +-0.0194 5.5602 3.7961 +-0.0194 4.2843 -14.4985 +-0.0194 0.4556 3.5832999999999995 +-0.0194 0.4556 3.7961 +-0.8706 8.1844 -8.117099999999999 +-0.8706 8.4678 -6.9825 +2.6046 3.5044 -14.428199999999999 +2.6046 8.2552 -0.9554999999999999 +1.7534 -2.5225999999999997 -13.364300000000002 +1.7534 2.2987 -11.0246 +1.7534 2.2987 -11.3793 +1.7534 -3.6575999999999995 -13.8609 +1.7534 -3.5157000000000003 -13.577200000000001 +1.7534 -2.665 -13.009599999999999 +1.7534 -2.665 -13.081000000000001 +1.7534 -2.665 -13.4353 +1.7534 1.4479 -11.804499999999999 +0.9022 7.3332999999999995 -10.0318 +0.9022 -2.665 -12.8682 +3.5262000000000002 4.7802999999999995 1.4561 +3.5262000000000002 5.5602 1.2434 +3.5262000000000002 5.5602 -1.3096 +3.5262000000000002 5.5602 -1.3093000000000001 +3.5262000000000002 5.5602 -1.3807 +3.5262000000000002 5.5602 1.2430999999999999 +3.5262000000000002 5.5602 1.3143 +3.5262000000000002 0.4556 -1.3096 +3.5262000000000002 0.4556 -1.3093000000000001 +3.5262000000000002 -2.5232 -14.57 +3.5262000000000002 4.3545 -1.5224 +3.5262000000000002 1.8027000000000002 -0.0329 +3.5262000000000002 1.8027000000000002 -0.0333 +2.675 5.3474 -2.7279 +2.675 0.4556 -2.3731999999999998 +3.6670000000000003 7.1212 -7.1953000000000005 +3.6670000000000003 4.3553 -11.6617 +-3.0681 5.5607 2.3068 +-3.0681 2.2991 -15.1376 +-3.0681 2.2991 -17.3356 +-3.9193 -1.0344 -13.4356 +-3.9193 4.2843 -11.3077 +-3.9193 4.2843 -10.3866 +-3.9193 2.2988 -12.2304 +-3.9193 2.2988 -13.364500000000001 +-3.9193 -0.9631000000000001 -13.364899999999999 +-3.9193 0.7388 -13.6486 +-0.44409999999999994 5.8443000000000005 -5.5645 +-2.1465 7.7581 -8.4007 +-2.1465 -3.4448 -13.719100000000001 +-2.9977 4.2843 -10.3156 +-0.3737 8.6808 -4.217 +-1.2248999999999999 8.3262 -6.9825 +-1.2248999999999999 8.2553 2.0235 +-1.2248999999999999 5.5602 -3.2951 +-1.2248999999999999 2.2988 -10.9538 +-1.2248999999999999 0.4556 -3.3661000000000003 +-1.2248999999999999 0.4556 -3.5787 +1.3991 -3.8703000000000003 -13.8609 +1.3991 -3.3739 -13.8609 +1.3991 -4.083 -14.924599999999998 +0.5479 2.1568 -10.9538 +0.5479 8.1842 -8.117099999999999 +0.5479 8.1842 -8.187999999999999 +2.3207 -3.5867999999999998 -14.924599999999998 +2.3207 -3.5867999999999998 -17.3356 +2.3207 -3.6576999999999997 -17.2641 +2.3207 -3.6576999999999997 -14.9247 +2.3207 -3.0906 -17.3356 +2.3207 -3.0194 -15.1377 +2.3207 -3.0194 -17.3356 +2.3207 -3.3035 -14.9247 +1.4695 8.539 -4.2173 +1.4695 8.4681 -5.4220999999999995 +0.6183 8.6099 -5.9188 +3.2423 6.1279 -9.1807 +3.2423 6.8373 -8.8261 +2.3911000000000002 8.0423 -7.0535 +1.9664000000000001 8.4681 -1.3093000000000001 +1.9664000000000001 2.2988 -11.0244 +1.9664000000000001 8.3261 0.8883 +2.888 5.4183 2.4486 +2.888 3.2205999999999997 -17.3353 +2.888 0.8813 2.5194 +-2.5008 3.5753 -14.428199999999999 +-2.5008 8.1839 -6.4859 +-2.5008 3.5045 -13.3642 +-2.5008 3.5045 -14.428199999999999 +-2.5008 5.915299999999999 -6.840599999999999 +-3.3520000000000003 5.3484 -11.165899999999999 +-3.3520000000000003 4.3545 1.8813 +-1.5792000000000002 -3.5869999999999997 -14.3573 +-1.5792000000000002 -3.4450000000000003 -17.335 +-1.5792000000000002 -3.4450000000000003 -15.1376 +-2.4304 7.1913 -9.1807 +-2.4304 6.6953 -10.244499999999999 +-2.4304 5.2776000000000005 -12.0878 +-2.4304 0.4556 -2.9405 +-2.4304 6.8372 -9.1807 +0.1936 6.1988 -4.2168 +0.1936 6.1279 -3.7913 +0.1936 5.5607 -3.508 +0.1936 5.7737 -3.508 +0.1936 5.8444 -4.2168 +-0.6576000000000001 2.1568 -10.9538 +-0.6576000000000001 -2.5225999999999997 -13.2224 +-0.6576000000000001 -2.5225999999999997 -12.7972 +-0.6576000000000001 0.3838 -12.158900000000001 +-0.6576000000000001 2.2987 -11.3082 +-0.6576000000000001 -4.0122 -13.7897 +-0.6576000000000001 -3.0199 -13.0102 +-0.6576000000000001 2.2988 -11.3085 +-0.6576000000000001 2.2988 -10.9538 +-0.6576000000000001 0.7385 -12.017700000000001 +-0.6576000000000001 -3.0188 -13.009699999999999 +-0.6576000000000001 -2.665 -13.2224 +-0.6576000000000001 -2.665 -13.222900000000001 +-0.6576000000000001 -2.8771999999999998 -13.364400000000002 +-1.5088000000000001 3.5042999999999997 -15.137900000000002 +-1.5088000000000001 3.5042999999999997 -17.3353 +-1.5088000000000001 4.0005 -14.4285 +-1.5088000000000001 4.0005 -17.3353 +2.9561 5.1352 -8.7575 +-2.0039000000000002 8.0423 -7.6916 +-3.7062999999999997 6.8369 -5.4222 +-2.7847 2.2988999999999997 -11.0952 +-3.6359000000000004 2.2987 -17.3353 +-3.6359000000000004 -1.2461 -13.222600000000002 +-3.6359000000000004 2.1564 -11.4501 +-3.6359000000000004 2.2988 -11.4499 +-3.6359000000000004 2.2988 -13.364500000000001 +-3.6359000000000004 -1.2468 -13.2935 +-3.6359000000000004 2.2983 -11.8048 +-1.0119 5.5602 -3.2951 +-1.8631000000000002 6.624 3.1578000000000004 +-1.8631000000000002 6.7661 3.1578000000000004 +-1.8631000000000002 5.5609 2.9454000000000002 +-1.8631000000000002 7.5462 2.1654 +-1.8631000000000002 7.5462 2.6616 +-1.8631000000000002 5.5607 2.9447 +-1.8631000000000002 5.7028 3.2996999999999996 +-1.8631000000000002 7.5461 2.0937 +-2.7143 -2.5225 -13.364300000000002 +-0.0903 8.3264 0.8887 +-0.0903 5.5609 3.5122 +-0.0903 5.5609 3.7959 +-0.0903 8.2553 1.1017000000000001 +-0.0903 8.1135 2.6613 +-0.0903 8.6808 -2.9399 +-0.0903 8.6808 -0.5296000000000001 +-0.0903 8.6099 0.8887 +-0.0903 6.7661999999999995 3.6539 +-0.0903 8.539 1.4563 +-0.0903 5.4903 -7.478899999999999 +-0.0903 5.7737 -7.549799999999999 +-0.0903 8.3972 -2.9399 +-0.0903 8.3263 -7.478899999999999 +-0.0903 8.042399999999999 -7.478899999999999 +-0.0903 7.5463000000000005 2.7321 +-0.0903 8.3261 1.0309000000000001 +-0.0903 7.5461 3.2285 +-0.0903 7.5461 2.8034 +-0.9415 6.2697 3.6539 +-0.9415 7.333399999999999 3.2994000000000003 +3.4553000000000003 0.5266 -1.6642000000000001 +3.4553000000000003 5.5607 -1.4514 +3.4553000000000003 5.5602 -0.0329 +3.4553000000000003 5.5602 -0.0333 +3.4553000000000003 -1.6011000000000002 -13.2224 +3.4553000000000003 6.340800000000001 1.3855 +3.4553000000000003 6.9081 -1.4514 +2.6041000000000003 -1.8845 -12.867700000000001 +0.9721000000000001 8.2549 -7.6916 +-3.1390000000000002 7.191699999999999 -8.4007 +-3.1390000000000002 6.269900000000001 -9.1807 +-2.2174 7.688000000000001 -8.4007 +1.3282 -4.012099999999999 -17.3356 +4.0226 2.299 -11.8043 +4.0226 3.3622 -11.7333 +3.1713999999999998 6.411600000000001 -1.4514 +3.1713999999999998 6.6953 0.7471 +3.1713999999999998 6.4826 -4.2172 +3.1713999999999998 7.5463000000000005 -2.9402 +2.3906 5.4191 -8.117099999999999 +2.6018 5.2061 -12.015099999999999 +3.7386999999999997 5.9154 -9.1807 +3.7386999999999997 5.3483 -9.1807 +3.7386999999999997 -0.9631000000000001 -17.3356 +3.7386999999999997 -0.9631000000000001 -14.0027 +3.1691 4.3553 -12.4412 +3.1691 4.2844 -12.4412 +-3.4229000000000003 5.7736 -8.046100000000001 +-3.4229000000000003 6.5537 -2.9409 +-3.4229000000000003 5.5607 0.8178 +-3.4229000000000003 2.2988 -13.577 +-3.4229000000000003 7.192 -7.9752 +-4.2741 0.5968 -13.364500000000001 +-4.2741 1.0223 -12.726 +-4.2741 0.029599999999999998 -13.6486 +-4.2741 0.7388 -13.364899999999999 +-4.2741 0.7388 -13.364500000000001 +-4.2741 -0.4667 -16.484099999999998 +-0.7988999999999999 8.6099 -5.9188 +-0.7988999999999999 8.539 -5.9188 +-2.5013 8.3262 -0.8845000000000001 +-2.5013 6.1989 -4.2168 +-2.5013 6.411899999999999 -2.9409 +-2.5013 6.4826 -4.2168 +-2.5013 6.4117 -3.0826 +1.8955 8.113299999999999 -2.9402 +1.8955 5.4904 -7.6916 +1.0443 5.9154 -5.4224000000000006 +2.8171 4.6383 2.5907 +2.8171 5.5602 2.5194 +2.8171 0.4556 2.5196 +2.8171 0.4556 2.5907 +-3.7068 -2.2398000000000002 -14.996 +-3.7068 -2.0977 -14.5701 +-3.7068 -2.0977 -17.3353 +-3.7068 -0.9631000000000001 -17.3349 +-1.0828 8.539 1.0301 +-1.934 5.5607 -2.8694 +-0.16119999999999998 4.2842 -9.8193 +-0.16119999999999998 4.213299999999999 -9.394 +-0.16119999999999998 4.213299999999999 -13.7188 +-0.16119999999999998 4.213299999999999 -17.3353 +-0.16119999999999998 4.0715 -14.144200000000001 +-0.16119999999999998 4.0006 -14.4283 +-0.16119999999999998 4.0006 -14.4285 +-0.16119999999999998 2.3699000000000003 -10.8116 +-0.16119999999999998 2.299 -11.2369 +-0.16119999999999998 3.2205999999999997 -10.7409 +-0.16119999999999998 4.2843 -13.7198 +-0.16119999999999998 4.2843 -14.4285 +-0.16119999999999998 4.2843 -17.3351 +-0.16119999999999998 4.2843 -14.428199999999999 +-0.16119999999999998 3.8586 -10.244399999999999 +-0.16119999999999998 3.8588999999999998 -15.1376 +-0.16119999999999998 3.8588999999999998 -17.3351 +-0.16119999999999998 3.8588999999999998 -17.3353 +-0.16119999999999998 4.0714 -14.0745 +-1.0124 8.042399999999999 -8.4718 +1.6116 -4.012099999999999 -16.6261 +3.3844 0.4556 -1.3093000000000001 +3.3844 0.4556 1.2430999999999999 +2.5332 6.1988 -4.0749 +2.5332 5.9864 -2.9407 +2.5332 6.5535 -4.2168 +2.5332 6.5535 -3.3661999999999996 +-4.0611 2.0859 -13.4356 +-0.5859 4.9938 -8.4007 +-2.2883 5.5602 3.0869 +-2.2883 0.8813 3.0869 +0.4061 1.8737 3.7961 +3.0301 0.7389 -12.3716 +3.0301 0.7389 -11.9463 +3.0301 2.2988 -11.5918 +3.0301 2.2988 -11.2372 +0.47650000000000003 8.6099 -5.9189 +3.9516999999999998 0.6678 -14.002500000000001 +3.9516999999999998 0.6678 -14.0027 +3.1005000000000003 6.8371 -2.9405 +3.1005000000000003 5.5607 -1.4514 +-3.4938 7.6173 -0.3881 +-3.4938 3.5045 -12.2304 +-3.4938 6.4114 -9.1807 +-3.4938 7.191699999999999 -2.9409 +-3.4938 7.191699999999999 -5.4222 +-3.4938 7.1918 -5.4222 +-2.5722 5.5602 -2.8694 +-2.5722 -3.4448 -14.3573 +0.903 8.468 -6.840599999999999 +-0.7993999999999999 2.1565999999999996 -10.9538 +-0.7993999999999999 8.1845 -7.8334 +-2.5018 3.504 -17.3356 +1.8245999999999998 1.6598000000000002 -11.7338 +1.8245999999999998 -3.6575 -13.8609 +1.8245999999999998 -2.5229 -12.9388 +1.8950000000000002 3.2916 -15.137999999999998 +1.8950000000000002 3.2916 -17.3356 +1.0437999999999998 8.0417 -8.4007 +3.6678 6.1279 -9.1807 +3.6678 7.4756 -2.9409 +3.6678 7.120799999999999 -4.2172 +3.6678 7.2627 -2.9409 +3.6678 6.9079 -5.4224000000000006 +2.8166 7.8301 0.8888999999999999 +-2.0753 6.128 -2.9407 +-2.9265 -1.8846000000000003 -13.009599999999999 +-3.7777 6.7661 -6.840599999999999 +-3.7777 7.262499999999999 -5.4224000000000006 +-3.7777 7.0498 -6.840599999999999 +-3.7777 6.765899999999999 -1.3806 +-3.7777 6.765899999999999 -1.5226 +-3.7777 7.2627999999999995 -5.4224000000000006 +-3.7777 6.411600000000001 -8.117099999999999 +-3.7777 0.7389 -17.3353 +-3.7777 5.3482 -9.1807 +-3.7777 6.2698 -8.4007 +-3.7777 7.0501 -6.840599999999999 +-3.7777 5.5602 -0.0332 +-3.7777 5.5602 0.8175999999999999 +-3.7777 6.9787 -2.9409 +-3.7777 6.9787 -2.9402999999999997 +-3.7777 6.9787 -5.4224000000000006 +-3.7777 7.191699999999999 -2.9409 +-3.7777 7.191699999999999 -5.4222 +-3.7777 7.120799999999999 -6.8407 +-3.7777 6.6956 -6.9825 +-3.7777 0.4556 -0.0332 +-3.7777 0.4556 0.4632 +-3.7777 6.3412999999999995 -7.6916 +-3.7777 6.6247 -8.117099999999999 +-3.7777 6.0569 -9.1807 +-3.7777 6.269900000000001 -8.4007 +-3.7777 7.3336 -2.9409 +-3.7777 5.9873 -8.4007 +-1.1537 5.4893 -3.6496 +-1.1537 1.8027000000000002 -3.2951 +-1.1537 0.9523 -3.6496 +-2.0049 8.468 -4.2168 +-2.0049 2.2274 -11.024799999999999 +-2.0049 5.9156 -2.9402999999999997 +-2.0049 -2.3099000000000003 -13.364400000000002 +0.6191 8.2554 -7.904400000000001 +0.6191 8.2554 -7.8334 +-0.23210000000000003 7.1204 -10.5281 +-0.23210000000000003 5.5609 -8.046100000000001 +-0.23210000000000003 7.900500000000001 -8.117099999999999 +-0.23210000000000003 5.4191 -8.117099999999999 +-0.23210000000000003 7.7587 -9.322700000000001 +-0.23210000000000003 5.348 -7.8334 +-0.23210000000000003 7.4041999999999994 -9.251900000000001 +-0.23210000000000003 5.2067000000000005 -12.371400000000001 +-0.23210000000000003 5.2067000000000005 -12.7972 +-0.23210000000000003 5.2774 -12.7972 +-1.9345 6.411899999999999 -4.7133 +2.3919 6.9079 2.6611 +1.5407 4.000299999999999 -3.0822 +1.5407 5.8443000000000005 -6.3442 +1.5407 5.5602 -3.4368000000000003 +1.5407 5.5602 -3.0822 +1.5407 5.915299999999999 -6.4152000000000005 +1.5407 0.4556 -3.4368000000000003 +3.3135 1.8027000000000002 -1.0967 +3.3135 1.8027000000000002 1.1012 +3.3135 1.8027000000000002 1.2430999999999999 +4.2351 0.668 -13.1518 +4.2351 0.668 -17.3356 +4.2351 1.3061 -13.2943 +3.3839 6.6952 -7.6916 +3.3839 7.1212 -4.217 +3.3839 7.1212 -5.4222 +3.3839 6.765899999999999 -7.407800000000001 +3.3839 6.765899999999999 -6.9825 +-3.2104 4.6383 -1.3095 +-3.2104 5.5602 -1.4514 +-3.2104 1.8027000000000002 -1.3805 +-3.2104 1.8027000000000002 -1.4514 +-1.4376 3.7171000000000003 -14.4285 +-2.2887999999999997 5.5607 3.0869 +-2.2887999999999997 3.717 -14.499600000000001 +-0.516 7.5463000000000005 3.1576 +3.8808000000000002 4.2844 -10.4597 +3.0296 -2.7351 -13.8609 +3.0296 -1.4583000000000002 -12.867700000000001 +3.0296 2.2271 -11.663 +3.0296 2.2271 -11.2377 +3.0296 -2.1683999999999997 -13.8609 +2.1784000000000003 7.6869000000000005 -8.4007 +-0.7272 4.2844 -9.3239 +-2.4296 5.4191 -8.117099999999999 +2.0353 5.2061 -8.4024 +2.0353 5.1352 -8.4024 +-1.8623 4.2132000000000005 -9.5357 +-3.5646999999999998 2.3701 -17.3356 +-3.5646999999999998 5.4183 1.4562 +-3.5646999999999998 -2.4524 -17.3353 +-3.5646999999999998 6.908 0.8887 +-3.5646999999999998 5.5607 -1.4518 +-3.5646999999999998 6.340999999999999 -9.1807 +-3.5646999999999998 5.5602 1.3141999999999998 +-3.5646999999999998 1.7323000000000002 1.3853 +-3.5646999999999998 2.2991 -17.3356 +-3.5646999999999998 7.5461 -0.38739999999999997 +-2.6431 0.4556 2.3778 +-1.7215 8.3971 1.0301 +-1.7215 8.539 -0.3881 +2.6753 3.4332000000000003 -14.4285 +3.5969 5.2773 -10.5277 +3.5969 6.1278 -9.3229 +3.6672999999999996 6.2697 -7.6916 +-2.2166 5.8447 -6.8407 +-3.8486 5.5609 -0.24650000000000002 +-3.8486 2.1569000000000003 -11.520900000000001 +-3.8486 5.5602 -0.246 +-3.8486 6.4826 -0.45840000000000003 +-1.2246 5.9154 -4.2168 +-2.0758 3.5041999999999995 -14.428199999999999 +-2.0758 3.5041999999999995 -14.2152 +-2.0758 3.4333 -14.2152 +-2.0758 5.7025 -7.4788 +-2.0758 6.0571 -4.9967999999999995 +-2.0758 6.0571 -5.4224000000000006 +-0.303 -4.2959 -16.767699999999998 +-0.303 4.0006 -14.428199999999999 +1.4698 5.5602 3.5124000000000004 +1.4698 5.5602 3.1579 +1.4698 0.4556 3.5124000000000004 +1.4698 0.4556 3.2998 +3.2426000000000004 4.000299999999999 -1.1675 +3.2426000000000004 4.5674 1.1012 +3.2426000000000004 5.5602 -1.0967 +3.2426000000000004 5.5602 -1.3093000000000001 +3.2426000000000004 5.5602 1.2430999999999999 +1.5402 8.0426 0.8887 +3.3834000000000004 6.4117 -7.8334 +3.3834000000000004 5.9151 -7.8334 +1.9667000000000001 8.254999999999999 -6.840599999999999 +1.1155 6.2700000000000005 -4.9967999999999995 +1.1155 6.2700000000000005 -4.2172 +1.1155 6.128 -4.7134 +1.1155 6.128 -5.4224000000000006 +0.2643 5.5602 -3.7914999999999996 +0.2643 0.4556 -3.7914999999999996 +0.2643 0.4556 -3.5787 +0.2643 1.8027000000000002 -3.5077999999999996 +-1.4381 7.9009 2.5903 +2.0371 3.4334999999999996 -14.4283 +2.0371 4.2842 -13.5068 +2.0371 4.2842 -13.2943 +2.0371 5.7025 -7.4788 +2.0371 3.7879000000000005 -17.3356 +2.0371 8.3972 -2.9404 +2.0371 8.3972 -4.2168 +2.0371 8.1136 -2.9404 +2.0371 3.2916 -17.3356 +3.8099000000000003 0.668 -17.3356 +3.8099000000000003 0.6678 -15.1377 +3.8099000000000003 0.6678 -17.3356 +2.9587 -2.3104 -13.8609 +2.9587 6.3408999999999995 -5.4224000000000006 +2.9587 8.1135 -2.9409 +2.9587 8.113299999999999 -2.9402 +2.9587 -2.6653 -14.924599999999998 +3.0290999999999997 7.5461 -7.6916 +-3.5629 4.3553 -12.0157 +-3.3516999999999997 7.900600000000001 -2.9409 +-4.2029 0.7389 -17.3353 +-4.2029 0.8808 -17.3353 +-4.2029 0.7388 -14.782799999999998 +-4.2029 1.5895 -13.364500000000001 +-2.4301 -2.0977 -13.435500000000001 +-3.2813000000000003 5.5602 1.3141999999999998 +-3.2813000000000003 5.5602 1.2430999999999999 +-3.2813000000000003 2.2988 -14.428199999999999 +-3.2813000000000003 1.8027000000000002 1.1722 +-0.6573 -4.2250000000000005 -14.427999999999999 +-0.6573 -3.8703000000000003 -14.427999999999999 +-1.5085 3.5753 -15.1376 +-1.5085 3.5753 -17.3353 +-1.5085 4.0715 -14.4285 +-1.5085 4.0006 -17.3353 +-2.9956 5.1352 -8.7575 +-1.9331999999999998 5.490600000000001 -7.6916 +-3.6356 7.617400000000001 -5.4222 +-2.714 3.4333 -14.428199999999999 +-0.09 8.5389 1.4566000000000001 +-0.09 8.3262 0.8891 +-0.09 7.5463000000000005 3.1579 +-0.09 7.5463000000000005 2.8028999999999997 +-0.09 8.1134 2.6612 +-0.9412 -2.1676 -12.6552 +-1.7924 3.9297 -17.3353 +0.8316 8.4678 -6.840599999999999 +0.8316 8.1839 -6.415 +0.8316 8.1839 -6.840599999999999 +0.8316 5.9862 -6.840599999999999 +0.8316 8.042399999999999 -8.4717 +0.8316 8.042399999999999 -8.4007 +-0.8708 4.2843 -14.428199999999999 +2.6044 6.0574 -3.0116 +2.6044 7.5463000000000005 0.7463 +1.7531999999999999 5.5607 -2.9407 +1.7531999999999999 5.4899000000000004 -7.8331 +1.7531999999999999 5.4190000000000005 -7.8331 +3.526 7.688300000000001 -2.9402 +3.526 7.6172 -1.0968 +3.526 7.5463000000000005 -2.9402 +3.526 6.9081 0.6758 +-3.0683 7.5463000000000005 1.0301 +-2.1467 2.1565999999999996 -11.0956 +-2.1467 -2.948 -13.2933 +-2.1467 2.2988 -11.3792 +-2.1467 -1.8842 -12.726 +-2.1467 -2.3099000000000003 -13.364400000000002 +-2.9979 6.7658 -9.464500000000001 +-1.2251 0.5266 -3.5787 +-1.2251 5.5602 -3.2951 +-1.2251 5.5602 -3.5787 +-1.2251 0.4556 -3.3659000000000003 +-1.2251 1.8027000000000002 -3.2951 +3.1717000000000004 6.8371 -2.9405 +3.1717000000000004 4.2843 -9.89 +3.1717000000000004 4.2843 -11.8043 +2.3205 5.6316999999999995 -3.0116 +1.5396999999999998 5.1362 -8.258899999999999 +3.3829 5.0643 -11.3072 +1.9662 6.128 -5.4224000000000006 +1.9662 6.0571 -4.9967999999999995 +1.115 4.1424 -17.3351 +1.115 5.2062 -8.117 +3.739 0.7389 -15.137999999999998 +2.8878 5.5602 -2.3731999999999998 +2.8878 0.4556 -2.5152 +2.8878 0.4556 -2.3731999999999998 +-3.4226 7.2627999999999995 -5.4224000000000006 +-1.6498 7.5459 -9.322999999999999 +-1.6498 7.0496 -10.244499999999999 +-2.501 7.6882 1.9525000000000001 +-2.501 -2.807 -13.364500000000001 +-2.501 -3.4448 -14.3573 +-2.501 -2.9489 -14.3573 +-3.3522000000000003 2.3701 -11.6626 +-3.3522000000000003 4.2843 -9.961 +-3.3522000000000003 2.2991 -11.6626 +-1.5794 4.000299999999999 3.0869 +-1.5794 8.3971 1.0301 +-1.5794 8.1135 1.0301 +-1.5794 8.539 -0.1044 +-1.5794 8.539 -2.9405 +-1.5794 5.5607 -3.508 +-1.5794 5.5602 3.0869 +-1.5794 5.5602 3.4415 +-1.5794 5.5602 3.1579 +-1.5794 8.3972 1.0301 +-1.5794 8.2554 -2.9405 +-1.5794 0.4556 3.2287000000000003 +-1.5794 0.4556 3.4415 +-1.5794 0.4556 3.2289 +-1.5794 8.0427 1.0301 +0.1934 7.4752 -9.0388 +0.1934 7.4752 -9.1807 +0.1934 5.3481000000000005 -8.4717 +0.1934 5.2063 -8.4007 +0.1934 7.8298000000000005 -9.1807 +0.1934 7.758900000000001 -8.4007 +0.1934 8.6808 -2.9407 +0.1934 7.8296 -9.1807 +0.1934 5.3482 -8.4717 +0.1934 7.7587 -8.4007 +0.1934 6.1989 -4.2168 +0.1934 5.5607 -3.508 +0.1934 8.3972 -4.2168 +0.1934 8.3972 -2.9407 +0.1934 8.042399999999999 -8.4007 +0.1934 5.8444 -4.2168 +0.1934 5.2062 -8.4007 +0.1934 6.0569 -3.7205000000000004 +0.1934 7.4754000000000005 -9.038699999999999 +0.1934 7.4754000000000005 -9.1807 +-0.6577999999999999 -3.8701 -14.3573 +-0.6577999999999999 5.5607 -3.7913 +-0.6577999999999999 -3.6575999999999995 -13.435500000000001 +-2.8552999999999997 4.2843 -12.2304 +-2.8552999999999997 7.049900000000001 -9.1097 +-0.2313 5.6319 -7.8334 +-2.7849 3.3624 -14.4288 +-2.7849 7.475099999999999 0.605 +-2.7849 7.5461 0.8178 +-1.0121 8.2549 -7.8334 +-1.8633 6.340999999999999 -4.217 +-1.8633 6.270100000000001 -5.4222 +-1.8633 6.1281 -4.217 +0.7607 7.7587 -9.1807 +0.7607 6.6954 -11.0952 +-0.0905 7.4752 3.2994000000000003 +-0.0905 5.5609 3.5122 +-0.0905 7.5462 2.8035 +-0.0905 5.7735 3.7960000000000003 +2.5335 -3.5159000000000002 -15.562999999999999 +0.8311000000000001 8.4678 -6.8407 +0.8311000000000001 8.4678 -6.9116 +3.4551 7.688300000000001 -1.0259 +3.4551 5.5607 -1.4514 +2.6039 8.113199999999999 -6.4861 +1.7527000000000001 2.299 -10.9532 +-3.2096 7.6876 -7.0536 +-3.1392 7.1918 1.5983 +-3.9904 0.7388 -13.364899999999999 +-1.3664 8.2554 -4.2172 +-1.3664 8.2554 -5.4224000000000006 +-3.0688 5.5611 -11.236699999999999 +0.4064 8.539 -5.9189 +-0.4448 -4.2959 -14.925099999999999 +-1.2959999999999998 -3.4448 -13.364500000000001 +1.328 -4.0831 -14.4288 +1.328 -3.7287 -14.4288 +4.0224 -1.6012 -14.499899999999998 +4.0224 2.2277 -13.1518 +3.1712 7.404 -7.6916 +2.32 7.8295 -7.8335 +-2.5719 7.5463000000000005 1.0309000000000001 +-2.5719 4.2132000000000005 -9.677299999999999 +-3.4231 -1.7427000000000001 -13.293199999999999 +-3.4231 2.2274 -11.3081 +-1.6503 5.348 -8.117099999999999 +0.1225 5.4183 3.4415 +0.1225 5.9155 -5.4224000000000006 +0.1225 8.326 -5.9189 +0.1225 8.326 -5.4224000000000006 +0.1225 6.1992 -5.4224000000000006 +0.1225 6.128299999999999 -5.9189 +-0.7287 2.3701 -10.8116 +-0.7287 8.6808 -0.1044 +1.8953000000000002 7.3332 -9.464699999999999 +-1.5095 8.3259 -7.0536 +3.6681 -1.0342 -15.1377 +-3.7774 5.2775 -9.1807 +-3.7774 3.8583 -12.2299 +-3.7774 7.1918 -5.4222 +-3.7774 -1.9561 -14.0735 +-2.8558 8.1135 -4.2168 +-2.8558 8.1135 -2.9407 +-2.8558 8.1845 -2.9407 +-1.9342000000000001 8.4681 -5.4222 +0.6898 5.2774 -12.7972 +-0.1614 8.6099 1.0301 +1.6114 5.2067000000000005 -11.9458 +3.3842 6.1279 -8.4007 +3.3842 7.8298000000000005 -3.6494999999999997 +3.3842 6.8371 -1.4514 +3.3842 7.2627 -2.9409 +3.4546 5.8443000000000005 -8.117099999999999 +3.4546 7.1209999999999996 -7.8335 +3.4546 7.546600000000001 -6.6987000000000005 +-2.3588999999999998 5.2064 -11.5918 +-2.3588999999999998 5.6319 -11.8039 +-2.3588999999999998 6.7663 -9.251900000000001 +-4.0613 1.0223 -12.300899999999999 +-4.0613 2.2988 -13.222600000000002 +-1.4373 7.5462 2.9451 +-2.2885 5.3489 -8.117099999999999 +0.33549999999999996 8.6099 0.8891 +-1.3669 8.326 -4.217 +-1.3669 1.2356 -3.5787 +-1.3669 8.2552 -4.217 +-2.2180999999999997 8.042399999999999 -2.9409 +2.1083000000000003 3.8587000000000002 -14.3565 +3.0299 -2.3104 -17.3356 +3.0299 -2.3104 -14.0027 +3.0299 -2.3104 -13.4354 +3.0299 -3.0195 -16.0583 +3.0299 -3.0195 -14.499899999999998 +3.0299 -2.9485 -17.3356 +3.0299 2.299 -15.137800000000002 +3.0299 2.299 -17.3353 +3.0299 0.6678 -12.0172 +3.0299 0.5969 -12.443200000000001 +3.0299 -2.2395 -14.0027 +3.9515000000000002 -1.5306 -14.0027 +3.9515000000000002 -1.6721 -17.3356 +3.9515000000000002 0.668 -13.1518 +3.1003 5.5607 2.1648 +-1.5077 5.8443000000000005 -6.2024 +-3.4939999999999998 -0.8212 -13.4356 +-3.4939999999999998 7.3335 0.46290000000000003 +-3.4939999999999998 6.6953 -7.478899999999999 +-3.4939999999999998 6.6953 -7.6916 +-3.4939999999999998 5.5602 -1.6642000000000001 +-3.4939999999999998 5.5602 -1.4514 +-3.4939999999999998 -0.9631000000000001 -13.364899999999999 +-3.4939999999999998 0.9523 -1.4514 +-1.7212 -2.7355 -13.009699999999999 +-1.7212 5.8444 -6.4151 +-1.7212 -3.9414 -17.335 +-1.7212 -3.9414 -14.3573 +-1.7212 7.9708000000000006 -8.117099999999999 +-1.7212 -3.4450000000000003 -17.335 +-1.7212 -3.4450000000000003 -15.1376 +-2.5724 5.9866 -2.9409 +-2.5724 2.2274 -11.0953 +0.05159999999999999 5.5609 3.4412 +-0.7996 -4.2250000000000005 -17.335 +-0.7996 -4.2250000000000005 -14.3573 +1.8244 8.4678 -5.4224000000000006 +1.8244 8.0426 2.0231 +1.8244 5.7735 -6.8407 +2.746 6.9786 -9.1807 +2.746 7.9719 0.6754 +2.746 5.2066 -11.1661 +2.746 6.624099999999999 -9.8901 +2.746 6.4823 -9.1807 +2.746 5.5602 2.5196 +3.6676 6.0575 -8.117099999999999 +-3.9187 4.3553 -10.317 +-3.9187 4.2844 -11.1681 +-2.1458999999999997 5.348 -8.046100000000001 +-2.1458999999999997 8.184 -6.9825 +-3.8483000000000005 5.2063 -10.103 +-0.3731 8.0423 -7.478899999999999 +-1.2243 5.3481000000000005 -7.7623 +-2.9267000000000003 0.5266 2.3778 +-2.9267000000000003 5.5602 2.4489 +-2.9267000000000003 5.5602 2.3778 +-2.9267000000000003 5.1345 -2.5149999999999997 +-1.1539000000000001 -4.154100000000001 -16.625799999999998 +-1.1539000000000001 5.4888 3.6542 +1.4701 8.539 -5.4224000000000006 +0.6189 -4.2250000000000005 -14.4288 +0.6189 -4.2250000000000005 -17.3353 +0.6189 -3.9412000000000003 -14.4288 +0.6189 -3.7996000000000003 -15.137900000000002 +0.6189 7.9718 2.8028999999999997 +-0.2323 7.7587 -9.322999999999999 +-0.2323 5.2064 -12.371400000000001 +-0.2323 5.2064 -12.7972 +-0.2323 7.4749 -9.1807 +-0.2323 6.4115 -11.521 +-1.0835 5.3485 -12.6549 +3.3133000000000004 7.5463000000000005 0.3921 +2.4621 7.8301 1.6691 +2.4621 8.042100000000001 -6.9825 +2.8141 4.2844 -9.6778 +-3.2106000000000003 7.5461 -1.3805 +-3.2106000000000003 7.5461 0.8178 +0.2646 8.6808 -3.5781 +0.2646 8.3263 -4.2168 +2.0374 8.3972 -2.9409 +0.40540000000000004 5.8443000000000005 -5.4935 +-2.4298 4.3553 -13.150300000000001 +-3.2809999999999997 4.0713 -10.599 +-3.2809999999999997 3.3622 -11.094999999999999 +-3.2809999999999997 2.2991 -11.2369 +-4.1322 -0.9631000000000001 -17.3349 +-2.3594 4.000299999999999 -2.5149999999999997 +-2.3594 5.5602 -2.6569 +-2.3594 5.5602 -2.9405 +-2.3594 5.5602 -2.5859 +-2.3594 5.5602 -3.0116 +-2.3594 0.4556 -2.7279 +-2.3594 0.4556 3.016 +-2.3594 0.4556 -2.6569 +-2.3594 0.4556 -2.9407 +-3.5649 -0.6082 -13.364500000000001 +-3.5649 5.5609 -1.3805 +-3.5649 2.5117000000000003 -14.428199999999999 +-3.5649 5.5602 -0.0332 +-3.5649 5.5602 -1.4514 +-3.5649 4.2843 -10.0321 +-3.5649 0.4556 -0.0332 +-3.5649 0.4556 1.3141999999999998 +-3.5649 2.2274 -11.8757 +-0.0897 5.7028 -7.6916 +-0.0897 5.4901 -7.478899999999999 +-1.7921 8.1135 1.9525000000000001 +-0.8704999999999999 7.7587 -9.1807 +-1.7217 5.9155 -5.8479 +-1.7217 5.7028 -6.9825 +1.7534999999999998 7.5464 2.6612 +1.7534999999999998 -3.4446999999999997 -13.5769 +1.7534999999999998 -3.1607000000000003 -13.8609 +1.7534999999999998 2.2988 -11.3796 +1.7534999999999998 2.2988 -11.0244 +0.05109999999999999 5.8443000000000005 -5.4935 +3.5967 2.299 -14.428199999999999 +3.5967 4.2843 -11.876100000000001 +3.5967 2.4407 -14.428199999999999 +-3.9191999999999996 2.299 -12.2299 +-2.9976 7.5463000000000005 1.2435 +-2.9976 7.5463000000000005 1.0309000000000001 +-1.2248 5.9154 -5.4224000000000006 +1.3992 8.3971 0.8888999999999999 +1.3992 8.1134 0.8888999999999999 +-0.3032 6.9081 3.583 +1.4696 6.908 -10.5281 +1.4696 1.3775000000000002 -3.2243 +-0.2328 8.6099 -6.2734 +3.2424 2.299 -14.4285 +2.3912 6.4115 -2.9407 +1.54 4.2842 -9.4648 +1.54 4.213299999999999 -9.4648 +1.54 5.9862 -4.2173 +1.9665 8.4681 -4.6424 +0.2641 5.5602 -3.5079 +0.2641 5.5602 -3.7914999999999996 +0.2641 0.4556 -3.7914999999999996 +0.2641 0.4556 -3.5787 +0.2641 1.8027000000000002 -3.5079 +0.33449999999999996 5.3481000000000005 -7.6205 +3.8097 5.2063 -9.7484 +3.8097 4.2843 -10.2446 +3.8097 0.6678 -12.3007 +2.1073 7.8295 -8.117099999999999 +-3.4223000000000003 5.9159999999999995 -7.8334 +-3.4223000000000003 7.2623999999999995 -7.8334 +-3.3519 -2.0977 -14.5701 +-4.2031 -1.0341 -14.57 +-4.2031 2.2988 -12.6557 +-0.7279 8.113 -8.4007 +-1.5791 8.539 -4.2173 +-1.5791 8.539 -5.4220999999999995 +-3.2815 5.5609 -1.3805 +0.19369999999999998 -2.7362 -12.868099999999998 +-1.5087 8.4681 -4.217 +-1.5087 8.4681 -5.4222 +-3.8469999999999995 5.2061 -10.174999999999999 +-2.0038 8.254999999999999 -6.8407 +-2.0038 5.2061 -8.4024 +-2.0038 5.1352 -8.4024 +-2.0038 5.7737 -6.9825 +-3.7062 7.263 -6.9825 +-3.6358 5.4183 -1.3095 +-3.6358 6.694999999999999 0.8178 +-3.6358 5.5602 1.2430999999999999 +-1.0118 6.7661 3.5122 +-1.863 5.5607 -2.9407 +-0.0902 6.6954 -11.166 +-0.9414 -4.1537 -14.3573 +0.8314 5.9154 -4.2173 +3.4554 4.1423000000000005 -10.0319 +0.9018 5.915299999999999 -5.8481 +2.6746 7.6877 -7.8334 +-2.2877 8.1134 -6.9825 +-3.0685000000000002 -3.0194 -17.3353 +-3.0685000000000002 4.3545 -1.5932000000000002 +-0.3741 0.4556 3.7960000000000003 +-1.2253 8.6099 -2.9407 +1.3986999999999998 6.482499999999999 3.4412 +1.3986999999999998 -2.665 -13.364300000000002 +3.1715 4.4255 2.165 +3.1715 4.4255 -2.1604 +3.1715 5.5602 1.2434 +3.1715 5.5602 -1.3096 +3.2419000000000002 7.6168 -6.9825 +2.5315 5.4198 -8.117099999999999 +1.6803 5.2061 -12.582699999999999 +1.1148 8.6099 0.10859999999999999 +1.1148 8.5388 0.8887 +3.7388 0.384 -12.3723 +3.7388 -1.5301 -13.5063 +3.7388 4.6383 0.7468 +3.7388 2.1569000000000003 -11.450299999999999 +3.7388 2.299 -11.3787 +3.7388 5.5602 -0.0329 +3.7388 5.5602 -0.6006 +3.7388 5.5602 -0.0333 +3.7388 0.4556 -0.7421 +3.7388 0.4556 -0.0329 +3.7388 0.4556 -0.0333 +3.7388 3.5749999999999997 -0.8130999999999999 +-3.4228 5.5609 -8.4007 +-3.4228 6.5537 -5.4222 +-3.4228 6.270100000000001 -6.8407 +-3.4228 6.269900000000001 -8.4007 +-4.274 0.2422 -17.3349 +-2.5012 4.000299999999999 2.3778 +-2.5012 5.5602 2.3778 +-1.5796000000000001 3.6458999999999997 -14.4285 +-1.5796000000000001 5.2764 -3.5077999999999996 +3.7365000000000004 5.2061 -10.2466 +-2.0747 8.042399999999999 -7.6916 +-3.7067 1.3065 1.0305 +-3.7067 5.5602 -1.0967 +-3.7067 7.475099999999999 -1.3805 +-3.7067 0.8808 -15.1377 +-3.7067 0.4556 -0.9547999999999999 +-1.0827 5.9154 -4.2173 +-1.9339 8.3261 1.0309000000000001 +-2.7851 7.900799999999999 1.0301 +0.6901 4.213299999999999 -9.394 +3.3845 5.5607 0.7469 +3.3845 -2.452 -13.9314 +2.5333 3.6455 2.8743000000000003 +2.5333 5.5602 2.8034 +2.5333 0.4556 2.5196 +2.5333 0.4556 -2.8697 +2.5333 -2.8063000000000002 -13.364500000000001 +0.8309000000000001 8.2549 -7.8334 +3.4549000000000003 7.7592 -5.2803 +-1.3666 5.5602 3.1579 +-1.3666 0.4556 3.5832 +-2.2178 -1.6718 -12.6553 +1.3278 5.5602 -3.1532999999999998 +1.3278 5.5602 3.1579 +1.3278 4.2843 -13.2943 +1.3278 1.8027000000000002 3.2289 +3.1006 6.4117999999999995 -5.4224000000000006 +3.1006 7.546 0.7471 +3.1006 0.4556 -2.2313 +3.1006 7.5463000000000005 0.8175 +0.2631 5.2061 -12.9378 +2.1063 4.3553 -13.3628 +-3.7049 5.2061 -9.2529 +-2.6425 8.2551 -5.5644 +-3.4937000000000005 2.512 -17.3356 +-3.4937000000000005 7.0492 -8.117099999999999 +-2.5721000000000003 8.1845 0.4627 +-3.4233 4.2843 -12.2299 +-0.7993 5.1356 -8.117099999999999 +-1.6504999999999999 5.5602 3.4415 +-1.6504999999999999 0.4556 3.4415 +-1.6504999999999999 1.8027000000000002 3.0869 +-2.5017 6.1282000000000005 2.8738 +0.12229999999999999 8.6808 -4.2168 +2.7463 7.4043 0.6758 +2.7463 5.2063 -11.7333 +2.7463 6.482499999999999 -9.1807 +2.7463 5.2773 -11.7333 +2.7463 7.5463000000000005 0.7469 +1.8951 5.7735 -6.9825 +3.6679000000000004 1.8737 1.1012 +3.6679000000000004 6.5534 -1.5225 +3.6679000000000004 2.1569000000000003 -13.1518 +3.6679000000000004 6.8371 -2.0898 +3.6679000000000004 6.8371 -1.4513 +3.6679000000000004 2.299 -11.8043 +3.6679000000000004 2.2988 -13.1518 +3.6679000000000004 1.8027000000000002 -1.0967 +3.6679000000000004 4.2132000000000005 -11.8043 +-3.7775999999999996 5.5602 -0.0332 +-3.7775999999999996 0.4556 -0.0332 +-2.0048 5.5602 -3.2951 +-2.856 -2.9484 -13.79 +-2.856 5.2065 -9.1807 +-1.0832 8.539 1.0309000000000001 +3.3136 2.299 -11.237 +2.4624 -3.3023999999999996 -13.7898 +2.4624 4.9925999999999995 -2.3731999999999998 +2.4624 5.5602 -2.3731999999999998 +2.4624 2.2271 -11.0958 +4.2352 -0.6084 -17.3356 +4.2352 0.6678 -13.01 +4.2352 0.6678 -14.002500000000001 +4.2352 0.6678 -17.3356 +4.2352 0.6678 -14.0027 +3.3840000000000003 7.120799999999999 -4.2172 +3.3840000000000003 7.120799999999999 -5.4224000000000006 +3.3840000000000003 7.1915000000000004 0.8892000000000001 +3.5248 6.765599999999999 -8.4007 +3.5951999999999997 4.2844 -10.0329 +-2.3591 5.5607 -2.9407 +-2.3591 6.4826 -3.437 +-3.2103 4.000299999999999 1.3141999999999998 +-3.2103 5.4893 1.3141999999999998 +-3.2103 0.4556 2.094 +0.3353 5.2772 -8.6136 +0.3353 7.3332999999999995 -10.1741 +-1.3671 4.1424 -14.428199999999999 +2.1081 1.3775000000000002 -3.2239999999999998 +2.1081 8.2552 0.9599 +1.2569000000000001 -4.083 -14.427999999999999 +3.0297 -2.3813 -17.3356 +3.0297 -3.0904000000000003 -14.924599999999998 +3.0297 -2.807 -13.8609 +3.0297 -2.6651000000000002 -14.924599999999998 +3.0297 -3.0194 -17.3356 +3.0297 5.5607 -2.3021 +3.0297 6.5535 2.0938 +3.0297 7.2623999999999995 1.598 +3.0297 -3.0907 -14.924599999999998 +3.9513 3.5753 -11.876100000000001 +-3.4919 5.2061 -11.0947 +-2.5703 4.2844 -9.608 +-3.2807000000000004 6.624199999999999 -6.9825 +-4.1319 2.4408 -12.8683 +-4.1319 2.3699000000000003 -11.7335 +-4.1319 -1.247 -14.57 +-1.7918 7.4752 2.1654 +-1.7918 5.5609 2.9454000000000002 +-1.7918 5.5609 3.3703999999999996 +-0.8702 1.8027000000000002 3.7251 +-1.7214 4.0005 -14.4285 +0.0514 8.6808 -4.9263 +2.6754 6.2700000000000005 -4.2168 +2.6754 7.475 0.7471 +2.6754 1.8027000000000002 -2.2313 +1.8242 8.3264 0.8887 +1.8242 8.0426 0.8887 +1.8242 8.4681 -0.2463 +0.12179999999999999 8.1135 -8.4007 +3.5970000000000004 7.333399999999999 -0.24650000000000002 +3.5970000000000004 2.299 -17.3353 +3.5970000000000004 5.5602 1.1012 +3.5970000000000004 6.1992 -9.1807 +3.5970000000000004 -2.3813999999999997 -17.3356 +3.5970000000000004 0.4556 -0.0329 +3.5970000000000004 0.4556 1.2430999999999999 +3.5970000000000004 0.4556 -0.0333 +3.5970000000000004 2.37 -14.4285 +3.5970000000000004 2.37 -17.3353 +-3.8485 2.299 -11.4496 +-3.8485 -0.9631000000000001 -14.57 +-2.9269 4.2843 -12.2299 +-2.0053 8.468 -2.9405 +1.4699 7.6169 -9.1807 +1.4699 5.5602 3.0869 +1.4699 5.5602 3.4415 +1.4699 0.4556 3.2996 +1.4699 0.4556 3.4415 +1.4699 1.8027000000000002 3.1577 +0.6187 -3.7997000000000005 -15.1376 +0.6187 -3.7997000000000005 -17.3353 +0.6187 -4.2249 -14.4287 +0.6187 -4.2249 -17.3353 +0.6187 -3.9414 -14.4287 +0.6187 -3.7992999999999997 -13.5063 +-1.0836999999999999 8.4678 -6.840599999999999 +3.2426999999999997 2.9371 -14.3565 +3.2426999999999997 5.2773 -11.236799999999999 +3.2426999999999997 2.299 -14.428199999999999 +3.2426999999999997 2.299 -14.0022 +3.2426999999999997 -2.8066 -17.3356 +3.2426999999999997 7.5463000000000005 -2.9405 +2.3914999999999997 5.2066 -11.4494 +2.3914999999999997 5.7738 -11.5206 +1.5403 6.1281 -11.5918 +4.1643 -1.0342 -14.215800000000002 +4.1643 -0.8921 -14.002500000000001 +4.1643 2.1569000000000003 -12.229700000000001 +4.1643 1.0935000000000001 -17.0513 +4.1643 -1.105 -17.3356 +4.1643 -0.9631000000000001 -17.3356 +3.3131 5.2062 -8.896999999999998 +3.3834999999999997 6.412 -7.8335 +3.3834999999999997 6.412 -8.117099999999999 +0.2644 4.2843 -17.3351 +-1.438 8.1842 -5.4222 +2.0372000000000003 5.8445 -6.769699999999999 +2.0372000000000003 5.3474 3.2287000000000003 +2.0372000000000003 3.2205999999999997 -17.3353 +2.0372000000000003 5.5602 -3.2239999999999998 +2.0372000000000003 -3.7994 -14.428099999999999 +2.0372000000000003 3.7168 -17.3353 +2.0372000000000003 3.4332000000000003 -14.4285 +1.1860000000000002 0.7394000000000001 3.6540999999999997 +1.1860000000000002 7.191400000000001 -9.251900000000001 +1.1860000000000002 0.4556 -3.6494999999999997 +3.81 -0.9631000000000001 -14.0027 +2.9588 -2.3813 -15.1377 +1.2564 5.3481000000000005 -7.7623 +0.4052 5.8444 -6.840599999999999 +3.0292 6.057300000000001 -6.9825 +-3.2812 5.5602 1.3141999999999998 +-3.2812 0.4556 1.3853 +-3.2812 0.4556 -1.4514 +-3.2812 0.9523 -2.0189 +-3.6355 2.3701 -14.4288 +-3.6355 6.2696000000000005 -9.251900000000001 +-3.6355 2.2988 -14.428199999999999 +-3.5651 2.2275 -13.364500000000001 +0.8317 5.5602 -3.7204 +-0.0195 5.5602 3.7960000000000003 +-0.0195 5.5602 3.5124000000000004 +-0.0195 0.4556 3.7960000000000003 +-0.0195 0.4556 3.5832999999999995 +2.6045 0.4556 2.4486 +1.7533 5.4193 -12.300600000000001 +1.7533 5.5609 2.9452 +1.7533 7.475099999999999 2.0942 +3.5261 2.5117000000000003 -14.4285 +3.5261 6.9081 0.7469 +1.8236999999999999 5.1362 -8.4007 +0.9724999999999999 4.3553 -14.144000000000002 +-2.217 7.8295 -8.117099999999999 +-2.1466 1.8027000000000002 -2.7279 +-2.9978000000000002 5.5602 2.3778 +2.3206 4.8512 2.5196 +2.3206 5.5602 2.5196 +4.0934 0.5965 -12.584699999999998 +4.0934 0.8098 -12.442599999999999 +3.3126 6.270100000000001 -6.8407 +1.9663 0.4556 3.2996 +1.9663 6.6951 -10.5282 +1.1151 6.2698 -4.2173 +1.1151 6.2698 -4.7844 +0.26389999999999997 4.3553 -14.4985 +2.0367 5.5607 -3.2244 +0.3343 8.3263 -7.6916 +-1.0097 4.9934 -8.4018 +-3.3521 7.6167 -6.9825 +-1.5793000000000001 7.6172 2.8031 +-2.4305 7.1913 -9.1807 +-2.4305 5.2063 -11.5205 +-2.4305 5.2063 -12.0879 +-2.4305 6.7658 -9.1807 +0.1935 8.6099 -4.2168 +-3.7768 6.8371 -6.2025 +-3.7064 7.4756 -6.2025 +-0.2312 8.1845 -8.117099999999999 +-0.2312 7.9004 -8.117099999999999 +-2.7848 4.9222 2.6616999999999997 +-1.8632 -3.8703000000000003 -17.335 +-1.8632 -3.8703000000000003 -14.3573 +0.7608 8.6808 -0.3172 +0.7608 6.6953 3.583 +0.7608 5.7028 3.7249 +0.7608 -3.7287 -17.3353 +-0.0904 8.6808 0.5337999999999999 +-0.0904 8.6808 -2.9405 +-0.0904 8.6099 1.0301 +-0.0904 5.2773 -8.6136 +-0.0904 8.3972 -2.9405 +-0.0904 8.3263 1.0301 +-0.0904 1.8027000000000002 3.5124000000000004 +2.5336000000000003 7.4043 2.1648 +2.5336000000000003 6.340800000000001 2.732 +1.6824 8.5389 -1.0269 +1.6824 0.5967 -12.159 +3.4552 6.624499999999999 -2.9407 +2.604 7.1207 -9.1807 +-3.1391 8.042399999999999 -5.1384 +-3.1391 8.0427 -2.9405 +-3.9903 1.5896000000000001 -17.3353 +-2.2175000000000002 5.5602 -2.6569 +-3.0686999999999998 2.2987 -15.1377 +-3.0686999999999998 2.2276000000000002 -15.1377 +-3.0686999999999998 2.2276000000000002 -17.3353 +-0.44470000000000004 -3.7286 -13.4353 +1.3280999999999998 8.4679 1.1018999999999999 +0.4769 -4.2250000000000005 -14.215300000000001 +3.1008999999999998 -3.0195 -16.0583 +3.1008999999999998 -1.3885 -12.8683 +3.1008999999999998 2.3699000000000003 -11.166 +3.1008999999999998 2.299 -11.5914 +3.1008999999999998 4.2843 -9.89 +3.1008999999999998 0.6678 -12.0172 +3.1008999999999998 -2.8066 -14.0027 +3.1008999999999998 6.9081 0.7469 +2.2497 5.2764 -3.0822 +4.0225 2.2988 -13.1518 +3.1713 4.2843 -12.5142 +3.1713 4.1423000000000005 -11.805200000000001 +3.7386000000000004 2.299 -11.805200000000001 +3.8089999999999997 5.2061 -9.5376 +-3.4934 7.262499999999999 -5.9189 +-3.4934 7.262499999999999 -5.4224000000000006 +-3.4229999999999996 7.0498 -6.840599999999999 +-3.4229999999999996 7.0501 -6.840599999999999 +-3.4229999999999996 4.2843 -12.3011 +-3.4229999999999996 -2.6653 -14.5701 +-3.4229999999999996 0.4556 -1.6642000000000001 +-3.4229999999999996 5.7743 -8.117099999999999 +-3.4229999999999996 -1.8143 -13.364500000000001 +-0.7286 5.5609 3.7249 +-0.7286 8.397 1.9525000000000001 +-0.7286 7.9718 2.8031 +1.8954 6.5535 3.1576 +1.0442 -3.0906 -13.081000000000001 +-3.7773000000000003 6.6956 -6.9825 +-3.7773000000000003 6.553299999999999 -7.1954 +-2.0045 8.326 -6.627800000000001 +-2.8556999999999997 1.6613 2.5906 +-2.8556999999999997 0.4556 2.3778 +-3.7068999999999996 -0.4666 -12.7972 +-3.7068999999999996 2.2988 -11.4499 +-3.7068999999999996 -1.2468 -13.364500000000001 +-3.7068999999999996 -2.0977 -17.3353 +-3.7068999999999996 -0.9631000000000001 -15.1376 +-3.7068999999999996 -0.9631000000000001 -17.3353 +-1.9341000000000002 3.9297 -14.428199999999999 +-1.9341000000000002 3.5045 -14.285999999999998 +-1.0125 6.4115 -11.4499 +0.7603000000000001 8.2552 -5.9189 +3.3842999999999996 7.2626 -4.2168 +3.3842999999999996 7.2626 -2.9407 +3.3842999999999996 5.6325 -8.4007 +3.4547000000000003 5.5609 -8.4717 +3.4547000000000003 6.1282000000000005 -8.4007 +3.4547000000000003 6.057300000000001 -7.6206 +3.4547000000000003 6.341099999999999 -6.9825 +1.0419 4.9934 -8.4018 +-3.2099999999999995 6.5535 1.9526000000000001 +-4.0612 -1.4596 -17.3353 +-2.2884 4.000299999999999 -2.5860000000000003 +-2.2884 1.0231999999999999 -3.0824000000000003 +-0.5156 4.709300000000001 -3.7914999999999996 +-2.218 6.908 2.8738 +2.1084 8.0425 -2.9409 +2.1084 5.5607 3.1576 +2.1788 -3.5157000000000003 -13.8609 +3.9516000000000004 0.6678 -13.1518 +3.9516000000000004 2.2988 -11.5918 +2.2492 5.489999999999999 -7.8334 +1.6092 4.2844 -9.3949 +-3.4939 3.5041999999999995 -12.2304 +-3.4939 6.2698 -8.4007 +-3.4939 5.2773 -8.896999999999998 +-3.4939 0.4556 1.3141999999999998 +-3.4939 -2.5229 -14.428199999999999 +-0.8699 4.2843 -14.215 +-0.8699 4.3553 -14.215 +-1.7211 5.4190000000000005 -7.7623 +-1.7211 5.4190000000000005 -7.8331 +-2.5723 4.7802999999999995 2.3067 +-2.5723 -3.0192 -14.57 +-2.5723 -2.6648 -13.364500000000001 +-2.5723 -2.0271 -13.364500000000001 +-2.5723 7.5463000000000005 0.8883 +1.7541000000000002 7.8296 -8.4717 +-1.6507 8.1845 -2.9405 +1.8245 8.4681 -2.9402 +1.8245 7.546 2.5901 +1.8245 7.546 2.0229 +0.9733 7.2623 3.2994999999999997 +3.5972999999999997 2.2987 -13.1518 +3.5972999999999997 2.2987 -17.3356 +1.8949 6.128 -4.2173 +3.6677 7.1921 -6.840599999999999 +3.6677 6.908200000000001 -6.4151 +3.6677 6.624099999999999 -6.840599999999999 +3.6677 6.9079 -6.840599999999999 +2.8165 7.3332999999999995 -8.4007 +-2.1458 5.490600000000001 -7.8334 +-2.997 5.4198 -8.4007 +0.47819999999999996 8.3262 -7.6916 +-2.0754 6.057300000000001 -5.4224000000000006 +-3.7778 0.7388 -17.3349 +-3.7778 0.7388 -15.138099999999998 +2.3918 5.5607 -2.9405 +1.5406 4.213299999999999 -13.1518 +3.3133999999999997 6.553599999999999 -4.2168 +3.3133999999999997 0.4556 1.2434 +0.7597999999999999 6.128299999999999 -6.4151 +0.7597999999999999 6.128299999999999 -5.9189 +3.3838 6.908200000000001 -6.4151 +3.3838 6.908200000000001 -6.840599999999999 +3.3838 6.340999999999999 -6.6987000000000005 +3.3838 6.766500000000001 -6.9825 +3.3838 5.9865 -7.6916 +-3.2105 7.5457 -1.3806 +-3.2105 5.5607 -1.3806 +1.1863000000000001 7.688300000000001 2.874 +2.9591 5.5602 -2.3731999999999998 +2.9591 0.4556 -2.3731999999999998 +3.8807 4.2843 -10.8118 +3.0295 4.2842 -10.315100000000001 +3.0295 4.213299999999999 -9.8193 +3.0295 7.9719 -0.31679999999999997 +-3.4216999999999995 4.2844 -12.2287 +-3.3513 7.9007 -5.4224000000000006 +-3.3513 6.2700000000000005 -6.6987000000000005 +-3.3513 6.8371 -6.4151 +-3.3513 6.8371 -5.9189 +-3.3513 6.482799999999999 -5.4224000000000006 +-3.2809 7.6884999999999994 -6.840599999999999 +-3.2809 2.8665 -14.499600000000001 +-3.2809 2.2991 -14.4288 +-4.132099999999999 0.10120000000000001 -13.009699999999999 +-4.132099999999999 -0.9631000000000001 -17.3353 +-2.3592999999999997 5.2063 -8.4007 diff --git a/assets/xarm7/contacts/link6_vhacd.txt b/assets/xarm7/contacts/link6_vhacd.txt new file mode 100644 index 0000000..95cce18 --- /dev/null +++ b/assets/xarm7/contacts/link6_vhacd.txt @@ -0,0 +1,1313 @@ +1312 +8.704 1.5829 3.2917 +8.704 -1.7572 3.6191 +8.9664 -1.6261 3.5534000000000003 +7.0016 -0.84 3.9465 +3.9232000000000005 3.3513 -1.0307 +3.9232000000000005 1.2556 0.9339999999999999 +-2.2336 2.8926 4.0120000000000005 +-2.2336 0.208 5.5838 +-2.2336 -0.1854 5.5839 +11.1273 3.4824 -1.4895 +11.1273 6.888 -1.4895 +11.1273 3.4168 0.3444 +10.276100000000001 -2.6086 2.5057 +10.276100000000001 -2.8706 2.2439 +7.1977 -3.0017 -3.3888000000000003 +7.1977 -3.1327000000000003 -3.2576 +6.346499999999999 1.2558 3.2262 +6.346499999999999 -2.0192 -3.5852000000000004 +6.346499999999999 0.0107 4.1429 +5.2329 3.4824 3.0293 +5.2329 -1.3643 -2.9957000000000003 +0.4521 0.27330000000000004 5.8457 +-1.5127 1.9758999999999998 4.9289 +-1.5127 1.9758999999999998 5.2564 +-1.5127 2.5655 4.9943 +-1.5127 3.2201 3.9465 +-1.5127 3.0890999999999997 4.4052 +-2.6263 -2.0848 4.0120000000000005 +-2.6263 -1.9539 4.9289 +-2.6263 -1.2335 4.9289 +-2.6263 -2.5429 4.0776 +-2.6263 -2.5429 4.0120000000000005 +-3.4775 -1.6261999999999999 -0.24450000000000002 +-3.4775 -1.0371 4.4705 +10.472199999999999 -1.7572 2.5059 +10.7346 -1.9526999999999999 -1.3584 +10.7346 -2.0192 -1.4895 +5.9538 -1.7572999999999999 3.488 +5.9538 -3.0672 -2.9302 +4.8402 -3.3945000000000003 0.14809999999999998 +4.8402 -2.9362 2.6364 +1.4994 3.0236 4.4052 +-1.0542 0.6661 5.7802 +-2.1677999999999997 2.8273 4.3396 +-2.1677999999999997 2.4343 4.8633999999999995 +-3.019 2.1725000000000003 4.0120000000000005 +-3.019 2.3692 0.6726 +10.9307 -3.0673 -0.5069 +10.0795 -1.6260000000000001 -2.9303 +10.0795 3.4168 -2.9303 +7.0011 3.7442999999999995 -3.7817000000000003 +7.2635000000000005 3.4824 3.8153 +7.2635000000000005 3.4824 2.7022999999999997 +7.2635000000000005 6.888 3.7499 +7.2635000000000005 6.888 2.7022999999999997 +7.2635000000000005 3.4168 3.7499 +7.2635000000000005 3.4168 3.4879000000000002 +5.0363 -2.4775 -2.6683 +5.0363 -3.4601 -0.9001 +1.9579 0.7317 5.5182 +-2.5604999999999998 1.8446 5.0601 +-3.6741 -0.5132 4.0776 +-3.6741 -0.5132 4.0120000000000005 +-3.6741 0.4041 4.0120000000000005 +9.161999999999999 -3.3945000000000003 2.3094 +9.424399999999999 -2.6086 2.7022 +9.424399999999999 -2.6086 3.1607999999999996 +9.424399999999999 -2.085 -3.3230000000000004 +9.424399999999999 -2.0192 -2.8647 +9.424399999999999 -2.4776 2.7022 +9.424399999999999 -3.0669 -1.9479 +5.4948 -2.4124 3.6843 +4.6436 -2.5431 -1.2927 +4.6436 6.888 2.4400999999999997 +4.6436 -3.3291 0.14809999999999998 +4.6436 -2.6742 -1.424 +3.53 1.583 -0.5725 +3.53 -2.6087 1.3924 +-1.2508 3.6132 2.6364 +10.9965 -2.9363 0.6063 +10.9965 -2.8706 0.6063 +8.7693 -3.5909999999999997 -0.7037 +8.7693 -3.2634999999999996 2.8988 +6.2157 -2.5431 2.9641 +4.2509 -3.0017 -0.7040000000000001 +4.2509 -2.6742 -1.2933999999999999 +-0.7923 -0.1854 5.845899999999999 +-2.7571 -1.8884 4.0120000000000005 +-2.7571 -2.6742 -0.4411 +7.263 3.4824 2.7024 +7.263 6.888 3.7499 +7.263 6.888 2.7024 +7.263 3.4168 3.7499 +6.4117999999999995 -1.6916 3.4227 +1.6310000000000002 -3.4598999999999998 -0.4416 +0.5174 3.6132 3.6844 +-3.4122 -0.1853 4.0120000000000005 +-3.4122 -0.1853 -0.4411 +-3.4122 0.4041 4.0120000000000005 +-3.4122 0.4041 -0.4411 +10.7999 0.3396 -1.4895 +10.7999 3.4168 -1.4896 +7.721500000000001 -3.2634999999999996 -3.1266000000000003 +6.8703 0.5353 4.0119 +6.8703 3.0233 3.4227 +7.1327 -3.5255 2.309 +5.7567 3.3513 -3.3230999999999997 +5.7567 -1.1023 3.7500999999999998 +5.7567 1.2555 3.2914 +5.7567 -2.3464 3.2262 +5.7567 1.8451 3.4881 +5.7567 -2.281 3.2262 +6.0191 1.2558 3.0953 +6.0191 3.4168 -3.4541000000000004 +4.9055 -2.9362 -2.144 +4.0543000000000005 3.3516 0.1479 +-0.1377 1.7138 5.6493 +-0.9889 -0.1854 5.2565 +-2.9537 2.4346 -0.4411 +11.2584 6.888 1.1307 +11.2584 -1.8878 -1.0963 +10.1448 2.3684 2.8331 +10.1448 -1.7572 2.8331 +6.4776 -0.1191 -3.6506999999999996 +5.364 5.9707 -3.1266000000000003 +4.5128 -2.0845 -2.2102 +4.5128 0.4041 -2.2756 +3.3992 -0.11969999999999999 -0.4414 +3.3992 1.583 2.5057 +2.2856 -0.7095 5.3872 +-1.644 -3.1323 4.2087 +10.6033 6.888 -2.4066 +10.6033 -3.0017 -1.6196 +10.6033 3.5479 -2.4066 +8.6385 3.4824 2.4402 +7.7873 -2.5431 3.6191 +7.7873 -2.6086 3.2914 +7.7873 -1.7572999999999999 3.7500999999999998 +5.8225 -3.329 2.3094 +5.8225 -3.329 2.309 +5.8225 -3.329 2.3748 +5.8225 3.4824 1.9817 +5.8225 3.4824 -2.0136000000000003 +5.8225 3.4824 2.0474 +5.8225 3.4824 -3.3884999999999996 +5.8225 -2.6086 3.4225 +5.8225 -2.6086 2.9641 +5.8225 -3.2637 0.3444 +5.8225 3.3516 -2.9957000000000003 +5.8225 3.3516 -3.3232999999999997 +5.8225 6.888 -2.0792 +5.8225 6.888 -3.3230999999999997 +5.8225 6.888 -2.0134 +5.8225 6.888 -3.3232999999999997 +5.8225 6.888 2.0474 +5.8225 6.888 3.2911 +5.8225 6.888 2.0472 +5.8225 6.888 3.3569 +5.8225 -0.5132 4.2084 +5.8225 1.3208 -2.9958 +5.8225 0.46959999999999996 4.2085 +5.8225 5.905 -3.3884999999999996 +5.8225 1.2558 3.0953 +5.8225 -2.9362 3.0949999999999998 +5.8225 -2.0192 -3.3234 +5.8225 -3.5255 1.5230000000000001 +5.8225 -3.5255 0.3444 +5.8225 -3.0017 2.3094 +5.8225 -3.0017 2.2434 +5.8225 0.3386 4.2084 +5.8225 0.3386 3.881 +5.8225 0.3386 3.8809000000000005 +5.8225 3.4827999999999997 -2.0134 +5.8225 1.7141 3.9463999999999997 +5.8225 -2.6087 2.8988 +5.8225 -2.6087 3.3569 +5.8225 -1.8883 3.8809000000000005 +5.8225 3.4168 3.0299 +5.8225 3.4168 3.2911 +5.8225 3.4168 3.3569 +5.8225 3.4168 -3.3234 +5.8225 -1.7572 3.881 +5.8225 -1.7572 3.5537 +3.8577 6.888 0.1479 +3.8577 -3.0015 2.6364 +3.8577 3.4827999999999997 -0.7695 +0.7793 3.2858 -0.31029999999999996 +0.7793 3.7442999999999995 2.5707 +1.0416999999999998 3.4166000000000003 3.9463999999999997 +1.0416999999999998 3.3510999999999997 2.7673 +1.0416999999999998 3.6788000000000003 2.7673 +1.0416999999999998 -3.6566 -0.4416 +1.0416999999999998 3.6131 -0.4416 +1.0416999999999998 3.2857 -0.4416 +1.0416999999999998 3.351 2.7679 +1.0416999999999998 -3.1327000000000003 3.7499 +1.0416999999999998 -3.2634999999999996 2.7016999999999998 +-2.2991 2.2374 4.8635 +-3.1503000000000005 -1.9532999999999998 4.0776 +11.0618 -2.0193 0.3444 +11.0618 -2.8705000000000003 -0.5725 +11.0618 -2.6086 -1.0965 +11.0618 2.8268 0.3444 +11.0618 3.4168 -1.4895 +11.0618 -1.7572 0.3444 +11.0618 -1.7572 1.5886999999999998 +10.2106 -3.329 -1.5542 +10.2106 -3.3291 1.5233 +9.359399999999999 -1.8878 -3.3888000000000003 +9.359399999999999 3.4168 -3.3888000000000003 +4.3162 3.3513 -1.8827 +4.3162 3.3513 -1.8171 +4.3162 3.4824 2.1124 +4.3162 -1.3643 -1.8827 +4.3162 -1.3643 -1.8171 +8.7043 -3.5254 -1.9479 +5.8883 -2.0193 -2.9304 +5.8883 -2.0193 -3.3887 +5.8883 -2.8705000000000003 -3.0614 +5.8883 -2.8705000000000003 -2.4065 +5.8883 -3.46 -1.9480999999999997 +5.8883 -2.9361 -2.3411 +3.6611 -0.5783 0.148 +3.9234999999999998 2.5651 4.012099999999999 +2.5475000000000003 -3.4598999999999998 2.6364 +2.5475000000000003 -3.4598999999999998 2.7676 +2.8099 1.9756 4.6014 +2.8099 -3.0669999999999997 0.5408999999999999 +2.8099 -2.8048 4.1428 +2.8099 -2.6087 -0.3761 +2.8099 2.4998 2.7022 +0.8451 -0.1854 5.7804 +4.9708000000000006 -3.3291 -1.4893999999999998 +0.19 1.9758999999999998 5.4528 +-2.626 2.6963 3.6838 +-3.7396 0.4698 -0.4411 +-3.7396 -0.1853 3.9458 +-3.7396 0.7317 3.3564 +-3.7396 0.4041 3.8150000000000004 +-3.7396 0.4041 3.7496 +-3.7396 0.4041 -0.4411 +11.3237 3.7442999999999995 -0.8344 +11.3237 6.888 0.3444 +10.4725 -2.9361 -1.0965 +10.4725 3.4168 1.9162 +10.4725 3.4168 2.0472 +10.4725 -1.7572 1.9162 +10.4725 -1.7572 2.0472 +9.621300000000002 -2.0192 -3.1923 +9.621300000000002 -0.0536 -3.2575 +9.621300000000002 -3.1327000000000003 -2.6020000000000003 +7.394100000000001 6.888 -2.6685 +4.5781 2.5000999999999998 3.4878 +4.5781 2.303 -1.8169000000000002 +4.5781 2.303 -1.7513 +4.5781 2.4344 1.8507 +4.5781 2.8929 3.4878 +4.5781 3.4167000000000005 2.5054 +4.5781 3.4167000000000005 1.7853 +4.5781 1.2556 2.2437 +4.5781 1.2556 1.8506000000000002 +4.5781 -1.3643 -1.6856 +4.5781 -1.3643 -1.8169000000000002 +4.5781 2.4343 1.8506000000000002 +3.4645 -0.2506 4.4051 +3.4645 -2.8707 3.2916 +3.4645 -0.2509 4.4048 +1.7621000000000002 3.4166000000000003 -0.3756 +0.6485000000000001 -2.1501 4.6671 +-0.46509999999999996 -3.1981999999999995 3.8156000000000003 +-0.46509999999999996 3.7442999999999995 -0.4416 +-0.46509999999999996 3.7442999999999995 2.7673 +-0.46509999999999996 -3.5909999999999997 3.8156000000000003 +-0.46509999999999996 3.4168 2.7673 +-1.3163 -3.0017 3.7497000000000003 +-1.3163 -3.1327000000000003 -0.4416 +-3.2811 -0.775 4.9289 +5.0366 1.2555 2.8329 +5.0366 -3.46 0.9343 +3.0718 1.583 -0.44120000000000004 +1.107 -2.6088 4.7979 +-1.9713999999999998 3.2858 2.9637000000000002 +5.2326999999999995 -2.3464 3.3571999999999997 +4.3815 -1.3643 -1.424 +4.3815 -2.6742 0.1477 +0.45189999999999997 -3.1981 3.7497000000000003 +0.45189999999999997 -0.251 5.845899999999999 +0.45189999999999997 -3.6565 3.6184000000000003 +-0.3993 -3.2637 3.8156000000000003 +-0.3993 -3.7219 -0.4416 +-0.3993 -3.7219 3.0946000000000002 +-0.3993 -3.4602 -0.4416 +-0.3993 -3.5909999999999997 3.8156000000000003 +-1.5129 -0.1198 5.5182 +-1.5129 -1.2334 5.5184 +-1.5129 -2.8705000000000003 4.0120000000000005 +-1.5129 -0.1848 5.6493 +-1.5129 -2.2159 4.7979 +-1.5129 -1.9535 4.9289 +-1.5129 -1.2331 5.5183 +-1.5129 2.8926 4.0120000000000005 +-1.5129 -2.936 3.8157000000000005 +-1.5129 3.4821999999999997 -0.4416 +-1.5129 3.4821999999999997 2.7679 +-1.5129 3.4821999999999997 2.7673 +-1.5129 -3.2634000000000003 3.8157000000000005 +-1.5129 1.7135 5.3873 +-1.5129 1.9758999999999998 5.322 +-1.5129 1.9758999999999998 4.9946 +-1.5129 -2.0845 4.8635 +-1.5129 3.1548 2.7679 +-1.5129 2.0412 4.8635 +-1.5129 0.9276 5.5838 +-1.5129 3.4167000000000005 -0.4411 +-1.5129 -3.0669999999999997 -0.4411 +-1.5129 3.2859 3.9465 +-1.5129 3.0893 -0.4416 +-1.5129 3.0893 2.7016999999999998 +-1.5129 3.0893 -0.4411 +-1.5129 -2.5432 4.9289 +-1.5129 -2.2813 5.1251999999999995 +-1.5129 1.7794 4.9946 +-1.5129 -0.1854 5.6494 +-1.5129 -3.198 4.2086 +-1.5129 2.9583000000000004 3.9465 +-1.5129 3.2202 4.0120000000000005 +-1.5129 2.5651 4.8635 +-1.5129 -2.2157 4.8635 +-1.5129 -2.2157 5.191 +-1.5129 -0.4475 5.3219 +-1.5129 -3.2634999999999996 3.9458 +-1.5129 -3.4601 -0.4411 +10.734399999999999 -2.0192 -1.4895 +10.734399999999999 0.3396 -1.4895 +9.8832 -2.6086 -2.8645 +8.7696 -0.7086 -3.6506999999999996 +5.691199999999999 3.4168 3.2911 +3.9888 -1.8884 0.2137 +3.9888 -1.1024 4.1429 +0.9103999999999999 3.4165 4.0777 +1.1728 3.6787 2.7679 +1.1728 3.6787 2.8989000000000003 +-1.0544 -2.7398 4.9289 +-2.168 3.1547 -0.4411 +11.1929 -2.0193 -1.0965 +11.1929 -2.6741 0.3444 +8.9657 -3.0669999999999997 3.0949999999999998 +9.2281 3.4824 -2.2099 +9.2281 3.4824 -2.2100999999999997 +9.2281 6.888 -2.1444 +9.2281 6.888 -2.2099 +9.2281 6.888 -3.3232 +9.2281 6.888 -3.3887 +9.2281 -1.6260000000000001 -3.4543 +9.2281 -2.0192 -3.0612 +9.2281 -2.0192 -3.3888000000000003 +9.2281 -2.0192 -3.0613 +9.2281 4.2034 -2.1444 +9.2281 3.4168 -3.0612 +9.2281 3.4168 -3.3888000000000003 +9.2281 3.4168 -3.1269 +9.2281 3.4168 -3.4543 +9.2281 3.5479 -3.4541000000000004 +4.4473 -1.3643 -2.1445 +4.4473 -1.3643 -1.424 +3.3337 -2.6086 1.0648 +3.3337 -2.6086 0.21359999999999998 +3.3337 -1.6263 -0.4416 +3.3337 -1.6263 -0.4413 +3.3337 -1.6263 2.7022 +3.3337 -2.2155 -0.3757 +3.3337 -2.6087 0.0828 +3.3337 -2.6087 0.9998 +3.3337 -2.3465 -0.31020000000000003 +-0.5959 -3.5256000000000003 3.9467000000000003 +-0.33349999999999996 3.5478 3.9465 +-1.4471 3.0894 2.9642999999999997 +-2.5607 -1.2335 4.863300000000001 +10.5378 -2.9363 1.8502 +10.5378 -2.0193 -2.4062 +10.5378 -2.0192 -2.4066 +10.5378 -3.3291 0.6722 +10.5378 -2.9361 -1.8825999999999998 +8.573 -1.7572 3.2917 +2.6786 2.1071 -0.4416 +2.6786 2.1071 2.7016999999999998 +-0.1374 -3.7875 -0.4416 +-3.2157999999999998 -1.8881999999999999 4.0120000000000005 +-3.2157999999999998 1.8448 4.0120000000000005 +-3.2157999999999998 1.8447000000000002 4.012099999999999 +-2.9534000000000002 -1.2334 5.1256 +-2.9534000000000002 0.40449999999999997 5.3218000000000005 +-2.9534000000000002 -0.1848 4.8635 +-2.9534000000000002 -0.1848 5.3218000000000005 +10.9963 -2.6086 -1.3589 +7.3290999999999995 -2.6087 3.6191 +5.1019000000000005 6.888 2.8982 +0.058699999999999995 -2.8707 4.7979 +-0.7925 3.2201 4.4707 +-0.7925 -3.7220000000000004 -0.4416 +-3.6085 0.7972 4.2741 +-3.6085 -0.1854 4.4705 +9.7524 -3.1326 2.5052000000000003 +6.6739999999999995 3.4168 -3.7161 +5.8228 -3.1326 -1.6857 +5.8228 -3.1326 -1.9477000000000002 +5.8228 -3.46 -1.9477000000000002 +5.8228 -3.5255 0.34390000000000004 +5.8228 -3.5255 -1.3584 +5.8228 -3.2636 0.34390000000000004 +4.7092 3.4168 2.6364 +3.5956 -2.4775 1.1301 +3.5956 1.0594 4.6669 +3.5956 -1.0366 2.7022 +3.5956 -0.2509 4.732200000000001 +2.4819999999999998 -2.7396 3.7499 +-1.1852 -0.4475 5.7804 +10.7997 -2.085 2.0473000000000003 +9.948500000000001 3.4824 3.0296 +6.281299999999999 -3.329 -2.7337 +4.9052999999999995 6.888 0.1479 +4.9052999999999995 3.4827999999999997 0.1479 +1.2381 3.6131 -0.4416 +-2.6915 -2.7395 1.7201000000000002 +-3.8051000000000004 -0.3164 -0.4411 +-3.8051000000000004 -0.1853 -0.4411 +-3.8051000000000004 0.2075 1.0 +-3.8051000000000004 0.0112 2.8983 +-3.8051000000000004 -0.1854 2.3085 +-3.8051000000000004 -0.1854 -0.4411 +11.2582 6.4945 -1.0963 +10.407 3.4168 2.0474 +10.407 -1.7572 2.0474 +9.2934 -3.4597999999999995 -2.0791 +7.328600000000001 -2.0848 -3.7816 +3.6614 -3.329 3.0298 +3.6614 -3.329 2.6367000000000003 +3.6614 -1.1023 4.6014 +3.6614 -1.1023 4.2739 +3.6614 2.6307 4.012099999999999 +3.6614 -2.3467 3.7499 +3.6614 -2.3467 4.0774 +3.6614 1.0594 4.6015 +3.6614 1.0594 4.2739 +3.6614 -2.3464 3.8157000000000005 +3.6614 2.6961 3.4881 +3.6614 1.059 4.6014 +3.6614 1.059 4.2739 +3.6614 -1.1024 4.6013 +3.6614 -2.281 4.2084 +3.6614 -1.1679 4.2084 +-0.5306 3.3513 -0.4416 +-0.5306 3.7442999999999995 2.7673 +-1.3818000000000001 -0.1854 5.714700000000001 +-3.3466000000000005 -0.3164 -0.4411 +-3.3466000000000005 -1.8227 3.2911 +-3.3466000000000005 1.8448 3.2257000000000002 +-3.3466000000000005 1.1898 4.6669 +-3.3466000000000005 -0.1854 4.9289 +9.4895 -3.1326 -1.5547 +8.638300000000001 -3.5911 0.3444 +7.7871 -2.6086 3.2917 +7.7871 -2.6086 3.5534999999999997 +7.7871 -2.1503 3.7499 +7.7871 -1.7572999999999999 3.488 +7.7871 -1.7572999999999999 3.7499 +6.9359 -1.6261 3.75 +6.9359 0.7979 3.9465 +6.9359 3.4168 3.4881 +6.9359 3.4168 3.75 +6.9359 -1.7572 3.4227 +5.822299999999999 3.3513 -2.9957000000000003 +5.822299999999999 3.3513 -3.3230999999999997 +5.822299999999999 -2.5431 -2.6683 +5.822299999999999 -3.5256000000000003 -1.228 +5.822299999999999 -3.5256000000000003 0.1479 +5.822299999999999 1.9761000000000002 3.4881 +5.822299999999999 -1.1023 4.0776 +5.822299999999999 -2.8052 2.6367000000000003 +5.822299999999999 2.4341 3.4881 +5.822299999999999 -2.3467 3.2263 +5.822299999999999 -3.3945000000000003 -2.144 +5.822299999999999 1.0594 3.8157000000000005 +5.822299999999999 1.2555 3.0294000000000003 +5.822299999999999 -1.7570999999999999 3.9465 +5.822299999999999 2.3686 3.6191 +5.822299999999999 1.7798 3.9466 +5.822299999999999 0.9934000000000001 4.1431000000000004 +5.822299999999999 2.5655 3.4881 +5.822299999999999 -2.6085000000000003 -3.1268 +5.822299999999999 -0.9711 4.1431000000000004 +5.822299999999999 -2.7398 3.357 +5.822299999999999 -3.1325 2.7678000000000003 +5.822299999999999 -1.3643 -2.9957000000000003 +5.822299999999999 -1.3643 -3.3230999999999997 +5.822299999999999 1.059 3.8157000000000005 +5.822299999999999 -1.1024 4.0775 +5.822299999999999 3.4168 3.0293 +5.822299999999999 -2.6742 -2.6027 +5.822299999999999 -2.6742 -3.0613 +5.822299999999999 -2.6742 -2.6683 +5.822299999999999 -3.2634999999999996 0.1479 +3.0063 -1.6263 -0.4416 +3.0063 -1.6263 2.7022 +3.0063 -0.2509 4.863300000000001 +-2.0369 -2.8048 4.5359 +-2.8881 2.5000999999999998 3.2911 +-2.8881 2.1069 4.4704 +-2.8881 1.7794999999999999 4.012099999999999 +-2.8881 1.8449 -0.4411 +-2.8881 1.7141 4.8633999999999995 +-2.8881 -0.1854 4.9289 +-2.8881 0.9934999999999999 4.8633999999999995 +-2.8881 0.9934999999999999 4.7979 +11.324 -2.0193 0.3444 +11.324 -2.0848 -0.5067999999999999 +11.324 -1.7572 0.7375999999999999 +11.324 -1.7572 0.3444 +10.2104 3.4824 0.41009999999999996 +9.3592 6.888 -3.3232 +9.3592 3.4168 -3.3888000000000003 +8.2456 2.8926 3.75 +8.2456 6.888 3.7499 +4.316 3.3513 -1.8169000000000002 +4.316 3.2202 3.0947999999999998 +4.5784 3.3516 -2.3406 +2.3512 0.8629 5.3217 +0.38639999999999997 -2.0845 4.7325 +-0.46480000000000005 3.7442999999999995 -0.4416 +-0.46480000000000005 3.7442999999999995 2.7673 +-0.46480000000000005 3.4168 -0.4416 +-0.46480000000000005 3.4168 2.7673 +10.6689 6.888 2.309 +10.6689 3.4168 2.309 +9.555299999999999 -3.1326 -1.9477000000000002 +9.555299999999999 -3.5255 0.34390000000000004 +9.555299999999999 -3.5255 -1.0963 +9.555299999999999 -3.2636 0.34390000000000004 +6.739299999999999 3.4168 3.6844 +5.6257 1.0594 3.8157000000000005 +5.8881000000000006 6.888 -2.0792 +5.8881000000000006 0.46959999999999996 4.2085 +5.8881000000000006 -0.9711 4.1429 +5.8881000000000006 4.071899999999999 -2.0136000000000003 +5.8881000000000006 3.4168 3.4227 +3.6609000000000003 1.9106 4.0774 +3.6609000000000003 2.5655 4.0774 +3.6609000000000003 3.2854 3.0298 +3.6609000000000003 3.2854 3.2263 +3.6609000000000003 3.0236 3.0298 +2.5473 3.4821 2.7679 +-0.2687 -2.5433999999999997 5.0598 +-0.0063 3.8098 2.3744 +-0.8574999999999999 3.4821999999999997 3.9465 +-0.8574999999999999 3.6786 3.1607999999999996 +11.1274 3.4168 1.4577 +11.1274 3.4168 0.3444 +11.1274 3.0236 -1.4239 +9.1626 -2.0192 -3.0613 +6.609 -3.5911 0.9995999999999999 +4.3818 3.8103 -2.0783 +2.1546 -3.3291 3.8156000000000003 +1.3034000000000001 -3.0015 4.4704 +0.4522 -2.2159 4.6668 +10.472299999999999 -2.9362 -1.8817 +10.472299999999999 -1.7572 2.5057 +9.3587 -3.46 -1.9477000000000002 +9.883500000000002 -3.4598999999999998 1.3925 +7.656300000000001 -1.8878 -3.7817000000000003 +7.656300000000001 3.4168 -3.5197 +3.7267 -0.5783 0.148 +3.7267 0.5348999999999999 0.148 +3.7267 0.4697 2.7022 +2.6131 1.9758999999999998 4.274 +2.6131 -2.9359 -0.31029999999999996 +2.6131 -0.1854 4.6017 +-0.4653 -0.1854 5.1911 +-0.4653 0.6661 5.845899999999999 +-3.2813000000000003 1.8448 -0.4411 +10.9308 3.4168 -1.8825 +7.001200000000001 -2.9361 -3.3887 +7.2636 0.4043 3.9465 +-0.8580000000000001 -3.7220000000000004 2.0466 +-0.5956 -0.7095 5.845899999999999 +-2.5604 -2.7395 3.8150000000000004 +-3.6740000000000004 -1.0368 3.2911 +11.389299999999999 3.4824 0.3444 +11.389299999999999 3.4824 -0.2453 +11.389299999999999 6.888 -0.5074000000000001 +8.3109 -1.3641999999999999 3.75 +6.6085 -2.7395 -3.4541000000000004 +5.4948999999999995 3.3513 -3.1921 +5.4948999999999995 0.0113 -3.1921 +5.4948999999999995 3.3516 -3.1921 +4.6437 1.6480000000000001 -1.8171 +4.6437 -1.3643 -1.8171 +3.5301 -1.6261 -0.5725 +3.7925 -1.1023 4.2085 +3.7925 -3.1979 3.357 +3.7925 -3.0015 2.6367000000000003 +3.7925 3.0893 3.5536 +3.7925 3.0893 3.4881 +0.7141 3.4821 4.0123 +-0.3995 -3.46 -0.4416 +-0.3995 -3.2636 3.8156000000000003 +-0.3995 -3.7220000000000004 -0.4416 +-0.3995 -3.7220000000000004 3.0288 +-1.5131000000000001 -3.1979 4.0120000000000005 +-1.5131000000000001 -2.7394000000000003 4.7978 +-1.5131000000000001 -2.0848 4.9289 +-1.5131000000000001 -2.8048 4.0120000000000005 +3.9886 -2.7397 0.1479 +2.0238 3.2201 3.9467000000000003 +0.9102000000000001 -3.7219 1.1961 +-0.7922 -0.1854 5.845899999999999 +11.1927 -2.6738999999999997 0.3444 +9.4903 -3.5256000000000003 1.1958 +9.4903 -3.2636 2.4393000000000002 +9.4903 -2.8706 2.8327 +9.4903 -2.8706 2.3748 +9.4903 -2.8706 2.8986 +9.4903 -1.7572 2.8986 +9.4903 -1.7572 3.2260999999999997 +6.6743 -3.0669999999999997 3.2259999999999995 +-0.5961 3.3513 2.7673 +-1.4473 -3.5255 2.8325 +-3.4120999999999997 0.40449999999999997 4.8633999999999995 +-3.4120999999999997 0.4698 -0.4411 +-3.4120999999999997 0.4041 4.0120000000000005 +-3.4120999999999997 -0.1854 4.0120000000000005 +-3.4120999999999997 -0.1854 -0.4411 +-3.4120999999999997 1.5827999999999998 3.9458 +-3.4120999999999997 -1.7572 0.4106 +-3.4120999999999997 -0.1851 4.012099999999999 +-3.4120999999999997 -0.1851 4.8633999999999995 +10.8 -2.0193 -1.1622999999999999 +10.8 -2.9361 -1.0967 +9.948799999999999 -3.4598999999999998 -1.358 +5.7568 -2.1501 -3.3232999999999997 +5.7568 -1.3643 -3.3232999999999997 +6.0192000000000005 -1.7572999999999999 3.8809000000000005 +1.8272 1.6483999999999999 5.3217 +0.976 -1.4297 5.6491 +8.1801 3.4168 3.7499 +8.1801 3.4168 3.75 +8.4425 -2.6086 3.5534000000000003 +7.0665000000000004 -2.4122999999999997 -3.6506 +4.2505 3.3513 -1.7513 +4.2505 1.2556 1.8506000000000002 +4.2505 -1.3643 -1.8169000000000002 +1.4345 -1.8880000000000001 5.3872 +0.5832999999999999 -3.3944 4.2087 +-1.6439 0.9284000000000001 5.5838 +9.489799999999999 -3.2637 0.3444 +9.489799999999999 -3.3945000000000003 2.1125000000000003 +9.489799999999999 -2.9362 2.3094 +9.489799999999999 -3.5255 0.3444 +9.489799999999999 -3.5255 1.3267 +9.489799999999999 -3.0669999999999997 2.7678000000000003 +9.489799999999999 -3.0017 2.1778 +9.489799999999999 -3.0017 2.309 +9.489799999999999 -2.6087 3.0949999999999998 +9.489799999999999 -2.6087 2.7022999999999997 +7.5249999999999995 3.4824 -2.7341 +7.5249999999999995 6.888 -3.7159999999999997 +7.5249999999999995 6.888 -2.7341 +7.5249999999999995 3.4168 -3.7817000000000003 +6.673800000000001 3.4168 -3.7159999999999997 +5.5602 -2.3467 3.2263 +3.8578 1.2556 0.1479 +2.7442 -3.0016000000000003 3.2916 +2.7442 2.5000999999999998 3.9467000000000003 +2.7442 -3.1323999999999996 0.7375999999999999 +2.7442 -3.1323999999999996 2.7673 +2.7442 2.9581 4.0123 +2.7442 3.4166000000000003 2.7673 +2.7442 3.4166000000000003 2.5707 +2.7442 -0.2506 4.6014 +2.7442 -2.0193 2.7022 +2.7442 2.8273 4.0776 +2.7442 -2.2159 4.0776 +2.7442 -2.2159 4.4704 +2.7442 -2.1501 4.5358 +2.7442 3.0892 3.0293 +2.7442 2.0414000000000003 2.7022 +2.7442 2.0414000000000003 -0.44120000000000004 +2.7442 1.8448 4.274 +2.7442 -2.4775 2.7022 +2.7442 2.7618 4.2087 +2.7442 3.0237 0.345 +2.7442 3.0237 0.2137 +2.7442 -2.8707 -0.11399999999999999 +2.7442 2.6310000000000002 -0.44120000000000004 +2.7442 1.9758999999999998 4.2087 +2.7442 1.9758999999999998 4.6017 +2.7442 1.9758999999999998 4.6015 +2.7442 -3.0015 4.0122 +2.7442 -2.7396 3.8156000000000003 +2.7442 -2.6743 3.8157000000000005 +2.7442 -3.0669999999999997 3.2916 +2.7442 2.5 0.083 +2.7442 -3.3944 2.4396999999999998 +2.7442 -3.3944 2.7673 +2.7442 0.9936999999999999 4.8633999999999995 +2.7442 -3.3291 3.4882000000000004 +2.7442 -0.1849 4.9289 +2.7442 -2.6087 -0.4416 +2.7442 -2.6087 0.41019999999999995 +2.7442 2.8930000000000002 -0.0481 +2.7442 -0.1854 4.6016 +2.7442 -0.1854 4.6017 +2.7442 -0.1854 4.929 +2.7442 2.2374 4.0776 +2.7442 2.4998 2.7022 +2.7442 2.4998 -0.44120000000000004 +2.7442 -3.3945999999999996 2.5054 +2.7442 -3.3945999999999996 3.3569 +2.7442 2.1071 -0.4416 +2.7442 2.1071 2.7016999999999998 +2.7442 -0.9712999999999999 4.863300000000001 +2.7442 -2.0848999999999998 -0.4416 +2.7442 -2.0848999999999998 2.7016999999999998 +2.7442 3.4168 3.0293 +2.7442 3.4168 2.5705999999999998 +2.7442 -3.1327000000000003 3.8156000000000003 +2.7442 -3.1327000000000003 2.7676 +2.7442 -2.6742 -0.4416 +2.7442 -0.2509 4.6013 +2.7442 -2.2157 4.5362 +2.7442 -2.2157 4.143 +2.7442 -1.9538 -0.4416 +-0.0718 1.9758999999999998 4.8633999999999995 +-3.1502000000000003 -1.8884 4.0120000000000005 +8.8347 -3.5255 -1.9477000000000002 +9.0971 3.4824 -2.2099 +9.0971 6.888 -2.2099 +9.0971 -2.1503 3.4881 +9.0971 3.4168 -3.5195999999999996 +8.2459 -2.7397 -3.5195 +5.1674999999999995 3.3513 -2.9301 +4.3163 -2.6742 -1.4896 +3.2027 2.0414000000000003 2.7022 +3.2027 2.5 0.8687999999999999 +0.1243 3.7442999999999995 3.2262 +0.38670000000000004 -0.1854 5.1908 +-0.46449999999999997 3.7442999999999995 2.7679 +10.406799999999999 -2.8705000000000003 -1.0967 +10.406799999999999 -0.25 -2.6025 +10.406799999999999 -2.2158 -2.5371 +9.5556 -2.0193 -2.7990999999999997 +9.5556 -2.0193 -3.1923 +9.5556 -3.2634000000000003 -2.472 +9.5556 -2.0192 -2.8647 +9.5556 -2.9361 -2.7990999999999997 +9.5556 -2.9361 -2.2752000000000003 +9.5556 -3.0669 -1.9479 +7.590800000000001 -2.0192 -3.7162 +7.590800000000001 -2.0192 -3.4543 +7.590800000000001 3.4168 -3.7817000000000003 +7.590800000000001 3.0236 -3.5197 +4.7748 2.827 3.4881 +3.6612 -0.2506 4.4051 +3.6612 -3.329 2.3747000000000003 +3.6612 -2.8705000000000003 3.8158 +3.6612 3.0892 0.2794 +3.6612 -0.11950000000000001 4.7324 +3.6612 -1.6921 4.4702 +3.6612 -2.5433 0.14809999999999998 +3.6612 2.9584 -0.1137 +3.6612 3.0237 3.0293 +3.6612 -2.8707 0.9993 +3.6612 -2.8707 3.2916 +3.6612 1.7135 4.0776 +3.6612 -3.0015 2.5056 +3.6612 2.4339 4.1431000000000004 +3.6612 -1.8884 0.2137 +3.6612 1.9099000000000002 4.4051 +3.6612 1.583 -0.1139 +3.6612 3.3512 2.5051 +3.6612 2.5 -0.44120000000000004 +3.6612 2.5 1.196 +3.6612 -1.3643 -0.11410000000000001 +3.6612 -3.3291 2.3745 +3.6612 -3.3291 2.6364 +3.6612 -2.8048 3.2916 +3.6612 3.2857 3.0293 +3.6612 -2.6087 0.5408999999999999 +3.6612 -2.5429 1.1958 +3.6612 -2.0844 4.3393 +3.6612 -3.198 3.2916 +3.6612 2.4998 1.0648 +3.6612 2.4998 -0.5069 +3.6612 1.6486 -0.638 +3.6612 -0.9712999999999999 4.6667 +3.6612 -0.2509 4.4048 +3.6612 -3.2634999999999996 3.2255 +2.5476 2.8929 -0.4416 +-0.2684 -3.7875 0.9339999999999999 +-3.0844 -2.085 4.0120000000000005 +8.900500000000001 -3.3289 -2.734 +8.900500000000001 -2.4779 -3.454 +6.935700000000001 3.4168 3.7499 +4.9709 3.4827999999999997 -2.799 +4.1197 -2.0194 0.14809999999999998 +1.0413000000000001 3.2858 -0.4416 +1.0413000000000001 3.2858 2.7016999999999998 +1.0413000000000001 3.6788000000000003 -0.4416 +1.0413000000000001 3.6788000000000003 2.7673 +-2.8883 1.8448 4.0120000000000005 +-2.8883 -1.6260000000000001 4.9289 +-2.8883 1.7138 4.0120000000000005 +-3.7394999999999996 -0.2509 3.8804 +11.3238 6.4945 0.9341999999999999 +11.3238 6.888 0.3444 +11.3238 3.4168 0.3444 +11.3238 3.4168 0.8685 +11.3238 3.4168 0.8685999999999999 +11.3238 -1.7572 0.7375999999999999 +11.3238 -1.7572 0.3444 +6.543 -1.7572999999999999 3.3571999999999997 +4.3158 -2.6742 -1.424 +4.578200000000001 3.3513 -2.341 +4.578200000000001 3.3513 -1.8171 +4.578200000000001 1.2555 1.9165 +4.578200000000001 1.2555 2.3093 +4.578200000000001 2.4345 3.4881 +4.578200000000001 3.0890999999999997 3.2260999999999997 +4.578200000000001 3.4168 1.9817999999999998 +4.578200000000001 3.4168 2.5711999999999997 +4.578200000000001 2.827 3.4881 +3.4646000000000003 -0.25079999999999997 2.7022 +3.4646000000000003 -0.2509 2.7022 +3.4646000000000003 -0.2509 -0.4414 +3.727 1.7142000000000002 4.4705 +3.727 -2.8705000000000003 3.8154 +3.727 -2.281 3.7500999999999998 +3.727 -1.6264 4.4704 +3.727 -0.8402 4.6669 +-0.46499999999999997 -0.1854 5.191 +-1.5786000000000002 -0.1848 5.3218000000000005 +-1.5786000000000002 -0.1854 5.3219 +-1.3162 3.6132 -0.4416 +-2.4298 -2.0843 4.9945 +-2.4298 0.9939 5.4528 +-3.2809999999999997 0.40449999999999997 5.0601 +-3.2809999999999997 -0.5784 4.9289 +10.668700000000001 3.4168 2.3094 +9.817499999999999 -1.7572 3.0949 +8.7039 5.5125 2.4402 +8.7039 -3.5909999999999997 0.34390000000000004 +6.7391000000000005 6.888 -3.7159999999999997 +1.1071 3.6788000000000003 0.5413 +1.1071 3.2201 2.7016999999999998 +1.1071 3.0238 3.9463999999999997 +-2.8225 0.9934999999999999 4.7979 +-2.8225 2.3685 4.012099999999999 +10.276 3.4824 0.3444 +10.276 6.888 0.3444 +10.276 -3.4598999999999998 -0.11410000000000001 +7.1975999999999996 6.888 2.6369 +5.2328 -2.0845 -2.9957000000000003 +5.2328 -1.3643 -2.9957000000000003 +-1.5128000000000001 -3.46 -0.4416 +-1.5128000000000001 -3.2636 3.8156000000000003 +-1.5128000000000001 -3.0017 3.8156000000000003 +-1.5128000000000001 -3.1327000000000003 -0.4416 +-2.6264 -2.0189 4.0120000000000005 +-2.6264 -2.1499 4.667000000000001 +-2.6264 -1.1026 4.9289 +-3.4776000000000002 1.5827999999999998 -0.4411 +10.734499999999999 -1.3641999999999999 2.1783 +10.734499999999999 3.4168 2.0474 +10.734499999999999 -1.7572 2.0474 +8.7697 2.2377000000000002 3.2912999999999997 +8.7697 3.4824 2.4402 +8.7697 3.4824 2.3741000000000003 +8.7697 6.888 3.6191 +8.7697 6.888 3.6189 +8.7697 6.888 2.4398 +8.7697 6.888 2.5059 +8.7697 3.4168 3.6191 +8.7697 3.4168 3.6189 +8.7697 3.4168 3.3569 +8.7697 -1.7572 3.5534000000000003 +8.7697 -1.7572 3.2912999999999997 +7.6561 -3.46 2.6369 +3.9889 6.888 1.3269 +3.9889 3.4168 1.3924 +2.8753 -0.2506 4.5359 +2.8753 -1.7573999999999999 -0.4416 +2.8753 -3.3945999999999996 3.2916 +-1.0543 -3.5909999999999997 3.3563 +-1.0543 3.6787 0.9341999999999999 +-2.1679 -1.6915 5.3219 +-3.0191 -1.3643 4.9289 +11.193 -2.0193 -1.0967 +11.193 -2.0848 -1.0967 +8.1146 -1.7572 3.75 +4.4474 6.888 -2.2095 +3.3338 1.583 2.7022 +-3.6742 0.6664 4.012099999999999 +-3.6742 -0.1851 4.2741 +9.6867 3.4168 3.2258 +9.6867 3.4168 3.2260999999999997 +8.8355 3.4168 3.6191 +8.8355 -1.7572 3.2260999999999997 +6.8707 -3.2634999999999996 3.0294000000000003 +5.4947 -3.2634999999999996 -2.3404000000000003 +3.5298999999999996 1.9106 4.0118 +3.7923 3.3516 0.1479 +3.7923 6.888 -0.31120000000000003 +3.7923 3.4167000000000005 0.1482 +3.7923 3.4168 0.1482 +3.7923 5.2503 -0.4416 +-3.2157 -0.1854 5.1256 +10.996400000000001 -2.9361 0.3444 +6.478000000000001 -3.5911 0.3444 +6.478000000000001 -3.46 2.3094 +6.478000000000001 -3.5909999999999997 0.34390000000000004 +4.2508 3.4827999999999997 -1.8819 +4.2508 3.4168 1.9813 +1.4348 3.5476 3.6189 +-1.9060000000000001 -3.2634999999999996 3.4217999999999997 +10.3413 3.4168 -2.6682 +9.4901 -2.6088 -3.1266000000000003 +9.4901 -1.7572999999999999 3.2914 +8.6389 -3.0669 -3.1921999999999997 +7.5253 3.4824 -2.734 +7.5253 6.888 -2.734 +7.5253 6.888 -3.7161 +7.5253 3.4168 -3.7816 +4.4469 -3.1979 0.14809999999999998 +4.709300000000001 -2.6085000000000003 -1.424 +4.709300000000001 -3.0672 -1.7510999999999999 +2.4821 -0.1854 5.3218000000000005 +2.4821 -0.1854 5.3217 +2.4821 3.4821 2.7673 +0.5173 -3.7875 2.3742 +0.5173 -3.3291 -0.4416 +10.7998 -2.8051 1.5232 +7.9838000000000005 -3.1981999999999995 -2.0136000000000003 +7.9838000000000005 -2.0193 -3.7161 +7.9838000000000005 -2.0848 -3.3887 +7.9838000000000005 -2.936 -3.3886 +7.9838000000000005 -2.6741 -3.5851 +7.9838000000000005 -3.2634000000000003 -1.9479 +7.9838000000000005 -3.46 -2.6684 +7.9838000000000005 -2.0192 -3.454 +7.9838000000000005 -2.0192 -3.7161 +7.9838000000000005 -3.5255 -1.9480999999999997 +7.9838000000000005 -3.3944 -2.7995 +7.9838000000000005 -2.9361 -3.3230999999999997 +7.9838000000000005 -2.9361 -2.8647 +7.9838000000000005 -2.9361 -2.996 +7.9838000000000005 -2.9361 -3.3887 +7.9838000000000005 -3.5254 -1.9479 +7.9838000000000005 -3.2634999999999996 -1.9480999999999997 +6.2814 -3.5255 -1.9477000000000002 +4.9054 3.4824 0.1482 +4.9054 6.888 0.1482 +4.0542 3.3513 0.1479 +4.0542 1.2552 0.1479 +4.0542 2.4344 0.1482 +4.0542 3.4167000000000005 0.1482 +4.0542 1.2556 0.1479 +4.0542 -1.3643 -1.3583 +4.0542 -1.3643 -0.1796 +4.0542 2.4343 0.1479 +0.9757999999999999 -3.1981 3.8156000000000003 +0.9757999999999999 -3.5255 3.8156000000000003 +0.9757999999999999 -3.3291 -0.4416 +0.9757999999999999 -3.6565 -0.4416 +0.9757999999999999 -3.6565 3.2909 +0.12459999999999999 3.8098 -0.4416 +-2.1026 -3.1979 -0.1791 +-2.1026 -3.1979 2.8325 +-2.9537999999999998 1.8448 -0.4411 +-2.9537999999999998 1.7138 -0.4411 +-2.9537999999999998 -0.1854 4.863300000000001 +11.2583 -2.1505 0.9341999999999999 +11.2583 -1.7572 0.9995999999999999 +11.2583 -1.7572 0.9994 +9.555900000000001 -3.329 -2.2091 +9.555900000000001 -2.9362 -2.7338 +9.555900000000001 -3.5254 -0.8344 +8.1799 -3.5909999999999997 -1.2928 +4.5127 -3.2634999999999996 -0.44209999999999994 +3.3991000000000002 -1.6261 2.7022 +-1.3817 3.0893 -0.4416 +-1.3817 2.8927 3.9465 +10.8656 -2.0193 -1.0965 +10.8656 3.4168 1.9817 +5.8224 -3.5256000000000003 0.14809999999999998 +5.8224 -2.8707 2.6364 +5.8224 -3.46 1.916 +5.8224 -3.198 2.6364 +5.8224 -3.2634999999999996 0.14809999999999998 +4.12 -2.0191 4.2739 +2.7439999999999998 2.8926 4.0774 +2.7439999999999998 3.0894 2.7679 +3.0064 1.583 2.7022 +1.6303999999999998 -3.3944 3.8157000000000005 +-0.9232 3.4165 4.0777 +11.0617 3.4824 1.6543999999999999 +11.0617 -1.7572 0.3444 +9.0969 3.4168 -3.5197 +9.0969 3.4168 -3.1269 +7.132099999999999 -1.4951 -3.7816 +1.5001 -1.2331 5.5839 +1.5001 -0.1854 4.8635 +1.5001 -0.1854 4.8638 +1.5001 -0.1854 5.6491 +0.3865 -3.5256000000000003 3.8157000000000005 +0.3865 -2.2159 4.7322999999999995 +0.3865 -2.2159 5.0598 +0.3865 -2.6743 4.863300000000001 +0.3865 -3.3944 4.2086 +0.3865 -3.198 3.8157000000000005 +-2.6919 -2.4774000000000003 4.0120000000000005 +-3.5431 -1.1681000000000001 4.0120000000000005 +-3.5431 -1.1675 4.0120000000000005 +10.668999999999999 -2.7396 0.3444 +9.8178 3.4824 -1.4895 +9.8178 6.888 -1.4895 +7.5906 -1.9526999999999999 -3.7816 +7.5906 -2.0192 -3.4542 +7.5906 3.2199 -3.5197 +7.5906 3.4168 -3.7816 +5.888199999999999 3.4824 2.0474 +5.888199999999999 6.888 2.0474 +5.888199999999999 6.888 3.4223999999999997 +5.888199999999999 1.3208 -2.9958 +5.888199999999999 -2.0192 -2.9958 +5.888199999999999 -2.0192 -3.3887 +5.888199999999999 3.4168 -3.0614 +4.7745999999999995 -2.8052 1.3272000000000002 +4.7745999999999995 -3.2634000000000003 2.6364 +4.7745999999999995 -3.0015 2.6364 +4.7745999999999995 -3.0015 0.14809999999999998 +4.7745999999999995 -3.3291 0.6066 +4.7745999999999995 -3.0672 0.14809999999999998 +4.7745999999999995 -2.7395 1.3272000000000002 +4.7745999999999995 -3.2634999999999996 2.6364 +3.6609999999999996 -1.6261 -0.0485 +3.6609999999999996 -1.6261 -0.5725 +3.6609999999999996 -0.25079999999999997 2.7022 +3.6609999999999996 -0.25079999999999997 -0.4414 +3.6609999999999996 1.583 -0.11379999999999998 +3.6609999999999996 1.583 -0.5725 +3.6609999999999996 -0.2509 2.7022 +3.6609999999999996 -0.2509 -0.4414 +2.8098 -1.8884 2.7022 +2.8098 -2.6087 -0.4416 +-1.1198 -3.0669999999999997 4.6014 +-1.1198 -3.6565 1.2614999999999998 +-3.0846 1.1247 5.0601 +10.276299999999999 3.4824 0.3444 +10.276299999999999 6.888 0.3444 +8.311499999999999 -2.0192 -3.7162 +6.346699999999999 -3.5255 -2.0136000000000003 +4.1195 -2.1501 -1.424 +4.1195 -1.3643 -0.24489999999999998 +3.2682999999999995 -0.8404999999999999 2.7022 +1.3034999999999999 1.1244 5.6491 +1.3034999999999999 -3.6566 2.7673 +0.1899 -1.2331 5.7804 +-1.7749000000000001 -2.5429 4.9289 +9.6212 -2.543 -3.061 +8.5076 6.888 -3.7161 +5.4292 -2.7397 -2.8647 +2.6132 -2.2813 4.5359 +-0.20279999999999998 3.8098 -0.24459999999999998 +-0.20279999999999998 -3.3947 -0.4416 +-3.2812 -1.8881999999999999 -0.4411 +-3.2812 1.9761999999999997 3.1598 +-3.2812 -1.9539 3.1598 +-3.2812 1.8449 -0.4411 +-3.2812 1.9105 3.4217999999999997 +10.930900000000001 4.7273000000000005 1.9163 +10.930900000000001 -0.5777 -1.8825 +10.930900000000001 3.4168 -1.8825 +10.079699999999999 3.4168 -2.9303 +8.1149 0.14270000000000002 -3.7817000000000003 +8.1149 3.4168 -3.7816 +8.1149 3.4168 -3.7817000000000003 +6.1501 4.1375 3.5534000000000003 +3.0717000000000003 -1.6261 2.7022 +3.0717000000000003 -1.6261 -0.4414 +3.0717000000000003 1.4518 2.7022 +3.0717000000000003 1.4518 -0.4414 +3.0717000000000003 -2.2156 2.7022 +3.0717000000000003 1.583 2.7022 +3.0717000000000003 1.583 -0.4414 +3.0717000000000003 -1.4951 -0.4414 +1.9581000000000002 3.2856000000000005 3.9463999999999997 +1.9581000000000002 -1.5607 5.3218000000000005 +-1.9715 -1.1681000000000001 5.5184 +-1.9715 3.0237 4.0776 +-2.8226999999999998 -1.8227 -0.4411 +-2.8226999999999998 -1.8881999999999999 4.0120000000000005 +-2.8226999999999998 -1.8881999999999999 -0.4411 +-2.8226999999999998 -0.644 5.3873 +-2.8226999999999998 -2.6088 2.7016999999999998 +-2.8226999999999998 -1.8884 -0.4411 +-2.8226999999999998 1.8449 4.0120000000000005 +-2.8226999999999998 -1.7572 4.0120000000000005 +11.3894 -1.7569000000000001 0.2133 +11.3894 -1.7569000000000001 -0.2453 +11.3894 1.779 0.3444 +11.3894 0.6662 0.3444 +11.3894 2.8927 -0.5074000000000001 +11.3894 3.8754999999999997 0.4755 +9.687 -2.6738999999999997 2.9638 +4.3814 2.5000999999999998 3.4878 +4.6438 1.9761000000000002 1.9162 +4.6438 3.0235000000000003 1.9162 +4.6438 -1.3643 -2.4062 +4.6438 -3.3291 0.1479 +-1.513 2.8273 4.012099999999999 +-1.513 2.6307 4.8633999999999995 +-1.513 3.0237 4.4704 +-1.513 2.1721 4.7979 +-3.2154000000000003 -2.0195000000000003 -0.4411 +-3.2154000000000003 -1.8884 -0.4411 +-3.2154000000000003 1.8449 3.8804 +9.8831 3.4824 -1.4895 +9.8831 3.4824 -1.3584 +9.8831 6.888 -1.4895 +9.8831 6.888 -1.3584 +9.8831 6.888 3.0949999999999998 +8.769499999999999 1.5829 3.2917 +8.769499999999999 -1.4949000000000001 3.6191 +8.769499999999999 3.4168 3.3571999999999997 +8.769499999999999 3.4168 3.6191 +8.769499999999999 -1.7572 3.2917 +7.6559 -2.6086 3.6189999999999998 +7.9183 -1.7572999999999999 3.4223999999999997 +6.8046999999999995 6.2981 3.7499 +5.6911000000000005 -0.1198 4.2739 +5.6911000000000005 1.0594 4.143 +5.6911000000000005 -2.3464 3.6847 +5.6911000000000005 1.059 3.8157000000000005 +5.6911000000000005 -1.1024 3.7500999999999998 +3.9886999999999997 3.3516 -1.2279 +3.9886999999999997 6.888 -1.2279 +1.1726999999999999 -3.3291 2.7676 +-3.0193000000000003 -2.0844 4.274 +-3.0193000000000003 -0.1851 4.8633999999999995 +4.4472 -2.6742 0.1479 +3.3335999999999997 1.583 2.7022 +0.5176000000000001 1.3863 5.7146 +-1.7096 -1.6915 5.3873 +-1.4472 3.5478 0.08270000000000001 +-1.4472 -0.1854 5.5183 +10.8001 -2.9361 -1.0965 +10.8001 3.4168 -1.4895 +10.8001 3.4168 2.0472 +10.8001 3.4168 -1.4239 +10.8001 -1.7572 2.0472 +9.9489 6.888 -3.0612 +9.9489 3.9411 -3.0612 +9.9489 -2.2157 2.9638 +8.5729 3.4824 -3.7161 +8.5729 -2.6742 3.4879000000000002 +8.8353 6.888 3.6191 +6.0193 3.4168 -3.4542 +2.6785 0.27330000000000004 5.1251999999999995 +2.6785 -3.1325 3.8811999999999998 +2.6785 -2.0848999999999998 -0.4416 +2.6785 -2.0848999999999998 2.7016999999999998 +0.9761000000000001 1.9758999999999998 5.4525999999999994 +0.9761000000000001 -3.6566 -0.4416 +0.9761000000000001 -3.6566 3.2263 +0.9761000000000001 -3.6566 2.7673 +0.9761000000000001 -3.6566 2.7676 +0.9761000000000001 -3.3289 -0.4416 +0.9761000000000001 -3.3944 2.7673 +0.9761000000000001 -3.5254 3.8156000000000003 +-0.13749999999999998 -1.8880000000000001 5.5838 +-0.13749999999999998 3.1547 3.9465 +-0.13749999999999998 3.1547 3.9467000000000003 +-0.13749999999999998 1.9758999999999998 4.9289 +-0.13749999999999998 1.9758999999999998 5.1908 +-0.13749999999999998 1.9758999999999998 5.2564 +-0.13749999999999998 3.2201 4.4706 +-0.13749999999999998 2.2381 5.1908 +-0.13749999999999998 2.8272 4.863300000000001 +-0.13749999999999998 2.8272 4.8633999999999995 +-0.13749999999999998 3.4821 4.0777 +-0.13749999999999998 3.4821 3.9467000000000003 +10.9962 -2.8706 0.803 +9.031400000000001 -3.46 2.309 +9.031400000000001 -3.5255 1.9159 +9.293800000000001 -1.7572 3.4226 +7.9178 -3.0669999999999997 3.3569 +0.321 0.1421 5.845899999999999 +0.321 1.3863 5.714700000000001 +0.321 1.8448 4.8635 +0.321 1.8448 5.583699999999999 +0.321 1.9758999999999998 5.4528 +0.321 1.9758999999999998 4.8635 +0.321 1.7794 4.8635 +0.321 -0.1854 5.2565 +0.321 -0.1854 5.8457 +0.321 -0.1854 5.7802 +-0.5302 -1.4297 5.7149 +-1.9062 2.1066000000000003 5.191 +-3.6086 1.2553 3.2257000000000002 +-3.6086 1.3209 -0.24450000000000002 +10.6035 -2.8706 0.41009999999999996 +10.6035 -2.9361 0.3444 +8.6387 -1.8883 3.6191 +5.5603 -3.5256000000000003 0.8687 +5.5603 6.888 3.2259 +5.5603 6.888 -3.2577000000000003 +5.5603 3.4168 3.2259 +5.5603 -2.6742 -2.9957000000000003 +5.8227 -2.9361 -2.4065 +5.8227 -2.9361 -2.8647 +5.8227 -3.1327000000000003 -1.9480999999999997 +3.5955 3.0892 3.6189 +3.8579000000000003 0.404 4.6669 +3.8579000000000003 6.888 0.47559999999999997 +3.8579000000000003 6.888 0.1482 +3.8579000000000003 3.4168 0.8685 +1.0419 2.0417 5.3871 +-1.1853 -2.2159 5.1908 +-3.1501 1.1901 4.8635 +11.062 1.3863 -1.6205 +11.062 6.888 -1.4895 +11.062 6.888 -1.6205 +11.062 -2.0192 0.3444 +11.062 -2.0192 -1.4895 +11.062 -1.8878 -1.4896 +11.062 3.4168 -1.4896 +11.062 3.4168 -1.5551000000000001 +11.062 3.4168 -1.4895 +11.062 2.3685 0.3444 +7.5909 5.2505999999999995 3.8153 +5.3637 -3.5256000000000003 0.1479 +4.5125 3.3513 -1.6856 +4.5125 2.4343 2.2437 +3.6612999999999998 3.1547 0.2793 +3.6612999999999998 2.6965 3.4878 +3.6612999999999998 3.3510999999999997 2.7673 +3.6612999999999998 2.4344 0.1482 +3.6612999999999998 2.4344 1.0652 +3.6612999999999998 -0.5781999999999999 0.1479 +3.6612999999999998 2.4997 -0.5726 +3.6612999999999998 -1.3643 -0.6382 +3.6612999999999998 -1.3643 -0.11429999999999998 +3.6612999999999998 3.0890999999999997 0.1479 +3.6612999999999998 3.2202 3.3567 +3.6612999999999998 1.9758000000000002 0.1479 +3.6612999999999998 1.9758000000000002 -0.7035 +3.6612999999999998 2.4343 0.9339999999999999 +3.6612999999999998 2.4343 0.1479 +2.5477 -2.1501 4.143 +2.5477 -0.7747999999999999 5.1907000000000005 +0.5829 -2.1501 5.3218000000000005 +0.5829 -2.1501 5.3219 +0.5829 -1.6261999999999999 5.6491 +0.5829 -1.9536000000000002 5.5183 +0.5829 -0.1854 5.1907000000000005 +0.5829 -0.1854 5.191 +0.5829 -0.1854 5.7804 +0.5829 -2.2157 4.7327 +0.5829 -2.2157 4.7325 +0.5829 -0.4475 5.7804 +-3.3467 -0.1848 4.8635 +-3.3467 -0.2509 4.9289 +10.8654 -2.6086 1.6543999999999999 +10.8654 6.2329 -2.0136000000000003 +10.8654 -2.1503 -1.9482 +10.8654 -2.0192 -1.9479 +6.9358 -0.9057000000000001 3.9463999999999997 +6.9358 -1.6916 3.7500999999999998 +6.9358 1.2558 3.4882000000000004 +6.9358 0.3386 3.6844 +6.9358 0.3386 3.6847 +6.9358 0.3386 4.0119 +6.9358 0.3386 3.9463999999999997 +6.9358 3.4168 3.6844 +6.9358 3.4168 3.4882000000000004 +6.9358 -1.7572 3.4227 +4.1198 -2.0845 -1.424 +4.1198 -1.3643 -1.555 +1.0413999999999999 3.3513 2.8333 +1.0413999999999999 3.4821999999999997 3.8809000000000005 +1.0413999999999999 3.6786 2.7679 +1.0413999999999999 3.0894 3.9465 +-0.9233999999999999 1.1900000000000002 5.714700000000001 +-2.037 -3.0015 4.0120000000000005 +-2.8882000000000003 1.7135999999999998 4.012099999999999 +-2.8882000000000003 1.5827999999999998 4.8633999999999995 +-2.8882000000000003 2.1066000000000003 4.3396 +11.3239 -2.0192 0.3444 +11.3239 3.4168 0.3444 +11.3239 3.4168 -0.7688999999999999 +9.3591 -1.7572999999999999 2.9641 +4.5783 -2.6085000000000003 -2.0789 +4.5783 -2.6742 -1.9477000000000002 +0.38630000000000003 -3.7875 -0.4416 +0.6486999999999999 3.2201 4.4052 +-1.5785 3.2203000000000004 4.012099999999999 +-1.5785 2.8271 3.9458 +-1.5785 3.4823 1.3273 +-1.5785 3.351 3.6838 +-1.5785 -2.8049999999999997 4.0120000000000005 +-1.5785 -3.4601 2.9637000000000002 +-1.5785 -3.4601 -0.4411 +-2.4297 2.9579999999999997 2.7016999999999998 diff --git a/assets/xarm7/contacts/link7_vhacd.txt b/assets/xarm7/contacts/link7_vhacd.txt new file mode 100644 index 0000000..90d38d6 --- /dev/null +++ b/assets/xarm7/contacts/link7_vhacd.txt @@ -0,0 +1,420 @@ +419 +3.5456000000000003 1.3722 -0.08109999999999999 +3.5456000000000003 1.3247 -0.0336 +2.3104 3.0348 -2.3136 +1.9304999999999999 0.0416 0.013999999999999999 +-2.7735 -2.5716 -2.7415 +-2.7735 -2.5716 -2.4089 +-2.1079 3.1773000000000002 -2.4089 +3.6881999999999997 -0.8616 -2.3609999999999998 +3.6881999999999997 -0.5288 0.013999999999999999 +3.6881999999999997 0.0416 0.013999999999999999 +-3.4861999999999997 -0.101 -2.4089 +-3.4861999999999997 -0.101 -2.504 +-3.4861999999999997 -0.101 -2.8365 +-1.9653 -0.10139999999999999 0.013999999999999999 +3.3083 -1.9063 -2.4089 +3.3083 -1.7163000000000002 0.013999999999999999 +0.5051 3.7477000000000005 -0.08109999999999999 +3.4979999999999998 1.4673 -1.886 +2.5956 -2.8091 -2.7415 +-2.4882999999999997 2.4173 -2.4089 +-3.7234999999999996 -0.1006 -0.0336 +-3.7234999999999996 0.6596000000000001 -0.0336 +-3.7234999999999996 0.7545999999999999 -2.4089 +1.5500999999999998 3.1300000000000003 -2.4089 +-1.9657999999999998 3.1299 -2.8365 +-3.2009999999999996 -1.5265 -2.8365 +-3.2009999999999996 -2.0490999999999997 -2.7415 +-3.2009999999999996 -2.0490999999999997 -2.4089 +3.6406 -1.0988 -0.08109999999999999 +3.6406 -1.0988 -2.4089 +1.503 -3.4267 0.013999999999999999 +-2.6785 2.5597000000000003 -2.8365 +1.1231 -3.9014 -0.1285 +1.1231 -4.0446 -1.3635 +1.6927 3.3201 -2.8365 +-1.7761 -3.2842000000000002 0.013999999999999999 +-1.4433 3.5099 -0.08109999999999999 +-1.4433 3.5099 -2.4089 +-1.4433 -3.4269000000000003 -2.8365 +1.3128000000000002 -3.5220000000000002 -2.4089 +1.3128000000000002 -3.2368 -2.4089 +1.3128000000000002 -3.2368 -2.8365 +1.3128000000000002 -3.4269000000000003 -2.8365 +-1.3007 3.5574000000000003 -0.08109999999999999 +-3.7711 -0.3862 -2.4089 +-3.7711 -0.101 -2.4089 +-3.7711 -0.101 -1.2208999999999999 +-3.4383 -1.6214 -0.08109999999999999 +3.0705 2.2744 -2.4089 +1.1226 -3.9495000000000005 -2.6465 +1.4554 3.51 -0.08109999999999999 +1.4554 3.51 -2.4089 +-3.2486 -1.8114000000000001 -2.8365 +-1.1581 -3.9964 -2.3609999999999998 +-1.1581 -3.9964 -0.271 +-1.1581 -3.9489000000000005 -0.1762 +1.0755000000000001 -3.997 -0.22360000000000002 +-2.0604999999999998 3.1295 0.013999999999999999 +-0.6355999999999999 -4.0442 -2.3136 +-0.3028 -0.10139999999999999 -1.6009 +-3.106 -1.5741 -2.8365 +-1.0155 -4.0442 -1.1263 +-2.2507 -2.6192 -2.7415 +-2.2507 -2.6192 -2.8365 +2.643 -2.7139 -0.0336 +-3.2962 1.1344 -2.4089 +-3.2962 1.0868 -2.8365 +-3.2962 1.2294 -2.4089 +3.4983 0.0416 -2.4089 +3.4983 0.0416 -2.8365 +1.9303000000000001 -2.9043 -2.4089 +1.9303000000000001 -2.9043 -2.8365 +-0.8729 -3.997 -2.4565 +-2.1081 -3.1891999999999996 -2.7415 +-2.1081 -3.1891999999999996 -2.4089 +-3.6761000000000004 -0.1006 0.013999999999999999 +-3.6761000000000004 0.897 -0.6038 +2.7856 -2.5711 -2.4089 +2.7856 -2.5716 -2.4089 +-3.5334999999999996 1.3246 -0.08109999999999999 +-3.5334999999999996 1.4196 -2.4089 +-3.5334999999999996 1.4195 -2.4089 +3.6409 1.1346 -2.4089 +3.6409 -1.0984 -2.7415 +3.6409 -1.0984 -2.4089 +3.6409 0.8498 0.013999999999999999 +0.8377000000000001 3.7001 -0.08109999999999999 +-0.7303 -4.0922 -1.7912000000000001 +-1.7758 2.9873 -2.8365 +-1.443 3.51 -2.7415 +-1.443 3.51 -2.4089 +-2.1557 3.1299 -2.7415 +-2.1557 3.1299 -2.4089 +-3.7237 -0.101 -2.789 +-3.7237 0.7541 -2.7415 +3.7835 -0.2912 -2.1236 +3.7835 0.0416 -0.08109999999999999 +3.7835 0.0416 -2.4089 +3.7835 -0.3388 -1.0789 +3.7835 -0.24380000000000002 -2.7415 +-1.2533 -3.9493 -0.31870000000000004 +-1.2533 -3.9493 -2.4089 +1.8356000000000001 3.3199 -2.4089 +-1.3004 -3.1894 -2.4089 +-1.3004 -3.1894 -2.504 +-1.3004 -3.7595000000000005 -2.694 +-1.3004 -3.902 -2.4089 +0.6003999999999999 -4.0446 -2.3609999999999998 +0.6003999999999999 -4.0446 -0.41359999999999997 +-2.5356 2.8446 -2.4089 +-1.1107 -4.0442 -1.4583000000000002 +-0.7779 -4.4248 -1.696 +-0.7779 -4.4248 -1.0311000000000001 +-0.7779 -4.0446 -1.696 +-0.7779 -4.0446 -1.0786 +-2.0131 3.2248 -0.08109999999999999 +3.5933 -0.7664 -2.8365 +3.5933 1.2293 -2.7415 +2.3581000000000003 -2.9043 -2.8365 +1.6454 3.1299 -2.4089 +1.6454 3.0824000000000003 -2.4089 +1.6454 3.0824000000000003 -2.8364000000000003 +-2.7258 -2.5717 -2.4089 +-2.7258 -2.6663 -0.08109999999999999 +-2.7258 -2.6663 -2.4089 +-2.7258 -2.6668000000000003 -2.7415 +-2.7258 -2.6668000000000003 -2.4089 +2.1679 3.1299 -0.08109999999999999 +2.1679 3.1299 -2.4089 +2.1679 -3.0467 0.013999999999999999 +0.5999 -5.185 -1.0311000000000001 +0.5999 -4.3773 -1.9812 +-3.7713000000000005 -0.1006 -1.1737 +-3.7713000000000005 -0.1006 -2.4089 +-3.7713000000000005 -0.4336 -2.7415 +-3.7713000000000005 -0.4336 -2.5515 +-3.7713000000000005 0.5172 -0.4613 +-3.7713000000000005 -0.101 -2.4089 +-3.7713000000000005 0.3745 -2.4089 +-3.1057 -2.1915 -0.08109999999999999 +3.0231999999999997 2.3222 -2.4089 +3.0231999999999997 2.3222 -2.5991 +3.0231999999999997 1.8472 -2.4089 +3.0231999999999997 2.1798 -2.8364000000000003 +-0.11280000000000001 3.4625000000000004 -2.4089 +-1.6808 3.1299 -2.8365 +-1.348 -3.427 -2.8365 +-1.348 -3.1894 -2.4089 +-1.348 -3.2845 -2.8365 +1.9777 3.1773999999999996 0.013999999999999999 +0.4097 -4.4248 -0.651 +0.4097 -4.0446 -0.651 +-3.6287 -1.1461000000000001 -2.7415 +-3.6287 -1.1461000000000001 -2.4089 +-3.6287 -0.8138 -2.8365 +3.1658 -1.4786000000000001 -2.4089 +3.1658 -1.5267 -2.5989999999999998 +3.1658 -1.4314 -2.8365 +3.1658 -2.0015 -2.7415 +3.1658 -2.0015 -2.4089 +3.1658 -2.0493 -2.7415 +3.1658 -2.0493 -2.4089 +3.1658 -1.9067 -2.8365 +0.3626 0.0416 -1.6009 +0.3626 0.0416 -0.0336 +0.5523 -4.0446 -2.0286 +2.4531 -2.9043 -2.4089 +-0.6829 3.6526000000000005 -2.8365 +-0.3501 -4.4248 -2.1712 +2.9756 1.8472 -2.4089 +2.9756 1.8472 -2.8364000000000003 +2.9756 2.3695 -0.08109999999999999 +-2.9636 -2.3813999999999997 -2.4089 +3.4981 -1.4792 -0.08109999999999999 +2.2629 -2.9043 -2.8365 +2.2629 -2.9993 -2.789 +-2.1083000000000003 3.1774999999999998 -2.4089 +-2.1083000000000003 3.1300000000000003 -2.4089 +-1.7755 3.2724999999999995 -2.8365 +-3.3435 -1.8113000000000001 -0.08109999999999999 +-3.3435 -1.8113000000000001 -2.4089 +-3.7234000000000003 -0.7664 -0.08109999999999999 +-3.7234000000000003 -0.101 -0.0336 +-3.7234000000000003 -0.7189 -2.4089 +3.1182000000000003 -1.5741 -2.4089 +3.1182000000000003 -1.5267 -2.8365 +3.1182000000000003 -2.1915 -0.08109999999999999 +0.315 -0.006 -1.6009 +-3.5337 -0.101 -2.4089 +-3.2009000000000003 -2.0490999999999997 -2.4089 +-3.2009000000000003 -1.9541 0.013999999999999999 +0.8375 -3.997 -2.4565 +-0.7305 -0.1006 -2.4089 +-1.1103999999999998 -3.997 -2.5515 +-2.3456 -2.5717 -2.4089 +2.928 2.322 0.013999999999999999 +3.2607999999999997 -1.8111 -2.8365 +-0.208 0.7071 -2.4089 +-0.5879 -4.0442 -0.41359999999999997 +1.3129 3.5576000000000003 -2.4089 +-0.2551 -5.185 -0.7462 +-0.2551 -5.185 -2.0761000000000003 +1.8354 3.3201 -2.4089 +-2.5358 2.4173 -2.8365 +1.5026 3.1300000000000003 -2.8365 +2.3579 -2.9043 -2.4089 +2.3579 -2.9518 -2.4089 +0.7428 0.0416 -2.4089 +-2.3931999999999998 -2.8569 -2.8365 +2.8804 -2.3815 0.013999999999999999 +2.5004999999999997 2.8444000000000003 -0.0336 +-0.6355000000000001 3.7477000000000005 -2.7415 +-0.6355000000000001 3.7477000000000005 -2.4089 +-0.3027 -4.4248 -0.6035999999999999 +-3.4387 1.2294 -2.8365 +-3.4387 -1.6213000000000002 -2.7415 +-1.5379 3.1300000000000003 -2.8365 +-1.3481999999999998 -3.5220000000000002 -2.4089 +-1.3481999999999998 -3.1891999999999996 -2.4089 +-1.3481999999999998 -3.2842999999999996 -2.8365 +-2.5834 2.7497000000000003 -2.7415 +-2.5834 2.3695999999999997 -2.4089 +-2.5834 2.3695999999999997 -2.8365 +-3.2960999999999996 1.2296 -2.4089 +-3.2960999999999996 1.2296 -2.8365 +-3.2960999999999996 1.8948 -2.7415 +-3.2960999999999996 1.8948 -2.4089 +0.3624 -5.185 -0.7936000000000001 +0.3624 -5.185 -2.0286 +-3.676 -0.101 0.013999999999999999 +-3.676 -0.9567000000000001 -0.9838 +-3.676 -0.9567000000000001 -2.4089 +-3.676 -0.6715 0.013999999999999999 +-3.3432000000000004 1.6568 0.013999999999999999 +3.6880999999999995 0.8974 -0.08109999999999999 +3.6880999999999995 0.0419 0.013999999999999999 +2.4529 -2.9038999999999997 -2.4089 +-3.1535 -1.5265 -2.4089 +-2.8207 2.4645 0.013999999999999999 +-1.9654 -0.1006 0.013999999999999999 +-3.5334 -1.384 -2.4089 +3.3082000000000003 1.8946 -0.08109999999999999 +2.073 3.1774999999999998 -2.7415 +2.073 3.1300000000000003 -2.4089 +-1.3958 -3.5220000000000002 -2.7415 +-1.3958 -3.4741 0.013999999999999999 +-1.3958 -3.1418 -2.504 +-2.6310000000000002 2.7497000000000003 -2.4089 +-2.2982 -2.9515 0.013999999999999999 +-0.2077 -4.0446 -0.5559 +-3.3437 -1.8114000000000001 -2.4089 +1.8828 3.1300000000000003 -2.8365 +0.6476 3.7477000000000005 -2.7415 +0.6476 3.7477000000000005 -0.7938000000000001 +0.6476 3.7477000000000005 -2.4089 +0.6476 3.6526000000000005 -2.8365 +-0.9204 -3.9964 -0.22360000000000002 +-0.9204 -3.8539 -0.08109999999999999 +-0.9204 -3.902 -2.694 +0.9804 3.6526000000000005 -2.4089 +-3.2011 -1.9539999999999997 -2.7415 +-3.2011 -1.9539999999999997 -2.4089 +-3.2011 -1.3837 -2.4089 +-3.2011 -1.4313 -2.8365 +2.4053 -2.9515 -0.1762 +3.0709 2.2747 -2.4089 +-0.3979 3.7477000000000005 -2.4089 +1.5029000000000001 -3.5220000000000002 -2.7415 +1.5029000000000001 -3.5220000000000002 -2.4089 +0.12459999999999999 -4.4248 -0.6035999999999999 +2.0254000000000003 -2.9043 -2.4089 +2.0254000000000003 -2.9043 -2.8365 +2.0254000000000003 3.2249 -0.08109999999999999 +2.0254000000000003 -2.8565 -2.4089 +2.0254000000000003 -2.8565 -2.8365 +1.3127 -3.2843999999999998 -2.4089 +1.3127 -3.2843999999999998 -2.8365 +1.3127 -3.4745999999999997 -2.8365 +1.3127 -3.902 -2.4089 +0.0775 3.4625000000000004 -2.8365 +-1.4905 3.1300000000000003 -2.4089 +-3.0585 -2.0965000000000003 -2.8365 +0.2672 -5.185 -0.7462 +2.168 3.1299 -2.4089 +2.168 3.1299 -2.7414 +1.2656 -3.9494000000000002 -2.4089 +1.2656 -3.9494000000000002 -0.36619999999999997 +-3.7712000000000003 -0.101 -2.7415 +-3.7712000000000003 -0.101 -2.4089 +-3.7712000000000003 0.37420000000000003 -2.4089 +3.4032 -1.7167000000000001 -0.31870000000000004 +3.4032 -1.7167000000000001 -1.3157999999999999 +3.0233 1.7519 -2.8365 +3.0233 1.7043 -2.5515 +3.0233 1.7043 -2.4089 +3.0233 2.0843 -2.8365 +0.2201 0.7069 -2.4089 +-2.9159 2.4171 -0.0336 +3.5458000000000003 1.1347 -2.8365 +0.7426 -4.4248 -0.9835 +0.7426 -4.4248 -1.8384999999999998 +-2.3934 -2.524 -2.4089 +-2.3934 -2.524 -2.8365 +-2.3934 -2.5716 -2.4089 +-2.3934 -2.5716 -2.8365 +-2.0606 3.1774999999999998 -2.7415 +-3.2958000000000003 1.8945 -2.4089 +-0.6356999999999999 3.7477000000000005 -0.08109999999999999 +-0.6356999999999999 3.7477000000000005 -2.4089 +0.0299 -4.0446 -2.2189 +1.9307 3.1299 -2.8364000000000003 +3.6884 0.0416 -2.8365 +3.6884 0.1369 -2.8365 +0.21960000000000002 -4.4248 -2.2189 +-0.6828 -5.185 -1.2689000000000001 +-0.6828 -5.185 -1.5059 +1.218 -3.9494000000000002 -0.22360000000000002 +3.4981999999999998 0.041800000000000004 -2.4089 +3.4981999999999998 0.041800000000000004 -2.8365 +1.9302 0.0416 0.013999999999999999 +0.695 -5.185 -1.5535999999999999 +0.695 -4.0446 -0.8886 +-0.5402 -4.0446 -0.7936000000000001 +-3.6762 0.517 -2.8365 +-3.6762 0.9440999999999999 -2.4089 +3.1183 2.1794000000000002 -2.7415 +-0.3505 -0.1006 -1.6009 +-0.3505 -0.1006 -0.0336 +-0.3505 -0.10139999999999999 -0.0336 +-0.0177 -1.9543000000000001 0.013999999999999999 +-0.0177 0.3748 -1.6009 +-0.0177 0.3748 -0.0336 +-0.0177 -3.4739 0.013999999999999999 +-0.0177 1.9418000000000002 0.013999999999999999 +-0.0177 -0.7188 -2.4089 +-0.0177 -3.2843999999999998 -2.4089 +-0.0177 -3.2843999999999998 -2.8365 +-0.0177 -4.0442 -2.3609999999999998 +-0.0177 -4.0442 -0.41359999999999997 +-0.0177 3.6998 0.013999999999999999 +-0.0177 -3.4745999999999997 -2.8365 +-0.0177 1.3719999999999999 -2.4089 +-0.0177 -3.759 -0.08109999999999999 +-0.0177 -3.759 -2.4089 +-0.0177 3.7477000000000005 -2.7415 +-0.0177 3.7477000000000005 -2.4089 +-0.0177 3.7477000000000005 -0.0336 +-0.0177 -3.7595000000000005 -2.4089 +-0.0177 -3.7595000000000005 -2.694 +-0.0177 3.7001 0.013999999999999999 +-0.0177 -0.3388 -1.6009 +-0.0177 -0.3388 -0.0336 +-0.0177 0.37420000000000003 -1.6009 +-0.0177 0.37420000000000003 -0.0336 +-0.0177 1.3726 -2.4089 +-0.0177 -3.4745 -2.8365 +-0.0177 -4.0446 -2.3609999999999998 +-0.0177 -4.0446 -0.41359999999999997 +-0.0177 -0.7189 -2.4089 +-0.0177 -1.9541 0.013999999999999999 +-0.0177 -3.7594000000000003 -2.4089 +-0.0177 -3.7594000000000003 -2.694 +-0.0177 -3.4736999999999996 0.013999999999999999 +-0.0177 3.7473 -2.4089 +-0.0177 3.7473 -0.0336 +-0.0177 -3.2845 -2.4089 +-0.0177 -3.2845 -2.8365 +-0.0177 3.51 -2.4089 +-0.0177 3.51 -2.8365 +-0.0177 1.942 0.013999999999999999 +-0.0177 -0.3387 -1.6009 +-0.0177 -0.3387 -0.0336 +-0.0177 3.6526000000000005 -2.8365 +3.6408000000000005 1.1347 -2.4089 +0.8376 -4.3773 -1.2689000000000001 +0.8376 -4.4248 -1.2689000000000001 +0.8376 -4.0446 -1.5059 +-0.7303999999999999 -0.10139999999999999 -2.4089 +1.1704 -3.997 -2.3609999999999998 +-3.0111 2.322 -2.7415 +-3.0111 2.3218 -0.08109999999999999 +-3.0111 2.3218 -2.4089 +2.9281 -2.4287 -0.08109999999999999 +-0.5878 -5.185 -1.7912000000000001 +-0.5878 -5.185 -0.9835 +-3.3910000000000005 1.7520999999999998 -0.08109999999999999 +-3.3910000000000005 1.5147000000000002 -2.8365 +3.7834 0.27959999999999996 -0.08109999999999999 +3.7834 0.08940000000000001 -2.7415 +3.7834 0.041800000000000004 -2.4089 +3.7834 0.0419 -0.08109999999999999 +3.7834 0.0419 -2.4089 +3.7834 0.1845 -2.1236 +0.9802 3.6047000000000002 0.013999999999999999 +-1.6333 3.1299 -2.4089 +-1.6333 3.0823 -2.4089 +-0.44520000000000004 -4.4248 -2.1236 +-0.44520000000000004 -4.0446 -2.1236 +-3.5811999999999995 1.2296 -2.7415 +-3.5811999999999995 1.2296 -2.4089 +-3.5811999999999995 1.2294 -2.7415 +-3.5811999999999995 1.2294 -2.4089 +-3.2483999999999997 1.2772000000000001 -2.5989999999999998 +2.358 2.9873 -0.1762 +0.7429 0.0416 -2.4089 +-2.7258999999999998 2.6544000000000003 -1.506 +3.7358000000000002 -0.624 -0.08109999999999999 +3.7358000000000002 0.6594 -0.6038 +-0.9682 3.6048999999999998 0.013999999999999999 +0.9325999999999999 -3.902 -2.694 +1.4551 3.51 -2.7415 +3.3558999999999997 -1.8111 -2.7415 +3.3558999999999997 -1.8111 -2.4089 +-2.5833 -2.5717 -2.8365 +-2.5833 2.4173 -2.4089 +-2.5833 2.6549 -2.8365 +-2.5833 2.7973000000000003 -2.7415 +-2.5833 2.7973000000000003 -2.4089 +-2.2505 3.0824000000000003 -0.08109999999999999 diff --git a/assets/xarm7/contacts/linkbase.txt b/assets/xarm7/contacts/linkbase.txt new file mode 100644 index 0000000..e5cdd41 --- /dev/null +++ b/assets/xarm7/contacts/linkbase.txt @@ -0,0 +1,5782 @@ +5781 +-0.0 -4.62 0.0 +-0.0 -4.62 0.5 +-0.0 -4.590000000000001 0.5 +-0.0 -4.590000000000001 0.1 +0.0 -3.5242000000000004 -0.1 +-0.5888 3.614 -2.8001 +0.19840000000000002 1.0767 -0.06 +-0.6528 1.3694 -1.4000000000000001 +-7.532800000000001 -0.9399 2.5383 +3.872 2.7721 15.479999999999999 +-5.4336 0.9566 1.7019 +6.2976 -0.1736 0.1 +6.2976 -0.1736 0.8999999999999999 +-5.1712 -1.5859 1.9946 +-3.5328 -5.095000000000001 0.0 +-3.5328 -5.095000000000001 1.0 +-1.6320000000000001 3.1323999999999996 11.3 +-5.5616 -1.6998 2.1247 +-7.263999999999999 -1.7215999999999998 2.4953 +-7.263999999999999 -0.7792 2.9063 +-5.3632 -0.5218 2.9129 +-5.3632 2.2786 2.7511 +-5.3632 1.6102 3.6615 +-4.8384 0.1647 2.6231 +-3.2 -4.7631 1.0 +-3.2 -4.7631 0.44999999999999996 +-3.2 4.7632 1.0 +-3.2 4.7632 0.44999999999999996 +-5.6896 -1.1116 1.9068999999999998 +-4.9024 0.4039 3.2724999999999995 +-5.7536 0.43039999999999995 3.3211999999999997 +-4.704 0.8711 1.7187999999999999 +-7.1936 -1.6155 2.2375 +-7.1936 -0.8978999999999999 2.2273 +-7.1936 -1.7124000000000001 3.0655 +3.424 0.8163999999999999 11.3 +3.424 0.8163999999999999 15.479999999999999 +-5.6192 -1.5505 3.5161 +-5.6192 -2.1106 2.8251 +-5.6192 -0.5743 2.1524 +-4.896 1.4592 2.9726 +-4.896 1.4057 2.8931 +-4.896 1.4971999999999999 2.7319 +-4.896 0.9573 3.0404 +-4.896 1.4345 2.7773 +-4.896 1.157 2.8521 +-4.896 1.5085 2.7192000000000003 +-4.896 1.6621000000000001 2.7862 +-4.896 1.6045 2.7283999999999997 +-4.896 1.2309999999999999 2.992 +-4.896 1.6126999999999998 2.9833 +-4.896 1.4356 2.7604 +-4.896 1.5398 2.9974 +-4.896 1.1768 3.0983 +-4.896 1.4002999999999999 2.8316999999999997 +-4.896 0.9651 2.8981 +-4.896 1.6732 2.8920000000000003 +-4.896 1.0396 3.1245 +-4.6975999999999996 -0.7064 3.2228 +-8.5632 0.8693 2.9311 +-4.4992 1.5297 1.6777 +2.7136 -3.8986 11.3 +2.7136 -3.8986 15.479999999999999 +-5.216 -0.5231 2.9889 +-6.393600000000001 1.5473000000000001 2.3718 +-6.393600000000001 0.8210999999999999 2.5301 +-8.883199999999999 1.6923000000000001 1.9616000000000002 +-5.0816 0.3675 3.3291 +-1.0816 -3.3237 -0.3015 +-2.7136 3.8986 11.3 +-2.7136 3.8986 15.479999999999999 +-5.2672 -1.9667000000000001 2.3959 +2.0736 1.8231000000000002 -0.00030000000000000003 +-0.9408 -3.9352 -2.5824 +-5.5936 -0.8657 2.0691 +-4.2816 1.4751999999999998 1.6741 +-5.3952 -1.0455 1.9878 +-4.6080000000000005 -1.9795 2.9703 +-4.6080000000000005 -1.1381999999999999 1.9727000000000001 +-9.0624 0.8668 2.9985999999999997 +-4.473599999999999 0.6126 3.5071 +-1.1967999999999999 -3.9249 -0.3421 +-5.3248 -1.7344 2.1471 +-3.424 -0.8163999999999999 11.3 +-3.424 -0.8163999999999999 15.479999999999999 +-3.1616 -1.8472 -2.8001 +0.9024000000000001 -3.5242000000000004 -1.5227 +-5.4528 -1.6844999999999999 3.2888 +-5.2544 -0.9709000000000001 3.3911 +-5.2544 -1.6239 3.3334999999999995 +3.2 -4.7632 1.0 +3.2 -4.7632 0.44999999999999996 +3.2 4.7631 1.0 +3.2 4.7631 0.44999999999999996 +2.5472 -2.7631 -2.7037999999999998 +-5.9712000000000005 2.0682 3.4038 +1.6320000000000001 -3.1323999999999996 11.3 +3.5328 5.095000000000001 0.0 +3.5328 5.095000000000001 1.0 +-6.2976 0.1736 0.1 +-6.2976 0.1736 0.8999999999999999 +-9.0496 0.44860000000000005 2.9447 +-5.248 -1.8958 3.0541 +-8.0 1.8585999999999998 3.4509 +-8.0 0.3459 2.359 +-8.0 0.8518 1.8196 +-8.0 1.5959999999999999 1.7975 +-8.0 0.5027 3.3125 +-4.7232 -0.5067999999999999 2.5267 +0.6528 -1.3694 -1.4000000000000001 +-5.900799999999999 1.764 3.7624 +-0.19840000000000002 -1.0767 -0.06 +-4.5888 1.2932000000000001 1.654 +-7.7975 -0.8012999999999999 2.4529 +-5.173500000000001 -1.4883 2.4821 +-5.173500000000001 -1.0321 2.9378 +-5.173500000000001 -1.4916 2.9179 +-4.9111 -1.8124999999999998 0.0 +2.4297 2.5882 -2.4 +-5.2375 -1.9565 2.4987 +-4.7127 0.5772 1.9029999999999998 +-5.0390999999999995 -0.7294 3.2809 +-4.2519 -0.46740000000000004 2.7156 +4.2025 -1.9192 0.0 +4.2025 -1.9192 0.5 +-5.3655 -1.8676000000000001 2.9313 +-9.2311 1.8873000000000002 3.0384 +-5.1671000000000005 -0.7557999999999999 2.0996 +-5.1671000000000005 -1.4372 2.9749000000000003 +-5.7559 1.6362999999999999 3.6448 +1.0600999999999998 -3.9678999999999998 -2.4678 +-3.8551 2.4913000000000003 0.1 +-1.6919 2.4083 0.0 +-3.3943000000000003 -0.0789 0.0 +0.1449 -0.7988000000000001 -2.3997 +-8.0471 1.4701 1.9091 +-7.7847 -1.6933 2.4468 +-3.7207 -0.46759999999999996 -2.7 +-7.3239 -1.6856 2.9608 +-5.6855 -0.6767 3.2870000000000004 +-8.5655 0.5787 3.1836999999999995 +-8.5655 1.6012 2.4185000000000003 +3.1656999999999997 1.8168 0.0 +-5.6151 -1.7738 2.1801999999999997 +-4.5655 1.5615999999999999 3.4486000000000003 +-4.5655 0.6953 2.6188 +-4.5655 1.2562 2.2321 +-4.5655 1.0194 3.2864999999999998 +-4.5655 1.173 3.0113999999999996 +-4.5655 1.6292 2.1250999999999998 +-4.5655 1.6629999999999998 3.1653000000000002 +-4.5655 0.7327 2.2649 +-4.5655 0.6815 1.9666 +-4.5655 1.6688999999999998 2.4078 +-4.5655 1.3617000000000001 3.5761000000000003 +-4.5655 0.9776999999999999 3.5564 +-4.5655 0.3546 2.7601 +-4.5655 1.7859 2.7706 +-4.5655 1.2291 3.232 +-4.5655 1.9052 3.3147999999999995 +-4.5655 1.4636 2.8107 +-4.5655 0.787 2.6851 +-4.5655 1.7575 3.0716 +-4.5655 0.4217 2.377 +-4.5655 1.2281 3.0075000000000003 +-4.5655 1.1723000000000001 3.1940000000000004 +-4.5655 1.2724 2.2797 +-4.5655 0.7965 3.1062 +-4.5655 1.6833 2.2691 +-4.5655 1.1434 1.8173000000000001 +-4.5655 0.4051 2.9979 +-4.5655 0.5715 3.2925999999999997 +-4.5655 1.1388 1.7779 +-4.5655 1.8446 2.9155 +-4.5655 1.5799 2.1153999999999997 +-4.5655 1.6119 1.8879 +-4.5655 0.8375 3.1106000000000003 +-4.5655 1.456 3.0407 +-4.5655 0.6112000000000001 2.4602 +-4.5655 1.4024999999999999 3.4644 +-4.5655 1.0312999999999999 2.3661000000000003 +-4.5655 1.8889 2.9398 +-4.5655 1.0546 2.9142 +-4.5655 1.3787 2.1088 +-4.5655 1.4810999999999999 2.0564 +-4.5655 1.3124 2.1307 +-4.5655 2.1311 2.8863 +-4.5655 0.6399 2.4612 +-4.5655 2.041 2.2771 +-4.5655 1.5353999999999999 2.5016 +-4.5655 1.2707 2.3947 +-4.5655 1.3836 2.4764999999999997 +-4.5655 0.7052 1.9973999999999998 +-4.5655 0.931 2.9179 +-4.5655 1.0142 3.3445 +-4.5655 1.5751000000000002 3.0787 +-4.5655 0.8345 2.6689000000000003 +-4.5655 1.8200999999999998 3.0878 +-4.5655 1.6194 3.4998 +-4.5655 1.6276 1.8541999999999998 +-4.5655 0.7462 2.2902 +-4.5655 0.8805999999999999 3.2441999999999998 +-4.5655 1.6677999999999997 2.7045 +-4.5655 2.1239999999999997 2.5054 +-4.5655 1.0314 2.5577 +-4.5655 1.4834999999999998 2.9252000000000002 +-4.5655 1.8995000000000002 2.0793 +-4.5655 1.5685 2.4638 +-4.5655 1.5685 2.7637 +-4.5655 1.4638 3.4215000000000004 +-4.5655 0.3886 2.3653 +-4.5655 0.9495 2.6707 +-4.5655 0.8919 2.2640000000000002 +-7.5799 -1.2596 2.3653 +-5.9415000000000004 1.9951 3.4223999999999997 +-4.3031 -1.1228 2.9955 +-4.3671 -1.6136000000000001 3.3453999999999997 +-4.1047 -1.9636 2.9489 +-5.2183 -1.6214 2.0659 +-4.1687 -1.7586000000000002 2.1420000000000003 +-5.0199 -1.6299000000000001 3.38 +-5.0839 -0.5642999999999999 2.9638 +-1.2823 -3.5242000000000004 -0.1434 +-4.9495 -1.3287 1.9259 +-1.4102999999999999 -3.2933 -2.8000000000000003 +-9.077499999999999 1.4756 2.0156 +-9.077499999999999 1.8094999999999999 2.2459 +-9.077499999999999 1.0702 2.0022 +-9.077499999999999 0.6041000000000001 2.3805 +0.9513 -3.8442 -2.2085 +-5.0775 1.4262000000000001 1.4842 +-5.0775 0.13470000000000001 2.2012 +-0.8791 -3.5242000000000004 -2.4586 +-8.8087 0.9533 3.0431 +-7.823099999999999 -0.688 2.9000000000000004 +0.8937 -3.7241999999999997 -0.2821 +-8.9367 0.8913000000000001 1.8315000000000001 +-5.1351 -0.6694 2.1812 +0.5673 0.5055999999999999 -2.3496 +-1.1351 -3.3071 -2.4032 +-5.2631 -1.1098999999999999 3.4212 +4.7657 -0.086 11.3 +-4.8663 -0.874 1.8762 +1.0985 4.4566 0.5 +1.0985 4.4566 0.1 +-4.4055 -1.7064 2.6952 +-0.3415 6.1906 0.0 +-0.3415 6.1906 1.0 +-4.4695 0.4877 1.9775999999999998 +-5.5831 1.9239 3.5524 +-2.3063000000000002 2.4717 0.0 +-0.6679 -0.3645 -2.3731999999999998 +2.6793 -0.1924 0.0 +-5.1159 -1.1265 2.4703 +-5.7047 2.2765 2.3331 +-4.3927000000000005 -0.5153 2.783 +-4.4567000000000005 0.3229 3.1806 +3.0802 1.7286 15.479999999999999 +1.5122 4.2913 1.0 +1.5122 4.2913 11.3 +-0.1262 -3.6832999999999996 -0.6062 +-4.5165999999999995 -2.0004999999999997 0.5 +-5.1054 -0.5236000000000001 2.528 +-4.907 0.9344 1.6487999999999998 +1.0578 -3.8442 -2.4669 +4.2706 -1.5039 4.3626 +2.8946 -2.0746 -2.8000000000000003 +1.5186 1.8268 -0.0552 +-5.035 -0.9561 3.4179 +-7.262200000000001 -0.9487000000000001 3.1164 +-5.6238 -0.4442 2.3783 +2.8306 -1.447 -0.5 +-5.9502 1.5564 3.453 +-4.3118 -0.6959 2.2076 +-5.4254 -1.2963 1.9562 +-0.24780000000000002 -0.3259 -1.6 +-4.6382 -0.7484000000000001 3.2948 +-2.475 4.7632 0.44999999999999996 +-8.043 -1.9054000000000002 2.5073000000000003 +-8.043 -1.4725 3.3518 +-8.043 -1.3788 3.0249 +-8.043 -0.716 3.1350999999999996 +-8.043 -1.5503 2.8764000000000003 +-8.043 -1.0895 2.3887 +-8.043 -0.983 2.2601 +-8.043 -1.3820999999999999 3.1973000000000003 +-8.043 -1.3012 2.3557 +-8.043 -1.6066 2.3177 +-8.043 -1.2633 2.1856 +-8.043 -1.7671 2.7175000000000002 +-8.043 -1.1403999999999999 3.0319 +-8.043 -1.5948 2.71 +-8.043 -1.7763 2.2645 +-8.043 -0.9530000000000001 2.8842 +-8.043 -0.9402 2.541 +-8.043 -0.8209 2.9757 +-8.043 -0.74 2.7 +-8.043 -0.7876 2.4742 +-8.043 -0.9051 2.71 +-8.043 -1.9209 2.8559 +-8.043 -1.595 2.7 +-8.043 -0.6565 2.3504 +-8.043 -1.0602 3.3621 +-8.043 -1.7600999999999998 3.1543 +-8.043 -1.532 2.4842 +-8.043 -1.7680000000000002 2.6915 +-8.043 -1.5618999999999998 2.0922 +-8.043 -0.5635 2.7518000000000002 +-8.043 -0.905 2.7 +-8.043 -0.9625999999999999 2.0740000000000003 +-8.043 -1.034 3.1729 +-8.043 -1.2969 2.0185 +-5.0926 0.6987 1.5652 +1.9858 2.2921 0.0 +-8.4334 1.9518 2.8655 +-7.6462 -1.8859000000000001 2.9000000000000004 +-4.3694 -0.5825 3.0139 +0.8082 -3.8110999999999997 -0.6037 +-5.483 0.6105 3.5048999999999997 +-3.3838 -3.3334999999999995 1.0 +-3.3838 -3.3334999999999995 11.3 +2.9778 0.1905 -0.5 +-7.703799999999999 -0.9374 2.5488 +-4.2926 -0.5159 2.7851 +0.5586 -3.5965 -2.0818 +-8.2222 0.5883 2.4171 +-1.6685999999999999 3.1461 -2.8000000000000003 +0.9554 -3.5242000000000004 -0.5523 +0.8914 -2.699 -0.4897 +3.5794 2.7466 0.5 +-5.4638 -0.6871 3.1870999999999996 +-1.1374 -3.8442 -0.5422 +0.1106 4.5385 1.0 +-7.819 -1.1798 2.0292999999999997 +0.6354000000000001 -3.5059 -1.9887 +-5.195 -1.9746 2.9924 +-5.195 -0.5842 3.0314 +-4.9326 -1.0057 3.4396999999999998 +0.9682 -3.9293 -0.2052 +-6.763 -1.1904 2.5584 +-6.763 -1.195 2.8396 +-6.763 -1.195 3.0406 +-6.763 -1.3916 2.6404 +-6.763 -1.3895 2.7550000000000003 +-6.763 -0.8501 2.71 +-6.763 -1.3050000000000002 3.0406 +-6.763 -1.3050000000000002 2.3594 +-6.763 -1.3050000000000002 2.5604 +-6.763 -1.1972 2.3569 +-6.763 -1.1103999999999998 2.645 +-6.763 -1.3134 2.8386 +-6.763 -0.9094 2.645 +-6.763 -0.9094 2.7550000000000003 +-6.763 -1.6500000000000001 2.7 +-6.763 -1.5906 2.645 +-6.763 -0.8935000000000001 2.7025 +-6.763 -1.1113 2.7635 +-6.763 -1.6040999999999999 2.7127 +-0.2094 3.5138000000000003 15.479999999999999 +0.3154 -5.1612 -2.0015 +2.9394 4.9726 0.44999999999999996 +2.9394 4.5536 0.0 +-4.7278 0.45599999999999996 3.4055 +-4.4654 0.8722000000000001 1.7175 +0.9745999999999999 -3.3000000000000003 -2.2605 +-4.8557999999999995 1.7036 1.7614 +-4.9197999999999995 1.3006 3.7125 +-4.7854 0.7547 3.5956 +3.669 3.0168 1.0 +3.669 3.0168 11.3 +-9.043700000000001 0.7998 2.6479 +-9.043700000000001 1.5203 2.3361 +-9.043700000000001 1.0699999999999998 2.284 +-4.454899999999999 0.062299999999999994 3.3229 +-0.9157000000000001 -3.8442 -0.4266 +-2.0933 -4.0853 0.36 +-3.7956999999999996 2.0296000000000003 0.36 +-3.7956999999999996 2.3404000000000003 0.5 +3.5451 0.9114000000000001 0.0 +-7.9237 -1.5569 2.8666 +-5.4981 -0.5173 2.8141 +-5.5621 -0.8307 3.2987 +-4.5125 -1.3903 1.9789999999999999 +-5.3637 1.0331 3.9116999999999997 +-4.902900000000001 2.3384 2.8064999999999998 +2.1755 2.4764 -0.5 +-5.7541 1.6419 3.6457 +-5.2293 -0.5002000000000001 2.4891 +4.4731 -0.5889 0.5 +-5.4213 1.0209 3.7560999999999996 +-0.5061 1.3782 -0.06 +-5.1589 -1.5631 2.9204 +-5.1589 -1.5634 2.4548 +-5.2229 -1.809 2.2234 +0.21710000000000002 -4.5345 1.0 +-7.7765 -1.9053 2.8992 +-5.3509 -0.6883 2.1568 +-5.1525 -1.6943 3.2883999999999998 +-4.4293 -1.4375 1.9789 +-6.3941 0.7704 2.5024 +-1.2805 -3.7281 -2.4642 +-9.011700000000001 1.6861000000000002 3.4783 +1.0811 -0.3823 -0.06 +0.4923 -3.3000000000000003 -0.6466000000000001 +0.6267 -2.4242 -1.6132 +0.3003 -3.6581 -0.5967 +-3.3029 1.3317 -2.4 +-4.6789 -1.8384 3.3791 +-8.5445 0.6106 2.3672 +-8.5445 0.8947 2.0728 +-4.4805 0.22 2.6437 +-4.4101 -0.7786000000000001 2.6479 +-4.4101 -1.7413999999999998 2.63 +-4.9989 0.4553 2.0212 +-4.4741 -1.2258 1.9195 +-5.5877 -0.6257 2.2994 +-7.552499999999999 -1.7747 2.6993 +-5.3893 -1.72 2.0740000000000003 +1.6891 1.5237 -0.5 +-9.0565 2.0757000000000003 2.7542 +-5.8437 0.2696 1.9820999999999998 +0.9083000000000001 -3.5242000000000004 -2.5080999999999998 +-4.8581 2.2814 3.0195 +-7.8725000000000005 -1.5352 2.8881 +-7.8725000000000005 -0.9405 2.8624 +-7.8725000000000005 -1.4104 2.3909 +0.8443 1.2652999999999999 -0.06 +0.8443 -0.7266 -0.06 +-5.8373 0.8854000000000001 3.8581999999999996 +-4.589300000000001 0.2252 2.5233 +2.7515 3.6818999999999997 0.49979999999999997 +-0.7196 -1.1559 -1.4000000000000001 +4.458 0.8592000000000001 1.0 +4.458 -0.8592000000000001 1.0 +2.2308000000000003 3.6428000000000003 0.5 +-4.6491999999999996 0.6970999999999999 3.5669 +-4.3868 -0.783 3.2772999999999994 +-8.7772 0.8045 2.7283 +-5.0396 -1.8193000000000001 3.1674 +-5.366 0.3902 1.8196 +-5.366 0.0471 2.9682 +-5.1036 -0.9357000000000001 3.4090000000000003 +1.1236 -3.5242000000000004 -2.3097 +-6.0188 -1.5526 2.5329 +-5.756399999999999 1.63 3.6463 +-2.2812 -1.9764 -0.5 +-8.5724 2.0593 2.4826 +-4.7708 0.2042 2.7421 +-3.1323999999999996 -1.6320000000000001 11.3 +-7.324400000000001 -1.387 3.1937 +-7.324400000000001 -1.1129 2.2062999999999997 +-5.1612 -0.5697 2.3231 +-3.8491999999999997 -2.6109 14.0654 +3.4916 3.0254 0.0 +3.4916 3.0254 0.5 +-4.1756 1.744 3.6319 +4.214799999999999 1.6873 1.0 +4.214799999999999 -1.6874 1.0 +-4.566 2.1607000000000003 2.2001 +-4.303599999999999 -0.5273 2.5427 +-7.7084 -1.3047 3.3806999999999996 +-7.7084 -0.9232 2.6959 +-4.2332 -1.9203999999999999 3.0079000000000002 +-4.5596 2.2848 2.6082 +4.4196 -1.4463 14.0146 +-1.0844 -3.8442 -0.3735 +0.8163999999999999 -3.424 11.3 +-6.0636 1.6787 1.7163000000000002 +-6.0636 1.1598000000000002 3.6276999999999995 +-6.0636 0.9609 1.6669 +-5.5388 1.9504000000000001 3.5290000000000004 +-5.2764 -1.6136000000000001 2.0105 +-0.95 -0.9959000000000001 -0.06 +-8.3548 0.8881 2.3772 +-1.014 -1.7232999999999998 -0.0 +1.1492 -3.3589 -0.4336 +-8.2204 0.8511 3.3002 +-4.9436 -0.522 2.9919000000000002 +-4.2204 -0.30820000000000003 2.5239000000000003 +-4.2204 -0.6265999999999999 3.4276 +-4.2204 -1.5684 3.6035999999999997 +-4.2204 -2.1917 2.876 +-4.2204 -1.8727 1.9716999999999998 +-4.2204 -0.9316 1.7964 +-4.809200000000001 2.2609 2.5114 +-2.646 -5.607 0.0 +-2.646 -5.607 1.0 +-0.22039999999999998 -5.1612 -2.0318 +-4.8732 -0.7858999999999999 2.0802 +-4.8732 -1.4864 3.4114 +-7.8876 -1.5757 2.6984 +-7.7532000000000005 -1.0298 2.9701 +6.1412 0.8515999999999999 0.0 +6.1412 0.8515999999999999 1.0 +-4.8028 0.8824000000000001 3.6821 +-4.5404 2.1229 3.2392999999999996 +-5.1292 -0.5189 2.4318 +-1.0652 -3.9293 -2.5864000000000003 +-5.718 0.2396 2.4791 +0.906 -3.7262999999999997 -0.1286 +-5.1868 -0.52 2.779 +-5.5772 1.3761 3.4930000000000003 +5.3027999999999995 -0.21159999999999998 0.0 +-2.6908000000000003 -4.487 0.44999999999999996 +4.3876 1.1097 4.3643 +-5.180400000000001 -1.9772999999999998 2.9942 +-7.734000000000001 -0.9686 3.2308000000000003 +-7.6019000000000005 -0.6456 2.8998 +-0.7858999999999999 1.0412 -1.4000000000000001 +-0.7858999999999999 -0.9507 -1.4000000000000001 +-4.9139 -1.8688 3.1696 +0.2637 -4.4242 -0.7741 +-4.6515 0.9766 3.7253000000000003 +-5.7651 1.7215999999999998 2.9971 +-5.7651 1.1022 3.1517000000000004 +-0.9138999999999999 -3.5242000000000004 -2.3047999999999997 +-0.7155 -4.0242 -1.0103 +0.33409999999999995 -4.0242 -0.6768 +-2.4179 2.0552 -0.5 +-5.1699 -0.8699999999999999 2.02 +-2.7443 -0.0789 0.0 +0.7948999999999999 -3.4649 -1.3599 +-4.4467 0.43119999999999997 1.6315 +-4.4467 -0.0767 2.8658 +-4.4467 0.7392 3.9243 +-3.9218999999999995 2.2615 2.9988 +-7.7875 -1.3051 2.0199000000000003 +-5.3619 2.3741000000000003 3.2098 +-5.0995 -1.1712 3.4741 +-5.0995 -1.2225 3.4781 +-2.9363 4.5545 0.44999999999999996 +-5.6883 -1.9730999999999999 2.3106999999999998 +-4.6387 2.2965 2.3896 +-6.0146999999999995 -1.5190000000000001 2.4932 +-1.4259000000000002 -0.27590000000000003 -1.4000000000000001 +-8.0435 1.9965 2.343 +2.4461 0.251 -0.5 +1.3325 -1.1223 -2.3817999999999997 +-5.2211 -1.5699 3.4086 +0.026899999999999997 -3.7241999999999997 -0.5716 +0.2893 -0.7377 -0.06 +0.2893 0.7377 -1.4000000000000001 +-1.0867 -2.6993 -0.3055 +4.0909 1.9389 4.3629 +-9.0803 0.7955 3.2626000000000004 +1.4733 3.4485 -2.7 +1.4733 3.4485 -0.1 +-5.0803 -1.6129 2.9562 +-5.0803 -1.6129 2.4762 +-5.0803 -1.1329 2.9562 +-4.2931 -0.5658 2.4318 +-1.9955 4.0465 0.5 +-4.7475000000000005 2.1241 2.0396 +0.8909 -3.9124 -0.5969 +-0.48510000000000003 -3.2242 -1.8519999999999999 +-4.8755 1.3173000000000001 3.7731 +-4.6131 -1.3901000000000001 1.9788000000000001 +1.0893 -3.8101999999999996 -2.6672000000000002 +-4.4147 -0.8536 3.1872 +-7.7555 -1.4326999999999999 2.4059 +2.0109 2.3524 -0.5 +2.0109 -2.1024000000000003 -0.5 +-4.6067 -0.8384 3.3583000000000003 +-4.3443000000000005 -1.8057 3.1809999999999996 +-1.0675000000000001 -3.8136 -0.6706 +-3.5570999999999997 0.1716 -2.4 +-4.6707 -0.7314 2.1238 +-4.4083 -1.7002 2.9600999999999997 +-5.7843 1.6347 2.9472 +-5.7843 0.9934999999999999 3.1399000000000004 +-8.536299999999999 1.1821 2.2518 +-8.536299999999999 0.8279 2.5347999999999997 +-4.4723 -1.9785000000000001 2.4035 +-5.5859 0.5121 3.424 +-0.4083 -3.6954000000000002 -2.0812 +0.6413 -1.2012 -1.4000000000000001 +-5.3875 2.2719 2.803 +-2.1747 -2.9314 0.0 +-5.1891 -1.7706 2.1191 +-0.8626999999999999 -3.8442 -0.2579 +-5.5155 -0.5601 3.0610999999999997 +-5.2531 -0.5627 2.3286000000000002 +0.9741 -3.5242000000000004 -2.2435 +2.6125 -5.0013000000000005 0.0 +-4.5299 1.8317 3.5435000000000003 +-5.6434999999999995 -1.8985999999999998 3.2697 +-5.6434999999999995 2.2768 2.7824999999999998 +-5.6434999999999995 -0.9835999999999999 1.8788 +-5.6434999999999995 -2.0603 2.4021 +4.3853 -1.5499 14.424600000000002 +-1.1827 -3.7264 -2.1795 +0.7181 -3.7241999999999997 -0.3191 +-5.0483 -1.976 2.8282000000000003 +-4.7859 3.9415 0.0 +-4.7859 3.9415 1.0 +-5.8995 1.6423 3.4194000000000004 +-2.3603 -4.5381 1.0 +-2.3603 -4.5381 0.44999999999999996 +-2.3603 4.9882 0.44999999999999996 +-2.3603 -4.9881 1.0 +-2.3603 -4.9881 0.44999999999999996 +-2.3603 4.5382 1.0 +-2.3603 4.5382 0.44999999999999996 +-5.1123 -0.013300000000000001 2.5585 +-5.1123 2.4526 2.2988999999999997 +-5.505 -0.5257000000000001 2.5238 +1.247 1.5637 0.0 +1.247 -1.5637 -0.045 +-8.321000000000002 1.7637 3.1959 +-8.321000000000002 0.5637 2.8969 +-8.321000000000002 1.4853 3.3809 +-4.5194 -0.43150000000000005 1.0 +-4.5194 0.43160000000000004 1.0 +0.9206000000000001 -3.9284 -2.5843000000000003 +1.183 -3.9311 -2.4736000000000002 +-5.1082 -1.9796999999999998 2.9675 +2.7574 -3.6694999999999998 0.5 +2.7574 -3.6694999999999998 0.1 +-2.7466 3.5794 0.5 +-5.2362 -0.8631 3.3744000000000005 +-3.5978000000000003 -2.7365 4.3685 +-5.3642 -0.5946 2.6986 +-5.3642 -1.6572 2.1865 +-0.513 -2.4242 -1.8213 +0.5366 -3.5242000000000004 -0.7468 +-6.017 -1.0370000000000001 2.5317 +-7.393 -1.6215 2.71 +-7.393 -0.8782999999999999 2.7 +-7.393 -1.6216000000000002 2.7 +-7.393 -0.8784000000000001 2.71 +-5.7546 1.6424 3.6447 +-5.7546 1.6362999999999999 3.6473 +-5.7546 0.6387 3.521 +-7.194599999999999 -1.0201 3.2429 +-0.8330000000000001 -3.6579 -1.5577 +1.0678 -3.9678999999999998 -2.34 +-8.5642 0.5957 2.1803 +-5.3514 -1.4813 3.401 +-3.1882 -3.3436 0.0 +-3.1882 -3.3436 0.5 +-5.6778 -0.4246 2.6270000000000002 +-5.6778 -0.6168 2.1654 +1.0742 -3.3000000000000003 -0.5015000000000001 +2.9749999999999996 5.1528 1.0 +2.9749999999999996 5.1528 0.44999999999999996 +2.9749999999999996 -4.3734 1.0 +2.9749999999999996 -4.3734 0.44999999999999996 +2.9749999999999996 -5.1529 1.0 +2.9749999999999996 -5.1529 0.44999999999999996 +2.9749999999999996 4.3734 1.0 +2.9749999999999996 4.3734 0.44999999999999996 +-5.5434 -0.6293 3.1682 +-5.281000000000001 -1.9820999999999998 2.4028 +-6.3946000000000005 0.7541 2.378 +-5.345 -0.5275 2.4021 +-2.1961999999999997 -3.9399 0.36 +-5.0122 0.9634 1.7002 +-5.0762 2.008 3.382 +-0.22499999999999998 1.4000000000000001 -1.6 +-0.22499999999999998 1.4000000000000001 -2.35 +-0.22499999999999998 0.7155 -1.6 +1.9382 -2.9383 15.479999999999999 +-4.9418 -2.0367 0.5 +-4.9418 2.7407 1.0 +-6.0554 1.7443 3.5878 +-6.0554 2.0531 3.1314 +-4.417 -1.2612 3.2323 +-4.417 -1.8435 2.9156 +2.8598 -1.4529999999999998 0.0 +2.0086 3.1667 -0.1 +1.1574 -3.9164999999999996 -2.251 +-5.4601999999999995 0.9599 1.6480000000000001 +1.3558000000000001 -6.0499 0.0 +1.3558000000000001 -6.0499 1.0 +-4.4106 -0.6086 2.3202 +-9.063400000000001 1.3808 3.1740999999999997 +-5.2618 -0.13749999999999998 0.44999999999999996 +1.2278 -0.3735 -1.4000000000000001 +-4.801 1.8413 1.7795999999999998 +-5.652200000000001 1.9057000000000002 3.4796 +0.575 0.6209 -1.4000000000000001 +0.575 0.6209 -0.06 +0.575 -0.6209 -0.06 +-4.4041999999999994 -2.0367 0.0 +0.7734000000000001 -0.0808 -1.4000000000000001 +-5.517799999999999 2.2355 3.0267 +-4.7306 2.3216 2.5228 +-0.1418 0.374 -1.6 +-7.872999999999999 -1.0304 2.4206 +-7.872999999999999 -1.5610000000000002 2.5406 +-7.872999999999999 -1.375 3.025 +1.1062 -3.7241999999999997 -2.5179 +-5.185 -1.5439 1.9820999999999998 +-7.936999999999999 -1.7303 2.899 +-2.497 4.0407 1.0 +-2.497 4.0407 11.3 +-3.873 2.75 1.0 +-3.873 2.75 4.3999999999999995 +-3.873 -2.75 1.0 +-3.873 -2.75 4.3999999999999995 +-4.1994 1.7618000000000003 1.7673999999999999 +-2.625 -0.21649999999999997 0.0 +-2.625 -0.21649999999999997 -0.5 +-4.0009999999999994 2.31 0.0 +-4.0009999999999994 2.31 0.5 +-5.114599999999999 0.1596 2.0444 +-5.114599999999999 2.402 3.2030000000000003 +-5.114599999999999 2.1765 1.8321 +-7.8666 -1.9068 2.7102999999999997 +2.751 0.053899999999999997 -0.5 +-7.7985 -0.7358 2.6999 +-4.3233 -4.444 0.0 +-4.3233 -4.444 1.0 +-5.3025 -0.8056000000000001 2.1116 +3.6767000000000003 0.7377 -0.1 +0.9247 -3.5242000000000004 -2.2887999999999997 +-5.366499999999999 0.8222999999999999 3.6950999999999996 +0.8607 0.7377 -0.06 +4.1375 -4.750900000000001 0.1 +4.1375 -4.750900000000001 0.8999999999999999 +-5.4305 0.9362 1.7026 +-5.4305 1.3613 3.7763999999999998 +4.3359000000000005 1.3793 1.0 +4.3359000000000005 1.3793 11.3 +-8.7713 1.6836 2.8336 +-8.7713 0.8151 2.5707 +-2.2177 3.9537000000000004 1.0 +2.6335 3.6982 1.0 +-7.8496999999999995 -1.7227 2.8993 +-4.5729 -0.6909000000000001 3.1766 +-4.5729 -2.1425 2.6367000000000003 +-5.6865 -1.3696 3.5103000000000004 +-5.6865 -0.8169 2.0059 +-5.4241 2.3281 2.7505 +5.455900000000001 -3.15 0.1 +5.455900000000001 -3.15 0.8999999999999999 +-8.7649 0.8160000000000001 2.8452 +-4.5025 -0.8057 2.1116 +0.9375 -3.8238000000000003 -0.6701 +3.1007 -1.3776 0.0 +-7.8433 -1.8936000000000002 2.5258 +2.5119 4.9006 0.44999999999999996 +3.2991 -5.367100000000001 0.1 +3.2991 -5.367100000000001 0.8999999999999999 +-7.9073 -1.0156999999999998 2.4855 +-1.0913000000000002 -3.7241999999999997 -0.5302 +-0.8289 -3.5242000000000004 -1.2941 +-5.4817 0.24710000000000001 2.2884 +-3.9072999999999998 2.2559 0.5 +-3.9072999999999998 2.2559 4.3783 +-5.2833 -1.1904 3.2775 +2.2559 3.9072999999999998 0.5 +-4.0353 -2.0803 1.0 +-8.3553 1.3262 2.2227 +-4.5537 -1.5643 1.991 +-5.4689000000000005 0.5685 1.8492000000000002 +-8.2209 0.8057 2.137 +-1.6673 -2.4888 0.0 +-1.6673 -2.5087 -0.5 +3.5103000000000004 1.3193 -0.1 +-4.681699999999999 -1.0378 1.8255000000000001 +-4.681699999999999 -0.3501 2.7 +-4.419300000000001 -1.3462999999999998 3.3162 +-4.419300000000001 -1.0519 3.4271000000000003 +-5.2705 -0.8803 3.3341999999999996 +-8.6113 0.3836 2.9486 +-4.3489 -1.32 3.4431999999999996 +0.5023 4.495699999999999 4.3664000000000005 +-7.753699999999999 -1.4521 2.9784 +-8.6689 0.3172 2.701 +-3.2289 -0.2444 -0.5 +0.31029999999999996 -3.7241999999999997 -2.1759 +-4.3425 -1.6650999999999998 3.3163 +-1.0657 -3.8442 -2.5864000000000003 +-6.0449 0.7174 3.5714 +5.686299999999999 0.2087 0.44999999999999996 +-5.3217 -0.6171 3.1618 +0.31670000000000004 0.7101999999999999 -0.06 +1.9550999999999998 3.0822 0.0 +1.6287 3.2767999999999997 -2.8001 +-5.7761 0.0593 0.44999999999999996 +-4.4641 -1.7375000000000003 3.2576 +-5.5777 0.23310000000000003 2.8583999999999996 +0.2591 -3.6954000000000002 -2.1508 +3.5359000000000003 -0.42389999999999994 -2.8000000000000003 +0.5215 -3.4243999999999994 -2.0153 +5.1103000000000005 -0.22499999999999998 0.44999999999999996 +5.1103000000000005 0.22499999999999998 1.0 +5.1103000000000005 0.22499999999999998 0.44999999999999996 +-8.585700000000001 1.5652 3.0578000000000003 +-5.4392000000000005 -0.7066 2.4789 +-5.1768 0.3232 1.0 +-8.5176 0.7675000000000001 2.6588000000000003 +-4.716 0.5670999999999999 1.0 +-4.716 0.5670999999999999 11.3 +-4.4536 0.2201 2.8158 +-5.3048 -0.5801999999999999 2.3802 +-4.5176 -0.5359 2.4653 +-5.6312 0.1827 2.9225999999999996 +-5.4328 0.307 3.1293 +-4.9079999999999995 -1.1388 1.9727000000000001 +-7.9224000000000006 -0.9431999999999999 2.852 +-6.0216 1.52 1.6364 +-5.5607999999999995 -0.5687 2.4233000000000002 +-5.0360000000000005 -0.5194 2.4147 +-5.0360000000000005 -0.6817 2.1583 +-1.2344000000000002 -3.5242000000000004 -2.6788 +1.9784 2.1756 -0.5 +-5.4264 -1.9896 2.8001 +-1.164 -3.5242000000000004 -2.4259 +-5.618399999999999 -1.9565 2.4655 +-5.9448 0.2264 2.3064 +-4.8952 0.2524 2.4263 +0.2824 -1.9931999999999999 0.0 +1.9207999999999998 -2.5398 -0.5 +-4.6328000000000005 -1.0055 3.4402000000000004 +-4.3704 -2.0248 2.6228000000000002 +1.332 -4.5594 1.0 +1.332 -4.5594 11.3 +-5.2216 -0.4767 2.7903000000000002 +-5.548 1.8616000000000001 1.8585999999999998 +-8.9528 0.31670000000000004 2.7004 +-0.8248 -3.5742000000000003 -1.7117 +-8.7544 1.7319999999999998 2.7282 +-5.0168 -0.9958 2.0077000000000003 +-4.492 1.4285 3.7072000000000003 +-5.0808 0.7969 3.8421 +-7.8328 -1.1751 3.3676999999999997 +-1.2792 -3.7261 -2.3243 +-4.8824 -1.8726 2.2298 +-4.3576 -1.2725 1.0 +-9.0104 1.7002 2.7561999999999998 +-5.010400000000001 -0.7255 3.2772999999999994 +-4.2232 -2.0741 3.1755 +-4.2232 -1.5904999999999998 2.048 +-4.2232 -0.4259 2.2245 +-4.2232 -1.2502 3.6515 +-4.2232 -0.4261 3.1759000000000004 +-4.2232 -2.0739 2.2241 +-4.2232 -1.2498 1.7485 +-5.5992 1.0541 3.7108000000000003 +-5.0744 2.2824 2.59 +-4.6136 0.6126 3.5071 +-4.3512 -1.9032 2.3225 +-4.9399999999999995 -0.7299 3.2800999999999996 +-0.15280000000000002 -3.5288 11.3 +-4.5432 0.2437 2.383 +2.2728 3.9218999999999995 4.3610999999999995 +-5.132 -1.9355 2.4341999999999997 +-4.4088 -1.277 0.5 +-4.4088 -1.277 0.1 +1.0312 -3.8442 -0.5952 +-5.5224 1.2564 3.7906000000000004 +-4.472799999999999 0.7688 3.639 +-5.586399999999999 1.7727 1.7422 +-7.5512 -0.9487000000000001 2.8153 +-7.5512 -1.8067 2.7099 +-5.7784 1.0007 3.0386 +-0.8632000000000001 -3.5242999999999998 -0.3984 +1.3 -3.7241999999999997 -2.2375 +1.3 -3.5242000000000004 -2.2375 +-4.7288 1.2931 1.654 +-4.4664 -1.624 3.3383000000000003 +-2.3032 -2.6779 15.479999999999999 +-5.1192 -1.0073 3.0564999999999998 +0.5832 -3.4905 -0.7842 +-3.5448 -2.8525 1.0 +-3.5448 -2.8525 11.3 +-4.396 -0.52 2.7847 +2.0296000000000003 3.7956999999999996 0.36 +-5.8999999999999995 2.2089999999999996 0.1 +-5.8999999999999995 2.2089999999999996 0.8999999999999999 +0.9159999999999999 -3.8288 -2.6637999999999997 +-5.6376 -1.2073 3.5676 +-5.1128 1.1051 3.9426 +-8.5839 1.1616 2.2379 +-4.519900000000001 -1.6299000000000001 3.38 +-4.519900000000001 0.1742 2.8678 +-0.7183 -3.7259 -2.3456 +1.1825 -3.8442 -2.4758999999999998 +-4.5839 -0.5642999999999999 2.9638 +-9.038300000000001 1.6296000000000002 2.4684 +-5.3647 0.6239 3.5856 +-5.3647 0.187 2.9478 +-5.7551 1.6418 3.6442 +-5.7551 0.9612 3.6843 +-5.492699999999999 1.8980000000000001 3.4802 +-5.230300000000001 -1.9498000000000002 2.9564 +-7.7199 -1.4368 2.9567 +3.0961 -0.251 0.0 +-4.3087 -1.5506 2.0204 +4.4081 -1.7697999999999998 14.3721 +-4.9615 0.4915 1.9103999999999999 +-5.0255 -1.2552 3.4871 +-0.9615 -2.6993 -0.27759999999999996 +-5.9407000000000005 2.0718 2.0628 +-4.3023 -2.0322 2.7001 +-1.0255 -3.3579 -0.5566 +-3.7775000000000003 -2.6074 0.5 +-3.7775000000000003 -2.6074 0.1 +-4.6287 0.2067 2.784 +4.0881 -2.0942 0.1 +1.2721 -3.8454 -2.3559 +-6.395099999999999 0.8863 3.1877000000000004 +-2.8559 3.6316 0.0 +-2.8559 3.6316 0.5 +-1.2815 -3.5242000000000004 -0.1 +-5.9343 1.4959 3.8119 +0.8817 -3.5742000000000003 -1.4035 +-5.9983 0.6602 1.8376 +-3.3103000000000002 -3.1795999999999998 0.1 +-4.750299999999999 0.5217 3.4229999999999996 +-5.0767 -0.5466000000000001 2.4575 +-4.5519 2.717 3.0328999999999997 +-5.6655 1.4976 2.9648 +-5.6655 1.1387 3.2249 +-5.6655 1.7846000000000002 3.0396 +-5.6655 1.06 2.9389 +1.6753 -1.1066 -0.06 +-2.9775 -1.4567999999999999 -0.5 +-4.3534999999999995 -0.4738 2.6862 +0.4977 -3.7241999999999997 -0.7167 +-8.5455 0.8234 3.328 +-5.0063 -0.6159 2.3231 +1.8096999999999999 2.634 -0.5 +-5.6591000000000005 1.1009 3.7803999999999998 +1.4193 0.2693 -0.06 +-5.7231 1.6707 1.6953 +-5.4607 -1.3453 1.925 +0.2417 2.6172 -0.5 +-9.0639 0.6 3.1774999999999998 +-0.6735 0.7929 -1.4000000000000001 +-5.0639 -0.6291 2.2335000000000003 +-4.5391 -0.7294 3.2809 +-8.993500000000001 0.8918 2.3535 +-5.7167 2.1303 2.064 +-7.6815 -1.1868 2.025 +-4.4047 -1.778 11.3 +-5.8447 2.1875 1.9274 +-5.8447 1.9415000000000002 3.6989 +-8.8591 1.7161 2.8576 +-5.5823 1.3826 3.5069999999999997 +-0.9934999999999999 -3.7241999999999997 -2.553 +-5.7103 0.2412 2.954 +-6.0367 0.5418000000000001 1.8573 +-4.3983 -1.9857 2.9692 +-5.2495 -1.3287 1.9259 +-4.4623 2.1277 2.0518 +-1.1855 -3.8441 -0.20149999999999998 +-1.2494999999999998 -3.5247 -2.7029 +-5.3775 -2.0011 2.9045 +0.5872999999999999 0.4817 -1.6 +-2.6895 -2.6133 -2.7 +-2.6895 -2.6133 -0.1 +-0.26389999999999997 2.5 0.0 +-5.5055 0.45030000000000003 3.4414 +-4.259799999999999 2.103 3.3247 +-4.5862 -2.2186999999999997 0.5 +4.393 4.515700000000001 0.1 +4.393 4.515700000000001 0.8999999999999999 +-5.5014 2.1779 2.2287999999999997 +-8.5158 1.2007999999999999 3.1826 +-5.0405999999999995 1.3660999999999999 1.6012 +-5.367 1.9854 3.4143 +-5.367 0.3806 3.3612999999999995 +3.2858 3.1329000000000002 1.0 +-4.3814 -0.8845999999999999 3.3408 +-2.743 -1.0076999999999998 0.0 +1.0586 -3.5242000000000004 -0.2791 +-5.495 2.2721999999999998 2.8708 +-4.5094 2.1123 3.261 +-5.8854 1.4559 3.4374000000000002 +-5.623 0.6105 3.5048999999999997 +-5.0982 1.394 1.4394 +-4.5733999999999995 -1.8948 2.2588 +-5.686999999999999 -1.1863000000000001 3.2815999999999996 +-6.0134 2.0147000000000004 3.4583999999999997 +0.8026 -4.0242 -1.4496 +-8.0422 0.503 2.3472 +-4.8294 -1.8995000000000002 0.5 +2.249 0.053899999999999997 0.0 +-4.630999999999999 0.2978 3.0861 +2.185 3.5545 0.1 +-6.3974 1.4735 2.3663 +1.2058 -3.837 -2.5797 +-4.3622000000000005 -0.5176000000000001 2.4403 +-5.7382 0.7512 3.5957000000000003 +-7.703 -1.3012 2.3557 +-7.703 -1.25 3.0507 +-9.078999999999999 1.9578000000000002 2.7886 +-4.4902 0.29650000000000004 3.0894999999999997 +-5.6038 1.5185 3.7041 +-3.1782 -1.2248 0.0 +-3.1782 -1.1861 -0.5 +-4.291799999999999 -0.5626 2.9677 +-5.143 -0.9301999999999999 2.4116999999999997 +-5.143 -1.04 2.5483 +-5.9942 1.1729 3.7760000000000002 +-5.9238 2.221 3.3209000000000004 +-5.399 1.9876 3.5038 +0.041 -3.4631000000000003 -0.5937 +-4.6118 0.3268 2.2286 +-9.0022 0.9804999999999999 3.0745 +-5.463 1.2832 3.7313 +-5.591 0.5952 3.3346 +-5.591 1.9793999999999998 2.1363 +-5.591 2.1599 2.5968999999999998 +-5.591 1.3745 3.5900000000000003 +-5.591 2.0372999999999997 2.4741 +-5.591 1.6167 3.5205 +-5.591 1.5859999999999999 1.8363999999999998 +-5.591 1.094 1.7843999999999998 +-5.591 1.8272 3.3901 +-5.591 0.35469999999999996 2.9023 +-5.591 1.0252000000000001 3.5793 +-5.591 0.3737 2.408 +-5.591 0.6466000000000001 1.9952999999999999 +-5.591 0.4628 2.9259 +-5.591 2.0751 3.0843 +-4.8038 1.9300000000000002 3.4771000000000005 +-4.5414 0.2801 1.0 +-4.5414 0.2801 11.3 +-4.8678 0.8895 3.7171999999999996 +-0.5414 3.5198 -2.8000000000000003 +-4.6693999999999996 -1.5249000000000001 3.3848000000000003 +-7.159 1.0299 2.4507999999999996 +-7.159 1.0151000000000001 2.5543 +-7.159 1.3871 2.4602 +-7.159 0.924 2.6376 +-7.159 1.4906000000000001 2.475 +-7.159 1.3037999999999998 2.3692 +-4.9958 -3.6718 0.0 +-4.9958 -3.6718 1.0 +-4.9958 1.7036 1.7614 +-4.471 -0.5644 2.9754 +-5.5846 0.4351 2.6084 +-5.5846 1.8946 2.1916 +-5.3222 -1.9887 2.6178 +-4.535 -0.9561 3.4179 +-5.450200000000001 1.3415 1.6185 +-6.039 1.3225 2.1404 +-6.039 1.385 2.4671 +-6.039 1.2633999999999999 2.2765 +-6.039 1.6195000000000002 2.1351999999999998 +-6.039 0.8952999999999999 2.2504 +-6.039 0.8312999999999999 2.6780000000000004 +-6.039 1.6889 2.2245 +-6.039 1.0082 2.3555 +-6.039 1.6802000000000001 2.3875 +-6.039 0.6309 2.4579 +-6.039 1.4194 2.5037 +-6.039 1.2827 2.4146 +-6.039 1.5702 2.4732 +-6.039 1.6743999999999999 2.2726 +-6.039 0.7208 2.2887999999999997 +-6.039 1.0321 2.3395 +-6.039 0.8885000000000001 2.2776 +-6.039 0.9693999999999999 2.6587 +-6.039 1.0585 2.5219 +-6.039 1.0219 2.5563 +-6.039 1.4588999999999999 2.0711 +-6.039 0.6502 2.5961000000000003 +-6.039 0.705 2.6088 +-0.8614 -3.5242000000000004 -2.4774000000000003 +-5.5142 0.8142999999999999 3.6997 +-0.3366 -3.7241000000000004 -0.6760999999999999 +-2.0389999999999997 -2.0389999999999997 0.0 +-2.0389999999999997 2.4157 0.0 +-5.0534 0.9312 1.6438000000000001 +3.401 0.053899999999999997 -0.5 +-7.542999999999999 -1.5723999999999998 2.71 +-5.1174 -0.5337 3.0054999999999996 +-3.479 3.2516000000000003 11.3 +-4.855 0.363 3.3147 +-7.9334 -0.8000999999999999 2.4333 +-0.855 -3.3409 -2.3789000000000002 +-0.855 -3.335 -0.3953 +-4.914899999999999 0.6594 1.7771 +0.7875 -3.5242000000000004 -0.9426 +-0.8508999999999999 0.72 -1.4000000000000001 +-3.3404999999999996 0.1722 0.0 +1.7731000000000001 -2.6255 0.0 +-4.5181 -1.6209999999999998 2.0656999999999996 +-7.532500000000001 -1.5603 2.5425 +-5.3693 0.7248 3.6329000000000002 +-5.3693 3.1 0.0 +-5.3693 3.1 1.0 +-5.5613 -1.9820999999999998 2.7494 +-0.6461 3.5020999999999995 -2.4 +-0.6461 -4.4938 1.0 +-0.6461 4.4938 1.0 +0.8643 -3.7241999999999997 -0.317 +0.8643 0.2583 -0.06 +-5.4269 -1.2825 3.4819999999999998 +-3.2637 1.3505 11.3 +-7.9165 -0.6565 2.7101 +-4.6397 -1.0139 3.4152 +6.2403 0.8653 0.1 +6.2403 0.8653 0.8999999999999999 +0.7363 -4.5306 0.5 +0.7363 -4.5306 0.1 +-2.5405 4.5738 0.44999999999999996 +-8.044500000000001 1.4868 3.4894000000000003 +-4.242900000000001 -1.9425999999999999 2.4446 +-7.5837 -1.5578 2.8652 +-4.6333 -0.6392 2.2196000000000002 +-5.7469 0.2252 2.8313 +-4.9597 -1.5028 3.3908 +-8.8253 0.8528000000000001 2.416 +-8.8253 1.646 2.9854 +-5.0877 -0.5232 2.5769 +3.6290999999999998 -2.1738 0.36 +-4.3645000000000005 -1.6161999999999999 3.3401 +-5.4781 -1.1188 3.4347999999999996 +-5.5421 -0.9730000000000001 1.9727999999999999 +-4.2301 -1.4627 1.9834 +-5.3437 -1.9346999999999999 2.9677 +-8.3581 0.7728999999999999 2.6083 +-5.0813 0.5493 3.505 +-5.0813 -1.0916000000000001 2.5527 +-4.5565 -0.5531999999999999 0.5 +-4.5565 -0.5531999999999999 0.1 +-4.620500000000001 -1.1017000000000001 11.3 +-4.620500000000001 -1.1017000000000001 15.479999999999999 +-1.0813 -3.8098 -0.133 +3.2451 -1.4668 -2.4 +-4.4221 -0.6834 2.9831 +-5.2733 -1.8948 2.2588 +-4.2237 -0.4751 2.6362 +2.9891 0.9611 0.0 +-6.0541 0.36619999999999997 2.4069 +-6.0541 1.3728 3.6101 +-4.4157 -1.5895 2.1738 +-4.4157 -0.6391 2.5395999999999996 +-4.8061 2.1694 2.1986 +-7.8205 -1.9284 2.7 +-5.3949 0.1965 2.9747 +-5.4589 -1.4869999999999999 3.398 +-5.5869 1.5204 1.6463999999999999 +-3.1613 1.1516 -0.5 +-1.1261 -3.3343 -0.46340000000000003 +-8.530899999999999 0.8200000000000001 2.838 +-4.991700000000001 -1.4923 3.4402000000000004 +-4.7293 0.2252 2.5233 +-1.5165 0.1183 -1.4000000000000001 +-7.8077 -0.7485 2.3148 +-5.6445 1.9035 3.5095 +1.6963 -0.39249999999999996 -2.3807 +3.5971 -1.0597 -2.7 +3.5971 -1.0597 -0.1 +0.25630000000000003 -2.4409 0.0 +-5.5100999999999996 -0.9812 2.0155 +-3.6093 2.0265999999999997 0.36 +-5.5741 -1.9902 2.4595 +-1.0493000000000001 1.3818000000000001 -2.3924999999999996 +-5.4397 -1.7922 2.478 +-5.4356 -1.6288 2.0563000000000002 +0.9900000000000001 -0.1446 -2.4 +0.9900000000000001 0.1446 -1.4000000000000001 +-8.840399999999999 1.8611 2.0148 +-5.5636 1.0028000000000001 3.7496 +-5.4292 -0.856 2.036 +-5.1668 -1.5041 3.3923 +-6.018 -1.5205 2.5284 +-5.7556 1.6393000000000002 3.6443000000000003 +-5.6212 -2.8446 0.1 +-5.6212 -2.8446 0.8999999999999999 +-5.1604 -1.7744 2.1227 +0.8044000000000001 -3.8233 -2.5967000000000002 +-4.6996 2.2848 2.6077 +-5.614800000000001 1.8736 3.5294 +0.08760000000000001 2.2563 0.0 +-5.9412 1.6719000000000002 3.6586 +2.5132000000000003 -3.7929 1.0 +2.5132000000000003 -3.7929 11.3 +-9.0196 1.2515 3.5781 +-4.9556000000000004 -2.7351 1.0 +-4.9556000000000004 2.7351 4.3999999999999995 +-7.7076 -0.9436999999999999 2.8364000000000003 +-5.0196 2.1305 2.0608 +-6.3956 0.7935 2.5717 +-5.0836 1.9005 3.742 +3.3708 3.1346 0.1 +-4.8212 0.7357 3.6475 +-6.0628 1.4079 3.71 +-4.4243999999999994 0.9238 3.7051 +-9.077200000000001 1.9401000000000002 2.5166 +-8.8148 2.1042 2.274 +-4.4884 0.20600000000000002 2.7539000000000002 +-4.4884 -0.6174999999999999 2.2864 +-0.9492 -3.9222 -0.1968 +0.9516 -1.0767 -0.06 +-5.0771999999999995 0.2792 1.9576 +1.15 0.375 -0.06 +-2.4532000000000003 3.8794000000000004 0.5 +-2.4532000000000003 3.8794000000000004 0.1 +-8.744399999999999 0.49100000000000005 2.2997 +-5.4676 0.381 3.2670999999999997 +-5.4676 -1.9861 2.4467 +-1.6660000000000001 2.4903 -0.5 +-4.6804 2.1229 3.2392999999999996 +-1.4036 -4.3039000000000005 4.3625 +-4.417999999999999 -1.1527 3.3154000000000003 +-4.7444 0.24109999999999998 3.0051 +0.6956 -3.6573 -1.8851 +4.497199999999999 0.9181 0.5 +4.497199999999999 0.9181 0.1 +-8.674 0.47219999999999995 3.2144 +-5.134799999999999 -1.8686999999999998 3.1156 +-5.7236 0.4406 3.3531999999999997 +-4.9364 -1.9800000000000002 2.621 +-7.6884 -1.6986 2.4529 +-7.163600000000001 -1.9352 2.6224999999999996 +-7.7524 -1.5869000000000002 2.6995999999999998 +2.3404000000000003 3.7733000000000003 0.36 +2.3404000000000003 3.7956999999999996 0.5 +-0.9364000000000001 -3.8442 -2.3386 +-4.5396 -1.8193000000000001 3.1674 +-1.0644 -3.9678999999999998 -2.4638 +1.886 -4.1297 1.0 +1.886 4.1297 1.0 +-4.6676 -1.7119 3.2781 +5.949999999999999 -0.0 1.0 +5.949999999999999 -0.0 0.44999999999999996 +-5.845199999999999 2.4421999999999997 2.4676 +-5.058 -1.3617000000000001 3.4273 +-1.2564 -3.8687 -2.4116999999999997 +-4.5972 2.2248 2.2185 +-1.058 -3.7241999999999997 -2.5572999999999997 +-8.5268 0.9603 2.3414 +-7.7396 -1.5542 2.5902000000000003 +0.9131999999999999 -3.9678999999999998 -0.3738 +2.75 4.3131 1.0 +2.75 4.3131 0.44999999999999996 +2.75 5.0381 0.0 +2.75 -4.313199999999999 1.0 +2.75 -4.313199999999999 0.44999999999999996 +2.75 5.2131 1.0 +2.75 5.2131 0.44999999999999996 +2.75 -5.2132 1.0 +2.75 -5.2132 0.44999999999999996 +2.75 -4.4882 0.44999999999999996 +-0.2644 -3.4655 -2.1517 +-0.5908 0.5471 -2.3994 +-4.9812 1.9503 1.9435 +-5.1115 0.4483 1.7146000000000001 +-5.1115 0.0359 3.0364999999999998 +-5.1115 2.504 2.7767 +-5.1115 0.9705999999999999 1.4597 +-5.1115 1.8255000000000001 1.5696 +2.4917000000000002 2.8025 -0.1 +-5.1755 -1.2447 1.9129 +-6.0267 0.5452 3.437 +-8.7787 1.4024 2.2824 +-8.7787 1.0977000000000001 3.1176 +-7.9211 -0.9122 2.7104 +-6.0203 0.8194 3.6286 +-5.7579 1.3454000000000002 3.7220000000000004 +-1.2331 -3.8452 -2.2592 +0.0789 -2.2557 -0.5 +-5.9499 2.2023 2.3112 +-5.6875 -0.4989 2.3789000000000002 +-5.7515 1.3358 3.7189 +-1.9499 0.445 0.0 +-1.9499 0.445 -0.06 +-1.9499 -0.4451 0.0 +-1.9499 -0.4451 -0.06 +-7.7162999999999995 -0.9458 2.5902000000000003 +1.7236999999999998 -1.0246 -0.0 +1.7236999999999998 -4.4391 11.3 +0.8085 -3.8442 -2.4488 +-1.6811 -1.1041 0.0 +-1.6811 1.1041 -0.06 +-4.4331000000000005 -1.7096 3.3077 +-5.8731 2.1239999999999997 3.5323 +-8.6251 1.7755 2.8405 +-5.9371 2.3557 2.9181 +3.0421 2.2065 -2.7037999999999998 +-5.2139 -0.77 2.1357 +-5.2139 -1.8709 3.1665 +-8.5547 1.3316 3.4975 +-0.9514999999999999 -1.0767 -1.4000000000000001 +-8.3563 1.5247 2.3019000000000003 +-5.0795 2.3716999999999997 3.1968000000000005 +-0.7531 0.16390000000000002 -2.3943 +-5.1435 -0.522 2.9922 +-5.4699 0.21259999999999998 2.7677 +-4.4203 -1.0289 3.288 +-5.5339 2.1942 2.2784 +1.2821 -3.7248 -2.4815 +-5.3355 -0.9088 3.3992 +-4.2859 2.0556 2.0028 +4.6293 -1.0711 14.488599999999998 +1.0261 -3.9678999999999998 -0.31329999999999997 +-5.5275 2.2868 2.6104 +1.8133 -1.8186 0.0 +0.4373 -3.4242000000000004 -2.1866 +0.4373 -3.2242 -2.1866 +-5.3290999999999995 -1.1978 3.476 +-5.0667 0.43090000000000006 1.9609999999999999 +-4.8683 -1.4616 3.5721999999999996 +-4.8683 -0.3889 2.4472 +-4.343500000000001 -1.8925999999999998 2.3223000000000003 +-4.6699 1.8317 3.5435000000000003 +-4.6699 -1.9766 2.4027 +-4.2730999999999995 -1.389 3.4292999999999996 +-8.9259 1.0855 1.7714 +-5.2523 -0.4672 2.7003 +-4.9899 0.3823 3.3694 +-8.9195 0.3371 2.9619 +-5.3803 1.2093 3.787 +-1.8411 4.3917 15.479999999999999 +0.5845 -4.4242 -1.0887 +-0.7915 -3.3000000000000003 -0.9716 +-0.7915 -3.3000000000000003 -1.8284000000000002 +-3.0187 4.8499 0.0 +-5.5723 0.2698 0.0 +-8.5867 1.2105 3.1755 +0.787 -3.9059999999999997 -0.3091 +-0.653 -4.4242 -1.2537 +-5.3058000000000005 -0.8715999999999999 3.3789 +-3.1426000000000003 -3.4278000000000004 14.168 +-7.5329999999999995 -0.9412999999999999 2.8606 +-7.5329999999999995 -1.3773 3.0220000000000002 +-2.6178 -2.5436 0.0 +-2.093 -4.0851 0.1 +-7.9234 -1.0897000000000001 2.3909 +-5.4978 -0.598 2.3582 +-4.973000000000001 -1.5406 3.2323 +-4.973000000000001 -1.7822 2.4093 +-4.973000000000001 -1.8499999999999999 2.7 +-4.973000000000001 -1.798 2.9598 +-4.973000000000001 -1.3277 2.0985 +-4.973000000000001 -0.6538999999999999 2.812 +-4.973000000000001 -1.1723000000000001 3.3015000000000003 +-4.973000000000001 -0.9593 2.1677 +-4.973000000000001 -0.8336 3.1409 +-4.973000000000001 -0.7020000000000001 2.4402 +-4.973000000000001 -1.6025999999999998 2.2146 +-5.5618 -0.6096 3.049 +0.9278 -3.5242000000000004 -2.535 +-0.5122 -3.5964000000000005 -0.681 +-7.6546 -1.924 2.7102999999999997 +-1.4274 -0.9434 -2.4002 +-4.4418 -1.9373999999999998 2.4323 +-5.5554 -0.4771 2.6151 +-5.5554 -1.5972 3.3479 +2.899 -0.053899999999999997 -0.5 +-4.6338 1.0477999999999998 1.6663000000000001 +-4.4354 -1.9106 3.0218 +-2.0098000000000003 -3.6261 0.1 +-4.7618 1.0963 3.7134 +-5.0882 -0.6403 2.2790999999999997 +-0.7618 -3.7241999999999997 -0.24659999999999999 +-0.7618 1.1225 -2.4 +-5.4146 1.698 1.7579999999999998 +-3.5138000000000003 -0.2094 15.479999999999999 +-7.6418 -1.7257000000000002 2.8979999999999997 +0.7485999999999999 -3.5462000000000002 -0.9353999999999999 +-5.0178 1.4123 3.7706999999999997 +-1.2162 -0.2052 -2.4 +-1.2162 0.2052 -1.4000000000000001 +-8.2242 1.9568999999999999 2.5940000000000003 +0.755 -3.7259 -2.2564 +-5.0754 1.7443 3.5878 +-4.5506 2.2329000000000003 3.0417 +-1.0114 -3.7241999999999997 -0.23440000000000003 +-3.7634 -2.6797999999999997 0.0 +-3.7634 -2.6797999999999997 0.5 +-7.8914 -0.9606999999999999 2.8512 +-4.6146 -1.1261 1.0 +-4.6146 -1.1261 11.3 +-7.629 -1.161 3.3568000000000002 +4.627 -0.4613 14.17 +2.1374 -2.8485 -2.4 +-8.5442 1.3173000000000001 1.9785000000000001 +1.5486 0.8021999999999999 -2.3786 +-4.2178 -2.2196000000000002 15.4801 +-5.069 0.2248 2.3201 +-4.8065999999999995 2.2739 2.7317 +-4.5442 1.7974 1.8145000000000002 +-5.9201999999999995 0.6591 3.6984000000000004 +-3.757 -2.7417000000000002 14.4631 +-8.8002 0.5236000000000001 3.1997 +-4.3394 -1.932 1.0 +-4.3394 -1.932 11.3 +-8.9922 1.5404 3.0883000000000003 +-4.9922 -0.5616 2.9651 +-0.9282 -3.9316999999999998 -2.2147 +-1.0562 -3.3000000000000003 -0.5126999999999999 +4.6462 -0.9875999999999999 1.0 +4.6462 -0.9875999999999999 11.3 +-5.773 1.7179 1.9151000000000002 +-5.2482 -1.9763 2.8272 +-4.2626 -1.9788000000000001 2.4629000000000003 +0.13190000000000002 -2.7285 0.0 +-4.5209 -0.5126000000000001 2.8837 +-7.5353 -1.4233 2.401 +-7.5353 -1.0884 3.0027999999999997 +-7.5353 -1.086 2.405 +-5.4361 -1.1609 3.2855000000000003 +-0.5209 -3.3000000000000003 -2.147 +-0.5209 -3.5242000000000004 -0.653 +1.0534999999999999 -3.7241999999999997 -2.5497 +3.9399 -2.1961999999999997 0.36 +3.9399 -2.1738 0.5 +-0.7129 -3.5157000000000003 -0.8933 +-5.3657 2.0074 3.4081 +1.4503 4.2722999999999995 0.5 +-5.1033 -0.9084 2.052 +-4.9049000000000005 -0.8706 3.3802 +1.1943000000000001 -3.9311 -0.3665 +-5.1609 -1.4224999999999999 2.4709 +-5.1609 -0.9887999999999999 2.8704 +-4.7001 2.2024 2.2999 +-0.9625 0.3248 -1.4000000000000001 +4.7399 -0.30920000000000003 15.479999999999999 +0.8743000000000001 -4.5365 0.0 +0.8743000000000001 -4.5365 0.5 +1.0727 -3.7404 -1.4149 +-5.1480999999999995 -1.2804 3.4459999999999997 +3.5687 5.1944 0.1021 +-5.6025 -1.2206 1.958 +-5.0777 2.4663999999999997 2.7822 +-5.0777 2.4532000000000003 2.4992 +-5.1417 -1.0076999999999998 1.9598 +-3.2409 3.266 0.1 +-4.4185 -0.5039 2.9088 +0.7591 -0.0185 -1.6 +-8.5465 0.7927 3.2499000000000002 +-5.6601 1.0433 3.2729 +-5.6601 1.6892 3.0876 +-5.6601 1.1493 2.9976 +-5.6601 1.7952 2.8122000000000003 +-5.6601 0.8578 3.0434 +-5.7241 0.44780000000000003 2.0395 +2.9926999999999997 -2.0895 0.0 +-1.7241 -1.0356 -0.06 +-4.8025 0.153 2.5682 +0.8999 -3.4242000000000004 -1.4144999999999999 +0.8999 -3.2242 -1.4144999999999999 +1.6871 5.9661 0.0 +1.6871 5.9661 1.0 +-3.5545 2.185 0.1 +-4.9305 1.9456000000000002 1.8575000000000002 +-4.4697000000000005 0.8496999999999999 3.6754000000000002 +-4.6617 -1.5883 1.9955 +3.2039 0.25110000000000005 0.0 +-5.3145 -1.8359 3.211 +-4.2649 -0.6989000000000001 3.1936 +1.0471 -3.9321 -2.5954 +-5.5065 -2.004 2.8868 +4.5863000000000005 0.1848 0.5 +4.5863000000000005 0.1848 0.1 +-4.5872 -1.7693 3.2821999999999996 +-5.7008 0.8899 3.7236 +-5.438400000000001 -0.8335 2.2822999999999998 +-5.438400000000001 -0.8335 3.1177 +-5.7648 0.5733 3.3045 +-4.5168 -0.9958 2.0077000000000003 +2.8240000000000003 -5.0396 0.44999999999999996 +-5.367999999999999 -0.8966999999999999 3.3456 +-5.1056 -0.9374 3.4132999999999996 +-5.7584 1.7739999999999998 2.9062 +-4.5104 -0.7255 3.2772999999999994 +-7.2623999999999995 -1.7735 2.717 +-0.7088 -3.4652000000000003 -1.7738 +-5.2272 -1.2917 1.9559 +-4.964799999999999 0.9057000000000001 3.7239 +1.0 -3.7634 -2.4 +1.0 -3.7634 -0.4 +1.0 -2.6249000000000002 -0.4 +-5.6175999999999995 -0.6713 3.3516 +-5.1568000000000005 -1.9515 2.9527 +-4.632 1.4285 3.7072000000000003 +-4.632 -1.9355 2.4341999999999997 +-4.3696 -1.3844 3.4256 +0.808 -3.4912 -1.1421999999999999 +1.0064 -3.7241999999999997 -0.553 +0.5519999999999999 -3.6954000000000002 -1.9710999999999999 +-8.7536 0.7706000000000001 2.596 +2.9776000000000002 -0.9541 -0.5 +-5.016 -0.5231 2.9889 +-4.2288 -1.9837 2.803 +-5.208 -1.1381999999999999 1.9727000000000001 +-4.4208 -1.9358 2.4253 +1.2815999999999999 -3.5242000000000004 -1.4000000000000001 +1.2815999999999999 -3.5242000000000004 -0.1 +0.43039999999999995 1.1559 -2.4 +0.43039999999999995 -0.8359 -2.4 +0.43039999999999995 -1.1559 -1.4000000000000001 +-4.4848 0.23370000000000002 2.8629000000000002 +-2.8464 4.4951 0.0 +-4.8112 0.45510000000000006 1.9342000000000001 +5.8064 -2.174 0.0 +5.8064 -2.174 1.0 +-5.7264 -1.3114000000000001 3.2817 +-4.216 2.1881 1.0 +-4.216 2.1881 11.3 +-4.8048 2.2443 2.9379 +-0.7408 -3.5242000000000004 -1.7866 +-8.6704 1.9577 2.7883 +-8.6704 0.6389 3.1667 +-4.8688 -1.7704000000000002 3.4307999999999996 +-4.8688 -0.8014 3.4770000000000003 +1.0959999999999999 -3.7241999999999997 -2.2775 +-0.27999999999999997 -3.5520000000000005 -0.5628 +-4.408 -1.7689 2.8513 +-1.1952 -0.21090000000000003 -1.4000000000000001 +-1.1952 -3.8442 -0.4313 +-1.1952 0.21090000000000003 -2.4 +-4.536 -0.5194 2.4147 +-4.536 -0.6817 2.1583 +0.9039999999999999 -3.3279000000000005 -0.4988 +-3.5504000000000002 0.27759999999999996 -2.8000000000000003 +-5.7776000000000005 0.7069 1.9852999999999998 +-0.8623999999999999 -3.5992 -1.1851 +3.2016000000000004 -1.772 -2.8001 +-5.3168 -0.9958 2.0077000000000003 +-8.587200000000001 1.5938999999999999 2.35 +-5.048 -1.8958 3.0541 +-4.4551 0.8867999999999999 1.7145000000000001 +-8.5831 1.6984 2.5859 +-5.3063 -1.3022 3.4826 +-5.3063 -0.815 2.106 +-8.3207 1.9369999999999998 2.9147 +-8.3207 0.7206 3.1875 +-0.12869999999999998 -2.4242 -0.7505999999999999 +-3.1431 -1.8858 9.999999999999999e-05 +-4.8454999999999995 2.0906000000000002 2.0992 +5.7081 0.18409999999999999 0.0 +0.1401 -4.5478 1.0 +0.1401 -4.5478 11.3 +-0.9735 -3.8442 -0.3157 +-5.3639 1.9782000000000002 3.6805 +-5.3639 1.6695000000000002 3.6621 +-5.3639 2.2346 3.4320000000000004 +-7.194299999999999 -1.8332000000000002 2.7913 +-4.5062999999999995 -0.6159 2.3231 +-4.5062999999999995 0.3872 2.0863 +1.7208999999999999 -3.3318 -0.1 +-7.322299999999999 -1.7262 2.5071 +-5.1591 -0.9467 2.9756 +-1.1591 -3.7241999999999997 -0.44799999999999995 +-0.3719 0.8974 -1.4000000000000001 +-0.3719 -0.8974 -2.4 +-4.499899999999999 0.4737 3.4112000000000005 +-4.5639 -0.6291 2.2335000000000003 +-5.1527 -1.0465 2.3838999999999997 +-9.0183 1.8051000000000001 2.8320000000000003 +-5.7415 0.8048 1.7049 +-8.8199 0.8067 2.8446 +-8.5575 0.8024 3.1197 +-5.2807 -1.9772 2.9956 +-5.0183 -1.6214 2.0659 +-3.3799 -1.6244 -2.7 +-3.3799 -1.6244 -0.1 +-6.3943 0.7525999999999999 2.3988 +-2.3303000000000003 -3.5998 0.1 +-5.0823 1.7132 3.6294 +0.2937 -0.2853 -1.6 +-4.3591 -1.8800999999999999 3.0904000000000003 +-5.210299999999999 -1.6670999999999998 2.0874 +-0.29510000000000003 4.5020999999999995 0.5 +-4.4231 -1.1109 1.9707 +-1.7991 4.2227 0.5 +-1.7991 4.2227 0.1 +0.36410000000000003 -1.0412 -2.4 +-4.5511 -1.8398 0.5 +-7.5655 -1.2236 3.0216 +-9.0055 0.8175 2.8387 +2.9881 -4.6257 0.0 +-3.5655 2.2854 0.36 +-4.4167 -1.7215 3.1125 +-8.8071 0.3 2.7917 +-8.544699999999999 1.9418000000000002 2.5009 +-0.9415 1.1142 -1.4000000000000001 +-6.1831 1.2078 0.1 +-6.1831 1.2078 0.8999999999999999 +4.696899999999999 0.7079 1.0 +4.696899999999999 0.7079 11.3 +0.0441 -3.3000000000000003 -2.3062 +-5.722300000000001 1.9462 1.8627999999999998 +-4.6727 -1.2836999999999998 3.4375999999999998 +-4.4103 -0.7337 2.809 +-5.7863 2.1618 2.6915 +-8.6023 1.7144 3.4452999999999996 +-5.0631 -1.1098999999999999 3.4212 +-7.5527 -1.6376000000000002 2.3618 +-7.5527 -1.0947 3.1900999999999997 +0.31289999999999996 -3.6950999999999996 -0.6674 +2.4760999999999997 2.1608 -0.5 +-4.4039 -1.1476 1.9539999999999997 +-5.7799000000000005 -1.2283 2.7 +-1.4535 -4.3538 0.5 +-5.8439 2.3321 3.253 +0.05689999999999999 -3.5242000000000004 -0.5730999999999999 +-4.9223 -1.6176 3.3867000000000003 +-4.7239 0.6015 15.479999999999999 +-1.7735 4.1901 1.0 +-1.7735 4.1901 11.3 +-4.5255 -1.2552 3.4871 +-7.603899999999999 -1.377 2.0692 +-2.6887000000000003 -5.6974 0.1 +-2.6887000000000003 -5.6974 0.8999999999999999 +-5.4407 -0.2761 0.0 +-5.1742 -2.0285 2.7081 +-4.6494 2.1123 3.261 +-5.763 -1.1374 2.8668 +-5.763 -1.5708 2.5866 +-5.763 -1.1292 3.0229 +-5.763 -1.4666000000000001 2.6086 +-5.763 -1.5672 2.8186 +-5.763 -1.1197000000000001 3.0192 +-5.763 -1.3493 2.3846 +-5.763 -1.4604000000000001 2.976 +-5.763 -1.3667 2.5586 +-5.763 -0.9325 2.8347 +-5.763 -1.0323 2.613 +-5.763 -1.1507999999999998 2.5362 +-5.763 -1.3566 3.0147 +-5.763 -1.3886 2.8333 +-5.763 -0.9306 2.5732999999999997 +-5.763 -1.1504999999999999 2.3855999999999997 +-5.763 -1.1556 2.9097999999999997 +-5.763 -0.9892 2.8015000000000003 +-3.5998 2.3303000000000003 0.1 +-5.3022 -1.0357999999999998 3.4469 +-8.9054 1.5983 3.5803000000000003 +1.2578 -3.8303 -0.4974 +-4.771 0.2978 3.086 +-2.275 -3.9404000000000003 1.0 +-2.275 -3.9404000000000003 11.3 +1.5266 -0.0808 -0.06 +-6.4030000000000005 1.0128 3.1402 +-6.4030000000000005 0.9169 3.1845 +1.4626000000000001 1.8231000000000002 -0.0005 +5.7250000000000005 0.3897 1.0 +5.7250000000000005 0.3897 0.44999999999999996 +5.7250000000000005 -0.3897 1.0 +5.7250000000000005 -0.3897 0.44999999999999996 +1.0722 -3.5242000000000004 -0.265 +-4.4958 -0.49639999999999995 2.6256000000000004 +-4.751799999999999 0.3268 2.2286 +4.4898 -1.0892000000000002 0.0 +4.4898 -1.0892000000000002 0.5 +-5.0782 0.3522 3.5242999999999998 +-7.8302 -0.6644 2.3701 +-7.567799999999999 -1.8068 2.8999 +-7.567799999999999 -1.7776 2.4309000000000003 +2.5250000000000004 5.1528 1.0 +2.5250000000000004 5.1528 0.44999999999999996 +2.5250000000000004 -4.3734 1.0 +2.5250000000000004 -4.3734 0.44999999999999996 +2.5250000000000004 -5.1529 0.44999999999999996 +2.5250000000000004 4.3734 1.0 +2.5250000000000004 4.3734 0.44999999999999996 +-7.8942 -1.5105 2.5174 +0.8226000000000001 -3.5242000000000004 -1.2528 +-1.1421999999999999 -3.8442 -0.2627 +-0.35500000000000004 -4.7367 1.0 +-0.35500000000000004 -4.7367 11.3 +-4.2846 -0.6114999999999999 2.322 +-4.675 -1.5030999999999999 3.5615 +-6.051 2.129 2.4368999999999996 +-4.412599999999999 1.1098000000000001 1.0 +-4.412599999999999 1.1098000000000001 11.3 +-3.9517999999999995 2.1749 3.2069 +0.0482 -0.39709999999999995 -1.6 +0.0482 -0.39709999999999995 -0.06 +2.4737999999999998 -4.8224 0.0 +2.6722 -0.1905 -0.5 +4.573 0.6575 0.0 +4.573 0.6575 0.5 +-3.3566 -3.3628 14.5099 +-7.5485999999999995 -0.7716 2.8988 +1.9553999999999998 3.8150000000000004 0.1 +-5.7118 0.213 2.6882 +-5.187 -1.7725000000000002 3.2791 +-6.563 -1.1479 2.4834 +-6.563 -1.4615 2.5929 +-6.563 -1.3826 2.5536 +-6.563 -1.1086 2.5624000000000002 +-6.563 -1.0405 2.5929 +-6.563 -1.352 2.4855 +-7.740600000000001 -1.6757000000000002 2.2647 +-5.315 -1.413 1.9861 +-5.443 -0.63 2.313 +-5.443 -0.6663 2.7743 +-5.443 -1.9314000000000002 2.9386 +-5.443 -1.9707999999999999 2.6203 +-5.443 -0.9752000000000001 3.3703999999999996 +-5.443 -0.6479999999999999 3.1145 +-5.443 -1.3904 3.4172000000000002 +-5.443 -1.8366 2.7617 +-5.443 -1.7557 3.2188000000000003 +-5.443 -0.5256000000000001 2.7146 +-5.443 0.27390000000000003 0.44999999999999996 +-0.5277999999999999 -3.4625999999999997 -2.0032 +-5.571000000000001 1.0481 1.6729 +-5.571000000000001 -0.7719 3.1491 +-5.3086 -1.9828999999999999 2.9594 +-4.0629 -1.9559 4.3807 +-5.7653 2.1441000000000003 2.1152 +4.5899 -0.75 14.0171 +1.5755000000000001 3.1477 15.479999999999999 +-4.4533000000000005 2.5705 2.8495 +-4.4533000000000005 2.0478 1.6232 +-4.4533000000000005 1.7697999999999998 3.9154 +-4.4533000000000005 0.7243999999999999 1.4627 +-4.4533000000000005 0.4464 3.7549 +-4.4533000000000005 -0.0763 2.5284999999999997 +-5.5669 2.3383000000000003 2.7972 +0.5963 -3.3000000000000003 -2.0883 +-5.758900000000001 2.1512 2.5775 +-5.758900000000001 2.025 2.2088 +-6.1493 1.4378 3.4977 +0.6667000000000001 -3.2242 -1.2704 +1.1915 -3.8442 -2.3512 +-4.3125 -1.3797 1.9761000000000002 +-4.9013 1.3684999999999998 1.6004 +-4.6389 -1.9851 2.7004 +-2.7380999999999998 1.015 -0.5 +-5.7525 2.2384 2.4271000000000003 +-0.5749 -5.1612 -1.7423000000000002 +-4.4405 1.5682999999999998 1.3999 +0.7371 -3.8063 -0.3063 +-4.5045 0.527 3.4334999999999996 +-5.9445 1.772 1.7958999999999998 +-7.9093 -1.1007 2.9869 +-1.1573 -3.8993 -2.5801000000000003 +-1.1573 -4.4552000000000005 0.1 +-4.1716999999999995 2.2714000000000003 2.9593000000000003 +-5.0229 -1.809 2.2234 +-6.3989 0.7485 2.6037 +4.4811 -0.634 4.3643 +-7.8389 -1.3282 3.3649 +-4.2997 -0.52 2.6144 +0.8139000000000001 -3.7241999999999997 -1.2108 +1.0763 -3.927 -2.2115 +-8.7541 1.6444 2.9863 +-8.7541 0.8718999999999999 2.4028 +5.0763 3.7310999999999996 0.1 +5.0763 3.7310999999999996 0.8999999999999999 +-4.4917 2.3254 2.5711 +2.8491 -3.8005999999999998 1.0 +2.8491 -3.8005999999999998 11.3 +-5.080500000000001 -0.9697000000000001 2.822 +-5.080500000000001 -0.9697000000000001 2.342 +-5.080500000000001 -1.4497 2.342 +-4.5557 2.2620999999999998 2.521 +0.8843 -3.3585 -2.5039 +-0.2293 -5.1612 -0.779 +0.23149999999999998 -3.4236999999999997 -0.6285 +-4.2869 -0.6921 3.1826 +4.3659 1.5110000000000001 0.0 +4.3659 1.5110000000000001 0.5 +-0.5493 -3.7404 -2.3215 +-4.4149 -1.8010000000000002 2.2064 +-8.542900000000001 1.2013 3.1492 +1.1595 -3.7241999999999997 -0.3666 +-5.3941 2.1801999999999997 2.2393 +-0.21649999999999997 2.375 -0.5 +-7.685300000000001 -0.7276 2.6975 +-4.4725 -0.6613 3.1385000000000005 +-5.3237 -1.469 3.4459999999999997 +-7.5509 -0.7177 2.6993 +-7.5509 -1.3996 2.4162 +-3.0261 4.8224 0.44999999999999996 +-5.2533 -1.8531 3.1299 +-4.9909 1.1274 1.6680000000000001 +-4.7925 0.8359 3.6399 +2.0235 -4.0482 4.3641 +-4.5301 2.1667 2.2018 +-4.8565 0.9638000000000001 1.7026 +-5.7717 1.0163 1.8152000000000001 +-4.4597 -1.8096999999999999 3.1809 +-8.5877 1.7111999999999998 2.5677 +-3.1477 1.5755000000000001 15.479999999999999 +-4.261299999999999 -1.5332000000000001 2.0069 +-4.5877 -0.5233 2.5764 +-4.9804 -1.9772999999999998 2.9942 +-7.7324 -1.5306 3.127 +-7.7324 -0.6376 2.39 +-6.094 1.3525 3.5621 +-5.8316 1.3673 3.5623 +0.7924 -3.6954000000000002 -1.3446 +-5.2364 -1.9800000000000002 2.621 +-5.3644 1.1234 3.7333 +1.9764 -2.2812 -0.5 +-4.5772 1.7007999999999999 1.7590000000000001 +1.1252 -2.6993 -0.3721 +-5.4284 0.22290000000000001 2.8232 +-4.9036 2.1196 2.0092 +-7.3932 -0.7396 2.7047000000000003 +-5.7548 1.6423 3.6443999999999996 +-0.6412 -0.7907000000000001 -1.4000000000000001 +0.9332 -3.8442 -2.4577999999999998 +-3.7196 0.5364 -0.0982 +-4.8332 1.3612000000000002 3.7692000000000005 +-5.9468 2.2755 2.5911 +-0.2444 2.5789 -0.5 +-0.8332 -0.7101999999999999 -1.4000000000000001 +-1.55 -0.7988000000000001 -2.3834999999999997 +-7.8412 -1.7694 2.7101 +-3.2523999999999997 1.8665999999999998 -2.7 +2.9748 3.3921 0.5 +-8.558 2.0544 2.7603 +-3.6428000000000003 2.2308000000000003 0.5 +-5.0828 -1.555 2.5678 +-5.0828 -1.555 3.0478 +-4.558 -1.3617000000000001 3.4273 +-2.7851999999999997 -1.422 0.0 +-2.7851999999999997 -0.989 -0.5 +-5.5371999999999995 1.5521 3.7321 +-5.0764 -1.9973999999999998 2.9156 +-5.4668 2.2649 2.3061000000000003 +5.4132 0.2687 0.44999999999999996 +-4.4172 -1.1931 3.2535000000000003 +-5.5308 2.2748999999999997 2.738 +-4.481199999999999 0.9831 3.6934 +-7.822 -0.5887 2.5473 +-5.9212 1.1016 1.5504 +-9.0636 1.5907999999999998 2.3462 +-0.8715999999999999 -3.3000000000000003 -2.3928000000000003 +-4.7372 2.2248 2.2185 +-4.4748 -0.5202 2.8021000000000003 +-0.9356 -3.9678999999999998 -2.3364 +-8.602799999999998 0.7861999999999999 1.9541 +-0.47479999999999994 -3.3000000000000003 -0.6229 +-0.47479999999999994 -3.5242000000000004 -2.1771 +-1.0635999999999999 -3.8442 -2.4615 +-8.9932 0.7767999999999999 2.6484 +2.738 1.3959 -0.5 +2.0852 3.6740000000000004 0.5 +-1.1212 -3.5242999999999998 -0.4448 +-4.986800000000001 -0.52 2.779 +-4.526 0.48019999999999996 1.9701 +-2.4268 5.0864 1.0 +-3.8028 2.5871 0.49979999999999997 +-4.5219000000000005 0.202 2.8118 +-4.5219000000000005 0.1591 2.6032 +0.6557000000000001 3.4707000000000003 15.479999999999999 +-7.5363 -1.2402 2.3655 +-5.3731 -1.3539 3.4332000000000003 +-5.1107 -0.6829 2.2158 +-5.1107 -1.1355 1.9739 +-5.5011 -0.7821 2.1340000000000003 +4.0029 -2.5572 1.0 +4.0029 -2.5572 11.3 +-5.5651 -1.2526000000000002 1.9132 +-0.3875 1.3207 -1.4000000000000001 +-5.0403 0.8194 3.6286 +-4.5155 -0.5590999999999999 1.0 +-4.5155 -0.5590999999999999 11.3 +-5.6291 1.7249 3.5951999999999997 +-5.3667 0.22260000000000002 2.0294 +-5.104299999999999 -0.924 2.544 +-4.3171 -0.8864000000000001 2.0545999999999998 +-5.1683 -1.9768000000000001 2.4206 +-5.1683 -0.8786 3.3341000000000003 +-4.9699 -0.8699999999999999 2.02 +-4.7075 -1.7893 0.5 +-5.1619 -1.7974 3.1994000000000002 +-2.7363 -2.2617000000000003 -2.4 +-2.4739 -4.7039 0.0 +1.0012999999999999 -3.7241999999999997 -0.6937 +-8.566699999999999 1.9348 3.1889000000000003 +-0.11230000000000001 -2.4242 -2.0698000000000003 +-8.8931 0.4184 2.3848000000000003 +-3.1906999999999996 -3.5204 14.047699999999999 +-2.6658999999999997 1.2843 0.0 +-5.4178999999999995 0.8077000000000001 3.6845999999999997 +-5.1555 -0.9914 3.3965 +-7.6451 -0.7329 2.7104 +-7.6451 -1.7729000000000001 2.7099 +-7.7091 -0.9611 3.1207 +-5.6099000000000006 -1.5568 2.0295 +-2.3331 5.7443 0.0 +-2.3331 5.7443 1.0 +-5.3475 -1.9077 3.0257 +2.2557 0.0789 -0.5 +1.1421000000000001 -3.8442 -0.5374 +-5.2131 -1.3901000000000001 1.9788000000000001 +-7.7027 -1.0323 2.9716 +0.6877 1.8883 0.0 +0.9501000000000001 -3.9348 -2.2132 +-5.0786999999999995 -0.6878000000000001 2.1991 +-5.0786999999999995 0.7505000000000001 3.6445 +-5.1427 -0.89 2.0104 +-9.0083 1.6853 2.5897 +-5.5331 0.193 2.9589 +-4.7459 0.199 2.6202 +-8.873899999999999 1.8517 2.5274 +-0.6819000000000001 -3.6950999999999996 -1.8131000000000002 +-5.923500000000001 0.964 3.8174 +1.1549 -3.7241999999999997 -2.4154 +-2.9731 -3.4311000000000003 1.0 +-2.9731 3.4311000000000003 1.0 +-0.8099000000000001 -3.8367 -2.598 +0.5021 -3.2242 -1.8574 +-5.5267 -1.7753 2.1842 +-3.1011 -3.5982 14.2036 +4.5020999999999995 0.29510000000000003 0.5 +-2.0515 -2.911 -2.4 +-4.8035000000000005 1.0624 3.9217000000000004 +-4.8035000000000005 1.2649000000000001 3.8021 +-4.8035000000000005 2.3058 3.3468999999999998 +-4.8035000000000005 1.8980000000000001 3.752 +-4.8035000000000005 2.3542 2.8055 +-4.8035000000000005 0.724 1.5575999999999999 +-4.8035000000000005 0.0026 2.6925 +-4.8035000000000005 2.153 2.0421 +-4.8035000000000005 0.1923 3.7747 +-4.8035000000000005 2.3102 2.384 +-4.8035000000000005 1.6638 4.1484 +-4.8035000000000005 0.1191 2.1585 +-4.8035000000000005 2.7147 3.0597 +-4.8035000000000005 -0.2252 2.3202 +-4.8035000000000005 2.0788 1.7606 +-4.8035000000000005 2.4884 2.8017 +-4.8035000000000005 2.407 2.2325999999999997 +-4.8035000000000005 0.3132 3.5145999999999997 +-4.8035000000000005 0.35569999999999996 1.8285 +-4.8035000000000005 2.3026 1.5984000000000003 +-4.8035000000000005 1.5190000000000001 3.8977999999999997 +-4.8035000000000005 0.6783 3.7898 +-4.8035000000000005 0.5224000000000001 3.5340000000000003 +-4.8035000000000005 1.9985 3.5103000000000004 +-4.8035000000000005 1.0746 1.6119999999999999 +-4.8035000000000005 1.678 3.7076 +-4.8035000000000005 0.0821 3.1198 +-4.8035000000000005 1.1174 1.4567999999999999 +-4.8035000000000005 1.5735999999999999 1.4861 +-4.8035000000000005 2.2451 3.1656999999999997 +-4.8035000000000005 0.8942 3.7372 +-4.8035000000000005 0.8342999999999999 1.2327 +-5.3923 -1.5258 3.428 +-3.4915000000000003 3.0255 0.0 +-3.4915000000000003 3.0255 0.5 +-4.867500000000001 -1.1221999999999999 3.5886 +-1.0659 3.4962 9.999999999999999e-05 +-5.4563 -0.962 3.3848000000000003 +-3.8179 1.9524 0.36 +0.2461 0.7303 -2.385 +-5.520300000000001 0.7226 3.6419 +-4.733099999999999 -0.4007 11.3 +-4.733099999999999 -0.4007 15.479999999999999 +-4.2722999999999995 1.4503 0.5 +1.1677 -4.358 0.5 +-3.7475 0.1368 -2.7 +-2.9603 -3.4553000000000003 1.0 +-2.9603 -3.4553000000000003 11.3 +-1.0595 -3.7241999999999997 -0.12090000000000001 +-5.4498999999999995 -1.8371 3.1435999999999997 +-9.0531 2.0537 2.4840999999999998 +-4.9891 -1.7704999999999997 2.1191 +-7.9331 -0.74 2.71 +-2.2946999999999997 -2.4787 -0.5 +-5.0466999999999995 0.5452 3.437 +4.391 -1.8117999999999999 14.2036 +-0.9146 -2.7002 -0.4974 +2.5606 4.9726 0.0 +2.5606 -4.9727 0.44999999999999996 +2.5606 -4.5536 0.0 +-5.6314 0.9923 3.6911 +-0.7162 -3.7241999999999997 -0.455 +-5.369 -1.4807000000000001 3.3186 +0.33340000000000003 -3.5905 -2.2173 +-4.3194 -1.9175000000000002 2.3861 +-0.7802 -0.9297 -2.4 +-5.433000000000001 -0.6807 2.4191000000000003 +-5.433000000000001 -1.5795 3.2425 +-5.433000000000001 -1.25 3.2369000000000003 +-5.433000000000001 -0.6156 2.7229 +-5.433000000000001 -1.8842999999999999 2.7229 +-5.433000000000001 -1.3467 3.3205 +-5.433000000000001 -1.6178000000000001 2.1827 +-5.433000000000001 -1.7975 3.0210999999999997 +-5.433000000000001 -1.1539000000000001 3.3204 +-5.433000000000001 -0.9450000000000001 2.1343 +-5.433000000000001 -0.9204 3.2425 +-5.433000000000001 -1.3282 2.0701 +-5.433000000000001 -1.8192 2.4191000000000003 +-5.433000000000001 -0.7025 3.0210999999999997 +-5.561 -0.6897 3.1784 +-5.3626 -1.25 2.0456 +-5.3626 0.2451 3.4114 +-4.313000000000001 -0.8238000000000001 2.0926 +3.8150000000000004 -1.9553999999999998 0.1 +-3.5898 -5.1772 0.1 +-3.5898 -5.1772 0.8999999999999999 +2.375 4.1136 1.0 +2.375 4.1136 11.3 +-7.193 -0.7433000000000001 2.4074999999999998 +-7.193 -1.4014 2.1349 +-4.505 0.7103 3.567 +-8.8954 2.1064 2.7456 +-8.8954 0.47479999999999994 2.937 +-7.5834 -1.0199 2.9610000000000003 +-7.321 -0.8618000000000001 2.358 +-5.4202 2.2796 3.034 +-5.7466 2.2698 2.3236 +-5.8106 0.1699 2.6602 +-1.2218 -3.8447 -2.5602 +-2.073 -3.1378999999999997 -2.6972 +-0.1722 -2.6904999999999997 0.0 +-0.1722 -2.3095 -0.5 +-4.0378 2.0723 1.0 +-5.7402 1.1455 3.7327 +-5.4778 -0.5174 2.5892999999999997 +-4.6906 2.2329000000000003 3.0417 +-4.4282 -0.9096 2.026 +-5.081 -1.9820999999999998 2.4028 +-5.1450000000000005 -1.939 2.4198999999999997 +1.6709999999999998 1.1085 0.0 +-9.0106 2.1165 2.4514 +-8.7482 1.8407 2.5305 +-8.2234 1.8436000000000001 3.1085000000000003 +-8.2234 0.5995 3.0098 +-0.6202 -0.7851 -2.4 +-4.2234 -1.855 2.2818 +-4.8762 -1.9745 2.9975 +0.5638 -4.0242 -0.459 +1.0886 -3.8181 -2.1359 +-3.5642 3.1579999999999995 15.479999999999999 +-4.4794 -1.7667 3.2731000000000003 +-3.4298 2.9763 4.3485000000000005 +-3.1674 3.2664999999999997 1.0 +-3.1674 3.2664999999999997 11.3 +1.159 -3.5242000000000004 -0.4479 +-5.3946000000000005 -0.5666 2.9917 +3.3222 -0.1905 -0.5 +-4.607399999999999 0.4394 2.0514 +-4.9338 1.8752000000000002 3.5042999999999997 +-9.0618 1.5693 3.0551 +-9.0618 1.6918 2.872 +-4.473 -1.7559000000000002 3.32 +-4.473 -2.1916 3.2407 +-4.473 -0.8586 1.8950000000000002 +-4.473 -2.1395999999999997 2.5978999999999997 +-4.473 -0.42719999999999997 3.0526 +-4.473 -1.6053000000000002 1.8855 +-4.473 -0.3084 2.1593 +-4.473 -0.6796 3.3813999999999997 +-4.473 -0.9914 3.4573 +-4.473 -1.3073 3.5867999999999998 +-4.473 -1.2525 3.7858 +-4.473 -0.6573 3.2278000000000002 +-4.473 -2.0804 3.0162 +-4.473 -2.1892 2.1564 +-4.473 -0.9737000000000001 3.5444999999999998 +-4.473 -1.2494 1.6133000000000002 +-4.473 -0.31089999999999995 3.2451 +-4.473 -1.3842999999999999 3.4821999999999997 +-4.473 -0.36719999999999997 2.5518 +-4.473 -0.5423 2.1627 +-4.473 -0.45909999999999995 2.634 +-4.473 -0.5492 2.3275 +-4.473 -0.4972 2.9513000000000003 +-4.473 -1.9034 3.3022000000000005 +-4.473 -1.6327999999999998 3.5019 +-4.473 -1.94 2.1298999999999997 +-4.473 -1.2772000000000001 1.8117999999999999 +-5.324199999999999 -1.5463 2.0286999999999997 +2.4774000000000003 -2.2274 -0.5 +0.2502 -0.8083999999999999 -1.4000000000000001 +-0.3386 4.75 11.3 +0.9733999999999999 -3.8442 -0.4843 +0.9733999999999999 -4.4447 1.0 +0.9733999999999999 -4.4447 11.3 +1.7606 2.3778 -0.5 +1.7606 -2.3778 0.0 +1.7606 2.6222 0.0 +-4.793 1.9014 3.479 +-3.1546 1.1266 0.0 +2.2854 3.5655 0.36 +-5.4458 0.5087999999999999 3.4206 +-6.034599999999999 0.9317000000000001 3.5497 +-0.857 -3.9238000000000004 -2.5486999999999997 +-4.984999999999999 -1.5439 1.9820999999999998 +-4.984999999999999 1.3495 1.6653000000000002 +-5.5738 -1.3718 3.3383999999999996 +3.4054 -1.3558000000000001 9.999999999999999e-05 +-4.2618 -1.8041 3.1924 +-0.7226 -3.8143999999999996 -0.3618 +-4.5882 -0.6403 2.2790999999999997 +-5.7017999999999995 1.5068 2.8771 +-4.4561 0.6837 1.8108 +-5.6337 2.2540999999999998 2.9389 +-5.172899999999999 -0.6909000000000001 3.1766 +-4.9745 2.2007 2.3072 +-5.3009 -0.611 2.3325 +-1.7617 3.0949999999999998 -2.4 +-4.5137 0.8892000000000001 3.6612 +-5.8896999999999995 -0.22499999999999998 1.0 +-5.8896999999999995 -0.22499999999999998 0.44999999999999996 +-5.8896999999999995 0.22499999999999998 1.0 +-5.8896999999999995 0.22499999999999998 0.44999999999999996 +-5.1025 -0.8056000000000001 2.1116 +-5.4289 -0.5202 2.429 +-0.5137 -0.5727 -2.3847 +-4.9041 0.5821 3.4751999999999996 +-4.3793 -1.0625 3.4211 +-8.0465 1.0088 1.9121 +1.1951 -3.8442 -0.3687 +-4.833699999999999 -1.9154999999999998 1.0 +-7.323300000000001 -1.7582 2.7773 +-5.6849 0.3574 3.3229 +-4.0465 -1.9955 0.5 +1.1311 5.031 0.0 +-4.4369 -1.8078 2.2174 +-8.5649 1.0404 1.897 +-5.0257000000000005 1.8523999999999998 3.5993999999999997 +-4.5009 -0.2818 4.3797999999999995 +-4.5009 1.8234 3.5485 +-3.7137000000000002 2.6289 1.0 +-3.7137000000000002 2.6289 11.3 +-7.8417 -0.7396 2.71 +-5.6785000000000005 2.1420000000000003 2.1559 +-5.1537 -1.5643 1.991 +-5.0833 2.2766 2.543 +-4.6225000000000005 -2.1064 1.0 +0.8175 -3.8442 -2.3241 +-8.7505 1.9707999999999999 2.4932 +-1.1473 1.6429 -0.0 +0.7535000000000001 0.1638 -2.395 +-5.0769 1.8092000000000001 1.6135 +-5.0769 0.9816 1.5070999999999999 +-5.0769 -1.908 3.1054 +-4.5521 1.4937 1.6823000000000001 +-1.2753 -3.8121 -0.462 +-7.8929 -0.9329000000000001 2.7 +-5.7297 0.2803 2.324 +-5.9216999999999995 0.7382 1.6602999999999999 +-5.3969000000000005 -0.6316 2.3064999999999998 +-5.3969000000000005 0.35300000000000004 3.3093 +-4.4113 -0.7758 2.5494 +-7.7521 -1.8017999999999998 2.3480999999999996 +0.7022999999999999 -1.8846000000000003 -0.06 +-8.3409 0.7767999999999999 2.8362 +-5.652900000000001 -1.2139 2.7 +-5.1281 -1.2515 3.4776000000000002 +-4.8656999999999995 -2.1405 2.6149999999999998 +-5.1921 -1.574 3.408 +-9.0577 1.5292999999999999 1.9124999999999999 +-5.4481 0.2691 2.3596 +-0.46249999999999997 -3.4242000000000004 -2.172 +-0.46249999999999997 -3.2242 -2.172 +-1.3777 6.1475 0.1 +-1.3777 6.1475 0.8999999999999999 +-2.4913000000000003 -3.8551 0.36 +-7.6008000000000004 -1.1034 2.0803 +5.768800000000001 -0.0868 0.0 +-5.4376 2.1431 2.0792 +-4.516 -0.5231 2.9889 +2.3 -2.8689 -2.8003 +2.3 -4.7632 1.0 +2.3 -4.7632 0.44999999999999996 +2.3 4.7631 1.0 +2.3 4.7631 0.44999999999999996 +-5.3671999999999995 2.1584 3.1765000000000003 +0.5976 -3.424 -0.8713000000000001 +-7.9208 -1.5832 2.7 +-1.6936 0.3757 -2.387 +-5.559200000000001 -1.1231 1.9754 +-1.2328000000000001 4.3546000000000005 4.3643 +-0.4456 -3.2242 -0.8873000000000001 +1.9800000000000002 1.5757 -0.0031000000000000003 +-4.6376 -1.0281 1.978 +-1.0984 4.4566 0.5 +-1.0984 4.4566 0.1 +-9.028 1.2004000000000001 3.1466000000000003 +-9.028 1.5289000000000001 3.0524 +4.54 -0.0 1.0 +-0.7016 0.8090999999999999 -2.4 +-0.7016 -1.1828 -2.4 +-5.0855999999999995 -0.6023999999999999 3.0589999999999997 +-4.5608 1.0853 1.6641 +5.532 2.7995 0.0 +5.532 2.7995 1.0 +-5.079199999999999 -1.9584000000000001 2.378 +-3.1784 3.53 1.0 +-3.1784 3.53 11.3 +-4.292 -2.1765 3.2549 +-4.292 -2.1938 2.175 +-4.292 -0.32339999999999997 2.1451000000000002 +-4.292 -1.2327 3.7798 +-4.292 -0.3062 3.225 +-5.4056 -1.8794000000000002 3.1647000000000003 +-4.0936 -1.9868000000000001 2.5117000000000003 +-4.6823999999999995 -2.146 2.6335 +-1.1432 -3.7241999999999997 -0.31289999999999996 +-0.8808 -3.5521 -1.4591 +6.1976 -0.1709 0.0 +6.1976 -0.1709 1.0 +-4.548 -1.8958 3.0541 +-4.612 0.4282 2.0545999999999998 +-5.2008 -0.5051 2.6917 +-4.676 -0.9921 3.5584 +-0.8744 -4.5365 0.0 +-0.8744 -4.5365 0.5 +-8.5416 0.8054 2.7048 +0.636 -3.6832 -0.9044 +-4.0808 -1.958 2.4326 +1.0968 -4.0242 -1.4177 +-4.932 -1.9355 2.4341999999999997 +-4.4072 -1.7052999999999998 2.6378 +-4.4072 -1.6868 2.5971 +-9.06 0.8016000000000001 2.8287 +-5.3224 -1.5787 3.4098 +-5.9112 1.6537 3.4685 +0.9048 -3.5242000000000004 -0.3139 +5.231199999999999 0.0867 0.0 +5.231199999999999 -0.0868 0.44999999999999996 +-4.336799999999999 -1.717 2.1227 +0.8408000000000001 -3.4903000000000004 -1.5688 +1.3656 4.3148 4.3644 +-1.9112 2.4246 0.0 +3.5288 -0.15280000000000002 11.3 +-2.5 0.25 -0.5 +1.3016 4.4329 0.0 +1.3016 4.4329 0.5 +0.188 -3.5242000000000004 -2.2241 +-5.5784 1.9243 1.8453000000000002 +-5.5784 -1.2186000000000001 3.3229 +-0.46480000000000005 4.7393 15.479999999999999 +-5.1175999999999995 -1.5865 2.3948 +5.5 -0.44999999999999996 1.0 +5.5 -0.44999999999999996 0.44999999999999996 +5.5 0.44999999999999996 1.0 +5.5 0.44999999999999996 0.44999999999999996 +-7.9336 -1.7134 2.4756 +-7.9336 -0.7778 2.8995 +-3.0824000000000003 1.3959 -0.5 +-8.5864 0.8083999999999999 2.5244 +0.19849999999999998 -1.0767 -1.4000000000000001 +-4.4543 0.2843 2.2962 +-4.4543 2.2269 2.2265 +-7.5327 -1.5556 2.8605 +-4.2559 -1.9742 2.8754999999999997 +-4.9727 2.0903 2.1056 +2.3681 -0.2285 0.0 +-0.9087 -3.7241999999999997 -2.2703 +-5.036700000000001 2.1442 3.3028000000000004 +0.9280999999999999 -3.9701 -2.4659 +-3.1999 -1.5629 -2.4 +2.2401 2.8129 -2.8128 +-8.767900000000001 1.9501000000000002 2.0443 +-5.5551 2.2031 3.2072000000000003 +-5.9455 0.1585 2.6037 +2.9057 -0.0789 0.0 +-8.0383 0.5055 3.0608 +-5.6127 1.2559 3.727 +-4.5630999999999995 -1.1098999999999999 3.4212 +-5.4783 2.0426 3.3712 +3.7633 -2.6799 0.0 +3.7633 -2.6799 0.5 +-7.5711 -0.8670000000000001 3.1614999999999998 +-4.9471 2.2322 2.9813 +-6.0607 2.1341 3.2209000000000003 +-1.9967 -4.3099 1.0 +-1.9967 -4.3099 11.3 +-8.6143 2.1412 2.7353 +-0.4863 -1.3802999999999999 -0.06 +-5.1391 -0.7294 3.2809 +-2.9759 -1.4507 0.0 +-2.9759 0.9601999999999999 0.0 +-1.3375 0.3248 -0.06 +-5.7279 1.0549 1.6513 +1.3505 3.2637 11.3 +-1.1391 -3.9352 -0.2681 +1.0241 -3.7241999999999997 -0.5659 +-5.2671 -1.5487000000000002 1.9742 +-0.9407000000000001 -3.8442 -2.5886 +-5.5935 -1.8742999999999999 2.2252 +-0.41590000000000005 -3.4663 -0.7078 +-5.9199 0.1603 2.2817 +-5.6575 -1.2842 3.2845 +-4.8703 -0.5166999999999999 3.2204 +-4.6079 2.1239999999999997 2.0394 +0.8321000000000001 -3.5986 -1.1003 +-0.8063 -3.6579 -1.1369 +-0.9343 -3.8442 -2.2137000000000002 +2.6048999999999998 -2.3853 11.3 +3.3921 -2.9748 0.5 +-5.3887 -0.8103000000000001 2.0966 +-1.0623 -3.8134 -2.6719 +-5.4527 0.2225 2.5689 +-5.8431 0.3132 3.4745 +-5.3183 -1.6214 2.0659 +-5.0559 1.5205 3.6801 +-7.807899999999999 -1.7378 2.3057000000000003 +-5.1199 -1.6299000000000001 3.38 +-5.1839 -0.5642999999999999 2.9638 +-4.9215 0.3928 2.0151 +-7.9359 -1.4091 2.191 +-0.8574999999999999 -3.9334000000000002 -0.5356 +-7.9999 1.9973999999999998 2.0875 +-7.9999 2.2035 2.5432 +-7.9999 1.1547 3.6616000000000004 +-7.9999 2.1542 3.041 +-2.8223000000000003 5.033 0.0 +-5.0495 -1.3287 1.9259 +0.9153 -3.3339 -0.2831 +0.5889 4.4731 0.5 +-5.439900000000001 1.9405999999999999 1.8620999999999999 +-5.4357999999999995 -0.7100000000000001 2.9250000000000003 +-5.1734 -1.8948 2.2587 +-4.9750000000000005 -1.1155 3.4249 +2.0394 3.8158 0.5 +-5.3654 2.4565 2.9101 +-9.231 1.4976 1.7689 +-9.231 1.5720999999999998 3.3456 +-9.231 1.1154000000000002 2.2306 +-9.231 0.7762 2.5819 +-9.231 1.3668 2.2313 +-9.231 0.45570000000000005 3.2452 +-9.231 1.1103 1.7468000000000001 +-9.231 0.7898000000000001 2.8466 +-9.231 0.46290000000000003 2.1445 +-9.231 1.2926 3.6624999999999996 +-9.231 1.1367 3.4125 +-9.231 0.8487 2.1017 +-9.231 0.7458 1.8790999999999998 +-9.231 2.0892999999999997 3.173 +-9.231 1.6275000000000002 2.0864000000000003 +-9.231 0.5499999999999999 2.8944 +-9.231 1.7143 2.5668 +-9.231 1.1378 3.1697999999999995 +-9.231 0.7858 2.8332 +-9.231 1.9483000000000001 2.48 +-9.231 0.30760000000000004 2.4999000000000002 +-9.231 0.5677 2.9103 +-9.231 1.7191999999999998 2.8412 +-9.231 0.8231999999999999 3.5726 +-9.231 1.5942999999999998 3.0387999999999997 +-9.231 1.2359 1.9796999999999998 +-9.231 1.7648000000000001 3.5238 +-9.231 0.9026 2.3645 +-9.231 0.5890000000000001 2.4137 +-9.231 0.3051 2.8878 +-9.231 1.5892 2.3487 +-9.231 2.2205 2.7088 +-9.231 2.1007000000000002 2.2453999999999996 +-9.231 1.8447000000000002 1.942 +-9.231 0.9167 3.0566 +-9.231 1.718 2.5803 +-9.231 1.3847 3.1693 +-5.4294 0.2241 2.5308 +3.025 4.7631 0.0 +3.025 4.7631 0.44999999999999996 +-7.919 -1.8193000000000001 2.5420000000000003 +2.1738 3.6290999999999998 0.36 +2.1738 3.9399 0.5 +-5.7558 0.7757000000000001 3.6102000000000003 +-4.9686 0.3106 2.1383 +-4.7062 0.7268 11.3 +4.5354 -1.413 13.966000000000001 +-3.3942 2.9714 4.3788 +-1.7558 -4.4265 11.3 +-5.423 -0.4718 2.717 +-0.5718 0.5009 -2.3528000000000002 +-5.550999999999999 -1.4029 1.9371 +-5.0262 0.2224 2.6409 +-0.4374 -3.4242000000000004 -0.6134 +-0.4374 -3.2242 -0.6134 +-5.9414 0.8567999999999999 3.7028 +-4.303 -1.536 2.5829999999999997 +-4.303 -1.536 3.063 +-4.303 -1.7592 2.2896 +-4.303 -0.7334 3.101 +-4.303 -1.25 2.046 +-4.303 -1.7666000000000002 3.101 +-4.303 -1.8863999999999999 2.5495 +-4.303 -0.9648 2.5808999999999997 +-4.303 -0.7408 2.2896 +-4.303 -0.9901 3.0726 +-4.303 -1.3444 3.3374 +-4.303 -1.53 2.8135 +-4.303 -1.05 2.3335000000000004 +-4.303 -1.05 2.8135 +-4.303 -1.5602 2.3538 +-4.303 -0.6134999999999999 2.5495 +-4.303 -0.8845999999999999 2.9694000000000003 +-4.303 -0.8845999999999999 2.4894 +-4.303 -1.3719999999999999 2.5244 +-4.303 -1.3719999999999999 3.0044 +-4.303 -1.1352 2.9214 +-4.303 -1.543 3.2847 +-4.303 -0.6109 2.8389 +-4.303 -0.914 2.3762 +-4.303 -0.914 2.8562 +-4.303 -1.394 2.8562 +-4.303 -1.8891000000000002 2.8389 +-4.303 -0.9570000000000001 3.2847 +-4.303 -1.2304000000000002 3.2516000000000003 +-4.303 -1.16 3.3437 +-4.303 -1.4183 2.3466 +-4.303 -1.5322 2.11 +-4.303 -0.9677 2.11 +-4.303 -1.0811 2.5662000000000003 +-1.0262 -3.9678999999999998 -0.4868 +-0.7638 -4.4242 -1.6516 +-4.9558 2.2717 2.7378 +-1.2822 -3.7241999999999997 -2.6566 +-5.6726 0.1828 2.9219 +1.6682 -2.5079000000000002 0.0 +-4.8854 0.44010000000000005 2.051 +-9.077399999999999 1.5351 3.363 +-9.077399999999999 1.9366 2.503 +-7.439 1.023 2.1881 +-7.439 1.0335 2.6709 +-7.439 0.6956 2.779 +-7.439 1.1221 2.5334 +-7.439 0.7381000000000001 2.927 +-7.439 1.329 3.2543999999999995 +-7.439 1.3779 2.8666 +-7.439 1.0835 2.8278999999999996 +-7.439 1.2732 2.4855 +-7.439 1.8044 2.621 +-7.439 1.2238 2.9118999999999997 +-7.439 1.477 3.2119 +-7.439 1.4166 2.5721000000000003 +-7.439 1.1711 2.1456 +-7.439 1.4645 2.7232 +-7.439 1.762 2.473 +-5.864599999999999 2.4573 2.763 +-5.0774 0.8822 3.6595000000000004 +-5.0774 -1.6126999999999998 2.0089 +-5.0774 0.0503 2.4716 +-5.0774 0.5700000000000001 1.6768 +0.8234 -3.9385000000000003 -2.3255000000000003 +2.6602 1.2055 0.0 +-8.8086 1.5503 2.3598 +-5.3334 2.5124 2.7839 +-4.808599999999999 0.6374000000000001 1.7818 +0.8937999999999999 -3.7241999999999997 -2.2821000000000002 +-5.135 -0.9561 3.4179 +-4.4117999999999995 -0.6959 2.2076 +-9.0646 1.7214 2.5811 +-9.0646 0.7682 2.6536 +-9.0646 1.0493000000000001 2.2596000000000003 +-5.525399999999999 -1.9911 2.7234000000000003 +-7.7526 -0.9396 2.5534999999999997 +0.7722 -3.7241999999999997 -0.5733 +-0.3414 0.22169999999999998 -1.6 +-5.583 -1.0437 2.1107 +-5.583 -0.9332999999999999 3.2392999999999996 +-5.583 -1.871 2.7641999999999998 +-5.583 -1.637 2.2100999999999997 +-5.583 -0.6257999999999999 2.7140999999999997 +-2.3062 -1.9831 0.0 +-4.0085999999999995 -2.1526 1.0 +-4.0085999999999995 -2.1526 11.3 +-4.6614 -1.1213000000000002 3.4242000000000004 +-5.5126 -1.8939000000000001 3.138 +-4.9878 -0.5238999999999999 2.5742000000000003 +-4.463 -1.0066 3.3944 +-5.3142000000000005 -1.8606 3.18 +0.3882 0.8693 -1.4000000000000001 +2.0265999999999997 3.6093 0.36 +-4.3286 -1.9567999999999999 2.9653 +-1.0477 -3.5242000000000004 -0.26649999999999996 +-8.5165 1.7315 2.7489 +-8.5165 1.1151 2.2281 +-0.9133 -3.9678999999999998 -0.4262 +-4.318099999999999 -0.47850000000000004 2.7910999999999997 +-4.6445 0.527 3.4334999999999996 +0.5331 -4.0242 -2.3587000000000002 +-2.4813 -4.6764 0.44999999999999996 +-5.4957 2.144 3.2062 +-3.8573000000000004 2.4922 0.36 +-0.9069 -3.3279000000000005 -2.5016 +3.9442999999999997 2.6682 11.3 +-5.6237 -1.778 3.3884 +1.7170999999999998 -4.2890999999999995 0.0 +1.7170999999999998 -4.2890999999999995 0.5 +-4.3117 1.3265 3.7504999999999997 +-5.4253 1.8561999999999999 3.6003 +-2.4749 -2.177 0.0 +-8.5677 0.9821 3.0655 +-5.2909 -1.5488 3.4159 +-4.7661 1.1039999999999999 3.708 +-2.0781 -3.1315999999999997 -0.10239999999999999 +-4.5677 0.3701 3.3386 +-8.433300000000001 1.6483 2.9876 +-2.7309 1.0131 0.0 +4.0851 -2.093 0.36 +-5.745299999999999 0.7468 1.7337000000000002 +-5.2205 -0.9941 2.0023 +-4.6956999999999995 2.2620999999999998 2.521 +-0.3693 4.5751 0.5 +-0.3693 4.5751 0.1 +-4.2989 -1.18 1.9567999999999999 +0.7506999999999999 -3.7241999999999997 -1.7885000000000002 +-4.2924999999999995 -0.8349000000000001 2.0837000000000003 +-5.6685 2.2763 2.55 +-4.3565 -1.9726000000000001 2.8842 +3.2467 -5.281899999999999 0.0 +3.2467 -5.281899999999999 1.0 +-8.222100000000001 1.9448 2.8665 +2.1330999999999998 -4.0643 0.5 +2.1330999999999998 -4.0643 0.1 +0.6930999999999999 6.261799999999999 0.1 +0.6930999999999999 6.261799999999999 0.8999999999999999 +-5.3357 2.1596 3.5700000000000003 +-5.0733 -1.8948 2.2588 +-2.3853 -2.6048999999999998 11.3 +-0.5420999999999999 -5.1612 -1.0076999999999998 +-4.6701 2.1812 2.2395 +-6.0461 1.1376000000000002 3.7052 +-5.5213 2.0538 2.0438 +-1.9820999999999998 -2.2931 0.0 +1.2307000000000001 -3.7241999999999997 -0.5681 +-5.3229 -1.809 2.2234 +0.9043000000000001 -3.7298999999999998 -2.1271 +-8.9261 1.4143 3.6287 +-5.7133 0.3226 3.1691 +-5.4509 2.2264 3.1744000000000003 +-7.678100000000001 -0.7622 2.3057000000000003 +-5.2525 -1.6943 3.2883999999999998 +-1.1885 -3.8442 -2.4593 +-5.3805 -1.3743999999999998 1.9327 +-0.2029 -3.6568000000000005 -0.5660000000000001 +0.059500000000000004 3.6569 9.999999999999999e-05 +-3.0189 -3.4747 0.5003 +2.4211 0.2443 0.0 +3.4707000000000003 -0.6557000000000001 15.479999999999999 +-4.4589 -1.894 3.0705 +-4.5229 -1.809 2.2234 +2.2931 -1.9820999999999998 0.0 +2.2931 2.4726999999999997 0.0 +-5.6365 1.5629 3.6896999999999998 +-4.7172 1.7007999999999999 1.7590000000000001 +-4.4548 0.10300000000000001 1.9862000000000002 +0.7932 -4.4242 -1.3256000000000001 +-5.6259999999999994 2.1384 3.2308999999999997 +-5.3636 0.3724 3.351 +-0.4484 -1.1828 -1.4000000000000001 +-5.6899999999999995 1.8700999999999999 1.8624999999999998 +-5.1652000000000005 -1.038 1.9497 +-5.1652000000000005 -1.3018 1.9205 +-0.25 -2.5 0.0 +-0.25 -2.5 -0.5 +2.1756 -1.9784 -0.5 +-1.9524 -3.8179 0.36 +-5.3572 -1.5741 1.9938999999999998 +-4.8324 1.5391 1.6978 +-4.307600000000001 -2.0011 2.6322 +4.1468 -1.9677 0.5 +-5.7476 1.4871 3.7059 +-5.4852 -1.5983 2.0042 +-3.5844 -0.7481 -2.8001 +-4.9604 -1.7744 2.1227 +1.0044000000000002 -3.5242000000000004 -0.5333 +-5.2867999999999995 -0.52 2.779 +-6.4004 0.6851999999999999 2.4197 +-0.698 -4.4961 1.0 +-0.698 -4.4961 11.3 +-5.3508 -1.2628 1.9194 +-5.6772 1.5521 3.7321 +1.0748 -4.4091 1.0 +-6.394 1.4462 2.3223000000000003 +-6.394 0.8103000000000001 2.5898999999999996 +-5.6708 2.2748999999999997 2.738 +-0.7556 -0.1077 -2.3782 +-0.7556 -3.7241999999999997 -1.7406000000000001 +-8.6852 1.0937999999999999 1.7734 +-7.898 -1.398 2.4178 +-7.898 -1.25 3.0186 +-7.898 -1.1018999999999999 2.4178 +-4.6212 0.9831 3.6934 +-5.7348 0.2143 2.6637999999999997 +4.358 1.1677 0.5 +1.0172 -3.7241999999999997 -0.2453 +-5.338 -0.6896 2.1494 +-7.5652 -1.0627 2.4361 +-5.1396 -1.8193000000000001 3.1674 +-4.6148 -0.2198 0.0 +-4.6148 -0.2198 0.5 +-1.3379999999999999 -3.4189999999999996 9.999999999999999e-05 +0.8252 0.1875 -1.4000000000000001 +-0.8132 -3.9307000000000003 -2.4631 +-5.2036 -0.9356 3.4090000000000003 +-5.2036 -1.4294 1.9789999999999999 +-4.678800000000001 -0.4249 3.0509999999999997 +-6.0548 1.916 3.4667999999999997 +-4.4164 -1.1223 2.0863 +2.3996 -2.4178 -0.5 +-8.544400000000001 1.7229999999999999 2.1564 +-8.544400000000001 0.536 2.6859 +-8.544400000000001 1.7533 3.2174 +3.6476 0.1332 0.0 +-4.346 -1.9800000000000002 2.6153 +-1.0692 -0.3766 -1.4000000000000001 +-5.1972 -1.9764 2.4228 +-5.2612 -1.804 2.1531000000000002 +-7.750799999999999 -1.5289000000000001 2.8895 +-7.5524 -1.1068 2.2046 +-7.5524 -1.7227 2.899 +-5.389200000000001 1.1491 3.7756 +-1.3252 -1.1341 -2.3801 +-5.978 2.2720000000000002 3.049 +-4.4036 -0.5273 2.5427 +4.5116000000000005 -1.1267 14.518900000000002 +-4.2692 1.4588999999999999 4.3784 +-5.1204 -1.4625000000000001 3.0516 +-5.1204 -1.1028 2.8722000000000003 +3.8587999999999996 -2.4951999999999996 0.1 +-4.333200000000001 -1.9203999999999999 3.0079000000000002 +-5.7732 0.1668 2.6282 +-3.6740000000000004 2.0852 0.5 +-5.050000000000001 0.0 1.0 +-5.050000000000001 0.0 0.44999999999999996 +-5.965199999999999 2.0398 2.026 +-4.521100000000001 2.2851 2.6216 +-4.2587 -0.9492999999999999 3.3796 +-0.7835 0.1183 -0.06 +-5.4363 -0.8529 3.3747 +-4.9755 -1.2447 1.9129 +-3.0747 -2.1468000000000003 -2.7 +-3.0747 -2.1468000000000003 -0.1 +-4.450699999999999 -1.2515 3.4422 +0.7269 -3.5242000000000004 -1.8315000000000001 +-8.8411 0.7296 2.8639 +-5.3659 -1.1586 3.357 +-4.5787 1.8924 1.8644999999999998 +-2.6779 2.3032 15.479999999999999 +-0.053899999999999997 2.751 -0.5 +0.20850000000000002 1.1142 -1.4000000000000001 +0.20850000000000002 -1.1142 -0.06 +1.8469 2.0122999999999998 -0.5 +-1.1675 3.3334999999999995 15.479999999999999 +-5.5579 -1.348 3.4271000000000003 +-7.3243 -0.7746000000000001 2.8906 +0.5413 3.5198 -2.4 +-8.7643 1.6896000000000002 2.5687 +5.9173 1.8508 0.0 +5.9173 1.8508 1.0 +-5.2891 -1.7706 2.1191 +-5.6155 0.4021 3.2766 +3.6261 -2.0098000000000003 0.1 +-5.4171 -0.8170000000000001 2.0916 +-8.757900000000001 1.6191 2.4018 +-6.396300000000001 0.7243999999999999 2.5462 +0.6820999999999999 6.1624 0.0 +0.6820999999999999 6.1624 1.0 +-5.4107 -0.6959 3.2467 +0.2917 1.9929999999999999 -0.06 +-5.4746999999999995 -2.0265999999999997 2.7267 +-6.0635 0.4365 3.2161000000000004 +-6.0635 2.1561 3.0274 +-6.0635 1.8717000000000001 1.9640000000000002 +-6.0635 0.3155 2.4659 +-6.0635 1.883 3.4368000000000003 +-6.0635 0.7758 1.8614 +-6.0635 1.4514 3.6421 +-6.0635 0.2989 2.8534 +-6.0635 1.145 1.7423000000000002 +-6.0635 0.4835 2.1164 +-6.0635 0.2403 2.3437 +-6.0635 2.2115 2.6629 +-6.0635 1.0635999999999999 3.6452 +-6.0635 2.125 2.2919 +-6.0635 0.7060000000000001 3.4951000000000003 +-6.0635 1.5311 1.7785 +-6.0635 0.5079 1.9224 +-4.4251 -0.4705 2.6401999999999997 +4.2917 1.6276 0.5 +4.2917 1.6276 0.1 +-5.0139000000000005 -1.8709 3.1665 +-7.567500000000001 -0.9416000000000001 2.1889 +-5.1419 -0.6567 3.211 +-4.9435 2.0393000000000003 1.7267000000000001 +-4.9435 1.4034 3.9255999999999998 +-4.9435 0.1846 2.3568 +-4.9435 1.9418000000000002 3.7239 +-4.9435 0.8318000000000001 3.8642999999999996 +-4.9435 2.3422 2.4894 +-4.9435 0.1419 2.7308 +-4.9435 0.23149999999999998 3.1449 +-4.9435 0.3485 3.5528999999999997 +-4.9435 0.5597000000000001 3.5645999999999995 +-4.9435 2.0335 3.4769 +-4.9435 0.6721 1.7357999999999998 +-4.9435 2.3095 3.0212 +-4.9435 1.0453999999999999 3.7838 +-4.9435 1.5231 1.4735 +-4.9435 0.43689999999999996 1.7416999999999998 +-4.9435 0.3921 1.9873999999999998 +-4.9435 1.7049 1.6743000000000001 +-4.9435 2.4920999999999998 2.7498 +-4.9435 0.098 2.2061 +-4.9435 2.3869000000000002 2.1846 +-4.9435 0.10389999999999999 3.1667 +-4.9435 2.1239999999999997 2.0033 +-4.9435 1.1809 1.5778 +-4.9435 0.9482 1.4789 +-4.9435 1.5772000000000002 3.7521 +-4.9435 2.3324000000000003 3.3021000000000003 +0.4965 -4.723999999999999 1.0 +0.4965 -4.723999999999999 11.3 +3.7733000000000003 -2.3404000000000003 0.36 +-4.418699999999999 -1.0877 3.4408000000000003 +-5.269900000000001 -0.8699999999999999 2.02 +-2.6459 2.5313 -2.8001 +0.8933 -3.3000000000000003 -1.577 +-5.6603 0.7226 3.6419 +-5.1995 -1.1712 3.4741 +-5.2635000000000005 -1.1517 1.9227 +-5.0011 0.7747999999999999 1.7765 +2.0133 1.8418 -0.0552 +-7.5547 -0.8493999999999999 3.0196 +-7.5547 -1.6518000000000002 3.0183999999999997 +-4.2779 -0.5211 2.5669999999999997 +-4.4699 -0.7292 2.1157 +-5.845899999999999 -1.2149999999999999 3.3203000000000005 +-0.9307 -3.8754999999999997 -0.6446999999999999 +-2.3707 5.8369 0.1 +-2.3707 5.8369 0.8999999999999999 +-5.1227 -1.9836 2.5841 +-2.9595 -4.9525 0.0 +-2.9595 -0.1722 0.0 +-2.9595 -4.5737 0.44999999999999996 +0.8421 -3.3579 -0.3844 +-5.4491 1.4165 1.6223 +-7.9387 -1.7774999999999999 2.7001 +-4.6619 0.1591 2.6032 +-4.4635 -1.7606 0.0 +-3.9387 2.2472 4.354 +-0.6618999999999999 -3.5742000000000003 -1.9883000000000002 +3.1397 -4.5382 1.0 +3.1397 -4.5382 0.44999999999999996 +3.1397 4.9881 1.0 +3.1397 4.9881 0.44999999999999996 +3.1397 -4.9882 1.0 +3.1397 -4.9882 0.44999999999999996 +3.1397 4.5381 1.0 +3.1397 4.5381 0.44999999999999996 +-3.1515 1.4784 4.003 +-3.1515 0.2248 3.5464 +-3.1515 2.4812000000000003 2.1932 +-3.1515 -0.006600000000000001 2.2324 +-3.1515 1.9664000000000001 3.8167 +-3.1515 1.864 1.5022 +-3.1515 1.0594 4.0057 +-3.1515 1.4347 1.3723 +-3.1515 0.5277 1.5613 +-3.1515 0.6301 3.8758 +-3.1515 2.5007 3.1456 +-3.1515 2.2936 3.5099 +-3.1515 2.5834 2.6299 +-3.1515 2.2693000000000003 1.8316 +-3.1515 -0.0892 2.7481 +-3.1515 1.0156999999999998 1.375 +-3.1515 0.2006 1.8682 +-3.1515 0.013 3.1849000000000003 +-4.3931 -0.5658 2.4318 +-7.7339 -0.6981 2.3480999999999996 +-7.7339 -0.6472 2.71 +-0.9178999999999999 4.6605 1.0 +-0.9178999999999999 4.6605 11.3 +-5.701 -1.3144 3.0427 +-0.5234 -3.7404 -0.4635 +1.051 -3.3362999999999996 -0.5384 +-5.5026 2.2686 2.5399000000000003 +-6.1554 1.4966 3.5340999999999996 +-5.893000000000001 1.2043 2.7131 +-5.3682 -0.5875 3.0412000000000003 +-4.5809999999999995 -1.9820999999999998 2.4028 +3.547 -0.3182 -2.4 +-4.645 -1.5997000000000001 3.3483 +-4.645 0.7103 3.567 +4.0718 -4.6754999999999995 0.0 +4.0718 -4.6754999999999995 1.0 +-4.9714 -0.583 3.0235000000000003 +-6.085 1.1886 0.0 +-6.085 1.1886 1.0 +0.9934000000000001 -3.8503999999999996 -0.1289 +-5.5602 -1.8135999999999999 3.1713999999999998 +3.8158 -2.0394 0.5 +-6.0146 1.7863 1.7422 +-6.0146 2.0285 1.9254 +-7.1922 -1.1775 2.1149 +0.9358 -3.3579 -2.2549 +-5.093 -1.5061 3.4354000000000005 +-3.4546 -3.2612 13.96 +0.347 -6.2904 0.1 +0.347 -6.2904 0.8999999999999999 +-7.5826 -0.9313999999999999 2.5838 +1.1341999999999999 -3.3364 -2.4448999999999996 +-2.469 2.2921 0.0 +3.4958000000000005 -0.8770999999999999 -2.8107 +-5.5474000000000006 0.36579999999999996 3.3314000000000004 +-5.285 -0.8007 3.2948999999999997 +-5.285 -1.8297 3.2196000000000002 +-4.4978 0.402 3.2814 +-4.4978 -1.9796999999999998 2.432 +0.9421999999999999 -3.9656 -2.3307 +0.9421999999999999 -3.8442 -2.3331 +1.467 -0.8789999999999999 -2.4001 +-4.2993999999999994 -1.4897 3.4181999999999997 +-4.6258 0.23210000000000003 2.857 +-5.0802 -1.7623 3.2800999999999996 +-5.0802 -1.5956000000000001 2.874 +-5.0802 -1.1156 2.394 +5.2749999999999995 0.3897 1.0 +5.2749999999999995 0.3897 0.44999999999999996 +5.2749999999999995 -0.3897 0.44999999999999996 +-1.2786 -3.7241999999999997 -0.29510000000000003 +-5.669 1.5415 3.7508 +-5.4706 -0.5265 2.8825 +-5.4706 1.8215999999999999 3.5696 +-5.208200000000001 -1.9796999999999998 2.9675 +0.49420000000000003 1.3724999999999998 -1.4000000000000001 +0.49420000000000003 -0.6194 -1.4000000000000001 +-4.7474 0.4394 2.0514 +-4.2226 -1.4064999999999999 1.9751 +-5.073799999999999 -1.0449 1.9475 +-5.073799999999999 -0.5072 2.7167 +-0.7474 -3.7259 -2.53 +-5.1378 -1.5603 2.5239000000000003 +-5.1378 -1.5603 3.0039 +-4.8754 -0.5205000000000001 2.8028999999999997 +-0.8114 -3.8442 -2.3408 +-4.4146 -1.8509000000000002 2.5234 +1.0253999999999999 -3.3000000000000003 -2.5395000000000003 +-2.117 4.106400000000001 0.0 +-2.117 4.106400000000001 0.5 +4.699 -0.7006 14.2738 +-7.7490000000000006 -0.9183 2.7121 +-4.8626000000000005 1.3847999999999998 1.6695000000000002 +-0.5362 3.7224 -2.6987 +0.251 -2.4461 -0.5 +-4.4018 -2.0292 2.6614 +-9.0546 1.9477000000000002 2.2504 +-0.7282000000000001 -3.8448999999999995 -2.4336 +-4.3313999999999995 -1.6154000000000002 2.0591999999999997 +0.8462000000000001 -3.7241999999999997 -2.4665 +0.25739999999999996 -2.4242 -0.7823 +-4.6578 -1.3299 1.9217000000000002 +-5.573 -0.6 2.7 +-5.573 -1.7758 2.318 +-5.573 -1.5267 2.1119 +-5.573 -1.8948 2.7815 +-5.573 -1.6643000000000001 3.2008 +-5.573 -0.9892 1.9668 +-5.573 -1.0491000000000001 3.3181000000000003 +-5.573 -1.0491000000000001 2.0819 +-5.6370000000000005 2.2784 2.5699 +-5.3746 -0.6108 2.2706 +-4.4553 2.3867 3.4034 +-4.4553 2.4336 2.0566999999999998 +-4.4553 1.2015 4.0327 +5.6375 -0.2382 0.44999999999999996 +-8.3209 1.0583 3.3941 +-4.519299999999999 -0.3262 4.3555 +4.1335 -1.9017 1.0 +4.1335 -1.9017 11.3 +-5.4345 -1.942 2.4476999999999998 +-5.3641000000000005 -1.8155000000000001 2.3619000000000003 +-5.3641000000000005 -1.0185 2.0831 +-5.3641000000000005 -1.9062 2.6407 +-5.3641000000000005 -0.7739 2.2446 +1.7143 6.0623000000000005 0.1 +1.7143 6.0623000000000005 0.8999999999999999 +-4.0521 2.0206999999999997 3.4162 +-4.6409 1.8234 3.5485 +-5.7545 1.6424 3.6449000000000003 +4.8631 -4.0051000000000005 0.1 +4.8631 -4.0051000000000005 0.8999999999999999 +-7.1945 -0.6666 2.6094 +-5.293699999999999 -0.5836 3.0288 +2.3095 -0.1722 -0.5 +1.9831 -2.3062 0.0 +3.6214999999999997 -0.455 0.0 +-4.5705 1.9518 1.9389 +-4.5705 -0.8803 3.3341999999999996 +-1.0312999999999999 -3.8442 -0.2049 +-7.3225 -1.3829 2.2037999999999998 +-7.3225 -1.1171 3.1961999999999997 +2.4438999999999997 2.3524 0.0 +2.4438999999999997 -2.1024000000000003 0.0 +-2.6633 -5.0319 0.44999999999999996 +-2.6633 -4.4944 0.0 +-0.7625 -1.3207 -1.4000000000000001 +-0.7625 1.3207 -0.06 +4.3511 -1.6407 14.1681 +-4.6921 1.4937 1.6823000000000001 +4.7479000000000005 -0.1421 1.0 +4.7479000000000005 -0.1421 11.3 +-4.6217 -0.6171 3.1618 +-4.6217 2.3351 2.7749 +1.2791000000000001 -3.7249 -0.3095 +-1.7353 4.4216999999999995 1.0 +-1.7353 4.4216999999999995 11.3 +-1.0121 -3.7253000000000003 -0.6904 +-5.4025 1.9484000000000001 1.9309 +0.0375 -3.5520000000000005 -0.5142 +-4.0905 -2.4146 11.3 +-4.9417 -1.0076999999999998 1.9598 +-4.6793000000000005 -2.0029000000000003 3.1807000000000003 +-5.7225 1.9268 3.5505 +-4.8009 1.4137 3.7110999999999996 +-7.5529 -0.74 2.71 +-2.6377 -3.9503000000000004 11.3 +-2.6377 -3.9503000000000004 15.479999999999999 +-4.8649 -2.0845 2.3659 +-4.6025 -0.8056000000000001 2.1116 +-2.9641 -0.9544 -0.5 +0.8375 -3.7241999999999997 -0.11839999999999999 +0.8375 -3.7241999999999997 -2.6814 +0.8375 -3.5242000000000004 -0.11839999999999999 +0.8375 -3.5242000000000004 -2.2375 +-8.5321 1.7023 2.7508 +3.0711 -0.2443 -0.5 +-7.8729 -1.1322999999999999 3.0235000000000003 +-5.2489 -1.302 3.4409 +1.3751 0.0162 -1.4000000000000001 +1.3751 -0.0162 -2.4 +1.6375000000000002 4.4716 15.479999999999999 +-4.9161 -0.5201 2.9581 +-4.653700000000001 0.8892000000000001 3.6612 +-5.110399999999999 -0.7255 3.2772999999999994 +-1.0464 -1.3733 -2.3945000000000003 +-5.4368 1.6552 3.7002 +-7.664 -1.9113000000000002 2.5473 +2.1024000000000003 2.0109 -0.5 +2.1024000000000003 2.4438999999999997 0.0 +2.1024000000000003 -2.4438999999999997 0.0 +-0.3872 -3.7241999999999997 -0.6594 +-0.3872 -3.5242000000000004 -2.1405 +0.4 0.0 -0.06 +-5.3664000000000005 2.1869 1.9031 +-0.8416 -3.7241999999999997 -0.3905 +-0.8416 -3.5242000000000004 -0.40959999999999996 +-5.232 -1.9355 2.4341999999999997 +-5.5584 1.4941 1.6827999999999999 +-0.5087999999999999 1.2012 -2.4 +-7.9136 -0.8546 2.2448 +-6.0128 -1.8806 0.1 +-6.0128 -1.8806 0.8999999999999999 +-4.7008 1.0853 1.6641 +-0.9632 -0.1266 -2.4 +-0.9632 0.1266 -1.4000000000000001 +-5.3536 -1.5006 1.9629 +-5.3536 -1.989 2.777 +-9.0208 1.6768 2.5776 +-5.0847999999999995 2.1386 3.5524 +-2.6592000000000002 1.2593 -0.5 +-2.6592000000000002 -1.1516 -0.5 +-2.6592000000000002 -1.2593 0.0 +0.0288 -3.5538 -2.2851 +-4.3616 1.3037999999999998 3.7630999999999997 +-2.0 -0.0 -0.03 +-4.752 0.4282 2.0545999999999998 +-5.0784 1.0937000000000001 3.9074999999999998 +2.0 0.0 -0.03 +-4.6816 -2.0812 2.3695999999999997 +2.6592000000000002 1.1516 -0.5 +2.6592000000000002 -1.2593 -0.5 +-5.008 2.3399 2.8034 +-5.008 -1.1381999999999999 1.9727000000000001 +-2.5824 -2.4523 -2.8000000000000003 +-4.2848 -1.4097 3.4302 +-5.136 -0.5194 2.4147 +-5.136 -0.6817 2.1583 +-9.0016 0.8090999999999999 2.8265 +-6.051200000000001 1.472 1.7996999999999999 +-6.051200000000001 1.2348 1.7718 +-7.1648000000000005 -1.2408000000000001 3.3894 +-7.1648000000000005 -1.2590999999999999 2.0105999999999997 +-5.5264 -1.2629 3.4782 +-7.7536 -1.8624999999999998 2.3904 +0.9632 -0.1266 -1.4000000000000001 +0.9632 0.1266 -2.4 +0.6368 -3.5242000000000004 -2.0511 +6.0128 1.8806 0.1 +6.0128 1.8806 0.8999999999999999 +-5.4559999999999995 -1.6386 2.0278 +-4.6688 2.2638 2.5134 +0.5087999999999999 -1.2012 -2.4 +-5.584 0.6564000000000001 2.1259 +-5.584 1.3419999999999999 1.8862 +-5.584 0.48849999999999993 2.3987000000000003 +-5.584 1.9695 3.1057 +-5.584 1.0223 1.9062 +-5.584 1.1672 3.5147 +-5.584 1.6493 1.9771 +-5.584 0.8552000000000001 3.4255 +-5.584 1.7510000000000001 3.3480000000000003 +-5.1232 -0.47159999999999996 2.7201 +-1.0592000000000001 -3.8442 -2.2115 +0.8416 -3.5242000000000004 -2.3905 +0.8416 -3.5905 -1.6664999999999999 +-4.0736 -1.9890999999999999 4.3546000000000005 +-5.251200000000001 -1.9904000000000002 2.7851999999999997 +-2.1024000000000003 2.0109 0.0 +-2.1024000000000003 2.4438999999999997 -0.5 +-2.1024000000000003 -2.4438999999999997 0.0 +-2.1024000000000003 -2.0109 -0.5 +-5.1168 -0.9958 2.0077000000000003 +-4.8544 0.6014 1.879 +-9.0464 1.0801 3.1213 +-5.7696 -1.3728 3.2724999999999995 +-1.6375000000000002 -4.4716 15.479999999999999 +-1.3751 0.0162 -2.4 +-1.3751 -0.0162 -1.4000000000000001 +-1.1127 -1.6613 -0.06 +-4.4535 2.3154 2.4729 +-4.4535 2.1043 3.7059 +-4.4535 2.5564 2.4551 +-4.4535 0.46540000000000004 2.0151 +-4.1911 -1.7723 2.1559 +-5.3687 -1.0193 3.3185 +-5.3687 2.2387 2.9805 +-5.1063 -0.6159 2.3231 +-5.6951 2.2031 3.2072000000000003 +1.1209 -3.5242000000000004 -2.4586 +-3.0711 0.2443 -0.5 +-5.5607 -0.8645 2.0752 +-5.5607 -1.0663 3.4130000000000003 +-5.5607 -1.5166000000000002 2.0167 +-2.6103 2.4225 -2.8000000000000003 +-7.2631 -1.1772 3.2070000000000003 +-5.1639 -0.6291 2.2335000000000003 +-4.6391 -0.8444 2.0369 +2.9641 0.9544 -0.5 +0.47450000000000003 -3.4651 -0.7607 +0.6089 -4.0242 -1.9251999999999998 +0.8713000000000001 -3.3000000000000003 -2.4052000000000002 +-5.4199 -1.6399000000000001 3.3724999999999996 +-4.9591 -1.3083 3.4304 +-5.5479 1.9310999999999998 3.5429000000000004 +-2.0087 3.1667 -2.7 +-5.9383 1.9709 1.8458999999999999 +0.8137 -3.3000000000000003 -0.991 +-5.2151000000000005 -0.565 3.0701 +-5.2791 -1.9805 2.9694000000000003 +-0.4279 -4.0242 -2.0933 +-4.2935 -0.6073000000000001 3.0777 +-4.0311 2.1092 2.0883 +-5.2727 -1.4267 3.4228 +-5.0103 1.0718 3.7601999999999998 +-4.2231 -1.7545000000000002 2.162 +-4.2231 -1.9477000000000002 2.4474 +-4.5495 2.2087 2.3313 +-4.5495 -1.3287 1.9259 +-5.9255 0.34550000000000003 3.4198 +-5.4007 -1.3128000000000002 1.9606 +-5.1383 -1.7677999999999998 2.1642 +-5.9895 1.0671 1.6695000000000002 +0.8265 -3.7241999999999997 -2.6317 +-1.9255000000000002 2.4731 -0.5 +-4.677499999999999 2.099 2.1123 +0.7625 -1.3207 -0.06 +0.7625 1.3207 -1.4000000000000001 +2.6633 4.4944 0.0 +2.6633 5.0319 0.44999999999999996 +-5.528700000000001 0.1675 2.6321 +3.1881 -3.3437 0.0 +3.1881 -3.3437 0.5 +-4.7415 -0.28400000000000003 1.0 +-4.7415 -0.28400000000000003 11.3 +-8.8695 0.49100000000000005 2.2997 +-5.3303 -1.8859000000000001 2.33 +-5.6567 2.2597 2.5127 +-7.883900000000001 -0.9294 2.71 +-2.4438999999999997 2.1024000000000003 0.0 +-2.4438999999999997 -2.1024000000000003 -0.5 +-2.4438999999999997 -2.3524 0.0 +-4.4087000000000005 -0.7439 2.9541999999999997 +-4.4087000000000005 -1.5506 2.0204 +-4.472700000000001 -1.4594 3.4168 +-5.5863000000000005 1.5664 3.4563 +-2.3095 0.1722 -0.5 +-5.6503 -1.367 3.2736 +-5.125500000000001 -1.2552 3.4871 +-4.8631 4.0051000000000005 0.1 +-4.8631 4.0051000000000005 0.8999999999999999 +-1.0614999999999999 -3.9379999999999997 -2.22 +-9.055100000000001 0.9288 3.4775 +-1.7143 -6.0623000000000005 0.1 +-1.7143 -6.0623000000000005 0.8999999999999999 +-5.9703 0.3827 3.3687 +-5.7078999999999995 0.22560000000000002 2.834 +-5.7078999999999995 -1.1867 3.0393 +-5.4455 2.0276 3.4475 +-4.1335 1.9017 1.0 +-4.1335 1.9017 11.3 +4.519299999999999 0.2424 4.3643 +-7.800700000000001 -1.7722000000000002 2.6969 +-5.6375 0.2382 0.44999999999999996 +-4.9806 -0.8813 3.3386 +-4.4558 0.6164000000000001 1.8747 +-5.0446 0.2937 3.0718 +-1.1086 -2.699 -0.4897 +-5.499 1.3233 3.7153 +1.8418 1.5227 -0.0552 +-5.563 -0.6784 2.3234999999999997 +-5.563 -1.9274 2.6028 +-5.563 -0.9450999999999999 3.3127999999999997 +-5.563 -1.2351 2.0157000000000003 +-5.563 -1.8047 2.2991 +-5.563 -1.5548 2.0872 +-5.563 -1.7148 3.2023 +-5.563 -1.3546 3.3844 +-5.563 -1.8950000000000002 2.9287 +-5.563 -0.6154999999999999 2.9565 +-5.563 -0.5689 2.6323 +-5.563 -0.9188 2.101 +-3.9246000000000003 -2.6758 1.0 +-3.9246000000000003 -2.6758 11.3 +-4.7758 0.4023 3.2769 +-1.8254 -2.3605 -0.5 +-1.8254 2.6395 -0.5 +0.8626 -3.8442 -0.5420999999999999 +-7.918200000000001 -0.7223 2.4309000000000003 +-7.6558 -1.8355 2.3702 +-6.017399999999999 0.29510000000000003 3.0766999999999998 +-5.5565999999999995 -1.9654 2.8850000000000002 +-8.0462 1.8756 3.2338999999999998 +-2.7342 -3.8842000000000003 1.0 +-2.7342 -3.8842000000000003 11.3 +-8.763 2.2084 2.7153 +2.117 4.106400000000001 0.0 +2.117 4.106400000000001 0.5 +-7.579 -1.5832 2.7105 +-5.9406 0.7735 1.7185 +-5.9406 0.385 3.3762 +-1.0253999999999999 -3.3000000000000003 -2.2605 +-5.7422 0.21810000000000002 2.6635 +-4.955 0.7779999999999999 1.7067999999999999 +-4.955 0.5622 3.5315 +-5.409400000000001 0.5238999999999999 3.5075000000000003 +-0.49420000000000003 0.6194 -1.4000000000000001 +-0.49420000000000003 -1.3724999999999998 -1.4000000000000001 +-5.2749999999999995 0.3897 0.44999999999999996 +-5.2749999999999995 -0.3897 1.0 +-5.2749999999999995 -0.3897 0.44999999999999996 +-4.4878 -0.7589 2.1176 +-5.339 -0.4686 2.6895 +-5.0766 2.044 1.7718999999999998 +-5.1406 -1.4035 2.9066 +-4.8782 -0.5212 2.5754 +-4.8782 0.6585 1.8389 +-4.8782 -1.7513999999999998 3.2845 +-8.5454 0.822 2.8228 +-4.8717999999999995 0.3415 2.2039 +2.469 2.1627 0.0 +-5.787 0.3638 2.5907 +-5.787 0.381 2.8031 +-5.787 0.9762 3.5374000000000003 +-5.787 1.6669 1.9304999999999999 +-5.787 0.4509 2.2649 +-5.787 1.6101 3.5066 +-5.787 0.5815 2.1353 +-5.787 2.0279 2.2281 +-5.787 1.2064 1.8259 +-5.787 1.1162999999999998 3.5835 +-5.787 2.125 2.7161 +-5.787 1.8411 3.3570999999999995 +-5.787 0.5610999999999999 3.2397 +-5.787 0.7887 3.4845 +-5.787 2.0060000000000002 2.2592 +-7.163 -1.0071 3.3404999999999996 +-7.163 -1.0071 2.0595 +-7.163 -1.7627 3.1542 +-0.347 6.2904 0.1 +-0.347 6.2904 0.8999999999999999 +-4.539 1.4001 1.0 +-4.539 1.4001 11.3 +-4.603 -1.4487 3.0808 +-4.603 -1.3783 2.8436 +-4.603 -1.1525 2.421 +-4.603 -1.5242 2.5975 +-4.603 -1.015 2.8000000000000003 +-4.603 -1.015 2.81 +-4.603 -1.6258000000000001 2.496 +-4.603 -0.9753 2.6006 +-4.603 -1.3475000000000001 2.979 +-4.603 -1.0513 2.3192 +-4.603 -1.3444 2.4207 +-4.603 -1.1506 2.9766 +-4.603 -1.019 3.0835 +-4.603 -1.5246 2.7994000000000003 +-4.603 -1.1044999999999998 2.841 +-4.603 -1.1114000000000002 2.8333 +-4.603 -1.5814000000000001 2.3533 +-4.603 -1.1216 2.5564 +-4.603 -0.9127 2.8465000000000003 +-4.603 -0.8829999999999999 2.9825999999999997 +-4.603 -1.3886 2.5667 +-4.603 -1.5916 3.0364 +-4.603 -0.8776 2.4968 +-4.603 -1.6223 2.9032 +-4.603 -0.9083000000000001 2.3636 +-4.603 -1.4482 2.3226 +-3.8158 2.0394 0.5 +-5.780600000000001 2.2417 2.4228 +-8.5326 1.4347 3.1155 +-7.745399999999999 -0.8241999999999999 2.2647 +-5.8446 0.9188999999999999 1.5311 +-8.859 0.4456 3.2211 +6.085 -1.1886 0.0 +6.085 -1.1886 1.0 +0.3186 -0.2571 -0.06 +-5.9726 0.6272 1.8617000000000001 +-4.0718 4.6754999999999995 0.0 +-4.0718 4.6754999999999995 1.0 +2.4178 2.3996 -0.5 +-8.526200000000001 0.9804999999999999 3.0745 +-4.987 -1.7725000000000002 3.2791 +-5.5758 -1.2547000000000001 3.286 +-3.2141999999999995 -3.3616 14.424500000000002 +0.5234 -3.7404 -2.3364 +-4.3918 -0.5626 2.9678 +0.7858 -3.4241 -1.2297 +-5.5054 1.8825 3.5311000000000003 +-5.242999999999999 -1.8803 2.2995 +-2.6853 2.4796 0.0 +-5.4373 -1.3262 2.12 +-4.9125000000000005 -1.3903 1.9789999999999999 +-4.9125000000000005 -0.636 3.1794999999999995 +-4.6501 -1.376 3.4262 +-8.515699999999999 0.8496 2.4234 +0.1371 0.38939999999999997 -1.6 +-3.1397 -4.5381 1.0 +-3.1397 -4.5381 0.44999999999999996 +-3.1397 4.9882 1.0 +-3.1397 4.9882 0.44999999999999996 +-3.1397 -4.9881 1.0 +-3.1397 -4.9881 0.44999999999999996 +-3.1397 4.5382 1.0 +-3.1397 4.5382 0.44999999999999996 +-5.3669 0.0553 2.3935999999999997 +-5.3669 -0.6222 2.4956 +-0.1893 -4.4242 -2.0523 +2.9595 4.5737 0.44999999999999996 +2.9595 0.1722 0.0 +2.9595 4.9525 0.0 +-4.7077 0.3701 3.3386 +-4.7077 2.0993999999999997 2.1059 +2.3707 -5.8369 0.1 +2.3707 -5.8369 0.8999999999999999 +-5.0916999999999994 -1.4923 3.4402000000000004 +-1.0917 -3.5242000000000004 -2.5080999999999998 +-5.8725 2.4153000000000002 3.0161000000000002 +-5.6101 0.471 1.9386 +-5.3477 -1.212 1.9224999999999999 +-3.7733000000000003 2.3404000000000003 0.36 +-1.0853 -3.3334999999999995 -2.2856 +-3.3125 1.5605 -2.8001 +-4.4261 -1.9838000000000002 2.6172 +-5.0789 -1.013 2.5845 +-4.5541 -1.3491 3.4448 +-4.2917 1.6277 0.5 +-0.7525 -3.6955 -1.1381000000000001 +-5.1429 -1.9869999999999999 2.7525999999999997 +-5.1429 -1.4797 2.5488 +1.0843 -3.8442 -0.4265 +-5.4693 -0.853 2.0253 +-0.2917 -1.9929999999999999 -0.06 +-0.029300000000000003 0.4066 -0.06 +-3.0437 3.4356999999999998 0.5 +-0.6820999999999999 -6.1624 0.0 +-0.6820999999999999 -6.1624 1.0 +-5.0725 1.3881 1.6039 +-9.0021 1.3218 3.1558 +1.0907 1.688 -0.06 +-8.5413 1.9354 2.9389 +-3.6261 2.0098000000000003 0.1 +0.6363 -2.4242 -1.1622999999999999 +-5.9173 -1.8508 0.0 +-5.9173 -1.8508 1.0 +-7.549300000000001 -1.5454 2.5758 +-7.549300000000001 -1.1122 2.9893 +-7.549300000000001 -1.3866 3.2042 +1.1675 -3.3334999999999995 15.479999999999999 +-0.20850000000000002 1.1142 -0.06 +-0.20850000000000002 -1.1142 -1.4000000000000001 +0.053899999999999997 -2.249 0.0 +0.053899999999999997 -2.751 -0.5 +-5.4501 0.6311 1.8392 +-5.1876999999999995 -0.5232 2.5769 +2.6779 -2.3032 15.479999999999999 +-4.9893 2.0063999999999997 3.4637000000000002 +-5.5781 0.2205 2.6328 +3.0747 -2.1467 -0.1 +-4.5925 1.0737 1.6677000000000002 +-4.3301 1.3676000000000001 3.7499 +-5.1813 -0.5846 2.3611 +-7.9333 -0.7398 2.7 +-7.9333 -1.517 2.26 +-7.9333 -1.4076 3.19 +0.7835 -0.1183 -0.06 +-9.046899999999999 1.3799000000000001 3.1314 +-4.7204999999999995 -0.53 2.9207 +-5.3093 -1.6768999999999998 3.3521 +-4.7844999999999995 0.5886 3.4874 +-5.1772 -0.5118 2.6361 +-4.390000000000001 -1.049 3.4313000000000002 +-5.766 0.16570000000000001 2.6623 +-4.454000000000001 -0.7202 2.1618 +0.7236 -3.8077 -0.4595 +-5.0428 0.40499999999999997 3.2744000000000004 +-5.0428 2.3383000000000003 2.8302 +5.050000000000001 -0.0 1.0 +5.050000000000001 -0.0 0.44999999999999996 +3.6740000000000004 -2.0852 0.5 +-4.319599999999999 -1.1156 1.9744000000000002 +-5.4972 -1.2833 3.4772999999999996 +3.4819999999999998 -3.2308000000000003 1.0 +3.4819999999999998 -3.2308000000000003 11.3 +-5.0363999999999995 -1.9800000000000002 2.621 +-4.774 0.3162 3.1621 +1.3252 1.1341 -2.3801 +-5.158 -1.3617000000000001 3.4273 +-4.8956 -0.5636 2.4357 +1.0692 0.3766 -1.4000000000000001 +-4.4348 -1.8124999999999998 0.5 +-8.825199999999999 1.6018999999999999 2.3612 +-4.5628 -1.8280999999999998 1.0 +-5.740399999999999 0.9896999999999999 3.2281999999999997 +-5.740399999999999 0.9233 3.0194 +-5.740399999999999 1.069 2.9894 +-5.740399999999999 1.5877 3.0212 +-0.8252 -0.1875 -1.4000000000000001 +4.6148 -0.2199 0.0 +4.6148 -0.2199 0.5 +-6.3932 1.3925999999999998 2.2103 +-8.358 1.1148 2.2286 +-5.9324 1.2983 3.5176 +-4.294 1.4647000000000001 4.352799999999999 +-4.358 -1.1677 0.5 +-8.223600000000001 1.307 1.9817999999999998 +0.7556 -0.1077 -2.3782 +-4.2236 -1.9801 2.5916 +-4.9404 2.0642 3.3105 +-4.678 -0.731 1.9710999999999999 +-4.678 -0.6023999999999999 3.3175000000000003 +-6.053999999999999 0.3423 2.8811 +-0.8764 -3.5242000000000004 -2.3097 +-0.614 -3.4238999999999997 -0.8928 +-5.2668 -1.5041 3.3923 +0.698 4.4961 1.0 +0.698 4.4961 11.3 +-7.558 -0.9305000000000001 2.7 +-7.558 -1.5499 2.8141 +-7.558 -1.5716 2.7 +-4.1468 -1.9677 0.5 +-4.1468 -1.9677 0.1 +-5.2604 -1.7744 2.1227 +-0.6716 -3.5242000000000004 -0.9143 +1.9524 3.8179 0.36 +-5.4524 -0.47280000000000005 2.7093 +-2.1756 1.9784 -0.5 +-0.8635999999999999 -3.9352 -0.26080000000000003 +0.4484 1.1828 -1.4000000000000001 +-4.3324 -1.9564000000000001 2.9024 +0.9156 -3.8442 -0.3735 +-5.9644 1.0096 1.6833999999999998 +-4.4563 -0.4744 2.6446 +-2.2931 -2.4726999999999997 0.0 +-2.2931 1.9820999999999998 0.0 +-3.4707000000000003 0.6557000000000001 15.479999999999999 +-4.3219 -1.9785000000000001 2.5607 +-2.4211 -0.2443 0.0 +0.5293 3.6189 -2.8001 +-5.2371 -0.7367 2.1145 +-4.5139 -1.8709 3.1665 +-9.2307 0.743 3.2124 +1.0605 -3.7241999999999997 -0.2594 +1.8477000000000001 2.3665 0.0 +-4.4435 -1.8925999999999998 2.3223000000000003 +-5.5571 -1.6762 2.049 +-0.9683 -3.9293 -0.5949 +-5.358700000000001 -1.7416 2.1041 +-4.6355 -0.5193 2.4167 +-4.3731 -1.389 3.4292999999999996 +1.0669 -3.8442 -2.3422 +-5.4867 -0.7959 3.2910000000000004 +-0.3731 -4.7474 11.3 +-4.8275 1.0191000000000001 3.7497999999999996 +-1.0259 -3.5242000000000004 -2.2435 +1.1373 -3.8442 -0.2579 +-4.8915 2.0027 3.4677 +2.3853 2.6048999999999998 11.3 +-8.8211 1.6948999999999999 2.5694000000000004 +-5.5443 -1.9568999999999999 2.4674 +-5.281899999999999 -0.5217 2.5732 +-0.9554999999999999 -3.7241999999999997 -0.5524 +-0.6930999999999999 -6.261799999999999 0.1 +-0.6930999999999999 -6.261799999999999 0.8999999999999999 +-5.3459 -1.8066 3.1792000000000002 +-5.934699999999999 2.3654 2.4529 +-0.7571 -3.8715 -2.3265000000000002 +-2.1330999999999998 -4.0642 0.5 +-4.8850999999999996 1.9349 1.8488 +-3.2467 5.281899999999999 0.0 +-3.2467 5.281899999999999 1.0 +-4.9491 -2.0092 0.0 +0.7533 -4.689900000000001 11.3 +0.7533 -4.689900000000001 15.479999999999999 +1.2781 -3.8156000000000003 -0.3679 +-5.2755 -1.2447 1.9129 +-5.0131000000000006 -1.3901000000000001 1.9788000000000001 +-5.6019 0.2316 2.9343999999999997 +-5.0771 1.466 3.7175 +-5.0771 2.3749 2.2269 +-7.5667 -1.3877000000000002 2.9893 +1.0861 -3.5242000000000004 -2.3047999999999997 +-3.5666999999999995 -2.8087999999999997 1.0 +-4.4179 -1.3234 3.2685 +1.2205000000000001 -3.8774 -0.2797 +-5.3331 -0.5196000000000001 2.9781 +-7.8867 -1.3992 2.9869 +-7.8867 -0.9476 2.5850999999999997 +-4.0851 2.093 0.36 +2.7309 1.3978000000000002 0.0 +2.7309 -1.0131 0.0 +-7.163500000000001 -0.7858999999999999 3.2099999999999995 +-7.163500000000001 -1.8913 2.9530000000000003 +-7.163500000000001 -0.7997000000000001 2.1779 +-7.163500000000001 -1.8226 2.3159 +-7.163500000000001 -1.5622 3.3147 +-7.163500000000001 -0.6086 2.447 +-7.163500000000001 -1.5785 2.0938 +-4.4755 -1.5048000000000001 1.9585000000000001 +-1.1986999999999999 -3.9297 -0.4319 +-0.9363 -3.9678999999999998 -2.4645 +-5.5891 0.3649 3.2307 +-3.2915 -3.2849000000000004 14.0146 +1.0349000000000002 -3.3327000000000004 -0.264 +-1.7170999999999998 -4.2890999999999995 0.0 +-1.7170999999999998 -4.2890999999999995 0.5 +-5.5827 -1.5091 3.2716000000000003 +-5.1219 -1.5457999999999998 3.4195 +2.4813 4.6764 0.44999999999999996 +-0.5331 -4.0242 -0.44120000000000004 +-5.8387 0.0443 2.8402 +-5.8387 0.6375 1.652 +0.9133 -2.6993 -0.3055 +1.8988999999999998 -2.5836 0.0 +-7.9315 -0.8444999999999999 3.0189 +-5.7683 1.3098999999999998 1.7913 +-0.8531000000000001 -3.7241999999999997 -2.4602 +-5.2435 -0.522 2.9922 +-4.7187 1.8924 1.8644999999999998 +-5.1114 -0.6968 3.248 +-8.7146 2.0892 2.7505 +-8.5162 1.6454 2.9773 +-8.5162 1.4468999999999999 3.1428 +-2.0265999999999997 -3.6093 0.36 +-0.3882 -0.8693 -1.4000000000000001 +-4.5162 1.2057 3.7220999999999997 +-5.3674 0.8958 1.5206000000000002 +-5.2330000000000005 -1.6302 2.0591000000000004 +4.0085999999999995 2.1526 1.0 +4.0085999999999995 2.1526 11.3 +-0.9066 -3.7241999999999997 -0.26649999999999996 +-3.9210000000000003 -2.4995 14.3101 +2.3062 1.9831 0.0 +-7.2618 -1.3181 2.1923000000000004 +-5.6234 -2.0284 3.0835 +1.1926 -4.3671 4.3622000000000005 +-5.7514 0.296 3.0859 +-8.5674 0.4202 2.6886 +-4.7658 0.23210000000000003 2.857 +-5.617 -1.4156 1.8443 +-5.3546000000000005 -1.7454999999999998 3.2474999999999996 +-7.8442 -0.7743 2.8979999999999997 +-8.433 0.7898000000000001 2.8466 +-8.433 0.9079 3.3321000000000005 +-8.433 1.9401000000000002 2.5166 +-8.433 1.1378 3.1697999999999995 +-8.433 1.8093000000000001 3.1439000000000004 +-8.433 0.5677 2.9103 +-8.433 0.6645 3.1086 +-8.433 1.5352 3.3628 +-8.433 1.228 3.4137 +1.5958 1.9585000000000001 -0.5 +-7.7097999999999995 -1.575 2.6951 +-4.759399999999999 0.8782999999999999 3.6524 +-8.689 0.34659999999999996 2.9742 +-5.7386 2.3376 2.7955 +-4.9514000000000005 -1.6939 3.2883000000000004 +-7.7034 -1.5603 2.5534999999999997 +-2.7882000000000002 3.5642 4.3651 +-9.0794 0.6944 3.1508000000000003 +-6.3914 1.5042 2.1783 +-8.3562 1.6581 2.4419 +-5.0794 -0.9032 2.396 +-5.0794 -1.3832 2.876 +-7.8313999999999995 -0.5759000000000001 2.7102999999999997 +-4.6186 0.22369999999999998 2.5395999999999996 +-6.0586 1.2441 2.7016999999999998 +1.2822 -3.7241999999999997 -0.1433 +1.2822 -3.5242000000000004 -2.6566 +-8.6122 1.796 1.9946 +-5.3354 0.025599999999999998 3.0307 +-5.3354 1.5618999999999998 1.4603 +-5.3354 0.0021 2.4462 +-5.3354 0.9769999999999999 1.4497 +-5.3354 0.24359999999999998 1.9133 +-5.3354 2.0799000000000003 1.7323000000000002 +-5.3354 2.4207 2.2078 +-5.0729999999999995 -1.5406 2.1677 +-5.0729999999999995 -0.4846 2.2630999999999997 +-5.0729999999999995 -1.846 2.812 +-5.0729999999999995 0.5113000000000001 3.3836 +-5.0729999999999995 -2.0084999999999997 3.1357000000000004 +-5.0729999999999995 0.24380000000000002 2.7219 +-5.0729999999999995 1.9887 2.0164 +-5.0729999999999995 0.8728 1.7669000000000001 +-5.0729999999999995 -2.1311 2.6817 +-5.0729999999999995 0.315 3.0546 +-5.0729999999999995 0.315 2.3453999999999997 +-5.0729999999999995 -0.7177 2.4093 +-5.0729999999999995 -0.8521000000000001 3.479 +-5.0729999999999995 -1.798 2.4402 +-5.0729999999999995 -2.0265999999999997 2.6307 +-5.0729999999999995 -0.3754 2.7163 +-5.0729999999999995 -0.5034000000000001 3.1683999999999997 +-5.0729999999999995 -0.8234 1.9364 +-5.0729999999999995 -1.6664 3.1409 +-5.0729999999999995 2.0177 3.3508999999999998 +-5.0729999999999995 1.6273 3.6331 +-5.0729999999999995 -1.138 3.2960000000000003 +-5.0729999999999995 -1.1723000000000001 2.0985 +-5.0729999999999995 0.9136 3.6485999999999996 +-5.0729999999999995 1.25 3.6999999999999997 +-5.0729999999999995 1.25 1.7000000000000002 +-5.0729999999999995 -0.7020000000000001 2.9598 +-5.0729999999999995 1.5864 1.7513999999999998 +-5.0729999999999995 -1.2232 3.5742999999999996 +-5.0729999999999995 -1.6822 3.4680999999999997 +-5.0729999999999995 2.2218 2.4379999999999997 +-5.0729999999999995 2.2323 2.9196 +-5.0729999999999995 -0.8973 2.2146 +-5.0729999999999995 -0.8973 3.1854 +-5.0729999999999995 -1.9917 2.2363999999999997 +-5.0729999999999995 -0.65 2.7 +-5.0729999999999995 -1.6635 1.9236 +-5.0729999999999995 -1.4354 3.2706 +-5.0729999999999995 1.8606 1.7891000000000001 +-5.0729999999999995 0.4823 2.0490999999999997 +-4.5482000000000005 -1.9763 2.8272 +-5.5274 -0.5 2.4906 +-0.9386 -3.8442 -2.4636 +-5.329 -0.5203 2.4289 +-4.4074 -0.6827 2.6477 +-4.4074 -1.6886 2.6593 +1.7558 4.4265 11.3 +-5.4506 0.6972 3.5714 +-2.1738 -3.9399 0.5 +-2.1738 -3.6290999999999998 0.36 +-5.1882 -0.6403 2.2790999999999997 +-4.925800000000001 0.7906 3.6167 +-3.025 -4.7631 0.0 +-3.025 -4.7631 0.44999999999999996 +-5.777 -1.2462 3.0456 +-5.2522 -1.4242 1.9411 +-0.9258000000000001 -3.3000000000000003 -0.5015000000000001 +-2.0394 -3.8158 0.5 +-5.7066 2.3377 2.7993 +-5.4441999999999995 -0.5524 3.0554 +-8.5866 1.2963 2.2136 +-0.5889 -4.4731 0.5 +-5.2417 -1.0076999999999998 1.9598 +-0.6529 -3.6482 -0.8412 +-8.5825 1.4545000000000001 3.1251 +2.8223000000000003 -5.033 0.0 +-7.923299999999999 -1.559 2.5362 +-3.5969 -0.6496 0.0 +-4.7105 1.9518 1.9389 +-5.5617 -1.872 2.2345 +-5.5617 -0.5186999999999999 2.6620999999999997 +-5.2993 -2.0077000000000003 2.5260000000000002 +-4.9025 -0.8056000000000001 2.1116 +-5.4913 -1.8455 2.2006 +3.4879000000000002 5.2592 0.8971 +-5.2928999999999995 -1.855 2.2033 +-3.3921 2.9748 0.5 +-2.6048999999999998 2.3853 11.3 +-4.8321000000000005 0.2197 2.329 +-7.321700000000001 -0.9116000000000001 3.0842 +-7.321700000000001 -1.5883999999999998 3.0842 +-7.321700000000001 -1.5886 2.3159 +-4.8961 -0.677 2.2403 +0.7423 -3.4493000000000005 -1.6799000000000002 +-4.1729 1.8193000000000001 3.5905 +-4.7617 2.3351 2.7748 +-1.4848999999999999 -4.290299999999999 1.0 +-1.4848999999999999 4.290299999999999 1.0 +-4.2368999999999994 -1.7773 2.1769 +1.1391 -3.9352 -0.5319 +-7.9041 -1.5403 2.848 +-1.3505 -3.2637 11.3 +-4.3649000000000004 -0.6989000000000001 3.1936 +1.3375 -0.3248 -0.06 +2.9759 -0.9601999999999999 0.0 +2.9759 1.4507 0.0 +-4.9536999999999995 -1.5643 1.991 +0.4863 1.3802999999999999 -0.06 +2.1247 -4.2483 1.0 +2.1247 -4.2483 11.3 +-5.0817 -1.3729 2.9893 +-5.4081 2.2468 3.1433000000000004 +-9.0113 0.8867 2.4291 +-9.0113 1.303 2.2499000000000002 +-5.5361 -0.7293 2.1218999999999997 +-4.8769 -0.6835 3.1710000000000003 +-1.0753000000000001 -3.5242000000000004 -2.2887999999999997 +-8.5441 0.6925 3.1509 +-5.2673 -0.7910999999999999 2.0658 +-4.4801 -1.8653 2.2167 +-4.8065 0.3592 3.3172 +-4.8065 0.8488000000000001 1.6725 +-2.9057 0.0789 0.0 +-5.459300000000001 -0.5531 2.3432999999999997 +-4.4097 -1.7043 2.809 +0.7679 -3.8878999999999997 -0.4732 +-9.0625 0.8015 2.8433 +-5.0625 0.6769 1.7590000000000001 +-4.8641 2.3281 2.7503 +-1.0625 -3.9069 -0.6237 +-8.9921 1.7288999999999999 2.5576000000000003 +-4.9281 0.21280000000000002 2.3586 +-4.4673 2.3382 2.7865 +1.2351 -3.7266 -2.2382 +4.5119 -1.4888000000000001 14.508899999999999 +4.5119 -1.1291 13.960700000000001 +0.9087 -3.5242000000000004 -0.2702 +-2.3681 0.2285 0.0 +1.1711 -3.8155 -0.18159999999999998 +-7.8721 -0.894 2.6984 +-5.7089 -1.3141 2.7 +-5.4465 1.7075 1.7158 +-6.035299999999999 1.4646 3.6975000000000002 +-4.3969000000000005 -2.0092 0.5 +-8.0001 0.29550000000000004 2.8516 +-0.9217 -3.3364 -0.2822 +3.4047 -2.981 4.3647 +-4.2625 -1.1202 3.4238999999999997 +-5.6385 -0.5448999999999999 3.1986 +-5.113700000000001 0.1621 3.3313 +-0.19849999999999998 1.0767 -1.4000000000000001 +-5.308 -1.9795 2.9703 +-4.7832 -2.0719000000000003 1.0 +-5.372 -1.7212999999999998 3.2904999999999998 +3.0824000000000003 -1.3959 -0.5 +-5.1096 -0.9076000000000001 2.8781999999999996 +-5.9608 1.6838 3.692 +-5.1735999999999995 -0.9712000000000001 2.4692 +-5.5 -0.44999999999999996 1.0 +-5.5 -0.44999999999999996 0.44999999999999996 +-5.5 0.44999999999999996 1.0 +-5.5 0.44999999999999996 0.44999999999999996 +-4.4504 -0.5178 2.9617999999999998 +-5.365600000000001 -1.9373999999999998 2.3345000000000002 +-5.1032 -2.0328 2.6847 +-3.4648 -3.2592000000000003 15.479899999999999 +-1.3016 4.4329 0.0 +-1.3016 4.4329 0.5 +2.5 -0.25 -0.5 +-5.692 0.5965 3.5623 +-3.5288 0.15280000000000002 11.3 +1.9112 2.5754 0.0 +1.9112 -2.4246 0.0 +-5.231199999999999 0.0868 0.44999999999999996 +-5.231199999999999 -0.0867 0.0 +-4.508 -1.1384 1.9727000000000001 +-0.9688 -3.8442 -0.5952 +1.1304 -3.335 -0.3422 +-1.0968 -4.0242 -1.3821999999999999 +0.612 0.5184 -2.3997 +-7.9064 -1.567 2.71 +-4.4312 -0.5198999999999999 2.4275 +-5.8072 -1.1488 3.2777000000000003 +-6.396 0.9831 3.1711000000000005 +-6.396 0.8946000000000001 3.1237 +-6.396 1.4284 2.3222 +-6.1976 0.1709 0.0 +-6.1976 0.1709 1.0 +-5.148 -1.8958 3.0541 +-9.0776 0.5357 2.6977 +-9.0776 0.7864 2.1567 +-9.0776 1.0977000000000001 3.4055 +-5.0776 0.1858 3.2951 +-4.5527999999999995 -1.3574 1.9547999999999999 +1.6743999999999999 -2.4663 -0.5 +-4.6168000000000005 -0.9958 2.0077000000000003 +-4.4184 -0.9167 2.1629 +-5.532 -2.7995 0.0 +-5.532 -2.7995 1.0 +-5.397600000000001 1.5582 3.7304999999999997 +-5.4616 -1.8399999999999999 2.1924 +-4.412 -1.0754 1.9675000000000002 +0.43920000000000003 4.5991 0.0 +0.43920000000000003 4.5991 0.5 +0.7016 1.1828 -2.4 +0.7016 -0.8090999999999999 -2.4 +-5.0648 0.7175 3.5714999999999995 +-1.0008 -3.7295000000000003 -2.1099 +-0.7384 -4.4242 -1.0555999999999999 +-4.668 -0.521 2.8853 +3.6584 -0.07680000000000001 -2.8001 +-1.1864 -3.9352 -2.4572 +-1.1864 -3.8442 -2.3343 +-5.5767999999999995 -0.6694 2.9626 +-2.3 -4.7631 1.0 +-2.3 -4.7631 0.44999999999999996 +-2.3 4.7632 1.0 +-2.3 4.7632 0.44999999999999996 +-8.9176 0.7605 3.1317 +-5.116 -1.7843000000000002 3.2649999999999997 +-5.116 -0.5231 2.9889 +-4.3288 -1.9843 2.7984999999999998 +-5.768800000000001 0.0868 0.0 +-4.9816 1.7464 3.6540999999999997 +2.4913000000000003 3.8551 0.1 +1.3777 -6.1475 0.1 +1.3777 -6.1475 0.8999999999999999 +-7.6655 -0.5716 2.7 +-8.5167 1.6193 2.3966000000000003 +0.46249999999999997 -3.4242000000000004 -0.6279 +0.46249999999999997 -3.2242 -0.6279 +-4.5167 2.251 2.931 +0.0721 -3.6573 -2.245 +-4.5807 -1.9772 2.9956 +2.4977 -3.8865999999999996 0.0 +2.4977 -3.8865999999999996 0.5 +-5.6943 1.1832 3.1012 +-0.2543 -3.4906 -2.2087 +-5.4959 0.22190000000000001 3.0635 +-5.6239 -0.3786 2.6984 +-5.6239 -2.1069 2.5646999999999998 +-5.6879 1.9310999999999998 3.5429000000000004 +-5.6879 2.2563 3.1057 +-5.1631 -1.1098999999999999 3.4212 +-2.2767 -3.9143 4.3644 +-8.0431 -1.6573999999999998 3.0192 +-4.5679 0.1982 2.9902 +-7.5823 -1.5101 2.4783 +-7.5823 -1.5737 2.5956 +-5.9439 1.202 3.7735 +-8.6959 1.6032000000000002 3.5745 +-5.483099999999999 0.8697999999999999 3.6733000000000002 +-4.4975000000000005 2.2533000000000003 2.2785 +-6.0015 1.6655 3.6976 +2.9777 1.9534 -2.4 +-5.214300000000001 -1.8707999999999998 2.2851 +-4.4911 1.5328 3.6848 +-5.6047 2.2879 2.367 +0.3601 -3.2242 -0.836 +-5.4063 2.0484999999999998 2.0364 +-4.8815 0.2228 2.5773 +-9.0095 1.6175 2.9671 +1.0833000000000002 -3.7241999999999997 -2.6766 +-4.9455 1.1769 1.6049 +-4.6831 -1.4544 1.8211000000000002 +-1.1439 -3.3589 -0.348 +-0.9455 -3.7241999999999997 -2.2543 +-3.6975000000000002 -0.672 -0.0982 +-4.875100000000001 -1.1795 1.9227 +-4.3503 -0.5176000000000001 2.9611 +-4.4143 -1.8752000000000002 2.6775 +3.7137000000000002 -2.6289 1.0 +3.7137000000000002 -2.6289 11.3 +-5.591900000000001 2.2036 3.2148000000000003 +-8.9327 1.9144999999999999 2.0313999999999997 +-4.6063 -0.6159 2.3231 +-4.6063 0.6593 1.8221 +-4.6063 -1.3023 3.4826 +-5.9823 0.359 2.1602 +1.0961 -3.7241999999999997 -2.1312 +4.0465 1.9955 0.5 +-4.4719 -1.0215999999999998 1.9449999999999998 +-1.1951 -4.5972 1.0 +-1.1951 -4.5972 11.3 +-5.3871 2.2875 2.6158 +-4.5999 0.6624 1.8345 +-0.7983 -3.4243999999999994 -1.5211999999999999 +0.5137 -0.5727 -2.3847 +-7.6783 -1.7513999999999998 2.3148 +1.0385 -2.6993 -0.27759999999999996 +-0.5999 -3.504 -2.0326 +-5.8415 -1.2802 3.2846 +5.8896999999999995 -0.22499999999999998 1.0 +5.8896999999999995 -0.22499999999999998 0.44999999999999996 +5.8896999999999995 0.22499999999999998 1.0 +5.8896999999999995 0.22499999999999998 0.44999999999999996 +-5.5791 -0.5142 2.6460999999999997 +-5.5791 0.23700000000000002 2.4857 +-5.3167 -2.0077000000000003 2.7583 +1.7617 3.0949999999999998 -2.8000000000000003 +-4.2671 -1.6136000000000001 3.3453999999999997 +-5.1183 -1.6214 2.0659 +-5.3743 -1.0189 1.952 +-4.7814000000000005 1.5579 3.6717 +-5.3702 2.1791 2.2335000000000003 +-5.6966 2.3379 2.7774 +-6.023 0.4044 3.2734 +-4.384600000000001 -0.6114999999999999 2.322 +-4.9734 -1.8948 2.2588 +-2.2854 -3.5655 0.36 +3.1546 -1.1266 0.0 +-1.7606 -2.6222 0.0 +-0.9733999999999999 4.4447 1.0 +-0.9733999999999999 4.4447 11.3 +1.1258000000000001 -3.5242000000000004 -0.43229999999999996 +2.7641999999999998 -3.5827 4.3648 +-0.2502 0.8083999999999999 -1.4000000000000001 +-5.7542 0.40879999999999994 2.0117 +-5.4918000000000005 0.1611 2.6073 +-5.357399999999999 -0.5211 2.4234999999999998 +-5.6838 -1.3571 1.8809 +0.8058 -3.9307000000000003 -0.43379999999999996 +-3.3222 0.1905 -0.5 +-5.5494 -0.4999 2.9054 +3.1674 -3.2664999999999997 1.0 +3.1674 -3.2664999999999997 11.3 +-5.351 -1.3540999999999999 3.4285 +3.5642 -3.1579999999999995 15.479999999999999 +-0.5638 -4.0242 -2.341 +-1.7413999999999998 2.6209 0.0 +-6.3942 0.9480999999999999 3.2761 +-5.0822 1.9786000000000001 3.4234 +-4.8198 2.1442 3.1974 +0.6202 0.7851 -2.4 +-8.9478 0.637 2.8905 +-8.9478 0.6254 3.1704999999999997 +-5.3382 -0.7484000000000001 3.2948 +0.36419999999999997 -3.5242000000000004 -0.5696 +-6.055 0.624 2.0048 +4.5626 -1.3451 11.3 +-8.544599999999999 1.3599 3.4132000000000002 +-8.544599999999999 0.5635 2.897 +-8.544599999999999 1.9402 2.5165 +-5.0694 -2.6162 4.3999999999999995 +-5.0694 -2.6085000000000003 1.0 +-4.6726 -0.52 2.5221 +-7.7509999999999994 -0.9387 2.8342 +-3.9494000000000002 2.26 3.0020000000000002 +-7.5526 -0.8618000000000001 2.3625 +-5.6518 2.2022 2.3138 +-4.6022 -1.0357999999999998 3.4469 +-4.3398 -1.2687 1.9456999999999998 +-3.8150000000000004 1.9553999999999998 0.1 +-1.9142 -2.434 0.0 +-2.503 -3.8648000000000002 0.1 +-3.3542 1.6944000000000001 -0.09870000000000001 +-5.8438 1.5139 1.5139 +-4.7942 2.1736 3.1444 +-4.2694 -0.5825 3.0139 +3.0714 3.6234 1.0 +3.0714 3.6234 11.3 +-4.6598 0.1727 2.8566000000000003 +0.7802 0.9297 -2.4 +-0.8582 -3.7258 -0.1519 +-0.07100000000000001 4.7495 1.0 +-0.07100000000000001 4.7495 11.3 +-2.5606 4.5536 0.0 +-2.5606 4.9727 0.44999999999999996 +-2.5606 -4.9726 0.0 +-5.575 -0.7767999999999999 2.2627 +-5.639 1.3233 3.7153 +-0.7837000000000001 -3.7241999999999997 -2.2141 +-5.4365 -1.3372 3.2859 +-5.1741 -1.0328 2.4816000000000003 +-4.3869 -0.6921 3.1826 +3.4787 0.7623 -2.8000000000000003 +-5.5645 2.3 2.4056 +0.6627 -3.7243 -0.9448 +-6.0189 -1.0498 2.4929 +2.9603 3.4553000000000003 1.0 +2.9603 3.4553000000000003 11.3 +3.7475 0.1369 -0.1 +-7.7213 -1.0509 2.4448000000000003 +-1.1677 4.358 0.5 +-5.8205 1.3668 3.5126 +4.2722999999999995 -1.4503 0.5 +-2.2813 2.4784 -0.5 +-5.6221 -0.44339999999999996 3.0218 +2.8323 2.3023 0.0 +-5.3597 -1.7549 2.1075 +4.733099999999999 0.4007 15.479999999999999 +1.3922999999999999 -3.5171 -2.692 +3.5555000000000003 2.9029 0.5 +-7.9133 -1.5195999999999998 3.2374 +3.8179 -1.9524 0.36 +-8.7645 0.8107 2.819 +2.0515 -2.911 -2.8000000000000003 +-4.5020999999999995 -0.29510000000000003 0.5 +-5.3533 0.571 1.6348999999999998 +-5.9421 2.2399999999999998 2.9728999999999997 +-6.0061 2.3372 2.7723999999999998 +-6.0061 0.2224 2.6405000000000003 +0.2211 -5.1612 -0.7577999999999999 +-8.822099999999999 1.7205000000000001 2.761 +-8.822099999999999 0.779 2.6429 +-8.559700000000001 2.0299 2.476 +-1.3469 -3.4139000000000004 -2.8003 +-5.9997 2.1303 2.0602 +1.8659 2.0269 -0.015300000000000001 +-6.063700000000001 1.3153 3.5168 +-5.8652999999999995 1.1988 3.9114999999999998 +1.2130999999999998 -3.9164999999999996 -0.445 +-5.0781 0.5670999999999999 3.7089 +-5.0781 2.1516 3.1883000000000004 +-7.8941 -1.0737 3.2998 +-9.0077 0.5131 3.2024 +-5.7309 2.2098 3.206 +-5.7309 0.44980000000000003 3.3441 +-5.7309 0.8172 3.6429000000000005 +-8.7453 0.7979999999999999 3.121 +-8.2205 1.8329000000000002 2.2752000000000003 +-4.9437 0.0036 2.7602 +-5.5325 1.6837000000000002 3.7005999999999997 +-2.2557 -0.0789 -0.5 +2.3331 -5.7443 0.0 +2.3331 -5.7443 1.0 +0.2403 1.3918 -2.3857 +-4.6749 -0.4332 2.3272999999999997 +-4.4125 -1.3797 1.9761000000000002 +-1.1357000000000002 -3.7244 -2.6563 +2.6658999999999997 -1.2843 0.0 +-4.7389 0.22899999999999998 2.8561 +-5.5901 0.2793 2.3213 +2.4739 4.7039 0.0 +2.7363 -2.2616 -2.4 +-5.4557 -1.9534 2.9384 +-4.7325 1.0737 1.6677000000000002 +-5.583699999999999 0.45030000000000003 2.0367 +-5.1229 -1.809 2.2234 +-4.8605 0.5486000000000001 3.5206 +-4.3997 -0.52 2.6144 +-8.854099999999999 0.3089 2.5152 +-5.5773 0.3019 3.1064000000000003 +4.5155 0.5590999999999999 1.0 +4.5155 0.5590999999999999 11.3 +-2.0381 1.0975000000000001 0.0 +-5.0525 -1.6943 3.2883999999999998 +0.3875 -1.3207 -1.4000000000000001 +-5.9037 1.3047 2.6843 +-5.6413 0.3712 3.3439000000000005 +-5.1165 -1.8443 2.2491 +-4.3293 -1.4375 1.9789 +-5.4429 -1.5622 2.0349 +-4.9181 -1.6209999999999998 2.0656999999999996 +0.7203 -3.8141000000000003 -2.384 +-3.9325 2.2287 2.3165 +-0.6557000000000001 -3.4707000000000003 15.479999999999999 +2.4268 -5.0864 1.0 +-5.5028 2.0533 3.3237 +0.8588 -3.3308999999999997 -2.398 +-7.922 -1.2066000000000001 3.2921 +-7.2627999999999995 -1.0688 2.2191 +-7.2627999999999995 -1.4307 3.1809999999999996 +-7.2627999999999995 -1.5507 2.2831 +-7.2627999999999995 -1.6487000000000003 3.0244 +-7.2627999999999995 -0.8507 2.3763 +-5.362 1.7736999999999998 3.8132 +-2.0852 -3.6740000000000004 0.5 +-4.6388 0.33409999999999995 3.1912000000000003 +-2.738 -1.3959 -0.5 +-8.7668 1.8551000000000002 2.8177 +-4.178 -1.7246000000000001 3.2849999999999997 +-7.1924 -0.7294 2.9922 +-5.1572 -1.4929 2.3852 +-3.5187999999999997 -3.0403 13.961100000000002 +-4.37 -1.9801 2.4274 +-0.8308 -3.4912 -1.2293 +-0.8947999999999999 -3.8303 -2.1431999999999998 +-5.874 2.0004999999999997 1.7557 +-5.086799999999999 -0.52 2.779 +-5.4132 -0.2687 0.44999999999999996 +-1.0868 -3.9678999999999998 -0.3739 +-4.1012 2.0982000000000003 0.1 +-7.7044 -1.4541 2.4319 +-5.2788 -1.1239000000000001 3.4347000000000003 +-4.754 0.6851999999999999 3.5561000000000003 +-5.0804 -1.9772999999999998 2.9942 +2.7851999999999997 0.989 -0.5 +-5.4068 -1.6128 2.0473000000000003 +3.6428000000000003 -2.2308000000000003 0.5 +-4.2868 -0.783 3.2772999999999994 +-2.9748 -3.3921 0.5 +-5.7268 0.611 3.5191 +3.2523999999999997 1.8665999999999998 -0.1 +-4.9396 -1.8193000000000001 3.1674 +-5.0036 -0.9356 3.4090000000000003 +-0.9396 -3.3346 -2.2696 +-4.8052 0.18710000000000002 2.9909000000000003 +-5.6564000000000005 -1.1277000000000001 3.2725999999999997 +3.5852000000000004 1.1267 -2.7037999999999998 +0.8332 0.7101999999999999 -1.4000000000000001 +-4.408399999999999 -1.7701000000000002 2.5758 +-4.4724 -1.2496 3.4382 +-4.5364 -1.9800000000000002 2.621 +-4.5364 2.0404999999999998 2.0157000000000003 +0.6412 0.7907000000000001 -1.4000000000000001 +-5.5156 0.3817 3.3657 +-4.53 1.6534 3.6469 +1.1084 -3.7258 -0.1355 +-6.034 1.2758 1.5987999999999998 +-5.5092 -0.7419 3.2893 +-5.2427 -0.9896 1.9662 +-5.3067 -0.8384 3.3583000000000003 +3.1477 -1.5755000000000001 15.479999999999999 +-8.3211 1.2604 3.2248 +-8.3211 1.771 2.7645 +-5.370699999999999 -0.6454 3.1300000000000003 +-0.9739 -3.9678999999999998 -0.31329999999999997 +3.0261 -4.8224 0.44999999999999996 +-7.3931 -1.7605 2.7033 +-5.7547 1.6409 3.6452 +-5.2939 -1.4603 3.4497 +0.6708999999999999 -5.1612 -1.5062 +-4.2443 -1.8057 3.1809999999999996 +-4.3723 -0.5222 2.8416 +-5.4859 -1.8055 3.2446 +0.21649999999999997 -2.625 -0.5 +0.21649999999999997 2.375 0.0 +-8.5643 1.6723 2.8528000000000002 +-5.0891 -1.7706 2.1191 +-5.6779 -2.0786 2.7096 +0.5493 -3.7404 -0.4784 +3.8261000000000003 2.4371 1.0 +-7.6427 -0.6063 2.5258 +-4.3659 1.5110999999999999 0.0 +-4.3659 1.5110999999999999 0.5 +4.6133 -0.5955 14.4149 +-4.6923 -1.3788 3.5961 +-4.6923 -0.48840000000000006 2.2105 +-0.3659 0.1809 -0.06 +-4.4939 0.6098 4.3547 +-5.3450999999999995 -0.9690000000000001 1.9724 +-5.0827 -1.3684 2.4826 +-5.0827 -0.8884 2.9626 +-5.0827 -0.8884 2.4826 +-7.5723 -1.6453 2.2448 +-7.5723 -1.6303 3.1645 +-8.9483 0.3555 2.9717000000000002 +-7.6363 -0.7773 2.8993 +-4.9483 -1.9753 2.8309 +-7.7003 -1.0673 2.4058 +-9.0763 1.9304000000000001 2.9248 +-5.338699999999999 -1.9851 2.7005 +-5.0763 -1.3299 1.9243 +-5.0763 -3.7310999999999996 0.1 +-5.0763 -3.7310999999999996 0.8999999999999999 +-4.9418999999999995 -2.7406 4.3999999999999995 +-4.6795 -1.7426000000000001 1.9534 +-4.4171000000000005 -1.5423 3.2597 +-4.4171000000000005 -0.8864000000000001 2.0545999999999998 +-5.5307 -1.9438 2.9628 +-4.4811 -0.6263000000000001 2.2928 +-5.0699000000000005 -0.8699999999999999 2.02 +-8.935500000000001 1.9055 2.8032000000000004 +0.8309000000000001 -3.6580000000000004 -1.2295 +-4.6731 2.1084 2.1132999999999997 +-7.6875 -1.7642000000000002 2.6999 +-4.4107 -0.6846 2.552 +-5.5243 2.2180999999999997 3.0455 +-4.999499999999999 -1.1712 3.4741 +-7.7515 -1.0458 2.432 +-4.4747 -2.037 2.677 +2.7380999999999998 -1.015 -0.5 +-9.0571 1.002 1.908 +-8.794699999999999 1.0789 3.5238 +-3.6171 0.5257000000000001 0.0 +3.6597 2.6669 4.3621 +-1.2555 -3.8264 -0.29009999999999997 +0.6453 -3.6573 -0.8496999999999999 +-7.5467 -0.9476 2.5850999999999997 +-5.447500000000001 0.43629999999999997 2.0558 +-6.0363 1.9803000000000002 2.1382000000000003 +-6.0363 2.1547 2.8183 +-4.4619 0.3413 3.1940999999999997 +-5.3770999999999995 -0.7278 3.2141999999999995 +-1.5755000000000001 -3.1477 15.479999999999999 +-5.373 -1.3308 3.4404999999999997 +-6.813 -1.4922 3.2767999999999997 +-6.813 -1.932 2.846 +-6.813 -1.8818000000000001 2.7203 +-6.813 -0.9246000000000001 3.2367 +-6.813 -1.4645 2.1052999999999997 +-6.813 -0.8715999999999999 3.286 +-6.813 -0.7098 2.3869000000000002 +-6.813 -1.7466 3.0783 +-6.813 -0.5781999999999999 2.8877 +-6.813 -0.6962 2.9883 +-6.813 -0.6257999999999999 2.6859 +-6.813 -0.6002000000000001 2.4696 +-6.813 -0.7817 2.194 +-6.813 -0.9993 2.1196 +-6.813 -1.7631999999999999 2.3445 +-6.813 -1.2133 3.3215000000000003 +-6.813 -1.3553000000000002 3.3895 +-6.813 -1.7183 3.206 +-6.813 -1.1446 2.0105 +-6.813 -1.8573 2.357 +-6.813 -1.557 2.0827 +5.443 -0.27390000000000003 0.44999999999999996 +-0.125 2.2835 0.0 +0.6622 -4.4242 -1.551 +-5.6930000000000005 -0.5783 2.5468 +-5.6930000000000005 -1.9054000000000002 2.8927 +-5.6930000000000005 -1.1343 2.0267 +-5.6930000000000005 -1.1279000000000001 3.0227 +-5.6930000000000005 -1.1151 3.0214000000000003 +-5.6930000000000005 -1.3606 2.3736 +-5.6930000000000005 -0.8893 3.001 +-5.6930000000000005 -0.9450999999999999 2.0872 +-5.6930000000000005 -0.8642000000000001 2.4918 +-5.6930000000000005 -1.3616 3.0256000000000003 +-5.6930000000000005 -0.8966999999999999 3.0386 +-5.6930000000000005 -1.6583 2.1523 +-5.6930000000000005 -1.0397999999999998 3.0707 +-5.6930000000000005 -1.4092 2.0357 +-5.6930000000000005 -1.7763 3.1355 +-5.6930000000000005 -0.8145 2.1663 +-5.6930000000000005 -0.964 2.3044 +-5.6930000000000005 -1.9304000000000001 2.6403 +-5.6930000000000005 -1.2648 2.0157000000000003 +-5.6930000000000005 -1.5784 2.8173 +-5.6930000000000005 -1.2351 3.3842999999999996 +-5.6930000000000005 -1.8528 3.0405 +-5.6930000000000005 -1.4267999999999998 3.0828 +-5.6930000000000005 -1.5548 3.3127999999999997 +-5.6930000000000005 -1.0643 2.3192 +-5.6930000000000005 -0.9299 2.5711999999999997 +-5.6930000000000005 -0.6273 3.0027000000000004 +-5.6930000000000005 -1.5791 3.0675 +-5.6930000000000005 -1.8758000000000001 2.4122 +-5.6930000000000005 -1.6389999999999998 2.9603 +-5.6930000000000005 -0.9268000000000001 2.8204 +-5.6930000000000005 -1.5778 2.5825 +-5.6930000000000005 -1.0361 3.0932999999999997 +-5.6930000000000005 -1.1472 3.0316 +-5.6930000000000005 -1.8215 2.3234999999999997 +-5.6930000000000005 -0.6229 3.0017 +-5.6930000000000005 -0.894 2.3663 +-5.6930000000000005 -1.5618999999999998 3.3078000000000003 +-5.6930000000000005 -1.5875 2.3431 +-5.6930000000000005 -1.5811 2.101 +-5.6930000000000005 -0.9625999999999999 3.3259999999999996 +-5.6930000000000005 -1.6392 2.4717 +-5.6930000000000005 -0.927 2.8444000000000003 +-5.6930000000000005 -0.8675999999999999 2.8963 +-5.6930000000000005 -1.4436 2.3118 +-5.6930000000000005 -0.9188 3.299 +-5.6930000000000005 -1.141 2.3737 +-5.6930000000000005 -1.2969 3.3815 +-5.6930000000000005 -0.6953 2.2991 +-1.1042 -3.3346 -2.4991 +-1.9553999999999998 -3.8150000000000004 0.1 +2.6334 -3.6982 1.0 +-8.573 1.3886 1.8662 +0.40619999999999995 -2.4242 -1.9317000000000002 +0.6686 -4.0242 -0.9553 +-5.3602 -1.1229 3.4248000000000003 +-0.445 -1.9499 0.0 +-4.573 -0.5632 2.3023 +-4.573 -1.8071 2.1348 +-4.573 -1.8825999999999998 3.324 +-4.573 -2.0692 3.0442 +-4.573 -0.9450999999999999 3.5347000000000004 +-4.573 -1.4704 1.9307 +-4.573 -1.7776 1.9849999999999999 +-4.573 -1.6053000000000002 3.5145000000000004 +-4.573 -0.7756 2.0637 +-4.573 -0.462 2.6054 +-4.573 0.6575 0.0 +-4.573 0.6575 0.5 +-4.573 -1.6575 3.381 +-4.573 -0.367 2.6005000000000003 +-4.573 -0.4886 2.9238 +-4.573 -1.8929999999999998 3.1651 +-4.573 -0.5087999999999999 2.1981 +-4.573 -1.3558999999999999 3.4865 +-4.573 -0.8188000000000001 1.923 +-4.573 -2.0056000000000003 2.2324 +-4.573 -0.9529 3.443 +-4.573 -1.1384999999999998 1.8183999999999998 +-4.573 -0.4112 3.0126 +-4.573 -0.6567 3.3616 +-4.573 -1.4741 1.8401 +-4.573 -2.0437 2.8014 +-4.573 -1.065 1.9282000000000001 +-4.573 -0.6385 3.206 +-4.573 -1.9848000000000001 2.4003 +-4.573 -1.2772000000000001 3.5881999999999996 +-4.3106 -0.6086 2.3202 +-2.6722 0.1905 -0.5 +-5.6866 -1.7108 2.0191 +3.2925999999999997 -1.8117 -2.7037999999999998 +-7.9138 -1.6212 2.2298 +-6.013 -1.195 2.5604 +-6.013 -1.5941 2.6442 +-6.013 -1.6499 2.705 +-6.013 -1.3089 2.3563 +-6.013 -0.7137 2.9438 +-6.013 -0.7393000000000001 2.705 +-6.013 -1.25 3.2146 +-6.013 -1.25 2.1853000000000002 +-6.013 -1.0992 2.7817000000000003 +-6.013 -1.7863 2.4562 +-6.013 -1.3895 2.645 +-6.013 -1.1084 2.6404 +-6.013 -0.7884 2.4734 +-6.013 -1.3347 3.0298 +-6.013 -1.3050000000000002 2.8396 +-6.013 -1.1194000000000002 2.5568 +-6.013 -1.3096 2.5584 +-6.013 -1.0116 2.1609 +-6.013 -1.5195 3.1383 +-6.013 -1.7114999999999998 2.4734 +-6.013 -1.5776 2.7879 +-6.013 -1.7665 2.993 +-6.013 -0.9688 3.2271 +-6.013 -1.7606 2.705 +-6.013 -0.8500000000000001 2.705 +-6.013 -0.9268000000000001 2.7943 +-6.013 -1.3131 2.114 +-6.013 -1.1938 2.3571 +-6.013 -1.3881 2.5645000000000002 +-6.013 -1.0384 2.5929 +-6.013 -1.352 2.4834 +-6.013 -1.448 2.595 +-6.013 -0.7335 2.407 +-6.013 -1.171 2.8331 +-6.013 -1.3886 2.7635 +-6.013 -1.3973 2.7954 +-6.013 -1.15 2.497 +-6.013 -1.7090999999999998 2.9316 +-6.013 -1.1674 3.0315000000000003 +-6.013 -1.5217 2.2630999999999997 +-6.013 -0.9055000000000001 2.6422 +-6.013 -1.4239 3.2716000000000003 +-6.013 -0.9782000000000001 2.2630999999999997 +-6.013 -0.9804999999999999 3.1383 +-6.013 -0.7908000000000001 2.9316 +-6.013 -1.5977000000000001 2.2239999999999998 +-2.4737999999999998 4.8224 0.0 +1.2638 -3.4242000000000004 -2.8000000000000003 +-8.0418 2.0667999999999997 2.8249 +-5.353800000000001 -1.6166 3.3362000000000003 +-7.581 -0.9450999999999999 2.8513 +4.412599999999999 -1.1098000000000001 1.0 +4.412599999999999 -1.1098000000000001 11.3 +-8.4322 1.7422 2.6048999999999998 +-4.893 1.6789999999999998 1.6939 +-4.893 -1.4687000000000001 3.4477 +-9.020999999999999 1.7569000000000001 1.9831 +-4.7586 0.22369999999999998 2.5395999999999996 +0.9438 -3.3000000000000003 -0.5126999999999999 +-5.085 -1.5439 1.9820999999999998 +-7.574599999999999 -1.0041 3.2526 +-4.3618 -1.8041 3.1924 +-2.5250000000000004 -4.3734 1.0 +-2.5250000000000004 -4.3734 0.44999999999999996 +-2.5250000000000004 5.1529 0.44999999999999996 +-2.5250000000000004 4.3734 1.0 +-2.5250000000000004 4.3734 0.44999999999999996 +-2.5250000000000004 -5.1528 1.0 +-2.5250000000000004 -5.1528 0.44999999999999996 +-4.4898 -1.0892000000000002 0.0 +-4.4898 -1.0892000000000002 0.5 +-5.8658 0.1207 3.1423 +-0.2274 -3.5946 -2.2559 +-4.6818 1.8887999999999998 1.8691 +-5.0082 -1.9796999999999998 2.9675 +0.1694 2.3103 -0.5 +-5.5969999999999995 1.0743 1.6255 +-5.9874 1.3324 2.6764 +-5.7250000000000005 0.29619999999999996 3.0811 +-5.7250000000000005 0.3897 1.0 +-5.7250000000000005 0.3897 0.44999999999999996 +-5.7250000000000005 -0.3897 1.0 +-5.7250000000000005 -0.3897 0.44999999999999996 +-4.9378 1.6046999999999998 1.6608 +-4.6754 -1.9768999999999999 2.9846 +-4.413 -0.8238000000000001 2.0926 +-4.413 -1.1164 3.0691 +-4.413 -1.1315 2.3395 +-4.413 -1.6166 3.0444 +-4.413 -0.7979 2.7668000000000004 +-4.413 -0.9489 2.7924 +-4.413 -0.964 3.0956 +-4.413 -0.8429000000000001 2.9608 +-4.413 -1.1821 2.9080000000000004 +-4.413 -1.434 2.6155999999999997 +-4.413 -1.4194 2.7924 +-4.413 -1.6625999999999999 2.7668000000000004 +-4.413 -1.3705 2.3304 +-4.413 -1.0016 2.6314 +-4.413 -1.5716999999999999 2.3211 +-4.413 -1.6495 2.4475000000000002 +-4.413 -0.8582 2.5114 +-4.413 -1.0717 2.7904 +-4.413 -1.6034 2.8223000000000003 +-4.413 -1.3282 2.5115 +-4.413 -1.3978000000000002 3.0855 +-4.413 -1.5879999999999999 2.5874 +-4.413 -1.162 2.527 +-4.413 -1.3243 2.9082 +-4.413 -0.9001 2.3302 +-1.5266 0.0808 -0.06 +2.275 3.9404000000000003 1.0 +2.275 3.9404000000000003 11.3 +-0.7394000000000001 -3.8361 -0.48669999999999997 +-3.293 -0.34559999999999996 3.0290999999999997 +-3.293 -0.6213 3.4174999999999995 +-3.293 -2.1857 2.8857 +-3.293 -0.3143 2.5143 +-3.293 -1.0828 3.6477999999999997 +-3.293 -1.8787000000000003 1.9825 +-3.293 -2.1544 2.3709000000000002 +-3.293 -0.943 1.7968000000000002 +-3.293 -1.4171 1.7522 +-3.293 -1.9872 3.3186 +-3.293 -0.5127999999999999 2.0814 +-3.293 -1.557 3.6032 +-4.6690000000000005 -0.5911 2.2988 +-3.0305999999999997 -3.3613999999999997 4.3638 +-5.3218000000000005 -1.2517 1.9619999999999997 +2.019 1.8218999999999999 -0.5 +1.6926 0.3715 -2.3919 +-0.7969999999999999 -3.9286000000000003 -0.3712 +-5.5778 1.6340000000000001 3.7074000000000003 +-5.117 -1.3896 2.3993 +3.5998 -2.3303000000000003 0.1 +-5.181 -1.9820999999999998 2.4028 +-4.6562 1.2057 3.7220999999999997 +1.3086 -3.3000000000000003 -2.4 +1.3086 -3.3000000000000003 -2.8000000000000003 +-7.7345999999999995 -1.4491 2.4448000000000003 +5.4407 0.2761 0.0 +2.6887000000000003 5.6974 0.1 +2.6887000000000003 5.6974 0.8999999999999999 +-4.4537 0.2186 2.5643 +1.7735 -4.1901 1.0 +1.7735 -4.1901 11.3 +2.2342999999999997 -3.0117000000000003 -0.1 +-4.9081 -1.9796 2.968 +-5.5609 -1.8875 3.0615 +-4.2489 -1.32 3.4431999999999996 +-7.2633 -1.76 2.7 +-7.2633 -0.7401 2.71 +1.4535 -4.3538 0.5 +1.4535 -4.3538 0.1 +-2.4760999999999997 2.294 -0.5 +-8.7673 1.6931000000000003 2.5945 +-1.1641000000000001 -3.5242000000000004 -0.4259 +-8.5689 0.4541 2.943 +-4.2425 -1.6650999999999998 3.3163 +-8.8953 0.5733 2.8942 +-3.4553000000000003 -3.2693 11.3001 +3.7575 -0.0696 -2.7037999999999998 +-8.8249 1.1154000000000002 2.2306 +-8.8249 1.3847 3.1693 +6.1831 -1.2078 0.1 +6.1831 -1.2078 0.8999999999999999 +0.9415 -1.1142 -1.4000000000000001 +0.8775 -3.7241999999999997 -2.5122 +3.5655 -2.2854 0.36 +-2.9881 4.6257 0.0 +1.0758999999999999 -3.8442 -2.2175000000000002 +-5.2153 -1.8154 3.2338999999999998 +-7.7049 -1.5612 2.8342 +-0.36410000000000003 1.0412 -2.4 +1.7991 4.2227 0.5 +1.7350999999999999 -0.0937 -2.3956999999999997 +-4.8825 -1.7606 0.5 +0.29510000000000003 -4.5020999999999995 0.5 +1.9335000000000002 2.4523 -0.5 +-5.2729 -0.6909000000000001 3.1766 +2.3303000000000003 3.5998 0.1 +3.3799 -1.6244 -0.1 +-4.8761 -0.8554 3.3221 +-4.6137 -2.2260999999999997 0.0 +-4.6137 -1.6738 0.5 +-5.202500000000001 -0.8056000000000001 2.1116 +-1.1384999999999998 -3.7241999999999997 -2.4774000000000003 +-5.2665 -1.2906 3.2627 +3.9751000000000003 2.2950000000000004 0.5 +3.9751000000000003 2.2950000000000004 0.1 +0.3719 0.8974 -2.4 +0.3719 -0.8974 -1.4000000000000001 +4.4359 -1.6999 14.047200000000002 +-0.21689999999999998 -0.3473 -0.06 +-7.884099999999999 -1.8543 2.8998 +-1.9193000000000002 -2.5589 -0.5 +-4.4089 -1.7590999999999999 2.6733 +-4.4089 -1.7063 2.5522 +-0.0825 -3.6974 -2.1895000000000002 +-8.6009 0.4402 2.3609 +-5.1257 -1.6012 2.0545999999999998 +-3.4873000000000003 -0.664 -2.4 +-3.4873000000000003 -0.664 -2.8000000000000003 +-8.728900000000001 1.7881 1.9918000000000002 +-0.5368999999999999 -4.4939 4.3641 +-5.842499999999999 1.5808 3.8699 +-0.1401 4.5478 1.0 +-0.1401 4.5478 11.3 +-5.1193 -1.4231 1.9843 +-7.871300000000001 -1.5997000000000001 2.7108 +-5.7081 -0.18409999999999999 0.0 +1.6327 1.4801 -0.0013 +-9.0489 0.6906 2.0665 +-8.5881 0.9538 2.3133 +1.1824 -3.9368 -2.3508 +4.3952 -1.8013000000000001 1.0 +4.3952 -1.8013000000000001 11.3 +-5.3008 -1.1191 1.9721 +0.40159999999999996 0.0796 -1.6 +-5.3648 -1.4815 2.0827999999999998 +-4.3792 1.2407 1.6429 +-2.4784 -2.2813 -0.5 +-5.032 -1.9355 2.4341999999999997 +1.1952 -0.21090000000000003 -2.4 +1.1952 0.21090000000000003 -1.4000000000000001 +-4.3088 -1.4336 3.4312 +-5.6848 2.0927000000000002 2.1033 +-4.372800000000001 1.1655 1.6469 +0.8048 -3.8442 -0.4313 +-4.4368 -1.717 2.1227 +-8.8272 1.8319999999999999 3.3077 +-8.04 0.7979999999999999 3.3943000000000003 +-5.6144 2.1341 2.0743 +-9.0192 1.2478 1.8215999999999999 +0.2224 2.6507 0.0 +0.7472000000000001 -3.8165999999999998 -2.5137 +-5.8064 2.174 0.0 +-5.8064 2.174 1.0 +-6.395199999999999 0.6728 2.4757000000000002 +2.8464 -4.4951 0.0 +-0.43039999999999995 1.1559 -1.4000000000000001 +-0.43039999999999995 0.8359 -2.4 +-0.43039999999999995 -1.1559 -2.4 +-4.295999999999999 -0.52 2.7847 +-8.686399999999999 1.8322 2.5475000000000003 +-8.686399999999999 0.5134 2.9259 +-0.49439999999999995 -3.7241999999999997 -2.0736999999999997 +-4.6224 -1.5787 3.4098 +-4.2256 -1.4758 2.0008999999999997 +-5.6016 0.7861 1.7206 +-5.0768 2.236 1.9801 +-5.0768 0.2244 3.0677 +-1.2752 -3.7241999999999997 -0.1363 +-5.4032 -2.0242 2.6342 +-2.9776000000000002 0.9541 -0.5 +-6.056 1.6758 2.8116 +-6.056 1.5752 2.9899999999999998 +-6.056 1.1847999999999999 3.0914 +-6.056 1.5322 2.7121 +-6.056 0.9603 3.0471000000000004 +-6.056 1.6788999999999998 2.9016 +-6.056 1.395 2.8823000000000003 +-6.056 1.1449 2.8465000000000003 +-6.056 0.9578 2.9093 +-6.056 1.4148 2.9255 +-6.056 1.2309999999999999 2.9815 +-6.056 1.0513 3.128 +-6.056 0.8956999999999999 3.6616000000000004 +-6.056 1.4333 2.77 +-6.056 1.6074000000000002 2.7363999999999997 +-6.056 1.6581 2.9123 +-6.056 1.5022 2.9925 +-5.5952 2.3388 2.8019 +-5.3328 -1.0055 3.4401 +-5.3328 -0.6647000000000001 3.2168 +-4.808 0.2912 2.1551 +-4.808 0.4792 3.4494999999999996 +-1.0064 -3.5242000000000004 -2.553 +-8.673599999999999 2.1526 2.4561 +-0.2832 -3.4243 -2.1565000000000003 +-4.936 -0.6817 2.1583 +-4.936 -0.5192 2.415 +-6.0496 0.1666 2.6192 +-7.1632 -0.5707 2.8583000000000003 +3.4543999999999997 0.8657 -2.4 +-7.752000000000001 -1.5313 3.2308000000000003 +-4.4752 0.3411 2.1828 +-4.8016000000000005 0.1624 2.7889 +-1.0 -3.7634 -0.4001 +-1.0 -3.7634 -2.4001 +-1.0 -2.6249000000000002 -0.4 +-8.9936 1.5313999999999999 2.317 +-8.9936 1.7281000000000002 2.8108 +-4.4688 -0.7868999999999999 3.2724 +-4.2703999999999995 -2.0248 2.6228000000000002 +-2.8240000000000003 5.0396 0.44999999999999996 +0.7152000000000001 -3.7241999999999997 -2.4278 +-5.115200000000001 0.4268 3.6505 +-0.7888 -3.8295999999999997 -2.2228000000000003 +-5.4416 0.46369999999999995 2.019 +-4.9168 -0.9958 2.0077000000000003 +-5.768 1.6167 2.8384 +-4.5863000000000005 0.1848 0.5 +-4.5863000000000005 0.1848 0.1 +-5.4375 0.6536 1.8422999999999998 +1.0521 1.3787 -2.3926 +-5.2391 -0.7294 3.2809 +-4.4519 -1.9737 2.8425 +-4.7783 2.2960000000000003 2.3876999999999997 +0.9240999999999999 -3.8442 -2.5825 +-3.2039 -0.25110000000000005 0.0 +-4.5799 0.3624 2.1458 +1.1225 -3.7241999999999997 -2.2878 +1.1225 -3.5242000000000004 -2.5122 +3.2857 -3.1329999999999996 1.0 +-4.6439 -1.0672 1.9456000000000002 +-6.0199 -0.9918 2.5257 +-5.7575 0.292 2.1867 +-4.7079 0.1982 2.9902 +-4.4455 -1.5088000000000001 3.3938999999999995 +-4.5095 0.9002 3.6578 +-5.0983 -0.5182 2.83 +0.3417 -4.4242 -1.9753 +-5.1623 -0.7662 3.261 +-4.8999 -1.1697000000000002 3.4754 +3.5545 -2.185 0.1 +1.5897000000000001 1.5838 -0.050100000000000006 +-4.963900000000001 -0.6291 2.2335000000000003 +-1.6871 -5.9661 0.0 +-1.6871 -5.9661 1.0 +-0.8999 -3.4242000000000004 -1.3854 +-0.8999 -3.2242 -1.3854 +-0.4391 4.5991 0.0 +-0.4391 4.5991 0.5 +0.3481 -3.5742000000000003 -0.5898 +-0.2407 0.7326 -2.3863 +-4.6311 1.5328 3.6848 +-7.645499999999999 -0.582 2.7104 +-0.8295 -3.8738 -0.2097 +-8.7591 1.6728 1.9553999999999998 +-5.2199 -1.6299000000000001 3.38 +-7.709499999999999 -0.5946 2.8992 +-9.0855 0.5437 2.9028 +-5.5463 2.1816999999999998 3.2668000000000004 +-5.5463 2.0484999999999998 2.0364 +-5.2839 -0.5642999999999999 2.9638 +-6.397500000000001 0.7106 2.5622 +-0.7591 -0.0185 -1.6 +-5.1495 -1.3287 1.9259 +-0.8231 -3.7258 -0.6224000000000001 +-5.4759 0.344 2.1052999999999997 +-8.816699999999999 0.5047 2.9138 +-0.6887 -3.7241999999999997 -0.9389 +-4.2919 -1.2670000000000001 1.6202 +-4.6183000000000005 -1.6214 2.0659 +-5.7319 1.2277 1.6105999999999998 +-5.4695 1.6191 3.6686000000000005 +-3.5687 2.8064999999999998 1.0 +-4.7463 0.6593 1.8221 +-5.335100000000001 0.512 3.7255000000000003 +-5.335100000000001 1.0853 3.9472 +-5.3991 -1.2248999999999999 3.4782 +-5.9879 1.169 2.7233 +-1.0727 -3.7404 -1.385 +1.0265 -3.8442 -0.3157 +-4.7399 0.3293 3.1848 +-4.7399 0.6624 1.8345 +0.9625 -0.3248 -1.4000000000000001 +-4.8679 -2.0051 3.1853 +-4.0807 -1.9480000000000002 2.9817 +-5.5207 -1.5682 2.0378 +-5.5207 -1.6031 3.3977 +-4.5991 0.3296 3.1864000000000003 +-4.3367 1.9671 15.479999999999999 +-0.07429999999999999 -3.5242000000000004 -0.5031 +-1.4503 -4.2722999999999995 0.5 +-8.8551 1.7818 2.562 +-3.9399 2.1738 0.5 +-3.9399 2.1961999999999997 0.36 +-5.3799 2.0164999999999997 2.0017 +-5.4439 -1.0413000000000001 1.9501000000000002 +-0.5287 -3.6385 -2.0869 +-5.1815 -0.9542999999999999 3.3840000000000003 +-7.9335 -1.1173 3.1974 +-3.8695 -2.7553 14.2567 +-8.5863 0.9058 3.0497 +-5.3095 -1.0924 1.9824000000000002 +-7.667 -1.3200999999999998 2.0292999999999997 +0.7874000000000001 -3.8851999999999998 -2.2709 +-5.3694 -0.9559 3.3773999999999997 +-2.6814 2.3436 -2.4 +0.8578 -3.8442 -0.2626 +-3.2702 1.6225 0.0 +-7.922999999999999 -1.2219 3.0504 +-5.235 -0.9561 3.4179 +-5.5614 -1.3166 1.9724 +-0.3838 -4.4242 -2.1186 +1.517 1.7141 -0.5 +-3.1357999999999997 -3.5671 14.372399999999999 +0.9282 -3.7241999999999997 -2.2582 +-4.3774 -1.143 4.3654 +-5.555000000000001 0.6722 3.6198 +0.8706 -3.9368 -0.5377 +-7.7118 -0.9249999999999999 2.7148 +-7.839799999999999 -0.614 2.9000000000000004 +-4.8894 0.2939 3.0724 +-8.755 1.1154000000000002 2.2306 +-8.755 1.3847 3.1693 +-1.1518000000000002 -3.3585 -2.3664 +-5.0813999999999995 -1.5313 2.3436 +-5.0813999999999995 -1.0513 2.8236 +-5.0813999999999995 -1.0513 2.3436 +-0.16620000000000001 -4.0242 -0.6023999999999999 +-5.4078 -1.9973 2.9148 +2.9825999999999997 3.7123000000000004 11.3 +-5.2094000000000005 -0.5838 2.3625 +-8.2238 1.5258 3.3649999999999998 +-8.8766 2.0434 2.4869 +1.2162 -0.2052 -1.4000000000000001 +1.2162 0.2052 -2.4 +-5.4014 2.1964 2.2919 +-4.6142 -1.8606 3.18 +-5.203 -2.0274 2.7093 +3.5138000000000003 0.2094 15.479999999999999 +-4.4158 -0.7433000000000001 2.3317 +0.7618 -1.1225 -2.4 +-0.6782 -2.4242 -1.3949 +2.0098000000000003 3.6261 0.1 +-5.9198 2.246 2.1041 +-4.2814 -0.8845999999999999 3.3408 +-4.8702000000000005 -0.5714 2.11 +-4.4094 -1.7516 2.698 +1.0306 -3.9273000000000002 -0.6 +-8.5374 1.6841 2.5754 +-7.7502 -0.9188 2.698 +0.7041999999999999 -3.4658 -1.0261 +-4.7998 1.4668 1.603 +-2.899 0.053899999999999997 -0.5 +-8.9918 1.2962 2.2151 +-0.27499999999999997 1.35 -2.4 +-6.0414 0.30010000000000003 2.1659 +-5.7086 -1.3131 3.2062 +4.6466 -0.9964999999999999 14.0075 +-7.9357999999999995 -1.1001 2.2007 +-4.659 2.2742 2.835 +2.093 4.0851 0.36 +2.6178 -2.5436 0.0 +-8.7166 0.6129 2.8828 +-8.7166 1.4215 3.6311000000000004 +5.5723 -0.2698 0.0 +-7.5349 -1.2877 3.0362 +-4.584499999999999 1.492 1.6808 +-5.698099999999999 1.4967 1.6848999999999998 +3.0187 -4.8499 0.0 +-7.6629000000000005 -1.8119 2.9000000000000004 +-4.9749 1.3792 3.771 +1.8411 -4.3917 15.479999999999999 +-5.5637 -0.5446000000000001 2.9022 +-5.3652999999999995 2.444 2.4118 +-5.3652999999999995 2.2707 2.5497 +-0.7765 -4.0242 -1.6092 +-4.9685 1.7339 1.7773 +1.1946999999999999 -3.8156000000000003 -2.2009 +-5.7493 0.5392 1.8804 +-0.5717 -3.6975000000000002 -0.8456 +2.9675 2.1411 -2.8001 +-5.2245 -1.9904000000000002 2.6682 +-5.9413 1.2612 1.6164 +-4.3029 -1.6197 2.4677000000000002 +-4.3029 -1.6197 2.9476999999999998 +-4.3029 -1.1397 2.4677000000000002 +-5.4165 -0.5329999999999999 3.0034 +-5.4805 -1.968 3.0012 +2.9099 2.3653 -0.1 +-5.0837 1.6416 3.8641 +-5.0837 2.2627 2.8716 +-4.6229 0.4652 3.3591 +-4.6229 -1.809 2.2234 +-7.7013 -0.8066 2.4468 +-6.0629 0.5336 3.4858000000000002 +-9.077300000000001 0.5676 2.9104 +-5.8645000000000005 1.7924 1.6195000000000002 +0.9514999999999999 1.0767 -1.4000000000000001 +-5.0773 0.0766 3.0337 +-5.0773 0.030600000000000002 2.7542 +-4.5525 -1.6943 3.2883999999999998 +-7.5669 -0.6806000000000001 2.5420000000000003 +-4.616499999999999 0.3152 2.2366 +-4.616499999999999 -0.5201 2.9600999999999997 +-4.6805 -2.1097 2.9524000000000004 +-5.0709 2.6059 4.3999999999999995 +-5.0709 2.614 1.0 +-5.4613000000000005 0.22669999999999998 2.9001 +-5.7877 2.0489 3.1153 +-1.7236999999999998 4.4391 11.3 +1.9499 0.4451 0.0 +1.9499 0.4451 -0.06 +1.9499 -0.445 0.0 +1.9499 -0.445 -0.06 +-5.7173 -1.1114000000000002 3.3041 +-5.7173 1.9601 1.8804 +-5.5189 -1.9461 2.4337999999999997 +-0.0789 2.2557 -0.5 +-0.0789 2.7443 0.0 +-4.270899999999999 -0.5211 2.846 +-5.1861 -1.8116 3.2391000000000005 +-4.3989 -1.18 1.9567999999999999 +-5.5125 -1.2930000000000001 1.9624 +-4.2645 -1.6161999999999999 3.3401 +-4.5908999999999995 -1.5488 3.4159 +-5.4421 1.7173 1.7214 +-4.3925 -0.8349000000000001 2.0837000000000003 +-2.4917000000000002 2.8025 -2.7 +-4.8492 1.1906999999999999 1.6658 +-4.5868 -0.52 2.779 +2.4916 3.8560999999999996 0.36 +-5.438 -1.5444 2.1889 +-5.438 -1.6664999999999999 3.1177 +-5.438 -1.0976 2.1302000000000003 +-5.438 -1.7135 2.3431 +-0.2604 -0.7033 -1.6 +-2.75 4.4882 0.44999999999999996 +-2.75 5.2132 1.0 +-2.75 5.2132 0.44999999999999996 +-2.75 -5.2131 1.0 +-2.75 -5.2131 0.44999999999999996 +-2.75 4.313199999999999 1.0 +-2.75 4.313199999999999 0.44999999999999996 +-2.75 -5.0381 0.0 +-2.75 -4.3131 1.0 +-2.75 -4.3131 0.44999999999999996 +-5.7644 0.20990000000000003 2.3722 +-5.239599999999999 -1.8193000000000001 3.1674 +-0.38839999999999997 -0.0957 -0.06 +-5.3676 -1.7069 3.1771000000000003 +-5.3676 -0.7931 3.1771000000000003 +4.1364 -2.3351 11.3 +4.1364 -2.3351 15.479999999999999 +-6.0204 0.2355 2.8691 +-5.4956 1.5225 3.7008 +-4.446 -1.9800000000000002 2.6153 +-5.6236 0.2285 2.3299 +-5.6236 -1.1480000000000001 1.8384 +-5.6236 -0.8971 3.4927 +-5.3612 -1.8773000000000002 2.2479 +-5.0988 -1.5304 2.8263 +-5.949999999999999 0.0 1.0 +-5.949999999999999 0.0 0.44999999999999996 +-5.687600000000001 -0.9167 3.4462 +1.1284 -3.3000000000000003 -2.3928000000000003 +-4.9004 0.2356 2.8691999999999998 +0.8019999999999999 -3.9309999999999996 -2.4507999999999996 +-5.0284 0.3677 2.1452999999999998 +-4.5036 -0.9357000000000001 3.4090000000000003 +-2.3404000000000003 -3.7956999999999996 0.5 +-2.3404000000000003 -3.7733000000000003 0.36 +-5.0924 -1.4262000000000001 2.5695 +2.1843999999999997 3.058 -2.7037999999999998 +-7.71 -1.5767 2.7139 +-2.27 -3.9316999999999998 1.0 +-4.497199999999999 0.9181 0.5 +-4.497199999999999 0.9181 0.1 +0.8788 -3.5242999999999998 -0.4448 +-8.9516 1.8842999999999999 2.5326 +-8.6892 0.3322 2.4854000000000003 +1.6660000000000001 2.5097 -0.5 +1.6660000000000001 2.4903 0.0 +-5.4764 -1.1953 1.9247 +-1.15 -0.375 -0.06 +-0.9516 1.0767 -0.06 +-5.6044 0.7524000000000001 1.7339 +-1.1436 -3.7241999999999997 -2.3136 +4.5588 -1.3583 15.479899999999999 +-4.5484 2.2704 2.8405 +-2.91 2.3653 -2.7 +-2.91 2.3653 -0.1 +-2.5132000000000003 3.7929 1.0 +-2.5132000000000003 3.7929 11.3 +-0.8748 -2.6993 -0.3721 +-5.0668 -1.5041 3.3923 +-5.655600000000001 0.3817 3.3657 +-0.21559999999999999 -4.4242 -0.6143 +-4.67 1.6534 3.6469 +-5.521199999999999 -0.47619999999999996 2.7815 +-6.11 1.5987 3.4425 +5.6212 2.8446 0.1 +5.6212 2.8446 0.8999999999999999 +0.9684 -3.3242000000000003 -2.2849999999999997 +-5.0604000000000005 -1.7744 2.1227 +-4.926 1.5297 3.6755000000000004 +-5.7772 -1.2538 3.2105 +-4.465199999999999 -0.7409 3.2580999999999998 +-1.1884000000000001 -3.9276 -2.333 +-5.316400000000001 -0.5201 2.9600999999999997 +-5.316400000000001 -1.3261 1.9689999999999999 +-8.3308 1.7326000000000001 2.5619 +-0.9900000000000001 -0.1446 -1.4000000000000001 +-0.9900000000000001 0.1446 -2.4 +-5.6428 2.0533 3.3237 +-0.4652 -2.4242 -0.919 +1.0452 -3.8139 -0.6734 +-4.5228 1.2105 3.7358000000000002 +-6.0291 0.9612 1.6329 +2.4253 2.7277 0.0 +-5.0435 -0.522 2.9922 +-5.6323 0.1634 2.6054 +-5.3698999999999995 -2.0198 2.5946000000000002 +1.4461 0.9211 -2.4001 +3.6093 -2.0265999999999997 0.36 +-5.1715 -0.532 2.8864 +-7.9235 -1.4136 2.3926 +-7.9235 -1.0185 2.9603 +-3.5971 -1.0598 -2.7 +-4.9731 0.1544 2.5765 +-4.448300000000001 -1.9778 2.557 +-5.5619000000000005 -1.8549 2.2899 +1.5165 -0.1183 -1.4000000000000001 +-7.7891 -1.8317 2.9000000000000004 +-4.512300000000001 -1.9845000000000002 1.0 +-5.3635 1.2954 3.7587 +-5.3635 -1.9795 2.4533 +-0.4483 -3.4905 -0.6799000000000001 +-4.0515 -2.0017 2.6848 +-8.7043 0.6871999999999999 2.8760999999999997 +-8.7043 2.0060000000000002 2.4977 +-4.3778999999999995 -0.5206999999999999 2.5685 +-5.4915 -1.5675999999999999 3.4109 +-5.5555 2.33 2.852 +3.1613 -1.1516 -0.5 +-4.7683 1.3134 3.7201 +-4.5699 -0.8699999999999999 2.02 +-1.2931 -3.5242000000000004 -2.62 +-7.584299999999999 -1.047 2.4136 +-5.1587000000000005 -1.0773 2.9735 +-4.9603 2.1667 3.1502000000000003 +-8.8259 1.413 2.2474000000000003 +-8.8259 0.9338000000000001 3.0705 +-0.6339 -3.4241 -1.8780000000000001 +1.2669 -3.8537000000000003 -2.4335 +-4.4995 -1.1712 3.4741 +-5.6131 0.5598 3.4748 +-5.939500000000001 1.9597 3.5637000000000003 +1.1389 -3.8732 -0.613 +-5.4147 2.3277 2.8301 +-2.9891 -0.9611 0.0 +-8.8195 1.7012 2.5875 +-5.0819 1.3740999999999999 3.9177999999999997 +-5.9331000000000005 1.5051999999999999 1.5831000000000002 +-3.2451 -1.4668 -2.8000000000000003 +-4.6211 0.2416 2.4404 +-5.9971 0.2546 2.4334000000000002 +-4.3587 -0.9492999999999999 3.3796 +-0.8194999999999999 -3.8011000000000004 -0.622 +4.620500000000001 1.1017000000000001 11.3 +4.620500000000001 1.1017000000000001 15.479999999999999 +-1.1459000000000001 -3.9314 -0.5432 +-5.536300000000001 -0.9015000000000001 3.4012000000000002 +-3.8979 2.3 2.5879 +4.5565 -0.5533 0.5 +4.5565 -0.5533 0.1 +-4.2243 -1.2489999999999999 1.9594 +-5.0755 -1.1157 3.4320000000000004 +-5.0755 -1.2447 1.9129 +-5.6643 2.2180999999999997 3.0455 +-5.4018999999999995 -0.5034000000000001 2.7037999999999998 +0.5629000000000001 -0.5093000000000001 -1.6 +-5.7283 1.4513 1.6241999999999999 +-5.5299000000000005 1.1293 3.7756 +-3.6290999999999998 2.1738 0.36 +-4.480300000000001 -1.7217 2.0779 +-5.5939000000000005 0.7974 3.6306 +-4.5443 0.2053 2.9175 +-5.3955 -1.9446999999999999 2.3511 +-7.8851 -1.3965 2.0803 +-5.197100000000001 -1.1332 1.9638 +-6.0483 0.8654000000000001 1.8458999999999999 +-4.4739 0.2643 2.368 +-4.5379000000000005 2.0040999999999998 3.3985000000000003 +2.5405 -4.5738 0.44999999999999996 +-0.7363 -4.5306 0.5 +-6.2403 -0.8653 0.1 +-6.2403 -0.8653 0.8999999999999999 +-8.9923 1.2542 3.19 +-5.4531 0.98 3.7041 +3.2637 -1.3505 11.3 +-0.8643 -0.2583 -0.06 +0.6461 3.5020999999999995 -2.8000000000000003 +-5.1203 -1.4604000000000001 2.8285 +-5.9715 1.3065 3.5659000000000005 +-6.0355 0.4511 2.248 +-6.0355 0.3372 2.705 +-0.8579 -3.8442 -0.5374 +-4.7235 -1.7936 1.0 +5.3693 -3.1 0.0 +5.3693 -3.1 1.0 +-5.8370999999999995 2.3469 2.1787 +-5.5747 2.1361000000000003 2.0744 +-5.0499 1.2205000000000001 3.7217000000000002 +-1.7731000000000001 -2.6255 -0.5 +-1.7731000000000001 -2.3745 0.0 +-4.7875 1.7291999999999998 3.5956 +-5.1139 -1.8709 3.1665 +3.3404999999999996 -0.1722 0.0 +-4.851500000000001 2.1013 3.3629 +-4.5891 -1.7706 2.1191 +0.8508999999999999 -0.72 -1.4000000000000001 +-0.00030000000000000003 -3.7241000000000004 -0.6017 +1.1814 -3.8068 -0.6169 +-5.1098 -1.9526999999999999 3.0328999999999997 +-4.585 -1.5439 1.9820999999999998 +3.479 -3.2516000000000003 11.3 +0.4646 -3.4657 -2.0599 +-3.401 -0.053899999999999997 -0.5 +2.0389999999999997 -2.0389999999999997 0.0 +2.0389999999999997 2.0389999999999997 0.0 +-9.231399999999999 1.9609999999999999 2.5201000000000002 +0.8614 -3.7241999999999997 -0.47730000000000006 +0.7334 -3.5742000000000003 -1.8894000000000002 +-4.1818 -1.7943 3.2221 +-4.5081999999999995 -1.9796999999999998 2.9675 +-4.2458 -1.9800000000000002 2.617 +-5.6217999999999995 -1.6608999999999998 1.9349999999999998 +-5.3594 -1.208 3.4345 +4.9958 3.6718 0.0 +4.9958 3.6718 1.0 +0.8678 -1.8019 0.0 +-4.8986 2.1835 3.2397 +-0.8345999999999999 -3.7241999999999997 -2.4276 +4.5414 -0.2801 1.0 +4.5414 -0.2801 11.3 +-8.041 0.7176 2.0777 +-8.041 1.1285 3.5099 +-8.041 1.7902 2.0844 +-8.041 0.4311 2.6949 +-7.5802 -1.8785 2.6995 +-7.5802 -0.9197000000000001 2.71 +-5.9418 0.4209 1.9737 +-1.0266000000000002 -3.8442 -0.4844 +-8.7578 0.8835000000000001 3.0011 +-4.4314 -1.6154000000000002 2.0591999999999997 +-5.1482 -1.9763 2.8272 +-5.474600000000001 1.1093 3.7046 +-4.9498 0.36410000000000003 3.3179 +-6.0634 2.2628 2.8679 +-6.0634 1.9870999999999999 2.1002 +-6.0634 2.2754 2.5676 +-6.0634 2.1867 2.7959 +-6.0634 0.715 3.4688999999999997 +3.1782 1.1861 -0.5 +3.1782 1.2248 0.0 +-1.737 -0.00039999999999999996 -2.3889 +-5.4042 -0.9329999999999999 3.411 +1.0854000000000001 -2.7002 -0.4974 +-4.873 -0.5847 2.3346999999999998 +-4.873 0.2678 2.9196 +-4.873 2.185 3.0546 +-4.873 2.185 2.3453999999999997 +-4.873 0.5113000000000001 2.0164 +-4.873 1.9887 3.3836 +-4.873 0.8728 3.6331 +-4.873 2.0177 2.0490999999999997 +-4.873 1.6273 1.7669000000000001 +-4.873 2.2563 2.7219 +-4.873 0.2782 2.4379999999999997 +-4.873 0.9136 1.7513999999999998 +-4.873 1.25 3.6999999999999997 +-4.873 1.25 1.7000000000000002 +-4.873 1.5864 3.6485999999999996 +-4.873 0.4823 3.3508999999999998 +-4.3482 -1.9882 2.6084 +-2.185 -3.5545 0.1 +-2.249 -0.053899999999999997 0.0 +-5.2634 -0.6856 3.1864000000000003 +-1.7242 1.0356 -0.0 +-7.753 -1.25 3.0507 +-7.753 -1.1986999999999999 2.3557 +-4.4762 -1.9774 2.9917 +-3.689 -2.9961 14.4769 +-4.8026 1.201 3.7309 +-4.3418 -1.9373999999999998 2.4323 +0.8358000000000001 -3.6573 -1.544 +-5.7177999999999995 0.6760999999999999 1.8248 +-4.668200000000001 -0.8966999999999999 3.3456 +2.1478 -2.4689 -0.5 +-6.0442 0.5381 3.2737000000000003 +-4.4058 -1.7585 2.544 +-4.9946 2.1986 3.2144 +-4.732200000000001 -1.6738 0.0 +0.3814 -4.4242 -0.692 +-0.7962 -3.465 -1.3780000000000001 +2.743 1.0076999999999998 0.0 +-6.0378 1.6265 3.5213 +0.7782 4.6857999999999995 1.0 +0.7782 4.6857999999999995 11.3 +1.303 -3.4201 0.0 +-4.9882 -0.6403 2.2790999999999997 +-5.577 0.6029 3.3097000000000003 +-5.577 1.0079 3.5555000000000003 +-5.577 1.1006 1.8235999999999999 +-5.577 1.5719 1.8712 +-5.577 2.0719000000000003 2.3609 +-5.577 2.0627 3.0606999999999998 +-5.577 1.5758 3.449 +-5.577 0.3816 2.8907 +-5.577 1.8344 3.3606999999999996 +-5.577 1.8822999999999999 2.0851 +-5.577 2.1314 2.7331000000000003 +-5.577 0.6717 2.0248 +-5.577 0.407 2.4177 +-5.577 1.4904000000000002 3.4296 +-5.577 1.3601 3.5712 +-5.577 1.6202 3.4979000000000005 +-0.39940000000000003 -0.0625 -1.6 +-4.5274 0.4684 3.4131 +-4.5274 0.2693 3.1593999999999998 +1.175 3.4777000000000005 9.999999999999999e-05 +-1.0522 -3.3585 -0.2536 +-4.393 -4.515700000000001 0.1 +-4.393 -4.515700000000001 0.8999999999999999 +-5.5706 1.3124 3.7796999999999996 +-5.7009 -1.1851 3.2081999999999997 +-5.1761 -1.302 3.4449 +-5.1761 -0.6762 3.1619 +-4.3889 1.8189 3.5873000000000004 +-9.0417 0.8971 2.9803 +2.6895 -2.6132 -0.1 +-0.5872999999999999 0.4817 -1.6 +-8.5169 0.9033 3.0453 +-4.4529 -1.9845000000000002 2.8085 +-5.5665 -0.7394999999999999 2.1121 +-3.9281 2.2971 2.5312 +-5.0417 -1.0076999999999998 1.9598 +-5.6305000000000005 -1.3561 3.3117 +-0.1905 -2.3278 0.0 +-0.1905 -2.6722 -0.5 +-7.8576999999999995 -0.9319 3.0995000000000004 +-5.3617 1.4989999999999999 3.9056 +4.4047 1.778 11.3 +4.4047 1.778 15.479999999999999 +-8.7025 2.163 2.4381 +-4.6385000000000005 -2.1106 0.5 +-5.7521 1.6247999999999998 3.6554 +-5.4897 1.1936 3.7344000000000004 +-7.1921 -1.398 3.2786999999999997 +-7.1921 -1.7964 2.4783 +-8.0433 -0.7299 2.7191 +0.6735 -0.7929 -1.4000000000000001 +4.148700000000001 2.3132 1.0 +4.148700000000001 2.3132 11.3 +-5.6817 2.095 3.3895 +-4.0432999999999995 2.0318 1.9946 +-8.6961 0.8972000000000001 1.8254 +-4.9585 -1.0274 3.4072 +-1.4193 -0.2693 -0.06 +-4.4337 -1.8911 3.078 +-8.8241 0.7964000000000001 2.8297 +-1.8096999999999999 2.366 -0.5 +0.0911 -3.449 -2.1893 +2.9775 1.4567999999999999 -0.5 +1.2751000000000001 -3.7241999999999997 -2.6637 +1.2751000000000001 -3.5242000000000004 -0.1362 +-5.2785 -0.5229 2.5321 +0.42389999999999994 -3.6573 -2.1345 +-4.2289 -1.9758000000000002 2.8437 +-5.0801 2.274 2.9055 +-5.931299999999999 0.1057 2.7984999999999998 +3.3103000000000002 -3.1795999999999998 0.1 +-4.8817 -1.6619 2.0383 +-9.0097 0.4131 2.3913 +2.8559 3.6316 0.0 +2.8559 3.6316 0.5 +-8.5425 1.96 2.7877 +-4.7409 0.29910000000000003 2.2483 +-0.6769 -3.2242 -1.4439 +-8.9329 2.1614 2.4535 +0.8335 -3.8281 -2.1798 +-8.9969 0.8789999999999999 3.0977 +-0.8049000000000001 -3.8442 -0.36879999999999996 +-4.4081 -0.6993 2.6401999999999997 +-0.8689 -3.7241999999999997 -0.5045 +-3.0961 0.251 0.0 +-5.5857 0.6054999999999999 3.2084 +-5.5857 2.0650000000000004 2.7916 +3.9183000000000003 -2.2766 4.3579 +-5.6497 0.6997 3.6401999999999997 +-5.4513 0.2947 3.0754 +-7.7360999999999995 -1.0631 2.9567 +1.0488000000000002 -3.8442 -2.5915 +-8.781600000000001 0.3686 2.443 +5.8999999999999995 -2.2089999999999996 0.1 +5.8999999999999995 -2.2089999999999996 0.8999999999999999 +-2.0296000000000003 -3.7956999999999996 0.36 +-4.5192000000000005 1.4711999999999998 3.7303 +-5.108 -1.1381999999999999 1.9727000000000001 +-1.8952 2.5861 0.0 +3.5448 2.8525 1.0 +3.5448 2.8525 11.3 +-7.924 -0.8959999999999999 2.6983 +-5.236 -0.5194 2.4147 +-5.236 -0.6817 2.1583 +-0.9096 -3.3000000000000003 -1.3740999999999999 +-5.3 -0.5055 2.674 +-5.3 -1.1378 3.4682999999999997 +2.3032 2.6779 15.479999999999999 +-1.3 -3.7241999999999997 -2.2375 +-1.3 -3.5242000000000004 -2.2375 +-6.0168 -0.9643999999999999 2.5101 +-5.492 -0.6065 3.0692 +-5.2296000000000005 -1.2041 3.4815 +-5.556 -0.5656 2.3242 +-8.5704 1.6105999999999998 2.9764 +-5.62 -1.9114 2.1284 +-5.0952 -0.9303 3.0322 +4.4088 -1.277 0.5 +4.4088 -1.277 0.1 +3.4936000000000003 1.0884 -2.8001 +-8.8264 1.0888 3.1542 +-5.2872 -1.7691999999999999 3.2821999999999996 +0.15280000000000002 3.5288 11.3 +-4.564 0.8711 1.7187999999999999 +-4.8904000000000005 -1.9807000000000001 2.4209 +-5.2168 -0.9958 2.0077000000000003 +-6.3944 0.9462 3.3334999999999995 +-8.948 2.1822999999999997 2.7237 +-5.2104 -0.7255 3.2772999999999994 +-4.948 -1.8958 3.0541 +-0.8135999999999999 -3.8442 -2.4657999999999998 +-5.204000000000001 -1.0012 3.4377999999999997 +-4.4168 -1.3679999999999999 2.0798 +-0.8776 -3.7241999999999997 -2.658 +-8.5448 0.5677 2.9103 +-4.4808 -0.5214 2.5853 +0.6968 -4.4242 -1.8221 +-5.332 -1.9355 2.4341999999999997 +-2.0552 -2.4179 -0.5 +0.108 -3.5242000000000004 -2.2983 +-5.6584 2.0527 2.0401 +-3.7576 2.9057 1.0 +-3.7576 2.9057 11.3 +3.0584 3.3348000000000004 4.365200000000001 +-5.9848 0.7459 3.6527999999999996 +-0.2824 1.9931999999999999 0.0 +-5.7863999999999995 0.3744 2.946 +1.164 -3.7241999999999997 -0.42579999999999996 +-5.3896 1.6052 3.7313 +-5.1912 -0.8092999999999999 2.0993 +-1.9784 2.2792 -0.5 +-1.9784 -2.1756 -0.5 +-1.1912 -3.8122000000000003 -0.604 +-4.532 -1.9355 2.4341999999999997 +-4.2696 -1.3844 3.4256 +-5.7096 1.0777 1.6679 +-7.9368 -1.7691 2.71 +-8.852 0.6674 2.8672 +-4.788 2.0602 3.3229 +-5.9656 1.3854 1.6715 +5.1768 -0.3232 1.0 +-7.9304 -1.6468 3.0261 +-9.044 1.9356000000000002 3.1872 +-0.852 -3.5242000000000004 -1.7215999999999998 +-4.7839 0.506 3.4129 +-4.2591 -1.8800999999999999 3.0904000000000003 +-0.9823000000000001 -3.8876 -2.6441 +-5.1103000000000005 -0.22499999999999998 1.0 +-5.1103000000000005 -0.22499999999999998 0.44999999999999996 +-5.1103000000000005 0.22499999999999998 0.44999999999999996 +-5.9615 1.3861 3.5067 +-4.3231 -1.1109 1.9707 +-5.4367 -1.79 2.9250000000000003 +-0.2591 -0.719 -2.3794 +-4.6495 0.9002 3.6578 +-5.5007 1.629 3.6497 +0.6625 4.7036 11.3 +0.6625 4.7036 15.479999999999999 +0.8609 -3.9352 -0.2681 +5.7761 -0.0593 0.44999999999999996 +-7.9199 -1.2596 2.3653 +-1.9550999999999998 3.0822 0.0 +-0.31670000000000004 -0.7101999999999999 -0.06 +-4.572699999999999 0.5772 1.9029999999999998 +-5.686299999999999 -0.46090000000000003 2.9321 +-5.686299999999999 -0.2087 0.44999999999999996 +-5.686299999999999 -2.0008999999999997 3.0396 +-0.7711 -3.8125 -0.2425 +-7.9135 -0.8699 3.1648 +-5.2255 -1.2552 3.4871 +3.2289 0.2444 -0.5 +-5.3535 -1.3433000000000002 3.3458 +-5.1551 -0.4786 2.6016999999999997 +-4.6943 -0.7277 2.1559 +-5.0207 0.5895 1.8980000000000001 +-5.8719 0.44539999999999996 1.7975999999999999 +-4.0351 2.1038 3.3184 +-5.4111 2.0953 3.3699 +-3.5103000000000004 1.3193 -2.7 +0.8160999999999999 -3.8441 -0.1963 +-5.2063 -0.6159 2.3231 +-4.681500000000001 -1.9675000000000002 2.16 +-2.2559 -3.9072999999999998 0.5 +0.1057 -3.3000000000000003 -0.4989 +3.9072999999999998 -2.2559 0.5 +-4.8735 -1.0955 3.4219 +-5.4623 2.3331 2.7517 +-3.2991 5.367100000000001 0.1 +-3.2991 5.367100000000001 0.8999999999999999 +-6.0511 1.694 1.8880000000000001 +-2.5119 -4.9006 0.44999999999999996 +-5.2639 -0.6291 2.2335000000000003 +-0.3487 -3.5242000000000004 -0.6405 +-3.1007 1.3776 0.0 +0.5729 -5.1612 -1.0678 +-5.455900000000001 3.15 0.1 +-5.455900000000001 3.15 0.8999999999999999 +-5.455900000000001 2.3165 2.8968000000000003 +-4.4063 -1.6963 2.8513 +-7.7471 -1.8037999999999998 2.7 +-4.4703 0.6039 4.3790000000000004 +-4.3359000000000005 -1.3793 1.0 +-4.3359000000000005 -1.3793 11.3 +-5.4495000000000005 -1.2651000000000001 3.4421 +-4.6623 -1.7791000000000001 2.1263 +-4.1375 4.750900000000001 0.1 +-4.1375 4.750900000000001 0.8999999999999999 +-0.8607 -0.7377 -0.06 +-5.5775 0.6591 1.8368 +-8.591899999999999 1.2246 3.5697 +-3.6767000000000003 0.7377 -2.7 +-0.9887 -3.5242000000000004 -0.23440000000000003 +-7.606300000000001 -0.7202 2.3339 +-5.4431 -1.0368 1.9978 +-5.4431 -1.8581 2.305 +-0.0031000000000000003 -3.2242 -0.738 +-4.3935 -0.6073000000000001 3.0777 +4.3233 4.444 0.0 +4.3233 4.444 1.0 +-5.2447 -0.5896 3.1206 +-1.7055 3.2402 -2.8001 +-0.0671 -3.2242 -2.0759 +-4.7199 0.3624 2.1458 +2.0961 4.0938 0.1 +-8.5855 1.7206 2.8241 +-2.751 -0.053899999999999997 -0.5 +-8.5174 1.4423 2.2637 +-4.453399999999999 1.1574 1.3622 +4.0009999999999994 2.31 0.0 +4.0009999999999994 2.31 0.5 +-0.9142000000000001 -3.8028 -2.6668000000000003 +2.625 0.21649999999999997 0.0 +2.625 0.21649999999999997 -0.5 +-8.5814 0.9297 3.4776000000000002 +-7.9222 -1.402 3.0023999999999997 +-6.0214 2.249 3.1159 +-1.1062 -3.7241999999999997 -2.2822 +-5.759 0.40940000000000004 3.0464 +-5.759 0.3357 2.6586 +-5.759 1.5256 1.8277999999999999 +-5.759 2.1462 2.864 +-5.759 0.47530000000000006 2.2067 +-5.759 0.7956 1.9005 +-5.5606 -1.9699000000000002 2.5657 +-7.327 -0.7446 2.6239 +-2.4118 -2.7552 -2.8001 +-0.7734000000000001 0.0808 -1.4000000000000001 +-0.575 0.6209 -0.06 +-0.575 -0.6209 -1.4000000000000001 +-0.575 -0.6209 -0.06 +-6.079 1.6355000000000002 3.479 +-8.5686 1.4144999999999999 2.2776 +-8.5686 0.9665 2.3464 +-5.0294 1.8469 1.7748 +-1.2278 -3.7241999999999997 -0.5733 +-1.2278 0.3735 -1.4000000000000001 +5.2618 0.13749999999999998 0.44999999999999996 +-7.582999999999999 -1.2219 3.0504 +3.0346 1.8638 -2.8000000000000003 +-1.3558000000000001 6.0499 0.0 +-1.3558000000000001 6.0499 1.0 +-6.0086 0.3684 2.144 +-2.8598 1.4529999999999998 0.0 +-5.087 -1.7725000000000002 3.2791 +1.6650000000000003 2.0372999999999997 -0.0039 +-1.9382 2.9383 15.479999999999999 +0.22499999999999998 1.4000000000000001 -1.6 +0.22499999999999998 0.7155 -1.6 +-4.4277999999999995 -1.9787 2.8374 +-5.541399999999999 2.1964 2.2919 +-6.3926 1.5549 2.3028 +-4.4918 -0.7277 3.2440999999999995 +-0.9526 -3.8307 -0.1276 +-5.0806 1.2416 3.7248 +-5.0806 -1.8531 2.2044 +-7.570200000000001 -0.6545 2.7101 +1.1466 -3.9162000000000003 -2.5616 +-5.1446 -1.6206000000000003 3.3459999999999996 +2.1961999999999997 3.9399 0.36 +-0.8182 -3.9361 -2.3399 +-0.2934 -3.6573 -2.1957 +-8.222999999999999 0.5362 2.7126 +-8.222999999999999 1.0531000000000001 2.0137 +-8.222999999999999 1.5960999999999999 2.0755 +-4.9462 1.7257000000000002 3.5996 +-4.223 -1.7451 2.1501 +-4.223 -0.5186 2.9694000000000003 +-4.223 -1.8487 2.265 +-4.223 -1.6199999999999999 2.0591000000000004 +-5.0742 2.2849 2.7855000000000003 +-5.663 0.9344 3.2575 +-5.663 1.8363 2.9143 +-5.663 1.5803 3.0721 +-5.663 1.5716 2.7715 +-5.663 0.9256 2.9569 +1.9402 1.5775000000000001 -0.5 +-2.9749999999999996 -4.3734 1.0 +-2.9749999999999996 -4.3734 0.44999999999999996 +-2.9749999999999996 5.1529 1.0 +-2.9749999999999996 5.1529 0.44999999999999996 +-2.9749999999999996 4.3734 1.0 +-2.9749999999999996 4.3734 0.44999999999999996 +-2.9749999999999996 -5.1528 1.0 +-2.9749999999999996 -5.1528 0.44999999999999996 +-4.415 -0.6281 2.7758000000000003 +-5.0678 2.1255 2.052 +-4.933400000000001 0.16620000000000001 2.6290999999999998 +-0.34459999999999996 -4.4242 -0.8146 +-7.7494 -1.5829 2.7117999999999998 +-1.0614000000000001 -3.8442 -2.3365 +-4.9270000000000005 -1.3243 3.4743000000000004 +-4.4662 -1.5269 3.3821 +0.9738 -3.9678999999999998 -0.48669999999999997 +-0.7926000000000001 -3.6954000000000002 -1.4808999999999999 +2.7466 -3.5794 0.5 +-0.5942000000000001 -4.4242 -1.7076999999999998 +-7.9990000000000006 1.5145 3.6218 +-7.9990000000000006 1.2331999999999999 1.7410999999999999 +-7.9990000000000006 0.7852 3.5388 +-7.9990000000000006 0.5601 2.0339 +-8.5878 0.7685 2.8316 +-1.247 1.5637 -0.06 +-5.375 -1.9768000000000001 2.9792 +2.3603 -4.5382 1.0 +2.3603 -4.5382 0.44999999999999996 +2.3603 4.9881 1.0 +2.3603 4.9881 0.44999999999999996 +2.3603 -4.9882 0.44999999999999996 +2.3603 4.5381 1.0 +2.3603 4.5381 0.44999999999999996 +4.7859 -3.9415 0.0 +4.7859 -3.9415 1.0 +-8.321299999999999 0.9135000000000001 3.1133 +-8.321299999999999 1.6112000000000002 3.092 +-5.4349 -0.6715 2.1792 +-5.8253 1.5888 3.4751999999999996 +-4.5133 0.2683 3.079 +-2.6125 5.0013000000000005 0.0 +-0.9741 -3.5242000000000004 -0.5566 +-5.6269 1.5306 3.6733000000000002 +-5.3645 0.5646 3.7148 +-4.3149 -1.8010000000000002 2.2064 +-5.4285 -1.8236999999999999 2.2415000000000003 +-7.9181 -0.6931999999999999 2.8999 +2.1747 -2.9314 0.0 +-6.0173 -1.0159 2.445 +0.20990000000000003 -4.4242 -2.1763 +-0.6413 1.2012 -1.4000000000000001 +-4.8333 1.9106999999999998 1.9019000000000001 +-5.4220999999999995 2.3198 2.4861 +-3.5213 -3.0372 14.516699999999998 +-0.8333 -3.7241999999999997 -1.3368 +-8.7629 0.9384999999999999 3.0807 +0.7411 -3.6973 -1.6846 +-2.0109 2.1024000000000003 -0.5 +-4.500500000000001 0.5423 3.4391 +-5.6141000000000005 0.35660000000000003 2.0732 +-4.9549 2.259 2.5101 +-5.2813 -1.4119 1.9396 +-6.394900000000001 0.6899 2.4737999999999998 +-4.7565 0.3152 2.2366 +-4.2317 -0.5198 2.4295 +-5.0828999999999995 -0.8052 3.2971 +1.9955 -4.0465 0.5 +1.0803 -3.9143999999999997 -0.1933 +-6.0621 0.3546 3.2849000000000004 +-9.0765 1.9459 3.0036 +-3.6365000000000003 0.4283 -2.8001 +-1.4733 3.4485 -2.7 +-1.4733 3.4485 -0.1 +0.6899 -4.4242 -1.0011 +-1.5372999999999999 0.8142999999999999 -2.3861 +-4.5517 0.8496999999999999 1.233 +-4.5517 0.1849 3.7612 +-4.5517 -0.21259999999999998 2.3052 +-4.5517 1.6821 4.1342 +-4.5517 2.2812 1.5897000000000001 +-3.7645 -2.8968000000000003 14.0486 +-4.8781 -1.4417 1.9466 +1.0867 -3.9678999999999998 -0.4262 +-0.2893 -0.7377 -1.4000000000000001 +-0.2893 0.7377 -0.06 +-6.0557 1.5110999999999999 3.4783 +-4.2829 2.0816999999999997 11.3 +-5.1341 -0.964 3.4232 +-1.3325 1.1223 -2.3819 +-2.4461 -0.251 -0.5 +-5.1981 -1.2899 3.4775 +-4.673299999999999 2.1963 2.2916 +-4.673299999999999 -0.9862 1.9683 +-9.063699999999999 1.7111999999999998 2.5677 +-9.063699999999999 1.0754 3.1564 +-5.786899999999999 1.3732 3.5798000000000005 +-8.8013 1.6006 2.9733 +-8.8013 0.8995 2.4267 +-8.6029 1.4878 3.5473999999999997 +1.7523 -2.6335 -0.5 +1.4259000000000002 0.27590000000000003 -1.4000000000000001 +-7.879700000000001 -1.7797 2.3339 +-1.0637 -3.9678999999999998 -2.3356 +-5.1917 -1.4923 3.4402000000000004 +2.9363 -4.5545 0.44999999999999996 +-5.8445 0.0465 2.5339 +-5.8445 0.6126 3.7342 +-4.7949 -2.0602 0.5 +0.31870000000000004 -3.4912 -0.614 +-5.7101 1.3199 3.7799 +2.7443 0.0789 0.0 +-4.9229 -1.809 2.2234 +2.4179 -2.0552 -0.5 +1.0419 -1.3778000000000001 -2.3944 +-4.7245 1.492 1.6808 +-7.7389 -0.6961 2.7 +0.9779 -3.8689 -2.1451000000000002 +-4.3277 -0.5161 2.4413 +0.7858999999999999 0.9507 -1.4000000000000001 +0.7858999999999999 -1.0412 -1.4000000000000001 +-5.7677 0.1763 2.6627 +-0.7204 -3.657 -1.8485 +-5.373200000000001 -1.0352000000000001 1.9659 +2.6908000000000003 4.487 0.44999999999999996 +-5.3027999999999995 0.21159999999999998 0.0 +-5.0404 0.2356 2.8691999999999998 +-5.3668000000000005 1.8683 1.6454 +-4.842 1.7306 3.6653 +-5.1684 -1.5871 3.3619999999999997 +-0.2532 -3.4243 -0.6333 +-4.5092 0.6970999999999999 3.5669 +-7.2612 -0.7251 2.6914000000000002 +1.1292 -3.9368 -0.2624 +-5.4244 1.2967 1.6552999999999998 +-0.24680000000000002 -4.7556 15.479999999999999 +-0.3748 4.5081999999999995 4.3663 +-6.1412 -0.8515999999999999 0.0 +-6.1412 -0.8515999999999999 1.0 +-4.5668 -1.5041 3.3923 +-4.3044 -1.4751999999999998 1.9793 +2.646 5.607 0.0 +2.646 5.607 1.0 +-6.3972 1.4718 2.3914 +-4.5604 -1.7744 2.1227 +0.6172000000000001 -3.5742000000000003 -0.7649 +-5.1492 -0.49639999999999995 2.8920000000000003 +-5.4756 0.603 3.5089 +-4.688400000000001 2.2704 2.8405 +-7.7028 -1.4701 2.9701 +-6.3908000000000005 0.7986 2.4283 +0.95 0.9959000000000001 -0.06 +-5.0788 1.0442 3.7409999999999997 +-0.8163999999999999 3.424 11.3 +-5.4692 0.9002 3.6533999999999995 +-6.058 1.8416 3.3978 +-4.4196 -1.1156 1.9744000000000002 +-4.4196 -1.7579 2.3232 +-5.2707999999999995 -0.5263 2.8785000000000003 +-5.1364 -1.9800000000000002 2.621 +0.3036 0.269 -0.06 +-0.8099999999999999 -3.4905 -1.6514999999999997 +-5.7892 -1.3688 3.3095 +-8.6692 2.0416 2.2054 +-5.3924 -0.5506 2.4851 +-7.882 -1.1229 2.0692 +-5.258 -1.3617000000000001 3.4273 +3.1323999999999996 1.6320000000000001 11.3 +2.2812 1.9764 -0.5 +-7.549200000000001 -1.3708 2.1915 +-0.9955999999999999 -3.5242999999999998 -0.5333 +-4.5988 0.2289 2.8565 +0.5788 3.7086 -2.7032 +-5.45 -1.9900999999999998 2.6229999999999998 +-4.662800000000001 1.2105 3.7358000000000002 +-5.776400000000001 -1.2459 3.2858 +-5.578 -0.6686 2.4442 +-5.578 -1.7947000000000002 3.0267 +-5.578 -1.8589000000000002 2.5122 +-5.578 -1.3136 2.068 +-2.2308000000000003 -3.6428000000000003 0.5 +0.7196 1.1559 -1.4000000000000001 +2.8828 3.7903 15.479999999999999 +-4.522 0.23240000000000002 2.4177 +-5.177099999999999 -1.822 2.1679 +-4.914700000000001 1.0067 3.691 +-5.5035 -0.9946 3.4356 +-4.7162999999999995 0.587 1.8712 +-0.9147000000000001 -3.3331 -0.5173 +0.1349 -0.7461 -2.3566 +-5.6955 1.7042000000000002 2.7598000000000003 +-5.6955 0.8579 3.1485 +-7.922700000000001 -0.9517 2.5315 +-4.6459 -1.8066 3.1792000000000002 +-0.8443 0.7266 -0.06 +-0.8443 -1.2652999999999999 -0.06 +-4.972300000000001 -0.7174 3.2091000000000003 +-5.5611 -0.6913 2.2275 +0.9285 4.4444 0.9998999999999999 +-4.5755 -1.2447 1.9129 +-5.6891 -1.6655 3.4025 +-5.7531 1.6362999999999999 3.6496 +-4.4411 -1.7149999999999999 3.2742 +-7.5835 -1.4135 2.3924999999999996 +-0.5051 3.7239 -0.0951 +-8.5627 1.8975 2.1773000000000002 +-4.7611 0.2416 2.4404 +-8.9531 2.0415 2.2062999999999997 +-8.7547 1.0656 3.1519 +-8.7547 1.4363000000000001 2.2485999999999997 +-5.0171 0.262 2.3967 +-4.4923 -1.4912 3.4407 +-4.4923 -0.5621 2.9666 +-5.6699 1.1294 3.7756 +-4.8827 -0.5627 2.9611 +-1.0811 0.3823 -0.06 +-5.209099999999999 -0.7491 3.2960000000000003 +-8.2235 1.1759 3.412 +-0.8826999999999999 -3.5244 -1.1598000000000002 +-5.2731 -2.0282999999999998 2.6813 +0.1669 -4.0242 -2.1866 +-4.2235000000000005 -1.8685 3.4295 +-4.2235000000000005 -1.9349999999999998 2.4278999999999997 +-4.2235000000000005 -2.191 2.5291 +-4.2235000000000005 -0.6314 1.9705 +-4.2235000000000005 -1.5723999999999998 1.7996 +-4.2235000000000005 -0.9275 3.6004 +-4.2235000000000005 -0.309 2.871 +-8.876299999999999 1.974 2.4923 +-4.6779 2.0040999999999998 3.3985000000000003 +-5.0043 0.7361000000000001 3.6475 +-2.0539 4.0309 4.366099999999999 +-5.0683 -0.8786 3.3341000000000003 +-4.5435 -0.522 2.9922 +-5.657100000000001 2.1852 3.1579999999999995 +0.5061 -1.3782 -0.06 +-9.061900000000001 0.8571000000000001 2.4319 +-9.061900000000001 1.2858 2.2256 +-4.4731 -1.0109 3.4097000000000004 +-4.4731 0.5889 0.5 +3.7956999999999996 -2.3404000000000003 0.5 +3.7956999999999996 -2.0296000000000003 0.36 +-4.460299999999999 0.6962999999999999 1.7925 +-0.9851000000000001 -3.3589 -2.5523000000000002 +-0.7227 -3.4524 -1.0751 +-5.1131 -1.3901000000000001 1.9788000000000001 +-8.3218 1.9451 2.5041 +0.1326 -0.7414 -1.6 +-5.3713999999999995 0.1665 2.6283999999999996 +-7.598599999999999 -1.4018 3.3162 +-1.8961999999999999 -2.5897 0.0 +-5.4994000000000005 -2.0151 2.5338 +-4.449800000000001 -1.6638 2.0695 +-0.9745999999999999 -3.3000000000000003 -2.5395000000000003 +-2.9394 -4.5536 0.0 +-2.9394 -4.9726 0.44999999999999996 +-1.0386 -3.9282999999999997 -0.19940000000000002 +0.8622 -3.7241999999999997 -0.46649999999999997 +-5.7554 1.6403999999999999 3.6442 +0.2094 -3.5138000000000003 15.479999999999999 +1.8478 -2.3665 -0.5 +-4.8338 2.2007 2.3072 +-5.2882 -0.6403 2.2790999999999997 +-0.1106 -3.7241999999999997 -2.2214 +-7.9058 -0.6214 2.6995 +-3.5794 -2.7466 0.5 +-4.693 -0.8 3.4794 +-6.3953999999999995 1.5313999999999999 2.3579 +-7.509 2.1248 2.673 +-7.509 2.0201000000000002 2.1164 +-7.509 1.1986 3.5715999999999997 +-7.509 0.437 2.3763 +-7.509 1.3819 1.7428 +-7.509 0.3195 2.4681 +-7.509 0.3871 2.8459000000000003 +-7.509 2.2088 2.5796 +-7.509 1.3703999999999998 3.6587 +-7.509 0.7235 2.001 +-7.509 0.5886 3.273 +-7.509 1.5457999999999998 3.5161 +-7.509 1.6285 1.9109 +-7.509 0.48700000000000004 2.1072 +-7.509 0.8855999999999999 1.8051000000000001 +-7.509 2.0115000000000003 3.1314 +-7.509 1.7148 1.8612 +-7.509 1.755 3.406 +-7.509 1.1634 1.8292 +-7.509 0.8749 3.5905 +-7.509 0.47990000000000005 3.2836 +-7.509 1.9834 2.2224 +-7.509 2.0131 3.2927999999999997 +-7.509 0.8555 3.4732 +-7.509 0.2913 2.8204 +-7.509 1.7441000000000002 3.5219 +-7.509 2.1806 2.9319 +-5.3458 -1.9525000000000001 2.4577 +-5.0834 2.2753 2.5672 +1.6685999999999999 3.1461 -2.4 +-4.885 1.7161 3.6712000000000002 +3.8318 -2.4364 1.0 +-4.1618 2.2904999999999998 2.5002 +-5.5378 -1.7682 3.232 +-6.389 1.4121 2.5610999999999997 +-6.389 0.5161 2.3363 +-6.389 1.3778000000000001 2.4448000000000003 +-6.389 1.5972 2.7169 +-6.389 0.9228999999999999 3.1884 +-6.389 1.023 2.1881 +-6.389 1.3703999999999998 2.4569 +-6.389 1.6433 1.9787 +-6.389 1.225 2.9148 +-6.389 0.6956 2.779 +-6.389 0.7381000000000001 2.927 +-6.389 1.7744 3.1243 +-6.389 0.9296000000000001 3.3160000000000003 +-6.389 1.0128 3.1402 +-6.389 1.1554 2.9208000000000003 +-6.389 0.9122 2.9076 +-6.389 1.7675 2.7362 +-6.389 1.0484 1.9028 +-6.389 1.0118 2.571 +-6.389 0.924 2.6376 +-6.389 1.468 3.0605 +-6.389 1.02 3.4986 +-6.389 0.6296 3.2397 +-6.389 1.8945 2.9364 +-6.389 1.329 3.2543999999999995 +-6.389 1.0410000000000001 2.6799 +-6.389 1.1114000000000002 2.5406999999999997 +-6.389 1.0835 2.8278999999999996 +-6.389 1.4524000000000001 2.831 +-6.389 1.8044 2.621 +-6.389 1.7229999999999999 3.3800999999999997 +-6.389 1.477 3.2119 +-6.389 0.9178999999999999 2.7152 +-6.389 1.1547 3.3002 +-6.389 2.0612 2.8566000000000003 +-6.389 1.3037 2.3692 +-6.389 1.4933999999999998 2.4743 +-6.389 1.8901999999999999 2.1901 +-6.389 1.4591 2.7201 +-6.389 1.1711 2.1456 +-6.389 0.9511999999999999 3.3274 +-6.389 0.43689999999999996 2.6071 +-6.389 1.9363 3.147 +-6.389 0.9995999999999999 2.5636 +-6.389 1.2702 2.491 +-6.389 0.7175 2.0777 +-6.389 1.6048 3.1496000000000004 +-6.389 1.3616 3.5114 +-6.389 1.2505 3.1098 +-6.389 0.9048999999999999 3.1712 +-6.389 1.389 2.8621 +-6.389 1.762 2.473 +-6.389 1.3716000000000002 1.8901000000000001 +-6.389 0.7969 3.1293 +-6.389 1.0291 2.448 +-0.6866 1.8912000000000002 -0.06 +-5.077 2.1957999999999998 2.2762000000000002 +-5.077 0.16219999999999998 2.6395999999999997 +-2.9778 -0.1905 -0.5 +-6.0562 2.1335 2.0861 +0.3694 4.5751 0.5 +0.3694 4.5751 0.1 +-1.9858 2.1626 0.0 +-7.752199999999999 -1.5625 2.5488 +-4.4754000000000005 0.7734000000000001 1.7596 +-5.589 1.2638 1.6143 +-4.8658 -1.6232 1.8827 +-4.8658 -1.2927 1.8025 +-4.8658 -2.1323000000000003 2.87 +-4.8658 -0.3605 2.871 +-4.8658 -1.9002999999999999 2.0799000000000003 +2.475 -4.7632 0.44999999999999996 +-8.9938 0.915 3.0567 +-5.717 1.6427 3.7047 +-5.4546 0.3932 3.2625 +-4.6674 0.2693 3.1593999999999998 +1.035 -3.3374 -2.5441 +-2.8306 1.447 -0.5 +-5.4482 0.336 2.2089999999999996 +-2.4978 -3.8865999999999996 0.0 +-2.4978 -3.8865999999999996 0.5 +-5.8386000000000005 0.12229999999999999 2.2506000000000004 +-5.8386000000000005 1.2087999999999999 1.4867 +-0.661 -5.1612 -1.3646 +-1.5122 -4.2913 1.0 +-1.5122 -4.2913 11.3 +-4.5906 2.3216 2.5228 +0.8493999999999999 -3.5242000000000004 -0.4277 +1.1118 -3.3383999999999996 -2.303 +-4.981 -1.9820999999999998 2.4028 +-3.0802 -1.7286 15.479999999999999 +-5.3737 -0.5035000000000001 2.7037999999999998 +0.3287 -4.5150999999999994 4.3623 +-5.3673 -0.6315000000000001 2.9316 +-5.3673 1.4657 1.4882 +-2.6793 0.1924 0.0 +-4.6441 -1.9344000000000001 2.9682 +-1.6937 -0.3756 -2.387 +0.6679 -0.3645 -2.3731999999999998 +2.3063000000000002 -2.4717 0.0 +-5.6232999999999995 0.9146 3.6856 +-5.6232999999999995 -0.777 1.9724 +-5.0985000000000005 -1.0897999999999999 3.0305999999999997 +0.3415 -6.1906 0.0 +0.3415 -6.1906 1.0 +-3.2617 1.4296 -2.8000000000000003 +-7.914499999999999 -1.6327 3.1622999999999997 +-5.7513000000000005 -0.9227000000000001 2.5908 +-4.1769 1.7384 1.7651 +1.7239 1.0292000000000001 -0.06 +-7.5817 -1.426 2.9905999999999997 +-8.4329 0.9270999999999999 3.0685000000000002 +-8.4329 1.3847 3.1693 +-1.0921 -3.8597 -2.1501 +-5.7449 1.0493999999999999 3.6986 +-6.3977 0.7164 2.5159000000000002 +-5.6745 1.8384999999999998 3.6115 +-4.3625 -1.1202 3.4238999999999997 +1.6022999999999998 4.4716 1.0 +1.6022999999999998 4.4716 11.3 +-4.4905 -0.5425 2.9712 +-5.3417 -0.9279000000000001 1.9911999999999999 +-4.2921000000000005 -1.9836 2.9732000000000003 +-4.3561000000000005 1.2791000000000001 1.0 +0.23270000000000002 -3.4888000000000003 -2.2239999999999998 +-7.696899999999999 -0.6683 2.9000000000000004 +4.4951 1.5352 1.0 +4.4951 1.5352 11.3 +-5.072900000000001 2.2953 2.6367000000000003 +-5.072900000000001 -1.4917 3.4091000000000005 +-5.072900000000001 -0.6909000000000001 3.1766 +-5.072900000000001 -1.2317 1.8225000000000002 +-4.8105 -2.1881 0.0 +-4.8105 -2.1881 0.5 +3.5799 -2.8911 0.5003 +-4.3497 -1.9800000000000002 2.7856 +1.5511000000000001 -0.7979999999999999 -2.3801 +-5.0025 -0.8056000000000001 2.1116 +-4.5417 -1.0076999999999998 1.9598 +-4.2793 -1.0625 3.4211 +2.4726999999999997 -2.2931 0.0 +-8.9961 1.08 2.2612 +-2.1801 3.0609 -0.09709999999999999 +-0.5417 -0.5348 -1.5994000000000002 +-4.669700000000001 -0.6522 3.1382 +-4.4073 -0.759 2.6822 +-4.4073 -0.721 2.6925 +-9.0601 1.5433000000000001 3.4757000000000002 +-9.0601 0.42519999999999997 2.6039 +3.7207 -0.4675 -0.1 +-7.748099999999999 -1.8425 2.71 +0.9686999999999999 -3.8442 -0.20479999999999998 +-5.5849 -1.5630000000000002 1.9875 +3.3943000000000003 0.0789 0.0 +-5.386500000000001 -1.7739999999999998 3.2756 +-7.8761 -1.2403000000000002 2.3653 +3.8551 -2.4913000000000003 0.36 +-5.9753 1.7065000000000001 1.7629 +-4.3369 -1.8078 2.2174 +-4.2025 -1.9192 0.0 +-4.2025 -1.9192 0.5 +-5.0537 -1.5643 1.991 +-8.522499999999999 1.6968 2.5864000000000003 +-8.5865 0.8015 2.8433 +0.6551 3.6956999999999995 -0.10300000000000001 +-7.5369 -0.9209 2.71 diff --git a/assets/xarm7/xarm7.urdf b/assets/xarm7/xarm7.urdf new file mode 100644 index 0000000..ab85319 --- /dev/null +++ b/assets/xarm7/xarm7.urdf @@ -0,0 +1,346 @@ + + + + + + + + + + /xarm + + gazebo_ros_control/DefaultRobotHWSim + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + transmission_interface/SimpleTransmission + + hardware_interface/PositionJointInterface + + + hardware_interface/PositionJointInterface + 100 + + + + transmission_interface/SimpleTransmission + + hardware_interface/PositionJointInterface + + + hardware_interface/PositionJointInterface + reduction + + + + transmission_interface/SimpleTransmission + + hardware_interface/PositionJointInterface + + + hardware_interface/PositionJointInterface + reduction + + + + transmission_interface/SimpleTransmission + + hardware_interface/PositionJointInterface + + + hardware_interface/PositionJointInterface + reduction + + + + transmission_interface/SimpleTransmission + + hardware_interface/PositionJointInterface + + + hardware_interface/PositionJointInterface + reduction + + + + transmission_interface/SimpleTransmission + + hardware_interface/PositionJointInterface + + + hardware_interface/PositionJointInterface + reduction + + + + transmission_interface/SimpleTransmission + + hardware_interface/PositionJointInterface + + + hardware_interface/PositionJointInterface + reduction + + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + + true + + \ No newline at end of file diff --git a/assets/xarm7/xarm7.xml b/assets/xarm7/xarm7.xml new file mode 100644 index 0000000..9c70a96 --- /dev/null +++ b/assets/xarm7/xarm7.xml @@ -0,0 +1,68 @@ + + diff --git a/environment.yml b/environment.yml new file mode 100644 index 0000000..698b2e6 --- /dev/null +++ b/environment.yml @@ -0,0 +1,60 @@ +name: asap +channels: + - defaults +dependencies: + - ncurses=6.3 + - pip=21.2.2 + - python=3.8.0 + - readline=7.0 + - setuptools=58.0.4 + - sqlite=3.33.0 + - tk=8.6.11 + - wheel=0.37.0 + - xz=5.2.5 + - zlib=1.2.11 + - pip: + - backcall==0.2.0 + - cloudpickle==2.0.0 + - cycler==0.11.0 + - decorator==5.1.0 + - fonttools==4.28.4 + - gym==0.21.0 + - ikpy==3.3.4 + - importlib-metadata==4.8.2 + - ipython==7.30.1 + - jedi==0.18.1 + - kiwisolver==1.3.2 + - matplotlib==3.5.1 + - matplotlib-inline==0.1.3 + - networkx==2.6.3 + - numpy==1.21.4 + - packaging==21.3 + - parso==0.8.3 + - pexpect==4.8.0 + - pickleshare==0.7.5 + - pillow==8.4.0 + - prompt-toolkit==3.0.24 + - ptyprocess==0.7.0 + - pyglet==1.5.23 + - pygments==2.10.0 + - pyparsing==3.0.6 + - pyquaternion==0.9.9 + - python-dateutil==2.8.2 + - python-fcl==0.6.1 + - requests==2.27.1 + - rtree==0.9.7 + - scikit-learn==1.0.2 + - scipy==1.7.3 + - seaborn==0.12.2 + - six==1.16.0 + - sortedcontainers==2.4.0 + - torch==1.13.1 + - torch-geometric==2.2.0 + - torch-sparse==0.6.18 + - torch-scatter==2.1.2 + - tqdm==4.62.3 + - traitlets==5.1.1 + - trimesh==3.10.8 + - typing-extensions==4.0.1 + - wcwidth==0.2.5 + - zipp==3.6.0 diff --git a/images/assembly-01115.gif b/images/assembly-01115.gif new file mode 100644 index 0000000..beef8e1 Binary files /dev/null and b/images/assembly-01115.gif differ diff --git a/images/assembly-01234.gif b/images/assembly-01234.gif new file mode 100644 index 0000000..50e159e Binary files /dev/null and b/images/assembly-01234.gif differ diff --git a/images/assembly-02099.gif b/images/assembly-02099.gif new file mode 100644 index 0000000..9fa38b7 Binary files /dev/null and b/images/assembly-02099.gif differ diff --git a/images/assembly-03212.gif b/images/assembly-03212.gif new file mode 100644 index 0000000..e9e6391 Binary files /dev/null and b/images/assembly-03212.gif differ diff --git a/images/robot-00833.gif b/images/robot-00833.gif new file mode 100644 index 0000000..bb26656 Binary files /dev/null and b/images/robot-00833.gif differ diff --git a/images/robot-01235.gif b/images/robot-01235.gif new file mode 100644 index 0000000..053d644 Binary files /dev/null and b/images/robot-01235.gif differ diff --git a/images/robot-01434.gif b/images/robot-01434.gif new file mode 100644 index 0000000..9dbf1ed Binary files /dev/null and b/images/robot-01434.gif differ diff --git a/images/test_beam_sim.gif b/images/test_beam_sim.gif new file mode 100644 index 0000000..f1d0222 Binary files /dev/null and b/images/test_beam_sim.gif differ diff --git a/images/test_multi_sim.gif b/images/test_multi_sim.gif new file mode 100644 index 0000000..00d4974 Binary files /dev/null and b/images/test_multi_sim.gif differ diff --git a/images/test_set.png b/images/test_set.png new file mode 100644 index 0000000..021f5f8 Binary files /dev/null and b/images/test_set.png differ diff --git a/images/test_simple_sim.gif b/images/test_simple_sim.gif new file mode 100644 index 0000000..08b5c6f Binary files /dev/null and b/images/test_simple_sim.gif differ diff --git a/images/training_set.png b/images/training_set.png new file mode 100644 index 0000000..57f4649 Binary files /dev/null and b/images/training_set.png differ diff --git a/plan_path/pyplanners/__init__.py b/plan_path/pyplanners/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/plan_path/pyplanners/bbox.py b/plan_path/pyplanners/bbox.py new file mode 100644 index 0000000..35ae3ff --- /dev/null +++ b/plan_path/pyplanners/bbox.py @@ -0,0 +1,92 @@ +import numpy as np +from scipy.spatial.transform import Rotation +from .transform import transform_pts_by_state + + +def transform_vectors(vectors, config): + if len(config) == 3: # translation only + return vectors + config + elif len(config) == 6: # translation + rotation + translation, rotation = config[:3], config[3:] + rotation = Rotation.from_euler('xyz', rotation).as_matrix() + return vectors.dot(rotation.T) + translation + else: + raise NotImplementedError + + +def get_bbox(vertices): + return np.min(vertices, axis=0), np.max(vertices, axis=0) + + +def get_bbox_all(vertices, configs): + min_box, max_box = np.zeros((0, 3)), np.zeros((0, 3)) + for config in configs: + transformed_vertices = transform_pts_by_state(vertices, state=config) + min_box = np.vstack([min_box, transformed_vertices.min(axis=0)]) + max_box = np.vstack([max_box, transformed_vertices.max(axis=0)]) + return min_box, max_box + + +def get_bbox_goal_test(vertices_move, vertices_still): + min_box_move, max_box_move = get_bbox(vertices_move) + min_box_still, max_box_still = get_bbox(vertices_still) + + def goal_test(config): + if len(config) == 3: # translation only + return ((config + min_box_move) >= max_box_still).any() or ((config + max_box_move) <= min_box_still).any() + elif len(config) == 6: # translation + rotation + vertices_move_new = transform_vectors(vertices_move, config) + min_box_move_new, max_box_move_new = get_bbox(vertices_move_new) + return (min_box_move_new >= max_box_still).any() or (max_box_move_new <= min_box_still).any() + else: + raise NotImplementedError + return goal_test + + +def compute_nearest_bbox_goal(nodes, vertices_move, vertices_still): + nodes_configs = np.array([n.config for n in nodes]) + if nodes_configs.shape[1] == 3: # translation only + + min_box_move, max_box_move = get_bbox(vertices_move) + min_box_still, max_box_still = get_bbox(vertices_still) + size_box_move = max_box_move - min_box_move + dist_to_min = -(min_box_still - (nodes_configs + min_box_move) - size_box_move) + dist_to_max = max_box_still - (nodes_configs + max_box_move) + size_box_move + + elif nodes_configs.shape[1] == 6: # translation + rotation + + min_box_move, max_box_move = get_bbox_all(vertices_move, nodes_configs) + min_box_still, max_box_still = get_bbox(vertices_still) + size_box_move = max_box_move - min_box_move + dist_to_min = -(min_box_still - min_box_move - size_box_move) + dist_to_max = max_box_still - max_box_move + size_box_move + + else: + raise NotImplementedError + + assert (dist_to_min >= 0).all() and (dist_to_max >= 0).all() + closest_to_min = np.unravel_index(np.argmin(dist_to_min), dist_to_min.shape) + closest_to_max = np.unravel_index(np.argmin(dist_to_max), dist_to_max.shape) + + if dist_to_min[closest_to_min] < dist_to_max[closest_to_max]: + node_idx, axis_idx = closest_to_min + closest_node = nodes[node_idx] + closest_goal = closest_node.config.copy() + if nodes_configs.shape[1] == 3: # translation only + closest_goal[axis_idx] = (min_box_still - min_box_move - size_box_move)[axis_idx] + elif nodes_configs.shape[1] == 6: # translation + rotation + closest_goal[axis_idx] += (min_box_still - min_box_move - size_box_move)[node_idx, axis_idx] + else: + raise NotImplementedError + else: + node_idx, axis_idx = closest_to_max + closest_node = nodes[node_idx] + closest_goal = closest_node.config.copy() + if nodes_configs.shape[1] == 3: # translation only + closest_goal[axis_idx] = (max_box_still - max_box_move + size_box_move)[axis_idx] + elif nodes_configs.shape[1] == 6: # translation + rotation + closest_goal[axis_idx] += (max_box_still - max_box_move + size_box_move)[node_idx, axis_idx] + else: + raise NotImplementedError + + return closest_goal, closest_node \ No newline at end of file diff --git a/plan_path/pyplanners/diverse.py b/plan_path/pyplanners/diverse.py new file mode 100644 index 0000000..967b292 --- /dev/null +++ b/plan_path/pyplanners/diverse.py @@ -0,0 +1,60 @@ +from itertools import combinations, product, permutations +from scipy.spatial.kdtree import KDTree + +import numpy as np + +from .utils import INF, compute_path_cost, get_distance + +# TODO: shared roadmap for multi-query + +def compute_median_distance(path1, path2): + differences = [get_distance(q1, q2) for q1, q2 in product(path1, path2)] + return np.median(differences) + + +def compute_minimax_distance(path1, path2): + overall_distance = 0. + for path, other in permutations([path1, path2]): + tree = KDTree(other) + for q1 in path: + #closest_distance = min(get_distance(q1, q2) for q2 in other) + closest_distance, closest_index = tree.query(q1, k=1, eps=0.) + overall_distance = max(overall_distance, closest_distance) + return overall_distance + + +def compute_portfolio_distance(path1, path2, min_distance=0.): + # TODO: generic distance_fn + # TODO: min_distance from stats about the portfolio + distance = compute_minimax_distance(path1, path2) + if distance < min_distance: + return 0. + return sum(compute_path_cost(path, get_distance) for path in [path1, path2]) + + +def score_portfolio(portfolio, **kwargs): + # TODO: score based on collision_fn voxel overlap at different resolutions + score_fn = compute_minimax_distance # compute_median_distance | compute_minimax_distance | compute_portfolio_distance + score = INF + for path1, path2 in combinations(portfolio, r=2): + score = min(score, score_fn(path1, path2, **kwargs)) + return score + + +def exhaustively_select_portfolio(candidates, k=10, **kwargs): + if len(candidates) <= k: + return candidates + # TODO: minimum length portfolio such that at nothing is within a certain distance_fn + best_portfolios, best_score = [], 0 + for portfolio in combinations(candidates, r=k): + score = score_portfolio(portfolio, **kwargs) + if score > best_score: + best_portfolios, best_score = portfolio, score + return best_portfolios + +def greedily_select_portfolio(candidates, k=10): + # Higher score is better + if len(candidates) <= k: + return candidates + raise NotImplementedError() + #return best_portfolios diff --git a/plan_path/pyplanners/graph.py b/plan_path/pyplanners/graph.py new file mode 100644 index 0000000..8ae20af --- /dev/null +++ b/plan_path/pyplanners/graph.py @@ -0,0 +1,82 @@ +from collections import namedtuple, Mapping +from heapq import heappush, heappop + + +class Vertex(object): + + def __init__(self, value): + self.value = value + self.edges = [] + + def __repr__(self): + return self.__class__.__name__ + '(' + str(self.value) + ')' + + +class Edge(object): + + def __init__(self, v1, v2, value, cost): + self.v1, self.v2 = v1, v2 + self.v1.edges.append(self) + self.value = value + self.cost = cost + + def __repr__(self): + return self.__class__.__name__ + '(' + str(self.v1.value) + ' -> ' + str(self.v2.value) + ')' + +SearchNode = namedtuple('SearchNode', ['cost', 'edge']) + + +class Graph(Mapping, object): + + def __init__(self): + self.vertices = {} + self.edges = [] + + def __getitem__(self, value): + return self.vertices[value] + + def __len__(self): + return len(self.vertices) + + def __iter__(self): + return iter(self.vertices) + + def __call__(self, value1, value2): # TODO - goal_test + if value1 not in self or value2 not in self: + return None + + start, goal = self[value1], self[value2] + queue = [(0, start)] + nodes, processed = {start: SearchNode(0, None)}, set() + + def retrace(v): + edge = nodes[v].edge + if edge is None: + return [v.value], [] + vertices, edges = retrace(edge.v1) + return vertices + [v.value], edges + [edge.value] + + while len(queue) != 0: + _, cv = heappop(queue) + if cv in processed: + continue + processed.add(cv) + if cv == goal: + return retrace(cv) + for edge in cv.edges: + cost = nodes[cv].cost + edge.cost + if edge.v2 not in nodes or cost < nodes[edge.v2].cost: + nodes[edge.v2] = SearchNode(cost, edge) + heappush(queue, (cost, edge.v2)) + return None + + def add(self, value): + if value not in self: + self.vertices[value] = Vertex(value) + return self.vertices[value] + + def connect(self, value1, value2, edge_value=None, edge_cost=1): + v1, v2 = self.add(value1), self.add(value2) + edge = Edge(v1, v2, edge_value, edge_cost) + self.edges.append(edge) + return edge diff --git a/plan_path/pyplanners/lattice.py b/plan_path/pyplanners/lattice.py new file mode 100644 index 0000000..d36b23d --- /dev/null +++ b/plan_path/pyplanners/lattice.py @@ -0,0 +1,46 @@ +from itertools import islice + +import numpy as np + +from .search import best_first, bfs + + +def get_nth(generator, n=0): + return next(islice(generator, n), None) + + +def get_neighbors_fn(extend_fn, targets=[], scale=1e3, bias=False): # TODO: could also include diagonal + # https://github.mit.edu/caelan/lis-openrave/blob/master/manipulation/motion/cspace.py#L171 + def neighbors_fn(current): + d = len(current) + for target in targets: + new = get_nth(extend_fn(current, target), n=1) + if bias or (new is target): + yield new + for k in range(d): + direction = np.zeros(d) + direction[k] = scale + for sign in [-1, +1]: + # TODO: hash the confs + target = tuple(np.array(current) + sign * direction) + #yield target + new = get_nth(extend_fn(current, target), n=1) + yield new + return neighbors_fn + + +def lattice(start, goal, extend_fn, collision_fn, distance_fn=None, **kwargs): + """ + :param start: Start configuration - conf + :param goal: End configuration - conf + :param distance_fn: Distance function - distance_fn(q1, q2)->float + :param extend_fn: Extension function - extend_fn(q1, q2)->[q', ..., q"] + :param collision_fn: Collision function - collision_fn(q)->bool + :param kwargs: Keyword arguments + :return: Path [q', ..., q"] or None if unable to find a solution + """ + #collision_fn = lambda q: False + neighbors_fn = get_neighbors_fn(extend_fn, targets=[goal]) + if distance_fn is None: + return bfs(start, goal, neighbors_fn, collision_fn, **kwargs) + return best_first(start, goal, distance_fn, neighbors_fn, collision_fn, **kwargs) diff --git a/plan_path/pyplanners/lazy_prm.py b/plan_path/pyplanners/lazy_prm.py new file mode 100644 index 0000000..eada35d --- /dev/null +++ b/plan_path/pyplanners/lazy_prm.py @@ -0,0 +1,387 @@ +from heapq import heappush, heappop +from collections import namedtuple, defaultdict + +from .nearest import BruteForceNeighbors, KDNeighbors +from .primitives import default_weights, get_embed_fn, get_distance_fn +from .utils import INF, elapsed_time, get_pairs, default_selector, irange, \ + merge_dicts, compute_path_cost, get_length, is_path, flatten + +import time +import numpy as np + +Metric = namedtuple('Metric', ['p_norm', 'weights']) +Node = namedtuple('Node', ['g', 'parent']) +Solution = namedtuple('PRMSolution', ['path', 'samples', 'edges', 'colliding_vertices', 'colliding_edges']) + +unit_cost_fn = lambda v1, v2: 1. +zero_heuristic_fn = lambda v: 0 + +ORDINAL = 1e3 +REVERSIBLE = True +ROADMAPS = [] # TODO: not ideal + +def sample_until(sample_fn, num_samples, max_time=INF): + # TODO: is this actually needed? + # TODO: compute number of rejected samples + start_time = time.time() + samples = [] + while (len(samples) < num_samples) and (elapsed_time(start_time) < max_time): + conf = sample_fn() # TODO: include + # TODO: bound function based on distance_fn(start, conf) and individual distances + # if (max_cost == INF) or (distance_fn(start, conf) + distance_fn(conf, goal)) < max_cost: + # TODO: only keep edges that move toward the goal + samples.append(conf) + return samples + +def retrace_path(visited, vertex): + if vertex is None: + return [] + return retrace_path(visited, visited[vertex].parent) + [vertex] + +def dijkstra(start_v, neighbors_fn, cost_fn=unit_cost_fn): + # Update the heuristic over time + # TODO: overlap with discrete + # TODO: all pairs shortest paths + # TODO: max_cost + start_g = 0. + visited = {start_v: Node(start_g, None)} + queue = [(start_g, start_v)] + while queue: + current_g, current_v = heappop(queue) + if visited[current_v].g < current_g: + continue + for next_v in neighbors_fn(current_v): + next_g = current_g + cost_fn(current_v, next_v) + if (next_v not in visited) or (next_g < visited[next_v].g): + visited[next_v] = Node(next_g, current_v) + heappush(queue, (next_g, next_v)) + return visited + +def get_priority_fn(w=1.): + assert 0. <= w <= INF + def priority_fn(g, h): + if w == 0.: + return g + if w == INF: + return (h, g) + return g + w*h + return priority_fn + +def wastar_search(start_v, end_v, neighbors_fn, cost_fn=unit_cost_fn, + heuristic_fn=zero_heuristic_fn, max_cost=INF, max_time=INF, **kwargs): + # TODO: lazy wastar to get different paths + # TODO: multi-start / multi-goal + # TODO: use previous search tree as heuristic + #heuristic_fn = lambda v: cost_fn(v, end_v) + priority_fn = get_priority_fn(**kwargs) + goal_test = lambda v: v == end_v + + start_time = time.time() + start_g = 0. + start_h = heuristic_fn(start_v) + visited = {start_v: Node(start_g, None)} + queue = [(priority_fn(start_g, start_h), start_g, start_v)] + while queue and (elapsed_time(start_time) < max_time): + _, current_g, current_v = heappop(queue) + if visited[current_v].g < current_g: + continue + if goal_test(current_v): + return retrace_path(visited, current_v) + for next_v in neighbors_fn(current_v): # TODO: lazily compute neighbors + next_g = current_g + cost_fn(current_v, next_v) + if (next_v not in visited) or (next_g < visited[next_v].g): + visited[next_v] = Node(next_g, current_v) + next_h = heuristic_fn(next_v) + if (next_g + next_h) < max_cost: # Assumes admissible + next_p = priority_fn(next_g, next_h) + heappush(queue, (next_p, next_g, next_v)) + return None + +################################################## + +class Roadmap(object): + def __init__(self, extend_fn, weights=None, distance_fn=None, cost_fn=None, + p_norm=2, max_degree=5, max_distance=INF, approximate_eps=0., **kwargs): + # TODO: custom cost_fn + assert (weights is not None) or (distance_fn is not None) + self.distance_fn = distance_fn + self.extend_fn = extend_fn + self.weights = weights + self.cost_fn = cost_fn + self.p_norm = p_norm + self.max_degree = max_degree + self.max_distance = max_distance + self.approximate_eps = approximate_eps + if self.weights is None: + self.nearest = BruteForceNeighbors(self.distance_fn) + else: + self.nearest = KDNeighbors(embed_fn=get_embed_fn(self.weights), **kwargs) + #self.nearest = BruteForceNeighbors(get_distance_fn(weights, p_norm=p_norm)) + self.edges = set() + self.outgoing_from_vertex = defaultdict(set) + self.edge_costs = {} + self.edge_paths = {} + self.colliding_vertices = {} + self.colliding_edges = {} + self.colliding_intermediates = {} + @property + def samples(self): + return self.nearest.data + @property + def vertices(self): + return list(range(len(self.samples))) # TODO: inefficient + def index(self, x): + #return self.samples.index(x) + for i, q in enumerate(self.samples): + if x is q: #x == q: + return i + return ValueError(x) + def __iter__(self): + return iter([self.samples, self.vertices, self.edges]) + def add_edge(self, v1, v2): + assert REVERSIBLE # TODO + edges = {(v1, v2), (v2, v1)} + self.edges.update(edges) + self.outgoing_from_vertex[v1].add(v2) + self.outgoing_from_vertex[v2].add(v1) + return edges + def add_samples(self, samples): + new_edges = set() + for v1, sample in self.nearest.add_data(samples): + #for v1, sample in enumerate(self.vertices): + # TODO: could dynamically compute distances + # if len(self.outgoing_from_vertex[v1]) >= self.max_degree: + # raise NotImplementedError() + max_degree = min(self.max_degree + 1, len(self.samples)) + for d, v2, _ in self.nearest.query_neighbors(sample, k=max_degree, eps=self.approximate_eps, + p=self.p_norm, distance_upper_bound=self.max_distance): + if (v1 != v2): # and (d <= self.max_distance): + new_edges.update(self.add_edge(v1, v2)) + return new_edges + def is_colliding(self, v1, v2): + edge = (v1, v2) + return self.colliding_vertices.get(v1, False) or \ + self.colliding_vertices.get(v2, False) or \ + self.colliding_edges.get(edge, False) + def is_safe(self, v1, v2): + edge = (v1, v2) + return not self.colliding_edges.get(edge, True) + def neighbors_fn(self, v1): + for v2 in self.outgoing_from_vertex[v1]: + if not self.is_colliding(v1, v2): + yield v2 + def check_vertex(self, v, collision_fn): + x = self.samples[v] + if v not in self.colliding_vertices: + # TODO: could update the colliding adjacent edges as well + self.colliding_vertices[v] = collision_fn(x) + return not self.colliding_vertices[v] + def check_intermediate(self, v1, v2, index, collision_fn): + if (v1, v2, index) not in self.colliding_intermediates: + x = self.get_path(v1, v2)[index] + self.colliding_intermediates[v1, v2, index] = collision_fn(x) + if self.colliding_intermediates[v1, v2, index]: + # TODO: record when all safe + self.colliding_edges[v1, v2] = self.colliding_intermediates[v1, v2, index] + if REVERSIBLE: + self.colliding_edges[v2, v1] = self.colliding_edges[v1, v2] + return not self.colliding_intermediates[v1, v2, index] + def check_edge(self, v1, v2, collision_fn): + if (v1, v2) not in self.colliding_edges: + segment = default_selector(self.get_path(v1, v2)) # TODO: check_intermediate + self.colliding_edges[v1, v2] = any(map(collision_fn, segment)) + if REVERSIBLE: + self.colliding_edges[v2, v1] = self.colliding_edges[v1, v2] + return not self.colliding_edges[v1, v2] + def check_path(self, path, collision_fn): + for v in default_selector(path): + if not self.check_vertex(v, collision_fn): + return False + # for v1, v2 in default_selector(get_pairs(path)): + # if not self.check_edge(v1, v2, collision_fn): + # return False + # return True + intermediates = [] + for v1, v2 in get_pairs(path): + intermediates.extend((v1, v2, index) for index in range(len(self.get_path(v1, v2)))) + for v1, v2, index in default_selector(intermediates): + if not self.check_intermediate(v1, v2, index, collision_fn): + return False + return True + def check_roadmap(self, collision_fn): + for vertex in self.vertices: + self.check_vertex(vertex, collision_fn) + for vertex1, vertex2 in self.edges: + self.check_edge(vertex1, vertex2, collision_fn) + def get_cost(self, v1, v2): + edge = (v1, v2) + if edge not in self.edge_costs: + self.edge_costs[edge] = self.cost_fn(self.samples[v1], self.samples[v2]) + if REVERSIBLE: + self.edge_costs[edge[::-1]] = self.edge_costs[edge] + return self.edge_costs[edge] + def get_path(self, v1, v2): + edge = (v1, v2) + if edge not in self.edge_paths: + path = list(self.extend_fn(self.samples[v1], self.samples[v2])) + self.edge_paths[edge] = path + if REVERSIBLE: + self.edge_paths[edge[::-1]] = path[::-1] + return self.edge_paths[edge] + def augment(self, sample_fn, num_samples=100): + n = len(self.samples) + if n >= num_samples: + return self + samples = sample_until(sample_fn, num_samples=num_samples - n) + self.add_samples(samples) + return self + +################################################## + +def get_metrics(conf, weights=None, p_norm=2, distance_fn=None, cost_fn=None): + # TODO: can embed pose and/or points on the robot for other distances + if (weights is None) and (distance_fn is None): + weights = default_weights(conf, weights=weights) + #distance_fn = distance_fn_from_extend_fn(extend_fn) + if cost_fn is None: + if distance_fn is None: + cost_fn = get_distance_fn(weights, p_norm=p_norm) # TODO: additive cost, acceleration cost + else: + cost_fn = distance_fn + return weights, distance_fn, cost_fn + +def lazy_prm(start, goal, sample_fn, extend_fn, collision_fn, distance_fn=None, cost_fn=None, roadmap=None, num_samples=100, + weights=None, circular={}, p_norm=2, lazy=True, max_cost=INF, max_time=INF, w=1., meta=False, verbose=True, **kwargs): #, max_paths=INF): + """ + :param start: Start configuration - conf + :param goal: End configuration - conf + :param sample_fn: Sample function - sample_fn()->conf + :param extend_fn: Extension function - extend_fn(q1, q2)->[q', ..., q"] + :param collision_fn: Collision function - collision_fn(q)->bool + :param max_time: Maximum runtime - float + :param kwargs: Keyword arguments + :return: Path [q', ..., q"] or None if unable to find a solution + """ + # TODO: compute hyperparameters using start, goal, and sample_fn statistics + # TODO: scale default parameters based on + # TODO: precompute and store roadmap offline + # TODO: multiple collision functions to allow partial reuse + # TODO: multi-query motion planning + start_time = time.time() + weights, distance_fn, cost_fn = get_metrics(start, weights=weights, p_norm=p_norm, distance_fn=distance_fn, cost_fn=cost_fn) + if roadmap is None: + roadmap = Roadmap(extend_fn, weights=weights, distance_fn=distance_fn, cost_fn=cost_fn, circular=circular) + #leafsize=10, compact_nodes=True, copy_data=False, balanced_tree=True, boxsize=None, **kwargs) + roadmap.add_samples([start, goal] + sample_until(sample_fn, num_samples)) + roadmap = roadmap.augment(sample_fn, num_samples=num_samples) + + samples, vertices, edges = roadmap + start_vertex = roadmap.index(start) + end_vertex = roadmap.index(goal) + degree = np.average(list(map(len, roadmap.outgoing_from_vertex.values()))) + + # TODO: update collision occupancy based on proximity to existing colliding (for diversity as well) + # TODO: minimize the maximum distance to colliding + if not lazy: + roadmap.check_roadmap(collision_fn) + + weight_fn = roadmap.get_cost + if meta: + lazy_fn = lambda v1, v2: int(not roadmap.is_safe(v1, v2)) # TODO: score by length + #weight_fn = lazy_fn + #weight_fn = lambda v1, v2: (lazy_fn(v1, v2), cost_fn(samples[v1], samples[v2])) # TODO: + weight_fn = lambda v1, v2: ORDINAL*lazy_fn(v1, v2) + roadmap.get_cost(v1, v2) + + visited = dijkstra(end_vertex, roadmap.neighbors_fn, weight_fn) + heuristic_fn = lambda v: visited[v].g if (v in visited) else INF # TODO: lazily apply costs + #heuristic_fn = zero_heuristic_fn + #heuristic_fn = lambda v: weight_fn(v, end_vertex) + path = None + while (elapsed_time(start_time) < max_time) and (path is None): # TODO: max_attempts + lazy_path = wastar_search(start_vertex, end_vertex, neighbors_fn=roadmap.neighbors_fn, + cost_fn=weight_fn, heuristic_fn=heuristic_fn, + max_cost=max_cost, max_time=max_time-elapsed_time(start_time), w=w) + if lazy_path is None: + break + if verbose: + print('Candidate | Length: {} | Cost: {:.3f} | Vertices: {} | Samples: {} | Degree: {:.3f} | Time: {:.3f}'.format( + len(lazy_path), compute_path_cost(lazy_path, cost_fn=weight_fn), + len(roadmap.colliding_vertices), len(roadmap.colliding_intermediates), + degree, elapsed_time(start_time))) + if roadmap.check_path(lazy_path, collision_fn): + path = lazy_path + + if path is None: + forward_visited = set(dijkstra(start_vertex, roadmap.neighbors_fn)) + backward_visited = set(dijkstra(end_vertex, roadmap.neighbors_fn)) + # for v in roadmap.vertices: + # if not roadmap.colliding_vertices.get(v, False): + # # TODO: add edges if the collision-free degree drops + # num_colliding = sum(not roadmap.colliding_vertices.get(v2, False) for v2 in roadmap.outgoing_from_vertex[v]) + + if verbose: + print('Failure | Forward: {} | Backward: {} | Vertices: {} | Samples: {} | Degree: {:.3f} | Time: {:.3f}'.format( + len(forward_visited), len(backward_visited), + len(roadmap.colliding_vertices), len(roadmap.colliding_intermediates), + degree, elapsed_time(start_time))) + return Solution(path, samples, edges, roadmap.colliding_vertices, roadmap.colliding_edges) + + if verbose: + print('Solution | Length: {} | Cost: {:.3f} | Vertices: {} | Samples: {} | Degree: {:.3f} | Time: {:.3f}'.format( + len(path), compute_path_cost(path, cost_fn=weight_fn), + len(roadmap.colliding_vertices), len(roadmap.colliding_intermediates), + degree, elapsed_time(start_time))) + #waypoints = [samples[v] for v in path] + #solution = [start] + refine_waypoints(waypoints, extend_fn) + solution = [start] + list(flatten(roadmap.get_path(v1, v2) for v1, v2 in get_pairs(path))) + return Solution(solution, samples, edges, roadmap.colliding_vertices, roadmap.colliding_edges) + +################################################## + +def create_param_sequence(initial_samples=100, step_samples=100, **kwargs): + # TODO: iteratively increase the parameters + # TODO: generalize to degree, distance, cost + return (merge_dicts(kwargs, {'num_samples': num_samples}) + for num_samples in irange(start=initial_samples, stop=INF, step=step_samples)) + +def lazy_prm_star(start, goal, sample_fn, extend_fn, collision_fn, distance_fn=None, cost_fn=None, max_cost=INF, success_cost=INF, + param_sequence=None, resuse=True, weights=None, circular={}, p_norm=2, max_time=INF, verbose=False, **kwargs): + # TODO: bias to stay near the (past/hypothetical) path + # TODO: proximity pessimistic collision checking + # TODO: roadmap reuse in general + start_time = time.time() + weights, distance_fn, cost_fn = get_metrics(start, weights=weights, p_norm=p_norm, distance_fn=distance_fn, cost_fn=cost_fn) + #print(weights, distance_fn, cost_fn) + #input() + if param_sequence is None: + param_sequence = create_param_sequence() + + roadmap = None + best_path = None + best_cost = max_cost + for i, params in enumerate(param_sequence): + remaining_time = (max_time - elapsed_time(start_time)) + if remaining_time <= 0.: + break + if verbose: + print('\nIteration: {} | Cost: {:.3f} | Elapsed: {:.3f} | Remaining: {:.3f} | Params: {}'.format( + i, best_cost, elapsed_time(start_time), remaining_time, params)) + if (roadmap is None) or not resuse: + roadmap = Roadmap(extend_fn, weights=weights, distance_fn=distance_fn, cost_fn=cost_fn, circular=circular) + roadmap.add_samples([start, goal] + sample_until(sample_fn, params['num_samples'])) + + new_path = lazy_prm(start, goal, sample_fn, extend_fn, collision_fn, roadmap=roadmap, + cost_fn=cost_fn, weights=weights, circular=circular, p_norm=p_norm, + max_time=remaining_time, max_cost=best_cost, + verbose=verbose, **params, **kwargs)[0] + new_cost = compute_path_cost(new_path, cost_fn=cost_fn) + if verbose: + print('Path: {} | Cost: {:.3f} | Length: {}'.format(is_path(new_path), new_cost, get_length(new_path))) + if new_cost < best_cost: + best_path = new_path + best_cost = new_cost + if best_cost < success_cost: + break + if roadmap is not None: + ROADMAPS.append(roadmap) + return best_path diff --git a/plan_path/pyplanners/meta.py b/plan_path/pyplanners/meta.py new file mode 100644 index 0000000..072ec0a --- /dev/null +++ b/plan_path/pyplanners/meta.py @@ -0,0 +1,142 @@ +import time + +from .lattice import lattice +from .lazy_prm import lazy_prm, lazy_prm_star, create_param_sequence +from .prm import prm +from .rrt import rrt +from .rrt_connect import rrt_connect, birrt +from .rrt_star import rrt_star +from .utils import INF + +from .smoothing import smooth_path +from .utils import RRT_RESTARTS, RRT_SMOOTHING, INF, irange, elapsed_time, compute_path_cost, default_selector + + +def direct_path(start, goal, extend_fn, collision_fn): + """ + :param start: Start configuration - conf + :param goal: End configuration - conf + :param extend_fn: Extension function - extend_fn(q1, q2)->[q', ..., q"] + :param collision_fn: Collision function - collision_fn(q)->bool + :return: Path [q', ..., q"] or None if unable to find a solution + """ + # TODO: version which checks whether the segment is valid + if collision_fn(start) or collision_fn(goal): + # TODO: return False + return None + path = list(extend_fn(start, goal)) + path = [start] + path + if any(collision_fn(q) for q in default_selector(path)): + return None + return path + # path = [start] + # for q in extend_fn(start, goal): + # if collision_fn(q): + # return None + # path.append(q) + # return path + +def check_direct(start, goal, extend_fn, collision_fn): + if any(collision_fn(q) for q in [start, goal]): + return False + return direct_path(start, goal, extend_fn, collision_fn) + +################################################################# + +def random_restarts(solve_fn, start, goal, distance_fn, sample_fn, extend_fn, collision_fn, + restarts=RRT_RESTARTS, smooth=RRT_SMOOTHING, + success_cost=0., max_time=INF, max_solutions=1, verbose=False, **kwargs): + """ + :param start: Start configuration - conf + :param goal: End configuration - conf + :param distance_fn: Distance function - distance_fn(q1, q2)->float + :param sample_fn: Sample function - sample_fn()->conf + :param extend_fn: Extension function - extend_fn(q1, q2)->[q', ..., q"] + :param collision_fn: Collision function - collision_fn(q)->bool + :param max_time: Maximum runtime - float + :param kwargs: Keyword arguments + :return: Paths [[q', ..., q"], [[q'', ..., q""]] + """ + start_time = time.time() + solutions = [] + path = check_direct(start, goal, extend_fn, collision_fn) + if path is False: + return None + if path is not None: + solutions.append(path) + + for attempt in irange(restarts + 1): + if (len(solutions) >= max_solutions) or (elapsed_time(start_time) >= max_time): + break + attempt_time = (max_time - elapsed_time(start_time)) + path = solve_fn(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, + max_time=attempt_time, verbose=verbose, **kwargs) + if path is None: + continue + path = smooth_path(path, extend_fn, collision_fn, max_iterations=smooth, + max_time=max_time-elapsed_time(start_time), verbose=verbose) + solutions.append(path) + if compute_path_cost(path, distance_fn) < success_cost: + break + solutions = sorted(solutions, key=lambda path: compute_path_cost(path, distance_fn)) + # print('Solutions ({}): {} | Time: {:.3f}'.format(len(solutions), [(len(path), round(compute_path_cost( + # path, distance_fn), 3)) for path in solutions], elapsed_time(start_time))) + return solutions + +def solve_and_smooth(solve_fn, q1, q2, distance_fn, sample_fn, extend_fn, collision_fn, **kwargs): + return random_restarts(solve_fn, q1, q2, distance_fn, sample_fn, extend_fn, collision_fn, + restarts=0, max_solutions=1, **kwargs) + +################################################################# + +def solve(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, algorithm='birrt', + max_time=INF, max_iterations=INF, num_samples=100, smooth=None, smooth_time=INF, # TODO: smooth_iterations + weights=None, circular={}, + cost_fn=None, success_cost=INF, verbose=False, **kwargs): + # TODO: better shared default options + # TODO: allow distance_fn to be skipped + # TODO: return lambda function + start_time = time.time() + path = check_direct(start, goal, extend_fn, collision_fn) + if (path is not None) or (algorithm == 'direct'): + return path + + remaining_time = max_time - elapsed_time(start_time) + if algorithm == 'prm': # TODO: cost_fn + path = prm(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, + num_samples=num_samples) + elif algorithm == 'lazy_prm': + if weights is not None: + distance_fn = None + path = lazy_prm(start, goal, sample_fn, extend_fn, collision_fn, num_samples=num_samples, + max_time=remaining_time, weights=weights, circular=circular, distance_fn=distance_fn, + cost_fn=cost_fn, success_cost=success_cost, verbose=verbose)[0] + elif algorithm == 'lazy_prm_star': + if weights is not None: + distance_fn = None + param_sequence = create_param_sequence(initial_samples=num_samples) + path = lazy_prm_star(start, goal, sample_fn, extend_fn, collision_fn, param_sequence=param_sequence, + max_time=remaining_time, weights=weights, circular=circular, distance_fn=distance_fn, + cost_fn=cost_fn, success_cost=success_cost, verbose=verbose) # **kwargs) + elif algorithm == 'rrt': + path = rrt(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, + max_iterations=max_iterations, max_time=remaining_time) + elif algorithm == 'rrt_connect': + path = rrt_connect(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, + max_iterations=max_iterations, max_time=remaining_time) + elif algorithm == 'birrt': + # TODO: checks the straight-line twice + path = birrt(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, + max_iterations=max_iterations, max_time=remaining_time, smooth=None, **kwargs) # restarts=2 + elif algorithm == 'rrt_star': + path = rrt_star(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, radius=1, + max_iterations=max_iterations, max_time=remaining_time) + elif algorithm == 'lattice': + path = lattice(start, goal, extend_fn, collision_fn, distance_fn=distance_fn, max_time=INF) + else: + raise NotImplementedError(algorithm) + + remaining_time = min(smooth_time, max_time - elapsed_time(start_time)) + return smooth_path(path, extend_fn, collision_fn, # sample_fn=sample_fn, + distance_fn=distance_fn, cost_fn=cost_fn, + max_iterations=smooth, max_time=remaining_time, verbose=verbose) diff --git a/plan_path/pyplanners/multi_rrt.py b/plan_path/pyplanners/multi_rrt.py new file mode 100644 index 0000000..559da32 --- /dev/null +++ b/plan_path/pyplanners/multi_rrt.py @@ -0,0 +1,156 @@ +from collections import Mapping +from random import random + +from .rrt import TreeNode, configs +from .utils import irange, argmin, get_pairs, randomize, take, enum + +ts = enum('ALL', 'SUCCESS', 'PATH', 'NONE') + +# TODO - resample and use nearest neighbors when the tree is large +# TODO - possible bug if a node is already in the tree + + +class MultiTree(Mapping, object): + + def __init__(self, start, distance_fn, sample_fn, extend_fn, collision_fn): + self.nodes = {} + self.distance_fn = distance_fn + self.sample_fn = sample_fn + self.extend_fn = extend_fn + self.collision_fn = collision_fn + self.add(TreeNode(start)) + + def add(self, *nodes): + for n in nodes: + self.nodes[n.config] = n + + def __getitem__(self, q): + return self.nodes[q] + # return first(lambda v: self.distance_fn(v.config, q) < 1e-6, self.nodes) + + def __len__(self): + return len(self.nodes) + + def __iter__(self): + for n in self.nodes.values(): + yield n + + def __call__(self, q1, q2=None, iterations=50): + if q1 in self: + path1 = self[q1].retrace() + else: + path1 = self.grow(q1, iterations=iterations) + if q2 is None: + return configs(path1) + if q2 in self: + path2 = self[q2].retrace() + else: + path2 = self.grow(q2, iterations=iterations) + if path1 is None or path2 is None: + return None + + for i in range(min(len(path1), len(path2))): + if path1[i] != path2[i]: + break + else: + i += 1 + return configs(path1[:i - 1:-1] + path2[i - 1:]) + + def clear(self): + for n in self: + n.clear() + + def draw(self, env): + for n in self: + n.draw(env) + + +class MultiRRT(MultiTree): + + def grow(self, goal_sample, iterations=50, goal_probability=.2, store=ts.PATH, max_tree_size=500): + if not callable(goal_sample): + goal_sample = lambda: goal_sample + nodes, new_nodes = list( + take(randomize(self.nodes.values()), max_tree_size)), [] + for i in irange(iterations): + goal = random() < goal_probability or i == 0 + s = goal_sample() if goal else self.sample_fn() + + last = argmin(lambda n: self.distance_fn( + n.config, s), nodes + new_nodes) + for q in self.extend_fn(last.config, s): + if self.collision_fn(q): + break + last = TreeNode(q, parent=last) + new_nodes.append(last) + else: + if goal: + path = last.retrace() + if store in [ts.ALL, ts.SUCCESS]: + self.add(*new_nodes) + elif store == ts.PATH: + new_nodes_set = set(new_nodes) + self.add(*[n for n in path if n in new_nodes_set]) + return path + if store == ts.ALL: + self.add(*new_nodes) + return None + + +class MultiBiRRT(MultiTree): + + def grow(self, goal, iterations=50, store=ts.PATH, max_tree_size=500): + if goal in self: + return self[goal].retrace() + if self.collision_fn(goal): + return None + nodes1, new_nodes1 = list( + take(randomize(self.nodes.values()), max_tree_size)), [] + nodes2, new_nodes2 = [], [TreeNode(goal)] + for _ in irange(iterations): + if len(nodes1) + len(new_nodes1) > len(nodes2) + len(new_nodes2): + nodes1, nodes2 = nodes2, nodes1 + new_nodes1, new_nodes2 = new_nodes2, new_nodes1 + + s = self.sample_fn() + last1 = argmin(lambda n: self.distance_fn( + n.config, s), nodes1 + new_nodes1) + for q in self.extend_fn(last1.config, s): + if self.collision_fn(q): + break + last1 = TreeNode(q, parent=last1) + new_nodes1.append(last1) + + last2 = argmin(lambda n: self.distance_fn( + n.config, last1.config), nodes2 + new_nodes2) + for q in self.extend_fn(last2.config, last1.config): + if self.collision_fn(q): + break + last2 = TreeNode(q, parent=last2) + new_nodes2.append(last2) + else: + if len(nodes1) == 0: + nodes1, nodes2 = nodes2, nodes1 + new_nodes1, new_nodes2 = new_nodes2, new_nodes1 + last1, last2 = last2, last1 + + path1, path2 = last1.retrace(), last2.retrace()[:-1][::-1] + for p, n in get_pairs(path2): + n.parent = p + if len(path2) == 0: # TODO - still some kind of circular error + for n in new_nodes2: + if n.parent == last2: + n.parent = path1[-1] + else: + path2[0].parent = path1[-1] + path = path1 + path2 + + if store in [ts.ALL, ts.SUCCESS]: + self.add(*(new_nodes1 + new_nodes2[:-1])) + elif store == ts.PATH: + new_nodes_set = set(new_nodes1 + new_nodes2[:-1]) + self.add(*[n for n in path if n in new_nodes_set]) + return path + if store == ts.ALL: + self.add(*new_nodes1) + return None diff --git a/plan_path/pyplanners/nearest.py b/plan_path/pyplanners/nearest.py new file mode 100644 index 0000000..afa964e --- /dev/null +++ b/plan_path/pyplanners/nearest.py @@ -0,0 +1,109 @@ +from scipy.spatial import KDTree +from itertools import product +from .utils import get_interval_extent, UNBOUNDED_LIMITS, INF + +import numpy as np + +def expand_circular(x, circular={}): + domains = [] + for k in range(len(x)): + interval = circular.get(k, UNBOUNDED_LIMITS) + extent = get_interval_extent(interval) + if extent != INF: + domains.append([ + -extent, 0., +extent, # TODO: choose just one + ]) + else: + domains.append([0.]) + for dx in product(*domains): + wx = x + np.array(dx) + yield wx + +################################################## + +class NearestNeighbors(object): + def __init__(self): + pass + # self.data = [] + # self.add_data(data) + def add_data(self, new_data): + raise NotImplementedError() + def query_neighbors(self, x, k=1, **kwargs): + raise NotImplementedError() + +################################################## + +class KDNeighbors(NearestNeighbors): + # https://scikit-learn.org/stable/modules/generated/sklearn.neighbors.KDTree.html + # https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.KDTree.html + # TODO: approximate KDTrees + # https://github.com/lmcinnes/pynndescent + # https://github.com/spotify/annoy + # https://github.com/flann-lib/flann + def __init__(self, data=[], circular={}, embed_fn=lambda x: x, **kwargs): # [0, 1] + super(NearestNeighbors, self).__init__() + # TODO: maintain tree and brute-force list + self.data = [] # TODO: self.kd_tree.data + self.embedded = [] + self.kd_tree = None + self.circular = circular + self.embed_fn = embed_fn + self.kwargs = kwargs + self.stale = True + self.add_data(data) + def update(self): + if not self.stale: + return + self.stale = False + if self.embedded: + self.kd_tree = KDTree(self.embedded, + #leafsize=10, compact_nodes=True, copy_data=False, balanced_tree=True, boxsize=None + **self.kwargs) + def add_data(self, new_data): + indices = [] + for x in new_data: + index = len(self.data) + indices.append(index) + self.data.append(x) + self.embedded.append(self.embed_fn(x)) + self.stale |= bool(indices) + self.update() + return zip(indices, new_data) + def remove_data(self, new_data): + raise NotImplementedError() # TODO: need to keep track of data indices (using id?) + def query_neighbors(self, x, k=1, **kwargs): + # TODO: class **kwargs + closest_neighbors = {} + for wx in expand_circular(x, circular=self.circular): + embedded = self.embed_fn(wx) + #print(x, embedded) + # k=1, eps=0, p=2, distance_upper_bound=inf, workers=1 + for d, i in zip(*self.kd_tree.query(embedded, k=k, **kwargs)): + if d < closest_neighbors.get(i, INF): + closest_neighbors[i] = d + return [(d, i, self.data[i]) for i, d in sorted( + closest_neighbors.items(), key=lambda pair: pair[1])][:k] # TODO: filter + +################################################## + +class BruteForceNeighbors(NearestNeighbors): + def __init__(self, distance_fn, data=[], **kwargs): + super(BruteForceNeighbors, self).__init__() + self.distance_fn = distance_fn + self.data = [] + self.add_data(data) + def add_data(self, new_data): + indices = [] + for x in new_data: + index = len(self.data) + indices.append(index) + self.data.append(x) + return zip(indices, new_data) + def query_neighbors(self, x, k=1, **kwargs): + # TODO: store pairwise distances + neighbors = [] + for i, x2 in enumerate(self.data): + d = self.distance_fn(x, x2) + neighbors.append((d, i, x2)) + # TODO: heapq + return sorted(neighbors, key=lambda pair: pair[0])[:k] diff --git a/plan_path/pyplanners/primitives.py b/plan_path/pyplanners/primitives.py new file mode 100644 index 0000000..6a7c329 --- /dev/null +++ b/plan_path/pyplanners/primitives.py @@ -0,0 +1,100 @@ +from itertools import takewhile + +import numpy as np + +from .rrt import TreeNode +from .trajectory.linear import get_default_limits, solve_linear +from .trajectory.retime import spline_duration +from .utils import argmin, negate, circular_difference, UNBOUNDED_LIMITS, get_distance, get_delta + +ASYMETRIC = True + + +def asymmetric_extend(q1, q2, extend_fn, backward=False): + if backward and ASYMETRIC: + return reversed(list(extend_fn(q2, q1))) # Forward model + return extend_fn(q1, q2) + + +def extend_towards(tree, target, distance_fn, extend_fn, collision_fn, swap=False, tree_frequency=1, **kwargs): + assert tree_frequency >= 1 + last = argmin(lambda n: distance_fn(n.config, target), tree) + extend = list(asymmetric_extend(last.config, target, extend_fn, backward=swap)) + safe = list(takewhile(negate(collision_fn), extend)) + for i, q in enumerate(safe): + if (i % tree_frequency == 0) or (i == len(safe) - 1): + last = TreeNode(q, parent=last) + tree.append(last) + success = len(extend) == len(safe) + return last, success + +################################################## + +def calculate_radius(d=2): + # TODO: unify with get_threshold_fn + # Sampling-based Algorithms for Optimal Motion Planning + # http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.419.5503&rep=rep1&type=pdf + # https://en.wikipedia.org/wiki/Volume_of_an_n-ball + interval = (1 - 0) + vol_free = interval ** d + radius = 1./2 + vol_ball = np.pi * (radius ** d) + gamma = 2 * ((1 + 1. / d) * (vol_free / vol_ball)) ** (1. / d) + # threshold = gamma * (math.log(n) / n) ** (1. / d) + return gamma + + +def default_weights(conf, weights=None, scale=1.): + if weights is not None: + return weights + d = len(conf) + weights = scale*np.ones(d) + return weights + + +def get_embed_fn(weights): + weights = np.array(weights) + return lambda q: weights * q + + +def get_distance_fn(weights, p_norm=2): + embed_fn = get_embed_fn(weights) + return lambda q1, q2: np.linalg.norm(embed_fn(q2) - embed_fn(q1), ord=p_norm) + + +def distance_fn_from_extend_fn(extend_fn): + # TODO: can compute cost between waypoints from extend_fn + def distance_fn(q1, q2): + path = list(extend_fn(q1, q2)) # TODO: cache + return len(path) # TODO: subtract endpoints? + return distance_fn + +################################################## + +def get_difference_fn(circular={}): + def fn(q2, q1): + return tuple(circular_difference(v2, v1, interval=circular.get(i, UNBOUNDED_LIMITS)) + for i, (v2, v1) in enumerate(zip(q2, q1))) + return fn + + +def get_cost_fn(distance_fn=get_distance, constant=0., coefficient=1.): + def fn(q1, q2): + return constant + coefficient*distance_fn(q1, q2) + return fn + + +def get_duration_fn(difference_fn=get_delta, t_constant=0., t_min=0., **kwargs): + v_max, a_max = get_default_limits(d=None, **kwargs) + def fn(q1, q2): + # TODO: be careful that not colinear with other waypoints + difference = difference_fn(q1, q2) + t_transit = 0. + if not np.allclose(np.zeros(len(difference)), difference, atol=1e-6, rtol=0): + t_transit = solve_linear(difference, v_max, a_max, only_duration=True) + assert t_transit is not None + #curve = solve_linear(difference, v_max, a_max) + #t_transit = spline_duration(curve) + t = t_constant + t_transit + return max(t_min, t) # TODO: clip function + return fn \ No newline at end of file diff --git a/plan_path/pyplanners/prm.py b/plan_path/pyplanners/prm.py new file mode 100644 index 0000000..7b94d47 --- /dev/null +++ b/plan_path/pyplanners/prm.py @@ -0,0 +1,278 @@ +from collections import namedtuple, Mapping +from heapq import heappop, heappush +import operator +import time + +from .utils import INF, get_pairs, merge_dicts, flatten, RED, apply_alpha, default_selector + + +# TODO - Visibility-PRM, PRM* + +class Vertex(object): + + def __init__(self, q): + self.q = q + self.edges = {} + self._handle = None + + def clear(self): + self._handle = None + + def draw(self, env, color=apply_alpha(RED, alpha=0.5)): + # https://github.mit.edu/caelan/lis-openrave + from manipulation.primitives.display import draw_node + self._handle = draw_node(env, self.q, color=color) + + def __str__(self): + return 'Vertex(' + str(self.q) + ')' + __repr__ = __str__ + + +class Edge(object): + + def __init__(self, v1, v2, path): + self.v1, self.v2 = v1, v2 + self.v1.edges[v2], self.v2.edges[v1] = self, self + self._path = path + #self._handle = None + self._handles = [] + + def end(self, start): + if self.v1 == start: + return self.v2 + if self.v2 == start: + return self.v1 + assert False + + def path(self, start): + if self._path is None: + return [self.end(start).q] + if self.v1 == start: + return self._path + [self.v2.q] + if self.v2 == start: + return self._path[::-1] + [self.v1.q] + assert False + + def configs(self): + if self._path is None: + return [] + return [self.v1.q] + self._path + [self.v2.q] + + def clear(self): + #self._handle = None + self._handles = [] + + def draw(self, env, color=apply_alpha(RED, alpha=0.5)): + if self._path is None: + return + # https://github.mit.edu/caelan/lis-openrave + from manipulation.primitives.display import draw_edge + #self._handle = draw_edge(env, self.v1.q, self.v2.q, color=color) + for q1, q2 in get_pairs(self.configs()): + self._handles.append(draw_edge(env, q1, q2, color=color)) + + def __str__(self): + return 'Edge(' + str(self.v1.q) + ' - ' + str(self.v2.q) + ')' + __repr__ = __str__ + +################################################## + +SearchNode = namedtuple('SearchNode', ['cost', 'parent']) + + +class Roadmap(Mapping, object): + + def __init__(self, samples=[]): + self.vertices = {} + self.edges = [] + self.add(samples) + + def __getitem__(self, q): + return self.vertices[q] + + def __len__(self): + return len(self.vertices) + + def __iter__(self): + return iter(self.vertices) + + def __call__(self, q1, q2): + if q1 not in self or q2 not in self: + return None + start, goal = self[q1], self[q2] + queue = [(0, start)] + nodes, processed = {start: SearchNode(0, None)}, set() + + def retrace(v): + pv = nodes[v].parent + if pv is None: + return [v.q] + return retrace(pv) + v.edges[pv].path(pv) + + while len(queue) != 0: + _, cv = heappop(queue) + if cv in processed: + continue + processed.add(cv) + if cv == goal: + return retrace(cv) + for nv, edge in cv.edges.items(): + cost = nodes[cv].cost + len(edge.path(cv)) + if nv not in nodes or cost < nodes[nv].cost: + nodes[nv] = SearchNode(cost, cv) + heappush(queue, (cost, nv)) + return None + + def add(self, samples): + new_vertices = [] + for q in samples: + if q not in self: + self.vertices[q] = Vertex(q) + new_vertices.append(self[q]) + return new_vertices + + def connect(self, v1, v2, path=None): + if v1 not in v2.edges: # TODO - what about parallel edges? + edge = Edge(v1, v2, path) + self.edges.append(edge) + return edge + return None + + def clear(self): + for v in self.vertices.values(): + v.clear() + for e in self.edges: + e.clear() + + def draw(self, env): + for v in self.vertices.values(): + v.draw(env) + for e in self.edges: + e.draw(env) + + @staticmethod + def merge(*roadmaps): + new_roadmap = Roadmap() + new_roadmap.vertices = merge_dicts( + *[roadmap.vertices for roadmap in roadmaps]) + new_roadmap.edges = list( + flatten(roadmap.edges for roadmap in roadmaps)) + return new_roadmap + + +class PRM(Roadmap): + + def __init__(self, distance_fn, extend_fn, collision_fn, samples=[]): + super(PRM, self).__init__() + self.distance_fn = distance_fn + self.extend_fn = extend_fn + self.collision_fn = collision_fn + self.grow(samples) + + def grow(self, samples): + raise NotImplementedError() + + def __call__(self, q1, q2): + self.grow(samples=[q1, q2]) + if q1 not in self or q2 not in self: + return None + start, goal = self[q1], self[q2] + heuristic = lambda v: self.distance_fn(v.q, goal.q) # lambda v: 0 + + queue = [(heuristic(start), start)] + nodes, processed = {start: SearchNode(0, None)}, set() + + def retrace(v): + if nodes[v].parent is None: + return [v.q] + return retrace(nodes[v].parent) + v.edges[nodes[v].parent].path(nodes[v].parent) + + while len(queue) != 0: + _, cv = heappop(queue) + if cv in processed: + continue + processed.add(cv) + if cv == goal: + return retrace(cv) + for nv in cv.edges: + cost = nodes[cv].cost + self.distance_fn(cv.q, nv.q) + if (nv not in nodes) or (cost < nodes[nv].cost): + nodes[nv] = SearchNode(cost, cv) + heappush(queue, (cost + heuristic(nv), nv)) + return None + +################################################## + +class DistancePRM(PRM): + + def __init__(self, distance_fn, extend_fn, collision_fn, samples=[], connect_distance=.5): + self.connect_distance = connect_distance + super(self.__class__, self).__init__( + distance_fn, extend_fn, collision_fn, samples=samples) + + def grow(self, samples): + old_vertices = self.vertices.keys() + new_vertices = self.add(samples) + for i, v1 in enumerate(new_vertices): + for v2 in new_vertices[i + 1:] + old_vertices: + if self.distance_fn(v1.q, v2.q) <= self.connect_distance: + path = list(self.extend_fn(v1.q, v2.q))[:-1] + if not any(self.collision_fn(q) for q in default_selector(path)): + self.connect(v1, v2, path) + return new_vertices + + +class DegreePRM(PRM): + + def __init__(self, distance_fn, extend_fn, collision_fn, samples=[], target_degree=4, connect_distance=INF): + self.target_degree = target_degree + self.connect_distance = connect_distance + super(self.__class__, self).__init__( + distance_fn, extend_fn, collision_fn, samples=samples) + + def grow(self, samples): + # TODO: do sorted edges version + new_vertices = self.add(samples) + if self.target_degree == 0: + return new_vertices + for v1 in new_vertices: + degree = 0 + for _, v2 in sorted(filter(lambda pair: (pair[1] != v1) and (pair[0] <= self.connect_distance), + map(lambda v: (self.distance_fn(v1.q, v.q), v), self.vertices.values())), + key=operator.itemgetter(0)): # TODO - slow, use nearest neighbors + if self.target_degree <= degree: + break + if v2 not in v1.edges: + path = list(self.extend_fn(v1.q, v2.q))[:-1] + if not any(self.collision_fn(q) for q in default_selector(path)): + self.connect(v1, v2, path) + degree += 1 + else: + degree += 1 + return new_vertices + +################################################## + +def prm(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, + target_degree=4, connect_distance=INF, num_samples=100): #, max_time=INF): + """ + :param start: Start configuration - conf + :param goal: End configuration - conf + :param distance_fn: Distance function - distance_fn(q1, q2)->float + :param sample_fn: Sample function - sample_fn()->conf + :param extend_fn: Extension function - extend_fn(q1, q2)->[q', ..., q"] + :param collision_fn: Collision function - collision_fn(q)->bool + :return: Path [q', ..., q"] or None if unable to find a solution + """ + # TODO: compute_graph + start_time = time.time() + start = tuple(start) + goal = tuple(goal) + samples = [start, goal] + [tuple(sample_fn()) for _ in range(num_samples)] + if target_degree is None: + roadmap = DistancePRM(distance_fn, extend_fn, collision_fn, samples=samples, + connect_distance=connect_distance) + else: + roadmap = DegreePRM(distance_fn, extend_fn, collision_fn, samples=samples, + target_degree=target_degree, connect_distance=connect_distance) + return roadmap(start, goal) diff --git a/plan_path/pyplanners/rrt.py b/plan_path/pyplanners/rrt.py new file mode 100644 index 0000000..d661458 --- /dev/null +++ b/plan_path/pyplanners/rrt.py @@ -0,0 +1,85 @@ +from random import random +import time + +from .utils import irange, argmin, RRT_ITERATIONS, apply_alpha, RED, INF, elapsed_time + + +class TreeNode(object): + + def __init__(self, config, parent=None): + self.config = config + self.parent = parent + + #def retrace(self): + # if self.parent is None: + # return [self] + # return self.parent.retrace() + [self] + + def retrace(self): + sequence = [] + node = self + while node is not None: + sequence.append(node) + node = node.parent + return sequence[::-1] + + def clear(self): + self.node_handle = None + self.edge_handle = None + + def draw(self, env, color=apply_alpha(RED, alpha=0.5)): + # https://github.mit.edu/caelan/lis-openrave + from manipulation.primitives.display import draw_node, draw_edge + self.node_handle = draw_node(env, self.config, color=color) + if self.parent is not None: + self.edge_handle = draw_edge( + env, self.config, self.parent.config, color=color) + + def __str__(self): + return 'TreeNode(' + str(self.config) + ')' + __repr__ = __str__ + + +def configs(nodes): + if nodes is None: + return None + return list(map(lambda n: n.config, nodes)) + + +def rrt(start, goal_sample, distance_fn, sample_fn, extend_fn, collision_fn, goal_test=lambda q: False, + goal_probability=.2, max_iterations=RRT_ITERATIONS, max_time=INF): + """ + :param start: Start configuration - conf + :param distance_fn: Distance function - distance_fn(q1, q2)->float + :param sample_fn: Sample function - sample_fn()->conf + :param extend_fn: Extension function - extend_fn(q1, q2)->[q', ..., q"] + :param collision_fn: Collision function - collision_fn(q)->bool + :param max_iterations: Maximum number of iterations - int + :param max_time: Maximum runtime - float + :return: Path [q', ..., q"] or None if unable to find a solution + """ + start_time = time.time() + if collision_fn(start): + return None + if not callable(goal_sample): + g = goal_sample + goal_sample = lambda: g + nodes = [TreeNode(start)] + for i in irange(max_iterations): + if elapsed_time(start_time) >= max_time: + break + goal = random() < goal_probability or i == 0 + s = goal_sample() if goal else sample_fn() + + last = argmin(lambda n: distance_fn(n.config, s), nodes) + for q in extend_fn(last.config, s): + if collision_fn(q): + break + last = TreeNode(q, parent=last) + nodes.append(last) + if goal_test(last.config): + return configs(last.retrace()) + else: + if goal: + return configs(last.retrace()) + return None diff --git a/plan_path/pyplanners/rrt_connect.py b/plan_path/pyplanners/rrt_connect.py new file mode 100644 index 0000000..94b614b --- /dev/null +++ b/plan_path/pyplanners/rrt_connect.py @@ -0,0 +1,93 @@ +import random +import time + +from .primitives import extend_towards +from .rrt import TreeNode, configs +from .utils import irange, RRT_ITERATIONS, INF, elapsed_time + +TREES = [] # TODO: return the trees + +def wrap_collision_fn(collision_fn): + # TODO: joint limits + # import inspect + # print(inspect.getargspec(collision_fn)) + # print(dir(collision_fn)) + def fn(q1, q2): + try: + return collision_fn(q1, q2) + except TypeError: + return collision_fn(q2) + return fn + +def alternating_swap(nodes1, nodes2): + swap = len(nodes1) > len(nodes2) # TODO: other swap conditions + return swap + +def random_swap(nodes1, nodes2): + p = float(len(nodes1)) / (len(nodes1) + len(nodes2)) + swap = (random.random() < p) + return swap + +def rrt_connect(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, + max_iterations=RRT_ITERATIONS, max_time=INF, **kwargs): + """ + :param start: Start configuration - conf + :param goal: End configuration - conf + :param distance_fn: Distance function - distance_fn(q1, q2)->float + :param sample_fn: Sample function - sample_fn()->conf + :param extend_fn: Extension function - extend_fn(q1, q2)->[q', ..., q"] + :param collision_fn: Collision function - collision_fn(q)->bool + :param max_iterations: Maximum number of iterations - int + :param max_time: Maximum runtime - float + :param kwargs: Keyword arguments + :return: Path [q', ..., q"] or None if unable to find a solution + """ + # TODO: goal sampling function connected to a None node + start_time = time.time() + if collision_fn(start) or collision_fn(goal): + return None + # TODO: support continuous collision_fn with two arguments + #collision_fn = wrap_collision_fn(collision_fn) + nodes1, nodes2 = [TreeNode(start)], [TreeNode(goal)] # TODO: allow a tree to be pre-specified (possibly as start) + for iteration in irange(max_iterations): + if elapsed_time(start_time) >= max_time: + break + #swap = alternating_swap(nodes1, nodes2) + swap = random_swap(nodes1, nodes2) + tree1, tree2 = nodes1, nodes2 + if swap: + tree1, tree2 = nodes2, nodes1 + + target = sample_fn() + last1, _ = extend_towards(tree1, target, distance_fn, extend_fn, collision_fn, swap, **kwargs) + last2, success = extend_towards(tree2, last1.config, distance_fn, extend_fn, collision_fn, not swap, **kwargs) + + if success: + path1, path2 = last1.retrace(), last2.retrace() + if swap: + path1, path2 = path2, path1 + #print('{} max_iterations, {} nodes'.format(iteration, len(nodes1) + len(nodes2))) + path = configs(path1[:-1] + path2[::-1]) + return path + return None + +################################################################# + +def birrt(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, **kwargs): + """ + :param start: Start configuration - conf + :param goal: End configuration - conf + :param distance_fn: Distance function - distance_fn(q1, q2)->float + :param sample_fn: Sample function - sample_fn()->conf + :param extend_fn: Extension function - extend_fn(q1, q2)->[q', ..., q"] + :param collision_fn: Collision function - collision_fn(q)->bool + :param kwargs: Keyword arguments + :return: Path [q', ..., q"] or None if unable to find a solution + """ + # TODO: deprecate + from .meta import random_restarts + solutions = random_restarts(rrt_connect, start, goal, distance_fn, sample_fn, extend_fn, collision_fn, + max_solutions=1, **kwargs) + if not solutions: + return None + return solutions[0] diff --git a/plan_path/pyplanners/rrt_star.py b/plan_path/pyplanners/rrt_star.py new file mode 100644 index 0000000..7ea8a71 --- /dev/null +++ b/plan_path/pyplanners/rrt_star.py @@ -0,0 +1,149 @@ +from __future__ import print_function + +from random import random +from time import time + +from .utils import INF, argmin, elapsed_time, BLUE, RED, apply_alpha + +EPSILON = 1e-6 +PRINT_FREQUENCY = 100 + +class OptimalNode(object): + + def __init__(self, config, parent=None, d=0, path=[], iteration=None): + self.config = config + self.parent = parent + self.children = set() + self.d = d + self.path = path + if parent is not None: + self.cost = parent.cost + d + self.parent.children.add(self) + else: + self.cost = d + self.solution = False + self.creation = iteration + self.last_rewire = iteration + + def set_solution(self, solution): + if self.solution is solution: + return + self.solution = solution + if self.parent is not None: + self.parent.set_solution(solution) + + def retrace(self): + if self.parent is None: + return self.path + [self.config] + return self.parent.retrace() + self.path + [self.config] + + def rewire(self, parent, d, path, iteration=None): + if self.solution: + self.parent.set_solution(False) + self.parent.children.remove(self) + self.parent = parent + self.parent.children.add(self) + if self.solution: + self.parent.set_solution(True) + self.d = d + self.path = path + self.update() + self.last_rewire = iteration + + def update(self): + self.cost = self.parent.cost + self.d + for n in self.children: + n.update() + + def clear(self): + self.node_handle = None + self.edge_handle = None + + def draw(self, env): + # https://github.mit.edu/caelan/lis-openrave + from manipulation.primitives.display import draw_node, draw_edge + color = apply_alpha(BLUE if self.solution else RED, alpha=0.5) + self.node_handle = draw_node(env, self.config, color=color) + if self.parent is not None: + self.edge_handle = draw_edge( + env, self.config, self.parent.config, color=color) + + def __str__(self): + return self.__class__.__name__ + '(' + str(self.config) + ')' + __repr__ = __str__ + + +def safe_path(sequence, collision): + path = [] + for q in sequence: + if collision(q): + break + path.append(q) + return path + +################################################## + +def rrt_star(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, radius, + max_time=INF, max_iterations=INF, goal_probability=.2, informed=True): + """ + :param start: Start configuration - conf + :param goal: End configuration - conf + :param distance_fn: Distance function - distance_fn(q1, q2)->float + :param sample_fn: Sample function - sample_fn()->conf + :param extend_fn: Extension function - extend_fn(q1, q2)->[q', ..., q"] + :param collision_fn: Collision function - collision_fn(q)->bool + :param max_time: Maximum runtime - float + :return: Path [q', ..., q"] or None if unable to find a solution + """ + if collision_fn(start) or collision_fn(goal): + return None + nodes = [OptimalNode(start)] + goal_n = None + start_time = time() + iteration = 0 + while (elapsed_time(start_time) < max_time) and (iteration < max_iterations): + do_goal = goal_n is None and (iteration == 0 or random() < goal_probability) + s = goal if do_goal else sample_fn() + # Informed RRT* + if informed and (goal_n is not None) and (distance_fn(start, s) + distance_fn(s, goal) >= goal_n.cost): + continue + if iteration % PRINT_FREQUENCY == 0: + success = goal_n is not None + cost = goal_n.cost if success else INF + print('Iteration: {} | Time: {:.3f} | Success: {} | {} | Cost: {:.3f}'.format( + iteration, elapsed_time(start_time), success, do_goal, cost)) + iteration += 1 + + nearest = argmin(lambda n: distance_fn(n.config, s), nodes) + path = safe_path(extend_fn(nearest.config, s), collision_fn) + if len(path) == 0: + continue + new = OptimalNode(path[-1], parent=nearest, d=distance_fn( + nearest.config, path[-1]), path=path[:-1], iteration=iteration) + # if safe and do_goal: + if do_goal and (distance_fn(new.config, goal) < EPSILON): + goal_n = new + goal_n.set_solution(True) + # TODO - k-nearest neighbor version + neighbors = filter(lambda n: distance_fn(n.config, new.config) < radius, nodes) + nodes.append(new) + + # TODO: smooth solution once found to improve the cost bound + for n in neighbors: + d = distance_fn(n.config, new.config) + if (n.cost + d) < new.cost: + path = safe_path(extend_fn(n.config, new.config), collision_fn) + if (len(path) != 0) and (distance_fn(new.config, path[-1]) < EPSILON): + new.rewire(n, d, path[:-1], iteration=iteration) + for n in neighbors: # TODO - avoid repeating work + d = distance_fn(new.config, n.config) + if (new.cost + d) < n.cost: + path = safe_path(extend_fn(new.config, n.config), collision_fn) + if (len(path) != 0) and (distance_fn(n.config, path[-1]) < EPSILON): + n.rewire(new, d, path[:-1], iteration=iteration) + if goal_n is None: + return None + return goal_n.retrace() + +def informed_rrt_star(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, radius, **kwargs): + return rrt_star(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, radius, informed=True, **kwargs) diff --git a/plan_path/pyplanners/search.py b/plan_path/pyplanners/search.py new file mode 100644 index 0000000..058725f --- /dev/null +++ b/plan_path/pyplanners/search.py @@ -0,0 +1,93 @@ +from collections import deque, namedtuple +from heapq import heappop, heappush + +import numpy as np +import time + +from .utils import INF, elapsed_time + +# https://github.mit.edu/caelan/lis-openrave/tree/master/manipulation/motion +# https://github.mit.edu/caelan/lis-openrave/commit/4d8683407ec79a7c39dab62d6779804730ff598d + +Node = namedtuple('Node', ['g', 'parent']) + + +def retrace(visited, q): + if q is None: + return [] + return retrace(visited, visited[tuple(q)].parent) + [q] + + +def bfs(start, goal, neighbors_fn, collision_fn, max_iterations=INF, max_time=INF): + """ + :param start: Start configuration - conf + :param goal: End configuration - conf + :param collision_fn: Collision function - collision_fn(q)->bool + :param max_time: Maximum runtime - float + :return: Path [q', ..., q"] or None if unable to find a solution + """ + start_time = time.time() + if collision_fn(start) or collision_fn(goal): + return None + iterations = 0 + visited = {tuple(start): Node(g=0, parent=None)} + queue = deque([start]) + while queue and (iterations < max_iterations) and (elapsed_time(start_time) < max_time): + iterations += 1 + current = queue.popleft() + if goal is not None and tuple(current) == tuple(goal): + return retrace(visited, current) + for new in neighbors_fn(current): + # TODO - make edges for real (and store bad edges) + if (tuple(new) not in visited) and not collision_fn(new): + visited[tuple(new)] = Node(visited[tuple(current)].g + 1, current) + queue.append(new) + return None + +################################################## + +def weighted(weight=1.): + if weight == INF: + return lambda g, h: h + return lambda g, h: g + weight*h + +uniform = weighted(0) +astar = weighted(1) +wastar2 = weighted(2) +wastar3 = weighted(2) +greedy = weighted(INF) +lexicographic = lambda g, h: (h, g) + +def best_first(start, goal, distance_fn, neighbors_fn, collision_fn, + max_iterations=INF, max_time=INF, priority=lexicographic): # TODO - put start and goal in neighbors_fn + """ + :param start: Start configuration - conf + :param goal: End configuration - conf + :param distance_fn: Distance function - distance_fn(q1, q2)->float + :param collision_fn: Collision function - collision_fn(q)->bool + :param max_time: Maximum runtime - float + :return: Path [q', ..., q"] or None if unable to find a solution + """ + start_time = time.time() + if collision_fn(start) or collision_fn(goal): + return None + queue = [(priority(0, distance_fn(start, goal)), 0, start)] + visited = {tuple(start): Node(g=0, parent=None)} + iterations = 0 + while queue and (iterations < max_iterations) and (elapsed_time(start_time) < max_time): + _, current_g, current = heappop(queue) + current = np.array(current) + if visited[tuple(current)].g != current_g: + continue + # TODO: lazy collision_fn checking + iterations += 1 + if tuple(current) == tuple(goal): + return retrace(visited, current) + for new in neighbors_fn(current): + new_g = current_g + distance_fn(current, new) + if (tuple(new) not in visited or new_g < visited[tuple(new)].g) and not collision_fn(new): + visited[tuple(new)] = Node(new_g, current) + # ValueError: The truth value of an array with more than one + # element is ambiguous. + heappush(queue, (priority(new_g, distance_fn(new, goal)), new_g, new)) + return None diff --git a/plan_path/pyplanners/smoothing.py b/plan_path/pyplanners/smoothing.py new file mode 100644 index 0000000..9c4b443 --- /dev/null +++ b/plan_path/pyplanners/smoothing.py @@ -0,0 +1,116 @@ +from random import randint, random, choice + +from .utils import INF, elapsed_time, irange, waypoints_from_path, get_pairs, get_distance, \ + convex_combination, compute_path_cost, default_selector, refine_waypoints, flatten +from .primitives import distance_fn_from_extend_fn + +import time +import numpy as np + +################################################## + +def smooth_path_old(path, extend_fn, collision_fn, cost_fn=None, + max_iterations=50, max_time=INF, verbose=False, **kwargs): + """ + :param extend_fn: Extension function - extend_fn(q1, q2)->[q', ..., q"] + :param collision_fn: Collision function - collision_fn(q)->bool + :param max_iterations: Maximum number of iterations - int + :param max_time: Maximum runtime - float + :param kwargs: Keyword arguments + :return: Path [q', ..., q"] or None if unable to find a solution + """ + if (path is None) or (max_iterations is None): + return path + assert (max_iterations < INF) or (max_time < INF) + start_time = time.time() + smoothed_path = path + for iteration in irange(max_iterations): + if (elapsed_time(start_time) > max_time) or (len(smoothed_path) <= 2): + break + if verbose: + cost = compute_path_cost(smoothed_path, cost_fn=cost_fn) # TODO: incorporate costs + print('Iteration: {} | Waypoints: {} | Cost: {:.3f} | Time: {:.3f}'.format( + iteration, len(smoothed_path), cost, elapsed_time(start_time))) + i = randint(0, len(smoothed_path) - 1) + j = randint(0, len(smoothed_path) - 1) + if abs(i - j) <= 1: + continue + if j < i: + i, j = j, i + shortcut = list(extend_fn(smoothed_path[i], smoothed_path[j])) + if (len(shortcut) < (j - i)) and all(not collision_fn(q) for q in default_selector(shortcut)): + smoothed_path = smoothed_path[:i + 1] + shortcut + smoothed_path[j + 1:] + return smoothed_path + +################################################## + +def smooth_path(path, extend_fn, collision_fn, distance_fn=None, cost_fn=None, sample_fn=None, + max_iterations=50, max_time=INF, converge_time=INF, tolerance=1e-3, verbose=False): + """ + :param distance_fn: Distance function - distance_fn(q1, q2)->float + :param extend_fn: Extension function - extend_fn(q1, q2)->[q', ..., q"] + :param collision_fn: Collision function - collision_fn(q)->bool + :param max_iterations: Maximum number of iterations - int + :param max_time: Maximum runtime - float + :return: Path [q', ..., q"] or None if unable to find a solution + """ + # TODO: makes an assumption on extend_fn (to avoid sampling the same segment) + # TODO: smooth until convergence + # TODO: dynamic expansion of the nearby graph + start_time = last_time = time.time() + if (path is None) or (max_iterations is None): + return path + assert (max_iterations < INF) or (max_time < INF) + if distance_fn is None: + distance_fn = distance_fn_from_extend_fn(extend_fn) + if cost_fn is None: + cost_fn = distance_fn + # TODO: use extend_fn to extract waypoints + waypoints = waypoints_from_path(path, difference_fn=None, tolerance=tolerance) # TODO: difference_fn + cost = compute_path_cost(waypoints, cost_fn=cost_fn) + #paths = [extend_fn(*pair) for pair in get_pairs(waypoints)] # TODO: update incrementally + #costs = [cost_fn(*pair) for pair in get_pairs(waypoints)] + for iteration in irange(max_iterations): + if (elapsed_time(start_time) > max_time) or (elapsed_time(last_time) > converge_time) or (len(waypoints) <= 2): + break + + segments = get_pairs(range(len(waypoints))) + weights = [distance_fn(waypoints[i], waypoints[j]) for i, j in segments] + paths = [list(extend_fn(*pair)) for pair in get_pairs(waypoints)] + #weights = [len(paths[i]) for i, j in segments] + probabilities = np.array(weights) / sum(weights) + if verbose: + print('Iteration: {} | Waypoints: {} | Cost: {:.3f} | Elapsed: {:.3f} | Remaining: {:.3f}'.format( + iteration, len(waypoints), cost, elapsed_time(start_time), max_time-elapsed_time(start_time))) + + #segment1, segment2 = choices(segments, weights=probabilities, k=2) + seg_indices = list(range(len(segments))) + seg_idx1, seg_idx2 = np.random.choice(seg_indices, size=2, replace=True, p=probabilities) + if seg_idx1 == seg_idx2: # TODO: ensure not too far away + continue + if seg_idx2 < seg_idx1: # choices samples with replacement + seg_idx1, seg_idx2 = seg_idx2, seg_idx1 + segment1, segment2 = segments[seg_idx1], segments[seg_idx2] + # TODO: option to sample_fn only adjacent pairs + #point1, point2 = [convex_combination(waypoints[i], waypoints[j], w=random()) + # for i, j in [segment1, segment2]] + point1, point2 = [choice(paths[i]) for i, j in [segment1, segment2]] + + i, _ = segment1 + _, j = segment2 + shortcut = [point1, point2] + # if sample_fn is not None: + # shortcut = [point1, sample_fn(), point2] + #shortcut_paths = [extend_fn(*pair) for pair in get_pairs(waypoints)] + new_waypoints = waypoints[:i+1] + shortcut + waypoints[j:] # TODO: reuse computation + new_cost = compute_path_cost(new_waypoints, cost_fn=cost_fn) + if new_cost >= cost: # TODO: cost must have percent improvement above a threshold + continue + if not any(collision_fn(q) for q in default_selector(refine_waypoints(shortcut, extend_fn))): + waypoints = new_waypoints + cost = new_cost + last_time = time.time() + #return waypoints + return refine_waypoints(waypoints, extend_fn) + +#smooth_path = smooth_path_old diff --git a/plan_path/pyplanners/star_roadmap.py b/plan_path/pyplanners/star_roadmap.py new file mode 100644 index 0000000..213b762 --- /dev/null +++ b/plan_path/pyplanners/star_roadmap.py @@ -0,0 +1,33 @@ +from collections import Mapping + +class StarRoadmap(Mapping, object): + + def __init__(self, center, planner_fn): + self.center = center # TODO: plan instead from the closest point on the roadmap + self.planner_fn = planner_fn + self.roadmap = {} + + """ + def __getitem__(self, q): + return self.roadmap[q] + + def __len__(self): + return len(self.roadmap) + + def __iter__(self): + return iter(self.roadmap) + """ + + def grow(self, goal): + if goal not in self.roadmap: + self.roadmap[goal] = self.planner_fn(self.center, goal) + return self.roadmap[goal] + + def __call__(self, start, goal): + start_traj = self.grow(start) + if start_traj is None: + return None + goal_traj = self.grow(goal) + if goal_traj is None: + return None + return start_traj.reverse(), goal_traj diff --git a/plan_path/pyplanners/targetless_rrt.py b/plan_path/pyplanners/targetless_rrt.py new file mode 100644 index 0000000..fa8b527 --- /dev/null +++ b/plan_path/pyplanners/targetless_rrt.py @@ -0,0 +1,46 @@ +from random import random +import time +import numpy as np + +from .utils import irange, argmin, RRT_ITERATIONS, INF, elapsed_time +from .rrt import TreeNode, configs +from .bbox import compute_nearest_bbox_goal + + +def targetless_rrt(start, vertices_move, vertices_still, distance_fn, sample_fn, extend_fn, collision_fn, goal_test, + goal_probability=.2, max_iterations=RRT_ITERATIONS, max_time=INF): + """ + :param start: Start configuration - conf + :param distance_fn: Distance function - distance_fn(q1, q2)->float + :param sample_fn: Sample function - sample_fn()->conf + :param extend_fn: Extension function - extend_fn(q1, q2)->[q', ..., q"] + :param collision_fn: Collision function - collision_fn(q)->bool + :param max_iterations: Maximum number of iterations - int + :param max_time: Maximum runtime - float + :return: Path [q', ..., q"] or None if unable to find a solution + """ + start_time = time.time() + if collision_fn(start): + return None + nodes = [TreeNode(start)] + + for i in irange(max_iterations): + if elapsed_time(start_time) >= max_time: + break + goal = random() < goal_probability or i == 0 + if goal: + s, last = compute_nearest_bbox_goal(nodes, vertices_move, vertices_still) + else: + s = sample_fn() + last = argmin(lambda n: distance_fn(n.config, s), nodes) + for q in extend_fn(last.config, s): + if collision_fn(q): + break + last = TreeNode(q, parent=last) + nodes.append(last) + if goal_test(last.config): + return configs(last.retrace()) + else: + if goal: + return configs(last.retrace()) + return None diff --git a/plan_path/pyplanners/tkinter/__init__.py b/plan_path/pyplanners/tkinter/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/plan_path/pyplanners/tkinter/run.py b/plan_path/pyplanners/tkinter/run.py new file mode 100644 index 0000000..7bd2b4b --- /dev/null +++ b/plan_path/pyplanners/tkinter/run.py @@ -0,0 +1,331 @@ +from __future__ import print_function + +import numpy as np +import argparse +import time +import random + +from ..meta import solve +from ..trajectory.linear import solve_multi_linear +from ..trajectory.discretize import distance_discretize_curve, V_MAX, A_MAX +from .samplers import get_sample_fn, get_collision_fn, get_extend_fn, get_distance_fn, wrap_collision_fn, wrap_sample_fn +from ..primitives import get_difference_fn, get_duration_fn +from ..trajectory.smooth import smooth_curve, get_curve_collision_fn, plot_curve +from ..trajectory.limits import analyze_continuity +from .viewer import create_box, draw_environment, add_points, \ + add_roadmap, get_box_center, add_path, create_cylinder, add_timed_path +from ..utils import user_input, profiler, INF, compute_path_cost, elapsed_time, remove_redundant, \ + waypoints_from_path +from ..prm import prm +from ..lazy_prm import lazy_prm +from ..rrt_connect import rrt_connect, birrt +from ..rrt import rrt +from ..rrt_star import rrt_star +from ..smoothing import smooth_path +from ..lattice import lattice + +ALGORITHMS = [ + prm, + lazy_prm, + rrt, + rrt_connect, + birrt, + rrt_star, + lattice, + # TODO: RRT in position/velocity space using spline interpolation + # TODO: https://ompl.kavrakilab.org/planners.html +] + +################################################## + +def buffer_durations(durations, switch_t=0., min_t=0.): + durations = durations + switch_t*np.ones(len(durations)) + durations = np.maximum(min_t * np.ones(len(durations)), durations) + return durations + +def dump_spline(positions_curve): + print(positions_curve.c[0, ...]) # Cubic parameters + print(positions_curve.c.shape) + for d in range(positions_curve.c.shape[-1]): + print(d, positions_curve.c[..., d]) + +def retime_path(path, collision_fn=lambda q: False, smooth=False, **kwargs): + # d = len(path[0]) + # v_max = 5.*np.ones(d) + # a_max = v_max / 1. + v_max, a_max = V_MAX, A_MAX + print('Max vel: {} | Max accel: {}'.format(v_max, a_max)) + + waypoints = remove_redundant(path) + waypoints = waypoints_from_path(waypoints) + positions_curve = solve_multi_linear(waypoints, v_max, a_max) + if not smooth: + return positions_curve + + # durations = [0.] + [get_distance(*pair) / velocity for pair in get_pairs(waypoints)] + # durations = [0.] + [solve_multivariate_ramp(x1, x2, np.zeros(d), np.zeros(d), v_max, a_max) + # for x1, x2 in get_pairs(waypoints)] + # durations = [0.] + [max(spline_duration(opt_straight_line(x1[k], x2[k], v_max=v_max[k], a_max=a_max[k])) for k in range(d)) + # for x1, x2 in get_pairs(waypoints)] # min_linear_spline | opt_straight_line + # times = np.cumsum(durations) + + #positions_curve = interp1d(times, waypoints, kind='quadratic', axis=0) # linear | slinear | quadratic | cubic + #positions_curve = CubicSpline(times, waypoints, bc_type='clamped') + #velocities = [np.zeros(len(waypoint)) for waypoint in waypoints] + #positions_curve = CubicHermiteSpline(times, waypoints, dydx=velocities) + + #positions_curve = MultiPPoly.from_poly(positions_curve) + #positions_curve = solve_multi_poly(times, waypoints, velocities, v_max, a_max) + #positions_curve = positions_curve.spline() + #positions_curve = positions_curve.hermite_spline() + print('Position: t={:.3f}, error={:.3E}'.format(*analyze_continuity(positions_curve))) + print('Velocity: t={:.3f}, error={:.3E}'.format(*analyze_continuity(positions_curve.derivative(nu=1)))) + print('Acceleration: t={:.3f}, error={:.3E}'.format(*analyze_continuity(positions_curve.derivative(nu=2)))) + + # t1, t2 = np.random.uniform(positions_curve.x[0], positions_curve.x[-1], 2) + # if t1 > t2: + # t1, t2 = t2, t1 + # print(t1, t2) + # print([positions_curve(t) for t in [t1, t2]]) + # positions_curve = trim(positions_curve, t1, t2) # trim | trim_start | trim_end + # print(positions_curve.x) + # print([positions_curve(t) for t in [t1, t2]]) + + curve_collision_fn = get_curve_collision_fn(collision_fn, max_velocities=v_max, max_accelerations=a_max) + positions_curve = smooth_curve(positions_curve, + #v_max=None, a_max=None, + v_max=v_max, + a_max=a_max, + curve_collision_fn=curve_collision_fn, **kwargs) + print('Position: t={:.3f}, error={:.3E}'.format(*analyze_continuity(positions_curve))) + print('Velocity: t={:.3f}, error={:.3E}'.format(*analyze_continuity(positions_curve.derivative(nu=1)))) + print('Acceleration: t={:.3f}, error={:.3E}'.format(*analyze_continuity(positions_curve.derivative(nu=2)))) + + return positions_curve + +################################################## + +def problem1(): + # TODO: randomize problems + obstacles = [ + create_box(center=(.35, .75), extents=(.25, .25)), + #create_box(center=(.75, .35), extents=(.25, .25)), + create_box(center=(.75, .35), extents=(.22, .22)), + create_box(center=(.5, .5), extents=(.25, .25)), + #create_box(center=(.5, .5), extents=(.22, .22)), + + create_cylinder(center=(.25, .25), radius=.1), + ] + + # TODO: alternate sampling from a mix of regions + regions = { + 'env': create_box(center=(.5, .5), extents=(1., 1.)), + 'green': create_box(center=(.8, .8), extents=(.1, .1)), + } + #start = np.array([0., 0.]) + start = np.array([0.1, 0.1]) + goal = 'green' + + return start, goal, regions, obstacles + +def infeasible(): + obstacles = [ + create_box(center=(.25, 0.5), extents=(.5, .05)), + create_box(center=(0.5, .25), extents=(.05, .5)), + ] + + # TODO: alternate sampling from a mix of regions + regions = { + 'env': create_box(center=(.5, .5), extents=(1., 1.)), + 'green': create_box(center=(.8, .8), extents=(.1, .1)), + } + #start = np.array([0., 0.]) + start = np.array([0.1, 0.1]) + goal = 'green' + + return start, goal, regions, obstacles + +################################################## + +def solve_lazy_prm(viewer, start, goal, sample_fn, extend_fn, collision_fn, radius=4, **kwargs): + path, samples, edges, colliding_vertices, colliding_edges = \ + lazy_prm(start, goal, sample_fn, extend_fn, collision_fn, **kwargs) + # add_roadmap(viewer, roadmap, color='black') # TODO: seems to have fewer edges than it should + # add_roadmap(viewer, [(samples[v1], samples[v2]) for v1, v2 in edges], color='black') + + for v1, v2 in edges: + if (colliding_vertices.get(v1, False) is True) or (colliding_vertices.get(v2, False) is True): + colliding_edges[v1, v2] = True + + red_edges = [(samples[v1], samples[v2]) for (v1, v2), c in colliding_edges.items() if c is True] + green_edges = [(samples[v1], samples[v2]) for (v1, v2), c in colliding_edges.items() if c is False] + blue_edges = [(samples[v1], samples[v2]) for v1, v2 in edges if (v1, v2) not in colliding_edges] + add_roadmap(viewer, red_edges, color='red') + add_roadmap(viewer, green_edges, color='green') + add_roadmap(viewer, blue_edges, color='blue') + print('Edges | Colliding: {}/{} | CFree: {}/{} | Unchecked: {}/{}'.format( + len(red_edges), len(edges), len(green_edges), len(edges), len(blue_edges), len(edges))) + + red_vertices = [samples[v] for v, c in colliding_vertices.items() if c is True] + green_vertices = [samples[v] for v, c in colliding_vertices.items() if c is False] + blue_vertices = [s for i, s, in enumerate(samples) if i not in colliding_vertices] + add_points(viewer, red_vertices, color='red', radius=radius) + add_points(viewer, green_vertices, color='green', radius=radius) + add_points(viewer, blue_vertices, color='blue', radius=radius) + print('Vertices | Colliding: {}/{} | CFree: {}/{} | Unchecked: {}/{}'.format( + len(red_vertices), len(samples), len(green_vertices), len(samples), len(blue_vertices), len(samples))) + return path + +################################################## + + +def main(draw=True): + """ + Creates and solves the 2D motion planning problem. + """ + # https://github.com/caelan/pddlstream/blob/master/examples/motion/run.py + # TODO: 3D workspace and CSpace + # TODO: visualize just the tool frame of an end effector + + np.set_printoptions(precision=3) + parser = argparse.ArgumentParser() + parser.add_argument('-a', '--algorithm', default='rrt_connect', + help='The algorithm to use.') + parser.add_argument('--anytime', action='store_true', + help='Run the planner in an anytime mode.') + parser.add_argument('-d', '--draw', action='store_true', + help='When enabled, draws the roadmap') + parser.add_argument('-r', '--restarts', default=0, type=int, + help='The number of restarts.') + parser.add_argument('-s', '--smooth', action='store_true', + help='When enabled, smooths paths.') + parser.add_argument('-t', '--time', default=1., type=float, + help='The maximum runtime.') + parser.add_argument('--seed', default=None, type=int, + help='The random seed to use.') + args = parser.parse_args() + print(args) + + seed = args.seed + if seed is None: + #seed = random.randint(0, sys.maxsize) + seed = random.randint(0, 10**3-1) + print('Seed:', seed) + random.seed(seed) + np.random.seed(seed) + + ######################### + + problem_fn = problem1 # problem1 | infeasible + start, goal, regions, obstacles = problem_fn() + #obstacles = [] + environment = regions['env'] + if isinstance(goal, str) and (goal in regions): + goal = get_box_center(regions[goal]) + else: + goal = np.array([1., 1.]) + + title = args.algorithm + if args.smooth: + title += '+shortcut' + + viewer = None # TODO: can't use matplotlib at the same time + if draw: + viewer = draw_environment(obstacles, regions, title=title) + + ######################### + + #connected_test, roadmap = get_connected_test(obstacles) + weights = np.reciprocal(V_MAX) + distance_fn = get_distance_fn(weights=[1, 1]) # distance_fn + min_distance = distance_fn(start, goal) + print('Distance: {:.3f}'.format(min_distance)) + + # samples = list(islice(region_gen('env'), 100)) + with profiler(field='tottime'): # cumtime | tottime + # TODO: cost bound & best cost + for _ in range(args.restarts+1): + start_time = time.time() + collision_fn, colliding, cfree = wrap_collision_fn(get_collision_fn(environment, obstacles)) + sample_fn, samples = wrap_sample_fn(get_sample_fn(environment, obstacles=[], use_halton=True)) # obstacles + #extend_fn, roadmap = get_wrapped_extend_fn(environment, obstacles=obstacles) # obstacles | [] + + circular = {} + #circular = {0: UNIT_LIMITS, 1: UNIT_LIMITS} + extend_fn, roadmap = get_extend_fn(circular=circular), [] + + # points = list(extend_fn(start, goal)) + # print(points) + # add_points(viewer, points, color='blue', radius=2) + # input() + # return + + # TODO: shortcutting with this function + #cost_fn = distance_fn + #cost_fn = get_cost_fn(distance_fn, constant=1e-2, coefficient=1.) + cost_fn = get_duration_fn(difference_fn=get_difference_fn(circular=circular), v_max=V_MAX, a_max=A_MAX) + path = solve(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, + cost_fn=cost_fn, weights=weights, circular=circular, + max_time=args.time, max_iterations=INF, num_samples=100, + success_cost=0 if args.anytime else INF, + restarts=2, smooth=0, algorithm=args.algorithm, verbose=True) + #print(ROADMAPS) + + #path = solve_lazy_prm(viewer, start, goal, sample_fn, extend_fn, collision_fn, + # num_samples=200, max_time=args.time, max_cost=1.25*min_distance) + + paths = [] if path is None else [path] + #paths = random_restarts(rrt_connect, start, goal, distance_fn=distance_fn, sample_fn=sample_fn, + # extend_fn=extend_fn, collision_fn=collision_fn, restarts=INF, + # max_time=args.time, max_solutions=INF, smooth=100) #, smooth=1000, **kwargs) + + # paths = exhaustively_select_portfolio(paths, k=2) + # print(score_portfolio(paths)) + + ######################### + + if args.draw: + # roadmap = samples = cfree = [] + add_roadmap(viewer, roadmap, color='black') # TODO: edges going backward? + add_points(viewer, samples, color='grey', radius=2) + add_points(viewer, colliding, color='red', radius=2) + add_points(viewer, cfree, color='blue', radius=2) # green + + print('Solutions ({}): {} | Colliding: {} | CFree: {} | Time: {:.3f}'.format( + len(paths), [(len(path), round(compute_path_cost(path, cost_fn), 3)) for path in paths], + len(colliding), len(cfree), elapsed_time(start_time))) + for i, path in enumerate(paths): + cost = compute_path_cost(path, cost_fn) + print('{}) Length: {} | Cost: {:.3f} | Ratio: {:.3f}'.format(i, len(path), cost, cost/min_distance)) + #path = path[:1] + path[-2:] + path = waypoints_from_path(path) + add_path(viewer, path, color='green') + + if True: + #curve = interpolate_path(path) # , collision_fn=collision_fn) + curve = retime_path(path, collision_fn=collision_fn, smooth=args.smooth, + max_time=args.time) # , smooth=True) + if not draw: + plot_curve(curve) + + times, path = distance_discretize_curve(curve) + times = [np.linalg.norm(curve(t, nu=1), ord=INF) for t in times] + #add_points(viewer, [curve(t) for t in curve.x]) + #add_path(viewer, path, color='red') + add_timed_path(viewer, times, path) # TODO: add curve + + if False and args.smooth: + for path in paths: + #extend_fn, roadmap = get_wrapped_extend_fn(environment, obstacles=obstacles) # obstacles | [] + #cost_fn = distance_fn + smoothed = smooth_path(path, extend_fn, collision_fn, + cost_fn=cost_fn, sample_fn=sample_fn, + max_iterations=INF, max_time=args.time, + converge_time=INF, verbose=True) + print('Smoothed distance_fn: {:.3f}'.format(compute_path_cost(smoothed, distance_fn))) + add_path(viewer, smoothed, color='red') + + user_input('Finish?') + +if __name__ == '__main__': + main() diff --git a/plan_path/pyplanners/tkinter/samplers.py b/plan_path/pyplanners/tkinter/samplers.py new file mode 100644 index 0000000..31263a3 --- /dev/null +++ b/plan_path/pyplanners/tkinter/samplers.py @@ -0,0 +1,144 @@ +import math + +import numpy as np + +from .viewer import is_collision_free, contains, point_collides, sample_line, STEP_SIZE +from ..primitives import get_difference_fn +from ..utils import interval_generator, get_distance, wrap_interval, get_difference, \ + UNBOUNDED_LIMITS, INF + + +def get_distance_fn(weights, difference_fn=get_difference): + # TODO: careful with circular joints + def fn(q1, q2): + diff = np.array(difference_fn(q2, q1)) + return np.sqrt(np.dot(weights, diff * diff)) + return fn + + +################################################## + +def wrap_sample_fn(sample_fn): + samples = [] + + def new_sample_fn(*args, **kwargs): + q = sample_fn(*args, **kwargs) + samples.append(q) + return q + + return new_sample_fn, samples + + +def get_sample_fn(region, obstacles=[], only_cfree=True, **kwargs): #, check_collisions=False): + # TODO: additional rejection function + # TODO: Gaussian sampling for narrow passages + collision_fn = get_collision_fn(region, obstacles) + lower, upper = region + generator = interval_generator(lower, upper, **kwargs) + + def region_gen(): + #area = np.product(upper - lower) # TODO: sample_fn proportional to area + for q in generator: + #q = sample_box(region) + if only_cfree and collision_fn(q): + continue + return q # TODO: sampling with state (e.g. deterministic sampling) + + return region_gen + + +def get_connected_test(obstacles, max_distance=0.25): # 0.25 | 0.2 | 0.25 | 0.5 | 1.0 + roadmap = [] + + def connected_test(q1, q2): + threshold = max_distance + are_connected = (get_distance(q1, q2) <= threshold) and is_collision_free((q1, q2), obstacles) + if are_connected: + roadmap.append((q1, q2)) + return are_connected + return connected_test, roadmap + + +def get_threshold_fn(d=2): + # http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.419.5503&rep=rep1&type=pdf + vol_free = (1 - 0) * (1 - 0) + vol_ball = math.pi * (1 ** 2) + gamma = 2 * ((1 + 1. / d) * (vol_free / vol_ball)) ** (1. / d) + threshold_fn = lambda n: gamma * (math.log(n) / n) ** (1. / d) + return threshold_fn + + +def wrap_collision_fn(collision_fn): + colliding = [] + cfree = [] + # TODO: KDTree for hyperspheres + # TODO: Signed Distance Function (SDF) + + def new_collision_fn(q, *args, **kwargs): + result = collision_fn(q, *args, **kwargs) + if result: + colliding.append(q) + else: + cfree.append(q) + return result + + return new_collision_fn, colliding, cfree + + +def get_collision_fn(environment, obstacles): + + def collision_fn(q): + #time.sleep(1e-3) + if not contains(q, environment): + return True + if point_collides(q, obstacles): + return True + return False + + return collision_fn + + +################################################## + + +def wrap_extend_fn(extend_fn): + roadmap = [] + + def new_extend_fn(q1, q2, *args, **kwargs): + raise NotImplementedError() + + return new_extend_fn, roadmap + + +def get_extend_fn(circular={}, step_size=STEP_SIZE, norm=INF): + #difference_fn = get_difference + difference_fn = get_difference_fn(circular=circular) + def fn(q1, q2): + # steps = int(np.max(np.abs(np.divide(difference_fn(q2, q1), resolutions)))) + # steps = int(np.linalg.norm(np.divide(difference_fn(q2, q1), resolutions), ord=norm)) + steps = int(np.linalg.norm(np.array(difference_fn(q2, q1)) / step_size, ord=norm)) + num_steps = steps + 1 + q = q1 + for i in range(num_steps): + q = (1. / (num_steps - i)) * np.array(difference_fn(q2, q)) + q + q = [wrap_interval(v, circular.get(i, UNBOUNDED_LIMITS)) for i, v in enumerate(q)] + q = np.array(q) # tuple + yield q + return fn + + +def get_wrapped_extend_fn(environment, obstacles=[], **kwargs): + collision_fn = get_collision_fn(environment, obstacles) + roadmap = [] + + def extend_fn(q1, q2): + path = [q1] + for q in sample_line(segment=(q1, q2), **kwargs): + yield q + if collision_fn(q): + path = None + if path is not None: + roadmap.append((path[-1], q)) + path.append(q) + + return extend_fn, roadmap diff --git a/plan_path/pyplanners/tkinter/viewer.py b/plan_path/pyplanners/tkinter/viewer.py new file mode 100644 index 0000000..30f719e --- /dev/null +++ b/plan_path/pyplanners/tkinter/viewer.py @@ -0,0 +1,222 @@ +try: + from Tkinter import Tk, Canvas, Toplevel, LAST + #import TKinter as tk +except ModuleNotFoundError: + from tkinter import Tk, Canvas, Toplevel, LAST + #import tkinter as tk +from _tkinter import TclError + +import numpy as np +import traceback + +from collections import namedtuple + +from ..utils import get_pairs, get_delta, INF, get_interval_center, get_interval_extent + +Box = namedtuple('Box', ['lower', 'upper']) +Circle = namedtuple('Circle', ['center', 'radius']) + +class PRMViewer(object): + def __init__(self, width=500, height=500, title='PRM', background='tan'): + # TODO: matplotlib viewer + tk = Tk() + tk.withdraw() + top = Toplevel(tk) + top.wm_title(title) + top.protocol('WM_DELETE_WINDOW', top.destroy) + self.width = width + self.height = height + self.canvas = Canvas(top, width=self.width, height=self.height, background=background) + self.canvas.pack() + + def pixel_from_point(self, point): + (x, y) = point + # return (int(x*self.width), int(self.height - y*self.height)) + return (x * self.width, self.height - y * self.height) + + def draw_point(self, point, radius=5, color='black'): + (x, y) = self.pixel_from_point(point) + self.canvas.create_oval(x - radius, y - radius, x + radius, y + radius, fill=color, outline='') + + def draw_line(self, segment, color='black'): + (point1, point2) = segment + (x1, y1) = self.pixel_from_point(point1) + (x2, y2) = self.pixel_from_point(point2) + self.canvas.create_line(x1, y1, x2, y2, fill=color, width=1) + + def draw_arrow(self, point1, point2, color='black'): + (x1, y1) = self.pixel_from_point(point1) + (x2, y2) = self.pixel_from_point(point2) + self.canvas.create_line(x1, y1, x2, y2, fill=color, width=2, arrow=LAST) + + def draw_rectangle(self, box, width=2, color='brown'): + (point1, point2) = box + (x1, y1) = self.pixel_from_point(point1) + (x2, y2) = self.pixel_from_point(point2) + self.canvas.create_rectangle(x1, y1, x2, y2, outline='black', fill=color, width=width) + + def draw_circle(self, center, radius, width=2, color='black'): + (x1, y1) = self.pixel_from_point(np.array(center) - radius * np.ones(2)) + (x2, y2) = self.pixel_from_point(np.array(center) + radius * np.ones(2)) + self.canvas.create_oval(x1, y1, x2, y2, outline='black', fill=color, width=width) + + def clear(self): + self.canvas.delete('all') + + +################################################################# + +STEP_SIZE = 1e-2 +MIN_PROXIMITY = 1e-3 + +def contains_box(point, box, buffer=0.): + (lower, upper) = box + lower = lower - buffer*np.ones(len(lower)) + upper = upper + buffer*np.ones(len(upper)) + return np.less_equal(lower, point).all() and \ + np.less_equal(point, upper).all() + #return np.all(point >= lower) and np.all(upper >= point) + +def contains_circle(point, circle, buffer=0.): + center, radius = circle + return np.linalg.norm(np.array(point) - np.array(center)) <= (radius + buffer) + +def contains(point, shape, **kwargs): + if isinstance(shape, Box): + return contains_box(point, shape, **kwargs) + if isinstance(shape, Circle): + return contains_circle(point, shape, **kwargs) + raise NotImplementedError(shape) + +def point_collides(point, obstacles, buffer=MIN_PROXIMITY, **kwargs): + return any(contains(point, obst, buffer=buffer, **kwargs) for obst in obstacles) + +def sample_line(segment, step_size=STEP_SIZE): + (q1, q2) = segment + diff = get_delta(q1, q2) + dist = np.linalg.norm(diff) + for l in np.arange(0., dist, step_size): + yield tuple(np.array(q1) + l * diff / dist) + yield q2 + +def line_collides(line, obst, step_size=STEP_SIZE, **kwargs): # TODO - could also compute this exactly + return any(point_collides(point, obstacles=[obst], **kwargs) for point in sample_line(line, step_size=step_size)) + +def is_collision_free(line, obstacles, **kwargs): + return not any(line_collides(line, obst, **kwargs) for obst in obstacles) + +def create_box(center, extents): + (x, y) = center + (w, h) = extents + lower = (x - w / 2., y - h / 2.) + upper = (x + w / 2., y + h / 2.) + return Box(np.array(lower), np.array(upper)) + +def create_cylinder(center, radius): + return Circle(center, radius) + +get_box_center = get_interval_center +get_box_extent = get_interval_extent + +def sample_box(box): + (lower, upper) = box + return np.random.random(len(lower)) * get_box_extent(box) + lower + +def sample_circle(circle): + center, radius = circle + theta = np.random.uniform(low=0, high=2*np.pi) + direction = np.array([np.cos(theta), np.sin(theta)]) + return np.array(center) + direction + +################################################################# + +def draw_shape(viewer, shape, **kwargs): + if viewer is None: + return + if isinstance(shape, Box): + return viewer.draw_rectangle(shape, **kwargs) + if isinstance(shape, Circle): + center, radius = shape + return viewer.draw_circle(center, radius, **kwargs) + raise NotImplementedError(shape) + +def draw_environment(obstacles, regions, **kwargs): + try: + viewer = PRMViewer(**kwargs) + except TclError: + traceback.print_exc() + return None + + for obstacle in obstacles: + draw_shape(viewer, obstacle, color='brown') + for name, region in regions.items(): + if name == 'env': + continue + draw_shape(viewer, region, color='green') + return viewer + +def add_segments(viewer, segments, step_size=INF, **kwargs): + if (viewer is None) or (segments is None): + return + for line in segments: + viewer.draw_line(line, **kwargs) + #for p in [p1, p2]: + for p in sample_line(line, step_size=step_size): + viewer.draw_point(p, radius=2, **kwargs) + +def add_path(viewer, path, **kwargs): + segments = list(get_pairs(path)) + return add_segments(viewer, segments, **kwargs) + +def hex_from_8bit(rgb): + assert all(0 <= v <= 2**8-1 for v in rgb) + return '#%02x%02x%02x' % tuple(rgb) + +def hex_from_rgb(rgb): + assert all(0. <= v <= 1.for v in rgb) + return hex_from_8bit([int(v*(2**8-1)) for v in rgb]) + +def spaced_colors(n, s=1, v=1): + import colorsys + return [colorsys.hsv_to_rgb(h, s, v) for h in np.linspace(0, 1, n, endpoint=False)] + +def add_timed_path(viewer, times, path, **kwargs): + if viewer is None: + return + # TODO: color based on velocity + import colorsys + + min_value = min(times) + max_value = max(times) + + def get_color(t): + fraction = (t - min_value) / (max_value - min_value) + rgb = colorsys.hsv_to_rgb(h=(1-fraction)*(2./3), s=1., v=1.) + return hex_from_rgb(rgb) + + for t, p in zip(times, path): + viewer.draw_point(p, radius=2, color=get_color(t), **kwargs) + for (t1, p1), (t2, p2) in get_pairs(list(zip(times, path))): + t = (t1 + t2) / 2 + line = (p1, p2) + viewer.draw_line(line, color=get_color(t), **kwargs) + +def draw_solution(segments, obstacles, regions): + viewer = draw_environment(obstacles, regions) + add_segments(viewer, segments) + +def add_roadmap(viewer, roadmap, **kwargs): + if viewer is None: + return + for line in roadmap: + viewer.draw_line(line, **kwargs) + +def draw_roadmap(roadmap, obstacles, regions): + viewer = draw_environment(obstacles, regions) + add_roadmap(viewer, roadmap) + +def add_points(viewer, points, **kwargs): + if viewer is None: + return + for sample in points: + viewer.draw_point(sample, **kwargs) diff --git a/plan_path/pyplanners/trajectory/__init__.py b/plan_path/pyplanners/trajectory/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/plan_path/pyplanners/trajectory/debug.py b/plan_path/pyplanners/trajectory/debug.py new file mode 100644 index 0000000..35eb472 --- /dev/null +++ b/plan_path/pyplanners/trajectory/debug.py @@ -0,0 +1,31 @@ +import numpy as np + + +def test_spline(best_t, x1, x2, v1, v2): + observations = [ + (0., x1[0], 0), + (best_t, x2[0], 0), + (0., v1[0], 1), + (best_t, v2[0], 1), + ] + degree = len(observations) - 1 + + from numpy import poly1d + terms = [] + for k in range(degree + 1): + coeffs = np.zeros(degree + 1) + coeffs[k] = 1. + terms.append(poly1d(coeffs)) + # series = poly1d(np.ones(degree+1)) + + A = [] + b = [] + for t, v, nu in observations: + A.append([term.deriv(m=nu)(t) for term in terms]) + b.append(v) + print(A) + print(b) + print(np.linalg.solve(A, b)) + # print(polyfit([t for t, _, nu in observations if nu == 0], + # [v for _, v, nu in observations if nu == 0], deg=degree)) + # TODO: compare with CubicHermiteSpline \ No newline at end of file diff --git a/plan_path/pyplanners/trajectory/discretize.py b/plan_path/pyplanners/trajectory/discretize.py new file mode 100644 index 0000000..4bfbfa2 --- /dev/null +++ b/plan_path/pyplanners/trajectory/discretize.py @@ -0,0 +1,139 @@ +import numpy as np + +from .retime import get_interval, spline_duration +from .limits import find_max_velocity, find_max_acceleration +from ..utils import get_distance, INF, even_space + +V_MAX = 0.8*np.ones(2) +A_MAX = abs(V_MAX - 0.) / abs(0.2 - 0.) +#V_MAX = INF*np.ones(2) +#A_MAX = 1e6*np.ones(2) +DEFAULT_RESOLUTION = 1e-2 + +################################################## + +def filter_proximity(times, positions, resolutions): + assert len(times) == len(positions) + if len(times) <= 2: + return times, positions + new_times = [times[0]] + new_positions = [positions[0]] + for idx in range(1, len(times)-1): + # TODO: search a list of existing samples (such as knot points) + current_delta = np.absolute(get_distance(positions[idx], new_positions[-1]) / resolutions) + next_delta = np.absolute(get_distance(positions[idx+1], new_positions[-1]) / resolutions) + if (current_delta >= 1).any() or (next_delta >= 1).any(): + new_times.append(times[idx]) + new_positions.append(positions[idx]) + new_times.append(times[-1]) + new_positions.append(positions[-1]) + return new_times, new_positions + +################################################## + +def inf_norm(vector): + #return max(map(abs, vector)) + return np.linalg.norm(vector, ord=INF) + +def time_discretize_curve(positions_curve, max_velocities=None, + resolution=DEFAULT_RESOLUTION, verbose=True, **kwargs): # TODO: min_time? + start_t, end_t = get_interval(positions_curve, **kwargs) + norm = INF + d = len(positions_curve(start_t)) + resolutions = resolution + if np.isscalar(resolution): + resolutions = resolution*np.ones(d) + if max_velocities is None: + # TODO: adjust per trajectory segment + v_max_t, max_v = find_max_velocity(positions_curve, start_t=start_t, end_t=end_t, norm=norm) + a_max_t, max_a = find_max_acceleration(positions_curve, start_t=start_t, end_t=end_t, norm=norm) + #v_max_t, max_v = INF, np.linalg.norm(V_MAX) + time_step = min(np.divide(resolutions, max_v)) + #time_step = 0.1*time_step + if verbose: + print('Max velocity: {:.3f}/{:.3f} (at time {:.3f}) | Max accel: {:.3f}/{:.3f} (at time {:.3f}) | ' + 'Step: {:.3f} | Duration: {:.3f}'.format( + max_v, np.linalg.norm(V_MAX, ord=norm), v_max_t, max_a, np.linalg.norm(A_MAX, ord=norm), a_max_t, + time_step, spline_duration(positions_curve))) # 2 | INF + else: + time_step = np.min(np.divide(resolutions, max_velocities)) + + times = even_space(start_t, end_t, step=time_step) + positions = [positions_curve(t) for t in times] + times, positions = filter_proximity(times, positions, resolution) + return times, positions + + # TODO: bug here (just use knot points instead?) + # times.extend(np.hstack(positions_curve.derivative().roots(discontinuity=True))) # TODO: make these points special within filter proximity + # times = sorted(set(times)) + # positions = [positions_curve(t) for t in times] + # return times, positions + + +def derivative_discretize_curve(positions_curve, resolution=DEFAULT_RESOLUTION, time_step=1e-3, **kwargs): + d = positions_curve.c.shape[-1] + resolutions = resolution*np.ones(d) + start_t, end_t = get_interval(positions_curve, **kwargs) + velocities_curve = positions_curve.derivative() + #acceleration_curve = velocities_curve.derivative() + times = [start_t] + while True: + velocities = velocities_curve(times[-1]) + dt = min(np.divide(resolutions, np.absolute(velocities))) + #dt = min(dt, time_step) # TODO: issue if an infinite derivative + new_time = times[-1] + dt + if new_time > end_t: + break + times.append(new_time) + times.append(end_t) + positions = [positions_curve(control_time) for control_time in times] + # TODO: distance between adjacent positions + return times, positions + +################################################## + +def sample_discretize_curve(positions_curve, resolutions, time_step=1e-2, **kwargs): + start_t, end_t = get_interval(positions_curve, **kwargs) + times = [start_t] + samples = [positions_curve(start_t)] + for t in even_space(start_t, end_t, step=time_step): + positions = positions_curve(t) + if np.less_equal(samples[-1] - resolutions, positions).all() and \ + np.less_equal(positions, samples[-1] + resolutions).all(): + continue + times.append(t) + samples.append(positions) + return times, samples + +def distance_discretize_curve(curve, resolution=DEFAULT_RESOLUTION, **kwargs): + # TODO: could compute for the full interval and then sort by proximity for speed purposes + # TODO: could sample at a small timestep and prune + d = curve.c.shape[-1] + resolutions = resolution*np.ones(d) + start_t, end_t = get_interval(curve, **kwargs) + times = [start_t] + while True: + t1 = times[-1] + position = curve(t1) + candidates = [] + for sign in [-1, +1]: + target = position + sign*resolutions + for i in range(len(position)): + candidates.extend(t for t in curve.solve(target[i])[i] if t1 < t < end_t) + # curve.roots() + if not candidates: + break + times.append(min(candidates)) + times.append(end_t) + positions = [curve(control_time) for control_time in times] + # TODO: record distance from adjacent positions + return times, positions + + +def integral_discretize_curve(positions_curve, resolution=DEFAULT_RESOLUTION, **kwargs): + #from scipy.integrate import quad + start_t, end_t = get_interval(positions_curve, **kwargs) + distance_curve = positions_curve.antiderivative() + #distance = positions_curve.integrate(a, b) + # TODO: compute a total distance curve + raise NotImplementedError() diff --git a/plan_path/pyplanners/trajectory/limits.py b/plan_path/pyplanners/trajectory/limits.py new file mode 100644 index 0000000..7346648 --- /dev/null +++ b/plan_path/pyplanners/trajectory/limits.py @@ -0,0 +1,179 @@ +import time +import numpy as np + +from .retime import EPSILON, get_max_velocity, poly_from_spline, get_interval, filter_extrema, find_extrema +from ..utils import INF, elapsed_time + +def old_check_spline(spline, v_max=None, a_max=None, start_idx=None, end_idx=None): + # TODO: be careful about time vs index (here is index) + if (v_max is None) and (a_max is None): + return True + if start_idx is None: + start_idx = 0 + if end_idx is None: + end_idx = len(spline.x) - 1 + signs = [+1, -1] + for i in range(start_idx, end_idx): + t0, t1 = spline.x[i], spline.x[i + 1] + t0, t1 = 0, (t1 - t0) + boundary_ts = [t0, t1] + for k in range(spline.c.shape[-1]): + position_poly = poly_from_spline(spline, i, d=k) + # print([position_poly(t) for t in boundary_ts]) + # print([spline(t)[k] for t in boundary_ts]) + + if v_max is not None: + vel_poly = position_poly.deriv(m=1) + if any(abs(vel_poly(t)) > v_max[k] for t in boundary_ts): + return False + if any(not isinstance(r, complex) and (t0 <= r <= t1) + for s in signs for r in (vel_poly + s * np.poly1d([v_max[k]])).roots): + return False + # a_max = None + + # TODO: reorder to check endpoints first + if a_max is not None: # INF + accel_poly = position_poly.deriv(m=2) + # print([(accel_poly(t), a_max[k]) for t in boundary_ts]) + if any(abs(accel_poly(t)) > a_max[k] for t in boundary_ts): + return False + # print([accel_poly(r) for s in signs for r in (accel_poly + s*np.poly1d([a_max[k]])).roots + # if isinstance(r, complex) and (t0 <= r <= t1)]) + if any(not isinstance(r, complex) and (t0 <= r <= t1) + for s in signs for r in (accel_poly + s * np.poly1d([a_max[k]])).roots): + return False + return True + +def check_spline(spline, v_max=None, a_max=None, verbose=False, **kwargs): + if (v_max is None) and (a_max is None): + return True + # https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.PPoly.html#scipy.interpolate.PPoly + # polys = [np.poly1d([spline.c[c, 0, k] for c in range(spline.c.shape[0])]) # Decreasing order + # for k in range(spline.c.shape[-1])] + # from numpy.polynomial.polynomial import Polynomial + # polys = [Polynomial([spline.c[c, 0, k] for c in range(spline.c.shape[0])][-1]) # Increasing order + # for k in range(spline.c.shape[-1])] + + # _, v = find_max_velocity(spline, ord=INF) + # _, a = find_max_acceleration(spline, ord=INF) + # print(v, v_max, a, a_max) + # input() + + if v_max is not None: + # TODO: maybe the pieces are screwing something + t, v = find_max_velocity(spline, **kwargs) + violation = abs(v) > get_max_velocity(v_max) + EPSILON + if verbose: # or violation: + print('Violation: {} | Max velocity: {:.3f}/{:.3f} (at time {:.3f})'.format( + violation, v, get_max_velocity(v_max), t)) + if violation: + return False + return True + # TODO: trusting continuous pieces to respect + # TODO: solve for the intersection when not at a root + # if a_max is not None: + # t, a = find_max_acceleration(spline, **kwargs) + # print('Max accel: {:.3f}/{:.3f} (at time {:.3f})'.format(a, get_max_velocity(a_max), t)) + # if abs(a) > get_max_velocity(a_max) + EPSILON: + # print(t, a) + # print(spline.x) + # print(t in spline.x) + # input() + # return False + # return True + +################################################## + +def minimize_objective(objective, lower, upper, num=100, max_time=INF, max_iterations=100, verbose=False, **kwargs): + # https://www.cvxpy.org/examples/basic/socp.html + from scipy.optimize import minimize #, line_search, brute, basinhopping, minimize_scalar + start_time = time.time() + best_t, best_f = None, INF + bounds = list(zip(lower, upper)) + assert num >= 1 + for iteration in range(num): + if elapsed_time(start_time) >= max_time: + break + x0 = np.random.uniform(lower, upper) + if max_iterations is None: + t, f = x0, objective(x0) + else: + result = minimize(objective, x0=x0, bounds=bounds, # maxiter=max_iterations, + **kwargs) # method=None, jac=None, + t, f = result.x, result.fun + if (best_t is None) or (f < best_f): + best_t, best_f = t, f + if verbose: + print(iteration, x0, t, f) # objective(result.x) + return best_t, best_f + +def find_max_curve(curve, start_t=None, end_t=None, norm=INF, **kwargs): + start_t, end_t = get_interval(curve, start_t=start_t, end_t=end_t) + # TODO: curve(t) returns a matrix if passed a vector, which is summed by the INF norm + objective = lambda t: -np.linalg.norm(curve(t[0]), ord=norm) # 2 | INF + #objective = lambda t: -np.linalg.norm(curve(t[0]), norm=2)**2 # t[0] + #accelerations_curve = positions_curve.derivative() # TODO: ValueError: failed in converting 7th argument `g' of _lbfgsb.setulb to C/Fortran array + #grad = lambda t: np.array([-2*sum(accelerations_curve(t))]) + #result = minimize_scalar(objective, method='bounded', bounds=(start_t, end_t)) #, options={'disp': False}) + + #print(max(-objective(t) for t in curve.x)) + best_t, best_f = minimize_objective(objective, lower=[start_t], upper=[end_t], **kwargs) + #best_f = objective(best_t) + best_t, best_f = best_t[0], -best_f + return best_t, best_f + +################################################## + +def find_candidates(curve, **kwargs): + return filter_extrema(curve, list(curve.x) + find_extrema(curve, **kwargs)) + +def maximize_curve(curve, ignore=set(), **kwargs): # fn=None + #d = curve(start_t) + times = find_candidates(curve, **kwargs) + times = [t for t in times if t not in ignore] # TODO: filter repeated + #fn = lambda t: max(np.absolute(curve(t))) + fn = lambda t: np.linalg.norm(curve(t), ord=INF) if curve(t).shape else float(curve(t)) + #fn = max + max_t = max(times, key=fn) + return max_t, fn(max_t) + +def exceeds_curve(curve, threshold, start_t=None, end_t=None, **kwargs): + # TODO: joint limits + # TODO: solve for the intersection with threshold + max_t, max_v = maximize_curve(curve, start_t=start_t, end_t=end_t, **kwargs) + if np.greater(max_v, threshold): + return max_t + return None + +################################################## + +def find_max_velocity(positions_curve, analytical=True, **kwargs): + velocities_curve = positions_curve.derivative(nu=1) + if analytical: + return maximize_curve(velocities_curve) + else: + return find_max_curve(velocities_curve, **kwargs) + +def find_max_acceleration(positions_curve, **kwargs): + # TODO: should only ever be quadratic + accelerations_curve = positions_curve.derivative(nu=2) + #return find_max_curve(accelerations_curve, max_iterations=None, **kwargs) + return maximize_curve(accelerations_curve, discontinuity=True,) + #ignore=set(positions_curve.x)) + +def analyze_continuity(curve, epsilon=1e-9, **kwargs): + # TODO: explicitly check the adjacent curves + start_t, end_t = get_interval(curve, **kwargs) + max_t, max_error = start_t, 0. + for i in range(1, len(curve.x)-1): + t = curve.x[i] + if not start_t <= t <= end_t: + continue + t1 = t - epsilon # TODO: check i-1 + t2 = t + epsilon # TODO: check i+1 + v1 = curve(t1) + v2 = curve(t2) + error = np.linalg.norm(v2 - v1, ord=INF) + if error > max_error: + max_t, max_error = t, error + return max_t, max_error diff --git a/plan_path/pyplanners/trajectory/linear.py b/plan_path/pyplanners/trajectory/linear.py new file mode 100644 index 0000000..dfc5f9f --- /dev/null +++ b/plan_path/pyplanners/trajectory/linear.py @@ -0,0 +1,209 @@ +import math + +import numpy as np + +from .limits import maximize_curve +from .retime import EPSILON, curve_from_controls, check_time, parabolic_val, append_polys +from ..utils import INF, get_sign, waypoints_from_path, get_pairs + +T_MIN = 1e-3 # EPSILON + +def quickest_inf_accel(x1, x2, v_max=INF): + #return solve_zero_ramp(x1, x2, v_max=INF) + return abs(x2 - x1) / abs(v_max) + +def acceleration_cost(p_curve, **kwargs): + # TODO: minimize max acceleration + # TODO: minimize sum of squared + # TODO: minimize absolute value + # total_accel = p_curve.integrate(p_curve.x[0], p_curve.x[-1]) # TODO: square or abs + a_curve = p_curve.derivative(nu=2) + max_t, max_a = maximize_curve(a_curve, **kwargs) + return max_a + +def find_lower_bound(x1, x2, v1=None, v2=None, v_max=None, a_max=None, ord=INF): + d = len(x1) + if v_max is None: + v_max = np.full(d, INF) + if a_max is None: + a_max = np.full(d, INF) + lower_bounds = [ + # Instantaneously accelerate + np.linalg.norm(np.divide(np.subtract(x2, x1), v_max), ord=ord), # quickest_inf_accel + ] + if (v1 is not None) and (v2 is not None): + lower_bounds.extend([ + np.linalg.norm(np.divide(np.subtract(v2, v1), a_max), ord=ord), + ]) + return max(lower_bounds) + +def check_curve(p_curve, x1, x2, v1, v2, T, v_max=INF, a_max=INF): + assert p_curve is not None + end_times = np.append(p_curve.x[:1], p_curve.x[-1:]) + v_curve = p_curve.derivative() + # print() + #print(x1, x2, v1, v2, T, v_max, a_max) + # print([x1, x2], [float(p_curve(t)) for t in end_times]) + # print([v1, v2], [float(v_curve(t)) for t in end_times]) + if not np.allclose([0., T], end_times): + raise RuntimeError([0., T], end_times) + if not np.allclose([x1, x2], [float(p_curve(t)) for t in end_times]): + raise RuntimeError([x1, x2], [float(p_curve(t)) for t in end_times]) + if not np.allclose([v1, v2], [float(v_curve(t)) for t in end_times]): + raise RuntimeError([v1, v2], [float(v_curve(t)) for t in end_times]) + all_times = p_curve.x + if not all(abs(v_curve(t)) <= abs(v_max) + EPSILON for t in all_times): + raise RuntimeError(abs(v_max), [abs(v_curve(t)) for t in all_times]) + a_curve = v_curve.derivative() + if not all(abs(a_curve(t)) <= abs(a_max) + EPSILON for t in all_times): + raise RuntimeError(abs(a_max), [abs(a_curve(t)) for t in all_times]) + # TODO: check continuity + +################################################## + +def zero_one_fixed(x1, x2, T, v_max=INF, dt=EPSILON): + from scipy.interpolate import PPoly + #assert 0 < v_max < INF + sign = get_sign(x2 - x1) + d = abs(x2 - x1) + v = d / T + if v > (v_max + EPSILON): + return None + t_hold = T - 2*dt + assert t_hold > 0 + v = d / t_hold + #return zero_three_stage(x1, x2, T, v_max=v_max, a_max=1e6) # NOTE: approximation + coeffs = [[0., x1], [sign*v, x1], [0., x2]] + times = [0., dt, dt + t_hold, T] + p_curve = PPoly(c=np.array(coeffs).T, x=times) # Not differentiable + return p_curve + + +def zero_two_ramp(x1, x2, T, v_max=INF, a_max=INF): + sign = get_sign(x2 - x1) + d = abs(x2 - x1) + t_accel = T / 2. + a = d / t_accel ** 2 # Lower accel + if a > (a_max + EPSILON): + return None + if a*t_accel > (v_max + EPSILON): + return None + a = min(a, a_max) # Numerical error + durations = [t_accel, t_accel] + accels = [sign * a, -sign * a] + p_curve = curve_from_controls(durations, accels, x0=x1) + return p_curve + + +def zero_three_stage(x1, x2, T, v_max=INF, a_max=INF): + sign = get_sign(x2 - x1) + d = abs(x2 - x1) + solutions = np.roots([ + a_max, + -a_max*T, + d, + ]) + solutions = filter(check_time, solutions) + solutions = [t for t in solutions if (T - 2*t) >= 0] + if not solutions: + return None + t1 = min(solutions) + if t1*a_max > (v_max + EPSILON): + return None + #t1 = min(t1, v_max / a_max) + t3 = t1 + t2 = T - t1 - t3 # Lower velocity + durations = [t1, t2, t3] + accels = [sign * a_max, 0., -sign * a_max] + p_curve = curve_from_controls(durations, accels, x0=x1) + return p_curve + +################################################## + +def opt_straight_line(x1, x2, v_max=INF, a_max=INF, t_min=T_MIN, only_duration=False): + # TODO: solve for a given T which is higher than the min T + # TODO: solve for all joints at once using a linear interpolator + # Can always rest at the start of the trajectory if need be + # Exploits symmetry + assert (v_max > 0.) and (a_max > 0.) + #assert (v_max < INF) or (a_max < INF) or (t_min > 0) + #v_max = abs(x2 - x1) / abs(v_max) + d = abs(x2 - x1) + #assert d > 0 + # if v_max == INF: + # raise NotImplementedError() + # TODO: more efficient version + + if a_max == INF: + T = d / v_max + T += 2 * EPSILON + T = max(t_min, T) + if only_duration: + return T + p_curve = zero_one_fixed(x1, x2, T, v_max=v_max) + check_curve(p_curve, x1, x2, v1=0., v2=0., T=T, v_max=v_max, a_max=a_max) + return p_curve + + t_accel = math.sqrt(d / a_max) # 1/2.*a*t**2 = d/2. + if a_max*t_accel <= v_max: + T = 2.*t_accel + #a = a_max + assert t_min <= T + T = max(t_min, T) + if only_duration: + return T + p_curve = zero_two_ramp(x1, x2, T, v_max, a_max) + check_curve(p_curve, x1, x2, v1=0., v2=0., T=T, v_max=v_max, a_max=a_max) + return p_curve + + t1 = t3 = (v_max - 0.) / a_max + t2 = (d - 2 * parabolic_val(t1, a=a_max)) / v_max + T = t1 + t2 + t3 + + assert t_min <= T + T = max(t_min, T) + if only_duration: + return T + p_curve = zero_three_stage(x1, x2, T, v_max=v_max, a_max=a_max) + check_curve(p_curve, x1, x2, v1=0., v2=0., T=T, v_max=v_max, a_max=a_max) + return p_curve + +################################################## + +def get_default_limits(d=None, v_max=None, a_max=None): + # TODO: unify with find_lower_bound + # TODO: figure out d from the bounds + if v_max is None: + v_max = INF*np.ones(d) + if a_max is None: + a_max = INF*np.ones(d) + assert len(v_max) == len(a_max) + return v_max, a_max + +def solve_linear(difference, v_max, a_max, **kwargs): + # TODO: careful with circular joints + # TODO: careful if difference is zero + unit_v_max = min(np.divide(v_max, np.absolute(difference))) + unit_a_max = min(np.divide(a_max, np.absolute(difference))) + return opt_straight_line(x1=0., x2=1., v_max=unit_v_max, a_max=unit_a_max, **kwargs) + +def solve_multi_linear(positions, v_max=None, a_max=None, **kwargs): + from scipy.interpolate import PPoly + assert positions + positions = waypoints_from_path(positions, **kwargs) + if len(positions) == 1: + positions.append(positions[-1]) + #assert len(positions) >= 2 + d = len(positions[0]) + v_max, a_max = get_default_limits(d, v_max=v_max, a_max=a_max) + splines = [] + for x1, x2 in get_pairs(positions): + difference = np.subtract(x2, x1) # TODO: pass if too small + curve = solve_linear(difference, v_max, a_max) + c = np.zeros(curve.c.shape + (d,)) + for k in range(d): + c[:,:,k] = difference[k]*curve.c + c[-1,:,k] += x1[k] + splines.append(PPoly(c=c, x=curve.x)) + assert splines + return append_polys(*splines) diff --git a/plan_path/pyplanners/trajectory/parabolic.py b/plan_path/pyplanners/trajectory/parabolic.py new file mode 100644 index 0000000..8ccc3bd --- /dev/null +++ b/plan_path/pyplanners/trajectory/parabolic.py @@ -0,0 +1,231 @@ +import numpy as np + +from .linear import quickest_inf_accel, acceleration_cost, check_curve, T_MIN +from .retime import curve_from_controls, check_time, spline_duration, append_polys, \ + MultiPPoly, EPSILON +from ..utils import INF, get_pairs + + +def min_two_ramp(x1, x2, v1, v2, T, a_max, v_max=INF): + # from numpy.linalg import solve + # from scipy.optimize import linprog + # result = linprog(c, A_ub=None, b_ub=None, A_eq=None, b_eq=None, bounds=None, + # method='interior-point', callback=None, options=None, x0=None) + + sign = +1 if a_max >= 0 else -1 + eqn = np.poly1d([ + T ** 2, # a**2 + sign * (2 * T * (v1 + v2) + 4 * (x1 - x2)), + -(v2 - v1) ** 2, # 1 + ]) + candidates = [] + for a in np.roots(eqn): # eqn.roots + if isinstance(a, complex) or (a == 0): + continue + if abs(a) > abs(a_max) + EPSILON: + continue + a = sign*a + ts = (T + (v2 - v1) / a) / 2. + if not (0 <= ts <= T): + continue + vs = v1 + a * ts + if abs(vs) > abs(v_max) + EPSILON: + continue + # vs = a * (-ts) + v2 + # if abs(vs) > abs(v_max): + # continue + candidates.append(a) + if not candidates: + return None + + a = min(candidates, key=abs) + ts = (T + (v2 - v1) / a) / 2. + durations = [ts, T - ts] + #accels = [sign*abs(a), -sign*abs(a)] + accels = [a, -a] + p_curve = curve_from_controls(durations, accels, t0=0., x0=x1, v0=v1) + #return p_curve + check_curve(p_curve, x1, x2, v1, v2, T, v_max=v_max, a_max=a_max) + return p_curve + +def quickest_two_ramp(x1, x2, v1, v2, a_max, v_max=INF): + #optimize_two_ramp(x1, x2, v1, v2, a_max) + solutions = np.roots([ + a_max, # t**2 + 2 * v1, # t + (v1**2 - v2**2) / (2 * a_max) + (x1 - x2), # 1 + ]) + solutions = [t for t in solutions if check_time(t)] + #solutions = [t for t in solutions if t <= abs(v2 - v1) / abs(a_max)] # TODO: omitting this constraint from Hauser (abs(v2 - v1) might be 0) + solutions = [t for t in solutions if t <= abs(v_max) / abs(a_max)] # Maybe this is what Hauser meant? + solutions = [t for t in solutions if abs(v1 + t*a_max) <= abs(v_max) + EPSILON] # TODO: check v2 + if not solutions: + return None + t = min(solutions) + T = 2*t + (v1 - v2) / a_max + if T < 0: + return None + #min_two_ramp(x1, x2, v1, v2, T, a_max, v_max=v_max) + return T + +################################################## + +def solve_three_stage(x1, x2, v1, v2, v_max, a): + tp1 = (v_max - v1) / a + tl = (v2 ** 2 + v1 ** 2 - 2 * v_max ** 2) / (2 * v_max * a) \ + + (x2 - x1) / v_max + tp2 = (v2 - v_max) / -a # Difference from Hauser + return tp1, tl, tp2 + + +def min_three_stage(x1, x2, v1, v2, T, v_max, a_max=INF): + #assert abs(v_max) < INF + a = (v_max**2 - v_max*(v1 + v2) + (v1**2 + v2**2)/2) \ + / (T*v_max - (x2 - x1)) + if np.isnan(a) or (abs(a) > abs(a_max) + EPSILON) or (a == 0): + return None + durations = solve_three_stage(x1, x2, v1, v2, v_max, a) + if any(t <= 0 for t in durations): # TODO: check T + return None + accels = [a, 0., -a] + p_curve = curve_from_controls(durations, accels, t0=0., x0=x1, v0=v1) + check_curve(p_curve, x1, x2, v1, v2, T, v_max=INF, a_max=INF) + return p_curve + + +def quickest_three_stage(x1, x2, v1, v2, v_max, a_max): + # http://motion.pratt.duke.edu/papers/icra10-smoothing.pdf + # https://github.com/Puttichai/parabint/blob/2662d4bf0fbd831cdefca48863b00d1ae087457a/parabint/optimization.py + # TODO: minimum-switch-time constraint + #assert np.positive(v_max).all() and np.positive(a_max).all() + # P+L+P- + ts = solve_three_stage(x1, x2, v1, v2, v_max, a_max) + if any(t < 0 for t in ts): + return None + T = sum(ts) + #min_three_ramp(x1, x2, v1, v2, v_max, a_max, T) + return T + +################################################## + +def min_stage(x1, x2, v1, v2, T, v_max=INF, a_max=INF): + # if (v1 == 0.) and (v2 == 0.): + # # TODO: isn't necessarily a straight line in multi-dimensions + # candidates = [ + # zero_two_ramp(x1, x2, T, v_max=v_max, a_max=a_max), + # zero_three_stage(x1, x2, T, v_max=v_max, a_max=a_max), + # ] + # else: + candidates = [ + min_two_ramp(x1, x2, v1, v2, T, a_max=a_max, v_max=v_max), + min_two_ramp(x1, x2, v1, v2, T, a_max=-a_max, v_max=-v_max), + ] + #if v_max != INF: + candidates.extend([ + min_three_stage(x1, x2, v1, v2, T, v_max, a_max), + min_three_stage(x1, x2, v1, v2, T, -v_max, -a_max), + ]) + candidates = [t for t in candidates if t is not None] + if not candidates: + return None + return min(candidates, key=lambda c: (spline_duration(c), acceleration_cost(c))) + +def min_spline(times, positions, velocities, **kwargs): + assert len(times) == len(positions) == len(velocities) + # if not strictly_increasing(times): + # print(times) + # print(positions) + # input() + splines = [] + for (t1, x1, v1), (t2, x2, v2) in get_pairs(list(zip(times, positions, velocities))): + T = t2 - t1 + if T == 0: # TODO: check x1/x2 continuity etc. + continue + spline = min_stage(x1, x2, v1, v2, T, **kwargs) + if spline is None: + return None + splines.append(spline) + return append_polys(*splines) + +def solve_multi_poly(times, positions, velocities, v_max, a_max, **kwargs): + assert len(times) == len(positions) == len(velocities) + d = len(positions[0]) + assert len(positions[0]) == len(velocities[0]) + positions = np.array(positions) + velocities = np.array(velocities) + positions_curves = [min_spline(times, positions[:, i], velocities[:, i], + v_max=v_max[i], a_max=a_max[i], **kwargs) for i in range(d)] + if any(position_curve is None for position_curve in positions_curves): + return None + return MultiPPoly(positions_curves) + +################################################## + +def quickest_stage(x1, x2, v1, v2, v_max=INF, a_max=INF, min_t=T_MIN): + # TODO: handle infinite acceleration + assert (v_max > 0.) and (a_max > 0.) + assert all(abs(v) <= (v_max + EPSILON) for v in [v1, v2]) + if (v_max == INF) and (a_max == INF): + T = 0 + return max(min_t, T) # TODO: throw an error + if a_max == INF: + T = quickest_inf_accel(x1, x2, v_max=v_max) + return max(min_t, T) + + # if (v1 == 0.) and (v2 == 0.): + # candidates = [opt_straight_line(x1, x2, v_max=v_max, a_max=a_max).x] + + candidates = [ + quickest_two_ramp(x1, x2, v1, v2, a_max, v_max=v_max), + quickest_two_ramp(x1, x2, v1, v2, -a_max, v_max=-v_max), + ] + #if v_max != INF: + candidates.extend([ + quickest_three_stage(x1, x2, v1, v2, v_max, a_max), + quickest_three_stage(x1, x2, v1, v2, -v_max, -a_max), + ]) + candidates = [t for t in candidates if t is not None] + if not candidates: + return None + T = min(t for t in candidates) + return max(min_t, T) + +def solve_multivariate_ramp(x1, x2, v1, v2, v_max, a_max): + d = len(x1) + durations = [quickest_stage(x1[i], x2[i], v1[i], v2[i], v_max[i], a_max[i]) for i in range(d)] + if any(duration is None for duration in durations): + return None + return max(durations) + +################################################## + +def optimize_two_ramp(x1, x2, v1, v2, a_max, v_max=INF): + from scipy.optimize import LinearConstraint, NonlinearConstraint, minimize + + a_max = abs(a_max) + v_max = abs(v_max) + d = x2 - x1 + def objective(args): + t1, t2, vp = args + return t1 + t2 + def equality(args): + t1, t2, vp = args + return t1*(v1 + vp) / 2. + t2*(vp + v2) / 2. + constraints = [ + # TODO: sample value and then optimize + LinearConstraint(A=[-a_max, 0, 1], lb=-np.inf, ub=v1, keep_feasible=False), + LinearConstraint(A=[+a_max, 0, 1], lb=v1, ub=+np.inf, keep_feasible=False), + LinearConstraint(A=[0, -a_max, 1], lb=-np.inf, ub=v2, keep_feasible=False), + LinearConstraint(A=[0, +a_max, 1], lb=v2, ub=+np.inf, keep_feasible=False), + NonlinearConstraint(fun=equality, lb=d-1e-2, ub=d+1e-2, keep_feasible=False), + ] + bounds = [ + # TODO: time bound based on moving to a stop + (0, np.inf), + (0, np.inf), + (-v_max, +v_max), + ] + guess = np.zeros(3) + result = minimize(objective, x0=guess, bounds=bounds, constraints=constraints) + print(result) + raise NotImplementedError() diff --git a/plan_path/pyplanners/trajectory/retime.py b/plan_path/pyplanners/trajectory/retime.py new file mode 100644 index 0000000..b9c314b --- /dev/null +++ b/plan_path/pyplanners/trajectory/retime.py @@ -0,0 +1,382 @@ +import numpy as np + +from ..utils import INF, get_pairs, find, Interval + + +EPSILON = 1e-6 + + +def get_max_velocity(velocities, norm=INF): + return np.linalg.norm(velocities, ord=norm) + + +def check_time(t): + return not isinstance(t, complex) and (t >= 0.) + + +def filter_times(times): + valid_times = list(filter(check_time, times)) + if not valid_times: + return None + return min(valid_times) + + +def iterate_poly1d(poly1d): + return enumerate(reversed(list(poly1d))) + + +def parabolic_val(t=0., t0=0., x0=0., v0=0., a=0.): + return x0 + v0*(t - t0) + 1/2.*a*(t - t0)**2 + +################################################## + +def poly_sum(p0, *polys): + p_total = np.poly1d(p0) + for p in polys: + p_total = np.poly1d(np.polyadd(p_total, p)) + return p_total + + +def poly_prod(p0, *polys): + p_total = np.poly1d(p0) + for p in polys: + p_total = np.poly1d(np.polymul(p_total, p)) + return p_total + + +def separate_poly(poly): + from scipy.interpolate import PPoly + k, m, d = poly.c.shape + return [PPoly(c=poly.c[:,:,i], x=poly.x) for i in range(d)] + + +def append_polys(poly1, *polys): + from scipy.interpolate import PPoly + if isinstance(poly1, MultiPPoly): + return poly1.append(*polys) + total_poly = poly1 + for poly in polys: + k1, m1, d1 = total_poly.c.shape + k2, m2, d2 = poly.c.shape + assert d1 == d2 + k = max(k1, k2) + c1 = np.zeros((k, m1, d1)) + c1[-k1:, ...] = total_poly.c + c2 = np.zeros((k, m2, d2)) + c2[-k2:, ...] = poly.c + new_xs = [total_poly.x[-1] + (x - poly.x[0]) for x in poly.x[1:]] + total_poly = PPoly(c=np.append(c1, c2, axis=1), + x=np.append(total_poly.x, new_xs)) + #total_poly.extend() + return total_poly + +################################################## + +def get_times(curve): + # TODO: rename these + return curve.x + + +def spline_start(spline): + return get_times(spline)[0] + + +def spline_end(spline): + return get_times(spline)[-1] + + +def spline_duration(spline): + return spline_end(spline) - spline_start(spline) + + +def get_interval(curve, start_t=None, end_t=None): + if start_t is None: + start_t = spline_start(curve) + if end_t is None: + end_t = spline_end(curve) + start_t = max(start_t, spline_start(curve)) + end_t = min(end_t, spline_end(curve)) + assert start_t < end_t + return Interval(start_t, end_t) + + +def poly_from_spline(spline, i, d): + return np.poly1d([spline.c[c, i, d] for c in range(spline.c.shape[0])]) + +################################################## + +def curve_from_controls(durations, accels, t0=0., x0=0., v0=0.): + assert len(durations) == len(accels) + #from numpy.polynomial import Polynomial + #t = Polynomial.identity() + times = [t0] + positions = [x0] + velocities = [v0] + coeffs = [] + for duration, accel in zip(durations, accels): + assert duration >= 0. + coeff = [0.5*accel, 1.*velocities[-1], positions[-1]] # 0. jerk + coeffs.append(coeff) + times.append(times[-1] + duration) + p_curve = np.poly1d(coeff) # Not centered + positions.append(p_curve(duration)) + v_curve = p_curve.deriv() # Not centered + velocities.append(v_curve(duration)) + # print(positions) + # print(velocities) + + #np.piecewise + # max_order = max(p_curve.order for p_curve in p_curves) + # coeffs = np.zeros([max_order + 1, len(p_curves), 1]) + # for i, p_curve in enumerate(p_curves): + # # TODO: need to center + # for k, c in iterate_poly1d(p_curve): + # coeffs[max_order - k, i] = c + from scipy.interpolate import PPoly + # TODO: check continuity + #from scipy.interpolate import CubicHermiteSpline + return PPoly(c=np.array(coeffs).T, x=times) # TODO: spline.extend + +################################################## + +def min_linear_spline(x1, x2, v_max, a_max, t0=0.): + #if x1 > x2: + # return conservative(x2, x1, v_max, a_max) + assert (v_max >= 0) and (a_max >= 0) # and (x2 >= x1) + sign = +1 if x2 >= x1 else -1 + v1 = v2 = 0. + x_half = (x1 + x2) / 2. + + position_curve = np.poly1d([sign*0.5*a_max, v1, x1]) + velocity_curve = position_curve.deriv() + t_half = filter_times((position_curve - np.poly1d([x_half])).roots) + # solutions = np.roots([ + # 0.5*a_max, + # v1, + # x1 - x_half, + # ]) + if (t_half is not None) and (abs(velocity_curve(t_half)) <= v_max): + # TODO: could separate out + durations = [t_half, t_half] + accels = [sign * a_max, -sign * a_max] + spline = curve_from_controls(durations, accels, t0=t0, x0=x1, v0=v1) + # T = 2*t_half + # times = [0., t_half, T] + # c = np.zeros([3, len(times) - 1]) + # c[:, 0] = list(position_curve) + # c[:, 1] = [-0.5*accels[1], velocity_curve(t_half), position_curve(t_half)] + # spline = PPoly(c=c, x=times) + return spline + + t_ramp = filter_times((velocity_curve - np.poly1d([sign * v_max])).roots) + assert t_ramp is not None + x_ramp = position_curve(t_ramp) + d = abs(x2 - x1) + d_ramp = abs(x_ramp - x1) + d_hold = d - 2*d_ramp + t_hold = abs(d_hold / v_max) + + durations = [t_ramp, t_hold, t_ramp] + accels = [sign * a_max, 0., -sign * a_max] + spline = curve_from_controls(durations, accels, t0=t0, x0=x1, v0=v1) + + # T = 2*t_ramp + t_hold + # times = [0., t_ramp, t_ramp + t_hold, T] + # c = np.zeros([3, len(times) - 1]) + # c[:, 0] = list(position_curve) + # c[:, 1] = [0.5 * accels[1], velocity_curve(t_ramp), position_curve(t_ramp)] + # c[:, 2] = [0.5 * accels[2], velocity_curve(t_ramp), position_curve(t_ramp) + velocity_curve(t_ramp)*t_hold] + # spline = PPoly(c=c, x=times) # TODO: extend + return spline + +################################################## + +def trim_end(poly, end): + from scipy.interpolate import PPoly + times = poly.x + if end >= times[-1]: + return poly + if end <= times[0]: + return None + last = find(lambda i: times[i] <= end, reversed(range(len(times)))) + times = list(times[:last+1]) + [end] + c = poly.c[:,:last+1,...] + return PPoly(c=c, x=times) + +def trim_start(poly, start): + from scipy.interpolate import PPoly, CubicHermiteSpline #, BPoly + #PPoly.from_bernstein_basis + #BPoly.from_derivatives + times = poly.x + if start <= times[0]: + return poly + if start >= times[-1]: + return None + + first = find(lambda i: times[i] >= start, range(len(times))) + ts = [start, times[first]] # + start) / 2.] + ps = [poly(t) for t in ts] + derivative = poly.derivative() + vs = [derivative(t) for t in ts] + correction = CubicHermiteSpline(ts, ps, dydx=vs) + + times = [start] + list(times[first:]) + c = poly.c[:,first-1:,...] + c[:,0,...] = correction.c[-poly.c.shape[0]:,0,...] # TODO: assert that the rest are zero + poly = PPoly(c=c, x=times) + return poly + +def trim(poly, start=None, end=None): + if isinstance(poly, MultiPPoly): + return poly.trim(start=start, end=end) + if end is None: + end = spline_end(poly) + if start is None: + start = spline_start(poly) + assert start <= end + poly = trim_end(poly, end) + poly = trim_start(poly, start) + return poly + +################################################## + +class MultiPPoly(object): + def __init__(self, polys): + self.polys = list(polys) + self.x = sorted(np.concatenate([poly.x for poly in self.polys])) + self.x = [self.x[0]] + [x2 for x1, x2 in get_pairs(self.x) if x2 > x1 + 1e-9] + # TODO: cache derivatives + @property + def d(self): + return len(self.polys) + @property + def start_x(self): + return spline_start(self) + @property + def end_x(self): + return spline_end(self) + def __call__(self, *args, **kwargs): + return np.array([poly(*args, **kwargs) for poly in self.polys]) + def trim(self, *args, **wkargs): + return MultiPPoly([trim(poly, *args, **wkargs) for poly in self.polys]) + #def append(self, new_polys): + # assert len(self.polys) == len(new_polys) + # return MultiPPoly([append_polys(poly, new_poly) for poly, new_poly in zip(self.polys, new_polys)]) + def append(self, *multi_polys): + d = len(self.polys) + new_polys = [] + for k in range(d): + new_polys.append(append_polys(self.polys[k], *[multi_poly.polys[k] for multi_poly in multi_polys])) + return MultiPPoly(new_polys) + @staticmethod + def from_poly(poly): + from scipy.interpolate import PPoly + if isinstance(poly, MultiPPoly): + return poly + assert len(poly.c.shape) == 3 + d = poly.c.shape[2] + return MultiPPoly([PPoly(c=poly.c[...,k], x=poly.x) for k in range(d)]) + @staticmethod + def concatenate(self, polys): + raise NotImplementedError() + #return MultiPPoly() + # def slice(self, start, stop=None): + # raise NotImplementedError() + # TODO: extend + def derivative(self, *args, **kwargs): + return MultiPPoly([poly.derivative(*args, **kwargs) for poly in self.polys]) + def antiderivative(self, *args, **kwargs): + return MultiPPoly([poly.antiderivative(*args, **kwargs) for poly in self.polys]) + def roots(self, *args, **kwargs): + # TODO: roots per poly + return np.array([poly.roots(*args, **kwargs) for poly in self.polys]) + def spline(self, **kwargs): + from scipy.interpolate import CubicSpline + times = self.x + positions = [self(x) for x in times] + return CubicSpline(times, positions, bc_type='clamped', **kwargs) + def hermite_spline(self, **kwargs): + from scipy.interpolate import CubicHermiteSpline + times = self.x + positions = [self(x) for x in times] + derivative = self.derivative() + velocities = [derivative(x) for x in times] + return CubicHermiteSpline(times, positions, dydx=velocities, **kwargs) + def __str__(self): + return '{}({})'.format(self.__class__.__name__, self.polys) + +################################################## + +class Curve(object): + def __init__(self, poly): # scipy.interpolate.PPoly + # TODO: adjust start time + # https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.PPoly.html#scipy.interpolate.PPoly + self.poly = poly + # TODO: record antiderivatives + @property + def degree(self): + k, m, d = self.poly.c.shape + return k + @property + def num_intervals(self): + k, m, d = self.poly.c.shape + return m + @property + def dim(self): + k, m, d = self.poly.c.shape + return d + @property + def start_t(self): + return spline_start(self.poly) + @property + def end_t(self): + return spline_end(self.poly) + @property + def duration(self): # spline_duration + return self.end_t - self.start_t + @property + def breakpoints(self): + return self.poly.x + def at(self, *args, **kwargs): + return self.poly(*args, **kwargs) + def __call__(self, *args, **kwargs): + return self.at(*args, **kwargs) + # TODO: way of inheriting these instead + def extrema(self, **kwargs): + return find_extrema(self.poly, **kwargs) + def derivative(self, *args, **kwargs): + return Curve(self.poly.derivative(*args, **kwargs)) + def antiderivative(self, *args, **kwargs): + return Curve(self.poly.antiderivative(*args, **kwargs)) + def roots(self, *args, **kwargs): + return self.poly.roots(*args, **kwargs) + def solve(self, *args, **kwargs): + # TODO: solve for a bunch of y + return self.poly.solve_tamp(*args, **kwargs) + def sample_times(self, dt=1./60): + return np.append(np.arange(self.start_t, self.end_t, step=dt), [self.end_t]) + def sample(self, *args, **kwargs): + for t in self.sample_times(*args, **kwargs): + yield self.at(t) + def __str__(self): + return '{}(d={}, t=[{:.2f},{:.2f}])'.format( + self.__class__.__name__, self.dim, self.start_t, self.end_t) + +################################################## + +def filter_extrema(curve, times, start_t=None, end_t=None): + # TODO: unify with filter_times + start_t, end_t = get_interval(curve, start_t=start_t, end_t=end_t) + return sorted(t for t in set(times) if not np.isnan(t) and (start_t <= t <= end_t)) + + +def find_extrema(curve, discontinuity=True, **kwargs): + derivative = curve.derivative(nu=1) + times = [] + roots = derivative.roots(discontinuity=discontinuity) + for r in roots: + if r.shape: + times.extend(r) + else: + times.append(r) + return filter_extrema(curve, times, **kwargs) \ No newline at end of file diff --git a/plan_path/pyplanners/trajectory/smooth.py b/plan_path/pyplanners/trajectory/smooth.py new file mode 100644 index 0000000..9cc0171 --- /dev/null +++ b/plan_path/pyplanners/trajectory/smooth.py @@ -0,0 +1,337 @@ +import random +import time + +import numpy as np + +from .linear import find_lower_bound, solve_linear, T_MIN +from .limits import check_spline +from .discretize import time_discretize_curve, derivative_discretize_curve, distance_discretize_curve, sample_discretize_curve +from .parabolic import solve_multi_poly, solve_multivariate_ramp +from .retime import EPSILON, trim, spline_duration, append_polys, get_interval, find_extrema +from ..utils import INF, elapsed_time, get_pairs, find, default_selector, waypoints_from_path, irange + +def within_velocity_limits(position_curve, max_v=None, **kwargs): + if max_v is None: + return True + velocity_curve = position_curve.derivative(nu=1) + extrema = find_extrema(velocity_curve, **kwargs) + return all(np.less_equal(np.absolute(velocity_curve(t)), max_v).all() for t in extrema) + + +def within_acceleration_limits(position_curve, max_a=None, **kwargs): + velocity_curve = position_curve.derivative(nu=1) + return within_velocity_limits(velocity_curve, max_v=max_a, **kwargs) + + +def within_dynamical_limits(position_curve, max_v=None, max_a=None, **kwargs): + return within_velocity_limits(position_curve, max_v=max_v, **kwargs) and \ + within_acceleration_limits(position_curve, max_v=max_a, **kwargs) + +################################################## + +def get_curve_collision_fn(collision_fn=lambda q: False, max_velocities=None, max_accelerations=None): # a_max + + def curve_collision_fn(curve, t0=None, t1=None): + # TODO: stage the function to check all the easy things like joint limits first + if curve is None: + return True + #if not within_dynamical_limits(curve, max_v=max_velocities, max_a=max_accelerations, start_t=t0, end_t=t1): + # return True + # TODO: can exactly compute limit violations + # if not check_spline(curve, v_max=max_velocities, a_max=None, verbose=False, + # #start_t=t0, end_t=t1, + # ): + # return True + # _, samples = time_discretize_curve(curve, verbose=False, start_t=t0, end_t=t1, #max_velocities=v_max) + _, samples = distance_discretize_curve(curve, start_t=t0, end_t=t1) + if any(map(collision_fn, default_selector(samples))): + return True + return False + return curve_collision_fn + +################################################## + +def smooth_curve(start_curve, v_max, a_max, curve_collision_fn, + sample=True, intermediate=True, cubic=True, refit=True, num=1000, min_improve=0., max_time=INF): + # TODO: rename smoothing.py to shortcutting.py + # TODO: default v_max and a_max + assert (num < INF) or (max_time < INF) + assert refit or intermediate + # TODO: https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.UnivariateSpline.html + #from scipy.interpolate import UnivariateSpline, LSQUnivariateSpline, LSQBivariateSpline + from scipy.interpolate import CubicHermiteSpline + start_time = time.time() + + if curve_collision_fn(start_curve, t0=None, t1=None): + #return None + return start_curve + curve = start_curve + for iteration in irange(num): + if elapsed_time(start_time) >= max_time: + break + times = curve.x + durations = [0.] + [t2 - t1 for t1, t2 in get_pairs(times)] # includes start + positions = [curve(t) for t in times] + velocities = [curve(t, nu=1) for t in times] + + # ts = [times[0], times[-1]] + # t1, t2 = curve.x[0], curve.x[-1] + t1, t2 = np.random.uniform(times[0], times[-1], 2) # TODO: sample based on position + if t1 > t2: # TODO: minimum distance from a knot + t1, t2 = t2, t1 + + ts = [t1, t2] + i1 = find(lambda i: times[i] <= t1, reversed(range(len(times)))) # index before t1 + i2 = find(lambda i: times[i] >= t2, range(len(times))) # index after t2 + assert i1 != i2 + + local_positions = [curve(t) for t in ts] + local_velocities = [curve(t, nu=1) for t in ts] + #print(local_velocities, v_max) + assert all(np.less_equal(np.absolute(v), v_max + EPSILON).all() for v in local_velocities) + #if any(np.greater(np.absolute(v), v_max).any() for v in local_velocities): + # continue # TODO: do the same with collisions + x1, x2 = local_positions + v1, v2 = local_velocities + + #min_t = 0 + min_t = find_lower_bound(x1, x2, v1, v2, v_max=v_max, a_max=a_max) + #min_t = optimistic_time(x1, x2, v_max=v_max, a_max=a_max) + current_t = (t2 - t1) - min_improve + if min_t >= current_t: # TODO: also limit the distance/duration between these two points + continue + + #best_t = min_t + if sample: + max_t = current_t + ramp_t = solve_multivariate_ramp(x1, x2, v1, v2, v_max, a_max) + ramp_t = INF if ramp_t is None else ramp_t + max_t = min(max_t, ramp_t) + best_t = random.uniform(min_t, max_t) + else: + best_t = solve_multivariate_ramp(x1, x2, v1, v2, v_max, a_max) + if (best_t is None) or (best_t >= current_t): + continue + #best_t += 1e-3 + #print(min_t, best_t, current_t) + local_durations = [t1 - times[i1], best_t, times[i2] - t2] + #local_times = [0, best_t] + local_times = [t1, (t1 + best_t)] # Good if the collision function is time sensitive + + if intermediate: + if cubic: + local_curve = CubicHermiteSpline(local_times, local_positions, dydx=local_velocities) + else: + local_curve = solve_multi_poly(times=local_times, positions=local_positions, + velocities=local_velocities, + v_max=v_max, a_max=a_max) + if (local_curve is None) or (spline_duration(local_curve) >= current_t) \ + or curve_collision_fn(local_curve, t0=None, t1=None): + continue + # print(new_curve.hermite_spline().c[0,...]) + local_positions = [local_curve(x) for x in local_curve.x] + local_velocities = [local_curve(x, nu=1) for x in local_curve.x] + local_durations = [t1 - times[i1]] + [x - local_curve.x[0] + for x in local_curve.x[1:]] + [times[i2] - t2] + + if refit: + new_durations = np.concatenate([ + durations[:i1 + 1], local_durations, durations[i2 + 1:]]) + # assert len(new_durations) == (i1 + 1) + (len(durations) - i2) + 2 + new_times = np.cumsum(new_durations) + # new_times = [new_times[0]] + [t2 for t1, t2 in get_pairs(new_times) if t2 > t1] + new_positions = positions[:i1 + 1] + local_positions + positions[i2:] + new_velocities = velocities[:i1 + 1] + local_velocities + velocities[i2:] + # if not all(np.less_equal(np.absolute(v), v_max).all() for v in new_velocities): + # continue + if cubic: + # new_curve = CubicSpline(new_times, new_positions) + new_curve = CubicHermiteSpline(new_times, new_positions, dydx=new_velocities) + else: + new_curve = solve_multi_poly(new_times, new_positions, new_velocities, v_max, a_max) + if (new_curve is None) or (spline_duration(new_curve) >= spline_duration(curve)) \ + or not check_spline(new_curve, v_max, a_max) or \ + (not intermediate and curve_collision_fn(new_curve, t0=None, t1=None)): + continue + else: + assert intermediate + # print(curve.x) + # print(curve.c[...,0]) + # pre_curve = trim(curve, end=t1) + # post_curve = trim(curve, start=t1) + # curve = append_polys(pre_curve, post_curve) + # print(curve.x) + # print(curve.c[...,0]) + + # print(new_curve.x) + # print(new_curve.c[...,0]) + pre_curve = trim(curve, end=t1) + post_curve = trim(curve, start=t2) + new_curve = append_polys(pre_curve, local_curve, post_curve) # TODO: the numerics are throwing this off? + # print(new_curve.x) + # print(new_curve.c[...,0]) + #assert(not curve_collision_fn(new_curve, t0=None, t1=None)) + if (spline_duration(new_curve) >= spline_duration(curve)) or \ + not check_spline(new_curve, v_max, a_max): + continue + print('Iterations: {} | Current time: {:.3f} | New time: {:.3f} | Elapsed time: {:.3f}'.format( + iteration, spline_duration(curve), spline_duration(new_curve), elapsed_time(start_time))) + curve = new_curve + print('Iterations: {} | Start time: {:.3f} | End time: {:.3f} | Elapsed time: {:.3f}'.format( + num, spline_duration(start_curve), spline_duration(curve), elapsed_time(start_time))) + check_spline(curve, v_max, a_max) + return curve + +################################################## + +def smooth_cubic(path, collision_fn, resolutions, v_max=None, a_max=None, time_step=1e-2, + parabolic=True, sample=False, intermediate=True, max_iterations=1000, max_time=INF, + min_improve=0., verbose=False): + start_time = time.time() + if path is None: + return None + assert (v_max is not None) or (a_max is not None) + assert path and (max_iterations < INF) or (max_time < INF) + from scipy.interpolate import CubicHermiteSpline + + def curve_collision_fn(segment, t0=None, t1=None): + #if not within_dynamical_limits(curve, max_v=v_max, max_a=a_max, start_t=t0, end_t=t1): + # return True + _, samples = sample_discretize_curve(segment, resolutions, start_t=t0, end_t=t1, time_step=time_step) + if any(map(collision_fn, default_selector(samples))): + return True + return False + + start_positions = waypoints_from_path(path) # TODO: ensure following the same path (keep intermediate if need be) + if len(start_positions) == 1: + start_positions.append(start_positions[-1]) + + start_durations = [0] + [solve_linear(np.subtract(p2, p1), v_max, a_max, t_min=T_MIN, only_duration=True) + for p1, p2 in get_pairs(start_positions)] # TODO: does not assume continuous acceleration + start_times = np.cumsum(start_durations) # TODO: dilate times + start_velocities = [np.zeros(len(start_positions[0])) for _ in range(len(start_positions))] + start_curve = CubicHermiteSpline(start_times, start_positions, dydx=start_velocities) + # TODO: directly optimize for shortest spline + if len(start_positions) <= 2: + return start_curve + + curve = start_curve + for iteration in irange(max_iterations): + if elapsed_time(start_time) >= max_time: + break + times = curve.x + durations = [0.] + [t2 - t1 for t1, t2 in get_pairs(times)] + positions = [curve(t) for t in times] + velocities = [curve(t, nu=1) for t in times] + + t1, t2 = np.random.uniform(times[0], times[-1], 2) + if t1 > t2: + t1, t2 = t2, t1 + ts = [t1, t2] + i1 = find(lambda i: times[i] <= t1, reversed(range(len(times)))) # index before t1 + i2 = find(lambda i: times[i] >= t2, range(len(times))) # index after t2 + assert i1 != i2 + + local_positions = [curve(t) for t in ts] + local_velocities = [curve(t, nu=1) for t in ts] + if not all(np.less_equal(np.absolute(v), np.array(v_max) + EPSILON).all() for v in local_velocities): + continue + + x1, x2 = local_positions + v1, v2 = local_velocities + + current_t = (t2 - t1) - min_improve # TODO: percent improve + #min_t = 0 + min_t = find_lower_bound(x1, x2, v1, v2, v_max=v_max, a_max=a_max) + if parabolic: + # Softly applies limits + min_t = solve_multivariate_ramp(x1, x2, v1, v2, v_max, a_max) # TODO: might not be feasible (soft constraint) + if min_t is None: + continue + if min_t >= current_t: + continue + best_t = random.uniform(min_t, current_t) if sample else min_t + + local_durations = [t1 - times[i1], best_t, times[i2] - t2] + #local_times = [0, best_t] + local_times = [t1, (t1 + best_t)] # Good if the collision function is time varying + + if intermediate: + local_curve = CubicHermiteSpline(local_times, local_positions, dydx=local_velocities) + if curve_collision_fn(local_curve, t0=None, t1=None): # check_spline + continue + #local_positions = [local_curve(x) for x in local_curve.x] + #local_velocities = [local_curve(x, nu=1) for x in local_curve.x] + local_durations = [t1 - times[i1]] + [x - local_curve.x[0] for x in local_curve.x[1:]] + [times[i2] - t2] + + new_durations = np.concatenate([durations[:i1 + 1], local_durations, durations[i2 + 1:]]) + new_times = np.cumsum(new_durations) + new_positions = positions[:i1 + 1] + local_positions + positions[i2:] + new_velocities = velocities[:i1 + 1] + local_velocities + velocities[i2:] + + new_curve = CubicHermiteSpline(new_times, new_positions, dydx=new_velocities) + if not intermediate and curve_collision_fn(new_curve, t0=None, t1=None): + continue + if verbose: + print('Iterations: {} | Current time: {:.3f} | New time: {:.3f} | Elapsed time: {:.3f}'.format( + iteration, spline_duration(curve), spline_duration(new_curve), elapsed_time(start_time))) + curve = new_curve + if verbose: + print('Iterations: {} | Start time: {:.3f} | End time: {:.3f} | Elapsed time: {:.3f}'.format( + max_iterations, spline_duration(start_curve), spline_duration(curve), elapsed_time(start_time))) + return curve + +################################################## + +DERIVATIVE_NAMES = [ + 'Position', + 'Velocity', + 'Acceleration', + 'Jerk', +] + +def plot_curve(positions_curve, derivative=0, dt=1e-3): + import matplotlib.pyplot as plt + # test_scores_mean, test_scores_std = estimate_gaussian(test_scores) + # width = scale * test_scores_std # standard deviation + # # TODO: standard error (confidence interval) + # # from learn_tools.active_learner import tail_confidence + # # alpha = 0.95 + # # scale = tail_confidence(alpha) + # # width = scale * test_scores_std / np.sqrt(train_sizes) + # plt.fill_between(train_sizes, test_scores_mean - width, test_scores_mean + width, alpha=0.1) + + colors = plt.rcParams['axes.prop_cycle'].by_key()['color'] # Default color order + curve = positions_curve.derivative(nu=derivative) + + start_t, end_t = get_interval(positions_curve, start_t=None, end_t=None) + times = np.append(np.arange(start_t, end_t, step=dt), [end_t]) + for i, coords in enumerate(zip(*[curve(t) for t in times])): + plt.plot(times, coords, color=colors[i], label='x[{}]'.format(i)) #, marker='o-') + + if derivative == 0: + #discretized_times = np.append(np.arange(start_t, end_t, step=5e1*dt), [end_t]) + resolution = 5e-2 + #discretized_times, _ = time_discretize_curve(curve, resolution=resolution) + #discretized_times, _ = derivative_discretize_curve(curve, resolution=resolution) + discretized_times, _ = distance_discretize_curve(curve, resolution=resolution) + print('Discretize steps:', np.array(discretized_times)) + for i, coords in enumerate(zip(*[curve(t) for t in discretized_times])): + plt.plot(discretized_times, coords, color=colors[i], label='x[{}]'.format(i), marker='x') # o | + | x + + for t in curve.x: + plt.axvline(x=t, color='black') + extrema = find_extrema(curve) + print('Extrema:', np.array(extrema)) + #plt.vlines(extrema) + for t in extrema: + plt.axvline(x=t, color='green') + + plt.xlabel('Time') + plt.ylabel(DERIVATIVE_NAMES[derivative]) + ax = plt.subplot() + ax.autoscale(tight=True) + plt.legend(loc='best') # 'upper left' + plt.grid() + plt.show() + #return curve diff --git a/plan_path/pyplanners/transform.py b/plan_path/pyplanners/transform.py new file mode 100644 index 0000000..f527930 --- /dev/null +++ b/plan_path/pyplanners/transform.py @@ -0,0 +1,60 @@ +''' +Transformation utilities +''' + +import numpy as np +from scipy.spatial.transform import Rotation + + +def get_transform_matrix(state): + ''' + Get transformation matrix of the given state and center of mass + ''' + if len(state) == 3: # translation only + transform = np.eye(4) + transform[:3, 3] = state + return transform + elif len(state) == 6: # translation + rotation + translation, rotation = state[:3], state[3:] + rotation = Rotation.from_euler('xyz', rotation).as_matrix() + transform = np.eye(4) + transform[:3, :3] = rotation + transform[:3, 3] = translation + return transform + else: + raise NotImplementedError + + +def transform_pts_by_matrix(pts, matrix): + ''' + Transform an array of xyz pts (n, 3) by a 4x4 matrix + ''' + pts = np.array(pts) + if len(pts.shape) == 1: + if len(pts) == 3: + v = np.append(pts, 1.0) + elif len(pts) == 4: + v = pts + else: + raise NotImplementedError + v = matrix @ v + return v[0:3] + elif len(pts.shape) == 2: + # transpose first + if pts.shape[1] == 3: + # pad the points with ones to be (n, 4) + v = np.hstack([pts, np.ones((len(pts), 1))]).T + elif pts.shape[1] == 4: + v = pts.T + else: + raise NotImplementedError + v = matrix @ v + # transpose and crop back to (n, 3) + return v.T[:, 0:3] + else: + raise NotImplementedError + + +def transform_pts_by_state(pts, state): + matrix = get_transform_matrix(state) + return transform_pts_by_matrix(pts, matrix) \ No newline at end of file diff --git a/plan_path/pyplanners/utils.py b/plan_path/pyplanners/utils.py new file mode 100644 index 0000000..c0e85df --- /dev/null +++ b/plan_path/pyplanners/utils.py @@ -0,0 +1,401 @@ +from random import shuffle +from itertools import islice +from collections import deque, defaultdict, namedtuple +import time +import contextlib +import pstats +import cProfile +import random + +import numpy as np + +INF = float('inf') +PI = np.pi + + +# TODO: deprecate these defaults +RRT_ITERATIONS = 20 +RRT_RESTARTS = 2 +RRT_SMOOTHING = 20 + + +try: + user_input = raw_input +except NameError: + user_input = input + + +RED = (1, 0, 0) +GREEN = (0, 1, 0) +BLUE = (0, 0, 1) + + +Interval = namedtuple('Interval', ['lower', 'upper']) # AABB +UNIT_LIMITS = Interval(0., 1.) +CIRCULAR_LIMITS = Interval(-PI, PI) +UNBOUNDED_LIMITS = Interval(-INF, INF) + +################################################## + +def apply_alpha(color, alpha=1.): + return tuple(color[:3]) + (alpha,) + + +def irange(start, stop=None, step=1): # np.arange + if stop is None: + stop = start + start = 0 + while start < stop: + yield start + start += step + + +def negate(test): + return lambda *args, **kwargs: not test(*args, **kwargs) + + +def clip(value, min_value=-INF, max_value=+INF): + return min(max(min_value, value), max_value) + + +def argmin(function, sequence): + # TODO: use min + values = list(sequence) + scores = [function(x) for x in values] + return values[scores.index(min(scores))] + + +def get_pairs(sequence): + sequence = list(sequence) + return list(zip(sequence[:-1], sequence[1:])) + + +def merge_dicts(*args): + result = {} + for d in args: + result.update(d) + return result + # return dict(reduce(operator.add, [d.items() for d in args])) + + +def flatten(iterable_of_iterables): + return (item for iterables in iterable_of_iterables for item in iterables) + + +def randomize(sequence): + sequence = list(sequence) + shuffle(sequence) + return sequence + + +def is_even(num): + return num % 2 == 0 + + +def is_odd(num): + return num % 2 == 1 + + +def bisect(sequence): + sequence = list(sequence) + indices = set() + queue = deque([(0, len(sequence)-1)]) + while queue: + lower, higher = queue.popleft() + if lower > higher: + continue + index = int((lower + higher) / 2.) + assert index not in indices + #if is_even(higher - lower): + yield sequence[index] + queue.extend([ + (lower, index-1), + (index+1, higher), + ]) + + +def take(iterable, n=INF): + if n == INF: + n = None # NOTE - islice takes None instead of INF + elif n is None: + n = 0 # NOTE - for some of the uses + return islice(iterable, n) + + +def enum(*sequential, **named): + enums = dict(zip(sequential, range(len(sequential))), **named) + enums['names'] = sorted(enums.keys(), key=lambda k: enums[k]) + return type('Enum', (), enums) + + +def elapsed_time(start_time): + return time.time() - start_time + + +@contextlib.contextmanager +def profiler(field='tottime', num=10): + pr = cProfile.Profile() + pr.enable() + yield + pr.disable() + pstats.Stats(pr).sort_stats(field).print_stats(num) # cumtime | tottime + + +def inf_sequence(): + return iter(int, 1) + + +def find(test, sequence): + for item in sequence: + if test(item): + return item + raise RuntimeError() + + +def get_sign(x): + if x > 0: + return +1 + if x < 0: + return -1 + return x + + +def strictly_increasing(sequence): + return all(x2 > x1 for x1, x2 in get_pairs(sequence)) + +################################################## + +def get_delta(q1, q2): + return np.array(q2) - np.array(q1) + + +def get_difference(q2, q1): + return get_delta(q1, q2) + + +def get_distance(q1, q2): + return np.linalg.norm(get_delta(q1, q2)) + + +def get_unit_vector(vec): + norm = np.linalg.norm(vec) + if norm == 0: + return vec + return np.array(vec) / norm + + +def is_path(path): + return path is not None + + +def compute_path_cost(path, cost_fn=get_distance): + if not is_path(path): + return INF + #path = waypoints_from_path(path) + return sum(cost_fn(*pair) for pair in get_pairs(path)) + + +def get_length(path): + if not is_path(path): + return INF + return len(path) + + +def remove_redundant(path, tolerance=1e-3): + assert path + new_path = [path[0]] + for conf in path[1:]: + difference = get_difference(new_path[-1], np.array(conf)) + if not np.allclose(np.zeros(len(difference)), difference, atol=tolerance, rtol=0): + new_path.append(conf) + return new_path + + +def waypoints_from_path(path, difference_fn=None, tolerance=1e-3): + if difference_fn is None: + difference_fn = get_difference + path = remove_redundant(path, tolerance=tolerance) + if len(path) < 2: + return path + waypoints = [path[0]] + last_conf = path[1] + last_difference = get_unit_vector(difference_fn(last_conf, waypoints[-1])) + for conf in path[2:]: + difference = get_unit_vector(difference_fn(conf, waypoints[-1])) + if not np.allclose(last_difference, difference, atol=tolerance, rtol=0): + waypoints.append(last_conf) + difference = get_unit_vector(difference_fn(conf, waypoints[-1])) + last_conf = conf + last_difference = difference + waypoints.append(last_conf) + return waypoints + + +def refine_waypoints(waypoints, extend_fn): + #if len(waypoints) <= 1: + # return waypoints + return list(flatten(extend_fn(q1, q2) for q1, q2 in get_pairs(waypoints))) # [waypoints[0]] + + +################################################## + +def convex_combination(x, y, w=0.5): + return (1-w)*np.array(x) + w*np.array(y) + + +def uniform_generator(d): + while True: + yield np.random.uniform(size=d) + + +def halton_generator(d, seed=None): + # TODO: randomly sample an initial point and then wrap around + # TODO: apply random noise on top + # https://ghalton.readthedocs.io/en/latest/ + import ghalton + if seed is None: + seed = random.randint(0, 100-1) # ghalton.EA_PERMS[d-1] + #ghalton.PRIMES, ghalton.EA_PERMS + #sequencer = ghalton.Halton(d) + #sequencer = ghalton.GeneralizedHalton(d, seed) # TODO: seed not working + sequencer = ghalton.GeneralizedHalton(ghalton.EA_PERMS[:d]) + #sequencer.reset() + #sequencer.seed(seed) # TODO: seed not working + sequencer.get(seed) # Burn this number of values + while True: + [weights] = sequencer.get(1) + yield np.array(weights) + + +def unit_generator(d, use_halton=False, **kwargs): + # TODO: mixture generator + if use_halton: + try: + import ghalton + except ImportError: + print('ghalton is not installed (https://pypi.org/project/ghalton/)') + use_halton = False + return halton_generator(d, **kwargs) if use_halton else uniform_generator(d) + + +def interval_generator(lower, upper, **kwargs): + assert len(lower) == len(upper) + assert np.less_equal(lower, upper).all() + if np.equal(lower, upper).all(): + return iter([lower]) + return (convex_combination(lower, upper, w=weights) + for weights in unit_generator(d=len(lower), **kwargs)) + +################################################## + +def forward_selector(path): + return path + + +def backward_selector(path): + return reversed(list(path)) + + +def random_selector(path): + return randomize(path) + + +def bisect_selector(path): + return bisect(path) + + +default_selector = bisect_selector # random_selector + +################################################## + +def is_hashable(value): + #return isinstance(value, Hashable) # TODO: issue with hashable and numpy 2.7.6 + try: + hash(value) + except TypeError: + return False + return True + +def value_or_id(value): + if is_hashable(value): + return value + return id(value) + +################################################## + +def incoming_from_edges(edges): + incoming_vertices = defaultdict(set) + for v1, v2 in edges: + incoming_vertices[v2].add(v1) + return incoming_vertices + + +def outgoing_from_edges(edges): + # neighbors_from_index = {v: set() for v in vertices} + # for v1, v2 in edges: + # neighbors_from_index[v1].add(v2) + outgoing_vertices = defaultdict(set) + for v1, v2 in edges: + outgoing_vertices[v1].add(v2) + return outgoing_vertices + + +def adjacent_from_edges(edges): + undirected_edges = defaultdict(set) + for v1, v2 in edges: + undirected_edges[v1].add(v2) + undirected_edges[v2].add(v1) + return undirected_edges + +################################################## + +def normalize_interval(value, interval=UNIT_LIMITS): + # TODO: move more out of pybullet-planning + lower, upper = interval + assert lower <= upper + return (value - lower) / (upper - lower) + + +def rescale_interval(value, old_interval=UNIT_LIMITS, new_interval=UNIT_LIMITS): + lower, upper = new_interval + return convex_combination(lower, upper, w=normalize_interval(value, old_interval)) + + +def wrap_interval(value, interval=UNIT_LIMITS): + lower, upper = interval + if (lower == -INF) and (+INF == upper): + return value + assert -INF < lower <= upper < +INF + return (value - lower) % (upper - lower) + lower + + +def interval_distance(value1, value2, interval=UNIT_LIMITS): + value1 = wrap_interval(value1, interval) + value2 = wrap_interval(value2, interval) + if value1 > value2: + value1, value2 = value2, value1 + lower, upper = interval + return min(value2 - value1, (value1 - lower) + (upper - value2)) + + +def circular_difference(theta2, theta1, interval=UNIT_LIMITS): + extent = get_interval_extent(interval) + diff_interval = Interval(-extent/2, +extent/2) + return wrap_interval(theta2 - theta1, interval=diff_interval) + +################################################## + +def get_interval_center(interval): + lower, upper = interval + return np.average([lower, upper], axis=0) + + +def get_interval_extent(interval): + lower, upper = interval + return get_delta(lower, upper) + + +def even_space(start, stop, step=1, endpoint=True): + sequence = np.arange(start, stop, step=step) + if not endpoint: + return sequence + return np.append(sequence, [stop]) \ No newline at end of file diff --git a/plan_path/run_connect.py b/plan_path/run_connect.py new file mode 100644 index 0000000..cbae39c --- /dev/null +++ b/plan_path/run_connect.py @@ -0,0 +1,219 @@ +import os +os.environ['OMP_NUM_THREADS'] = '1' +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import random +import numpy as np +from scipy.spatial.transform import Rotation +import trimesh +import redmax_py as redmax +import time + +from assets.load import load_assembly_all_transformed +from assets.save import sample_path +from assets.mesh_distance import compute_move_mesh_distance_from_mat, compute_ground_distance_from_mat +from assets.transform import transform_pts_by_matrix, get_transform_matrix, get_transform_matrix_euler +from plan_path.pyplanners.rrt_connect import rrt_connect, birrt +from plan_path.pyplanners.smoothing import smooth_path + + +class ConnectPathPlanner: + + def __init__(self, assembly_dir, + step_size=0.1, min_sep=0.5, sdf_dx=0.05): + + self.assembly = load_assembly_all_transformed(assembly_dir) + for part_id, part_data in self.assembly.items(): + + mesh_final = part_data['mesh_final'] + phys_mesh_final = redmax.SDFMesh(mesh_final.vertices.T, mesh_final.faces.T, sdf_dx) + self.assembly[part_id]['phys_mesh_final'] = phys_mesh_final + + mesh_initial = part_data['mesh_initial'] + if mesh_initial is not None: + phys_mesh_initial = redmax.SDFMesh(mesh_initial.vertices.T, mesh_initial.faces.T, sdf_dx) + self.assembly[part_id]['phys_mesh_initial'] = phys_mesh_initial + else: + self.assembly[part_id]['phys_mesh_initial'] = None + + self.step_size = step_size + self.min_sep = min_sep + self.sdf_dx = sdf_dx + + def get_fns(self, move_id, still_ids, removed_ids, rotation=False): + + mesh_move = self.assembly[move_id]['mesh'] + min_box_move = mesh_move.vertices.min(axis=0) + max_box_move = mesh_move.vertices.max(axis=0) + + phys_mesh_move = self.assembly[move_id]['phys_mesh_final'] + phys_meshes_still = [self.assembly[still_id]['phys_mesh_final'] for still_id in still_ids] + phys_meshes_removed = [self.assembly[removed_id]['phys_mesh_initial'] for removed_id in removed_ids] + phys_meshes_removed = [phys_mesh for phys_mesh in phys_meshes_removed if phys_mesh is not None] + + phys_meshes_all = [phys_mesh_move] + phys_meshes_still + phys_meshes_removed + min_box_all = np.min([phys_mesh.vertices.T.min(axis=0) for phys_mesh in phys_meshes_all], axis=0) + max_box_all = np.max([phys_mesh.vertices.T.max(axis=0) for phys_mesh in phys_meshes_all], axis=0) + extend_box_all = max_box_all - min_box_all + state_lower_bound = min_box_all - 0.5 * extend_box_all + state_upper_bound = max_box_all + 0.5 * extend_box_all + + if rotation: + def distance_fn(q1, q2): + mat1 = get_transform_matrix_euler(q1[:3], q1[3:]) + mat2 = get_transform_matrix_euler(q2[:3], q2[3:]) + boxes1 = transform_pts_by_matrix(np.vstack([min_box_move, max_box_move]), mat1) + boxes2 = transform_pts_by_matrix(np.vstack([min_box_move, max_box_move]), mat2) + return np.linalg.norm(boxes1 - boxes2, axis=1).sum() + else: + def distance_fn(q1, q2): + return np.linalg.norm(q1 - q2) + + def collision_fn(q): + mat = get_transform_matrix(q) @ np.linalg.inv(get_transform_matrix(self.assembly[move_id]['final_state'])) + d_m = compute_move_mesh_distance_from_mat(phys_mesh_move, phys_meshes_still + phys_meshes_removed, mat) + d_g = compute_ground_distance_from_mat(phys_mesh_move, mat) + return d_m <= self.min_sep or d_g <= -self.sdf_dx + + if rotation: + def sample_fn(): + while True: + ratio = np.random.random(3) + translation = ratio * state_lower_bound + (1.0 - ratio) * state_upper_bound + rotation = Rotation.random().as_euler('xyz') + state = np.concatenate([translation, rotation]) + if not collision_fn(state): + return state + else: + def sample_fn(): + while True: + ratio = np.random.random(3) + state = ratio * state_lower_bound + (1.0 - ratio) * state_upper_bound + if not collision_fn(state): + return state + + def extend_fn(q1, q2): + q_dist = distance_fn(q1, q2) + num_steps = int(np.ceil(q_dist / self.step_size)) + for i in range(num_steps): + yield q1 + (q2 - q1) / q_dist * (i + 1) * self.step_size + + return distance_fn, sample_fn, extend_fn, collision_fn + + def plan(self, move_id, still_ids, removed_ids, rotation=False, initial_state=None, final_state=None, max_time=120, smooth=True, verbose=False): + + if initial_state is None: + if 'initial_state' in self.assembly[move_id]: + initial_state = self.assembly[move_id]['initial_state'] + if initial_state is None: return None + if final_state is None: + if 'final_state' in self.assembly[move_id]: + final_state = self.assembly[move_id]['final_state'] + else: + final_state = np.zeros(6) + + if not rotation: + initial_state = initial_state[:3] + final_state = final_state[:3] + + distance_fn, sample_fn, extend_fn, collision_fn = self.get_fns(move_id, still_ids, removed_ids, rotation=rotation) + if collision_fn(initial_state): + print('initial state in collision') + return None + if collision_fn(final_state): + print('final state in collision') + return None + + connected_path = None + n_failed_attempt = 0 + while connected_path is None: + if verbose: + print('planning connecting path') + connected_path = rrt_connect(final_state, initial_state, # NOTE: disassembly from final to initial + distance_fn, sample_fn, extend_fn, collision_fn, max_iterations=100, max_time=max_time) + n_failed_attempt += 1 + if n_failed_attempt == 3: + if verbose: + print('path connector gets stuck') + break + else: + in_collision = False + for state in connected_path: + if collision_fn(state): + in_collision = True + + if verbose: + print(f'connecting path planned (len: {len(connected_path)}, collision: {in_collision})') + + if smooth and connected_path is not None: + if verbose: + print('smoothing path') + connected_path = smooth_path(connected_path, extend_fn, collision_fn, distance_fn, + cost_fn=None, sample_fn=sample_fn, max_iterations=100, tolerance=1e-5, verbose=False) # NOTE: max_time and converge_time not specified + + in_collision = False + for state in connected_path: + if collision_fn(state): + in_collision = True + + if verbose: + print(f'smoothing path completed (len: {len(connected_path)}, collision: {in_collision})') + + return connected_path + + def visualize_state(self, move_id, still_ids, removed_ids, state): + mesh_move = self.assembly[move_id]['mesh_final'] + meshes_still = [self.assembly[still_id]['mesh_final'] for still_id in still_ids] + meshes_removed = [self.assembly[removed_id]['mesh_initial'] for removed_id in removed_ids] + meshes_removed = [mesh for mesh in meshes_removed if mesh is not None] + + viz_new_mesh = mesh_move.copy() + viz_new_mesh.apply_transform(get_transform_matrix(state) @ np.linalg.inv(get_transform_matrix(self.assembly[move_id]['final_state']))) + trimesh.Scene([viz_new_mesh, *meshes_still, *meshes_removed]).show() + + def visualize_path(self, move_id, still_ids, removed_ids, path, n_frame=10): + for state in sample_path(path, n_frame): + self.visualize_state(move_id, still_ids, removed_ids, state) + + +if __name__ == '__main__': + + from argparse import ArgumentParser + parser = ArgumentParser() + parser.add_argument('--id', type=str, required=True, help='assembly id (e.g. 00000)') + parser.add_argument('--dir', type=str, default='joint_assembly', help='directory storing all assemblies') + parser.add_argument('--move-id', type=str, default='0') + parser.add_argument('--still-ids', type=str, nargs='+', default=['1']) + parser.add_argument('--removed-ids', type=str, nargs='+', default=[]) + parser.add_argument('--rotation', default=False, action='store_true') + parser.add_argument('--initial-state', type=float, nargs='+', default=None) + parser.add_argument('--final-state', type=float, nargs='+', default=None) + parser.add_argument('--sdf-dx', type=float, default=0.05, help='grid resolution of SDF') + parser.add_argument('--step-size', type=float, default=0.1, help='step size for state extension in sampling') + parser.add_argument('--min-sep', type=float, default=0.5, help='min part separation') + parser.add_argument('--max-time', type=float, default=120, help='timeout') + parser.add_argument('--seed', type=int, default=1, help='random seed') + parser.add_argument('--disable-smooth', default=False, action='store_true') + args = parser.parse_args() + + random.seed(args.seed) + np.random.seed(args.seed) + + asset_folder = os.path.join(project_base_dir, './assets') + assembly_dir = os.path.join(asset_folder, args.dir, args.id) + + planner = ConnectPathPlanner(assembly_dir, + step_size=args.step_size, min_sep=args.min_sep, sdf_dx=args.sdf_dx) + initial_state = np.array(args.initial_state) if args.initial_state is not None else planner.assembly[args.move_id]['initial_state'] + final_state = np.array(args.final_state) if args.final_state is not None else planner.assembly[args.move_id]['final_state'] + + planner.visualize_state(args.move_id, args.still_ids, args.removed_ids, initial_state) + planner.visualize_state(args.move_id, args.still_ids, args.removed_ids, final_state) + + path = planner.plan(args.move_id, args.still_ids, args.removed_ids, args.rotation, initial_state, final_state, max_time=args.max_time, smooth=not args.disable_smooth, verbose=True) + + if path is not None: + planner.visualize_path(args.move_id, args.still_ids, args.removed_ids, path) diff --git a/plan_path/run_joint_plan.py b/plan_path/run_joint_plan.py new file mode 100644 index 0000000..48fff4b --- /dev/null +++ b/plan_path/run_joint_plan.py @@ -0,0 +1,624 @@ +import os +os.environ['OMP_NUM_THREADS'] = '1' +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import random +import numpy as np +import redmax_py as redmax +import json +import trimesh +from time import time +import networkx as nx +from scipy.spatial.transform import Rotation +from scipy.spatial.distance import pdist, squareform +from pyquaternion import Quaternion + +from assets.load import load_assembly, load_pos_quat_dict, load_part_ids +from assets.save import save_path, clear_saved_sdfs +from assets.color import get_color +from assets.mesh_distance import compute_move_mesh_distance +from assets.transform import transform_pts_by_state, transform_pt_by_matrix +from utils.renderer import SimRenderer + +from plan_path.run_connect import ConnectPathPlanner + + +class State: + + def __init__(self, q, qdot): + self.q = q + self.qdot = qdot + + def __repr__(self): + return f'[State object at {hex(id(self))}]' + + +class Tree: + + def __init__(self): + self.tree = nx.DiGraph() + self.node_idx = 0 + self.root_node = None + self.last_node = None + + def add_node(self, state): + self.tree.add_node(state, idx=self.node_idx) + self.node_idx += 1 + if self.node_idx == 1: + self.root_node = state + self.last_node = state + + def add_edge(self, state_src, state_tar, action, states_between): + assert self.tree.has_node(state_tar) + assert self.tree.has_node(state_tar) + self.tree.add_edge(state_src, state_tar, action=action, states_between=states_between) + + def get_in_edge(self, state): + assert self.tree.has_node(state) + in_edges = list(self.tree.in_edges(state, data=True)) + assert len(in_edges) <= 1 + if len(in_edges) == 0: + return None + else: + return in_edges[0] + + def get_out_edges(self, state): + assert self.tree.has_node(state) + return list(self.tree.out_edges(state, data=True)) + + def has_path(self, start_state, end_state): + state = end_state + while True: + if state == start_state: + return True + in_edge = self.get_in_edge(state) + if in_edge is None: + return False + else: + state = in_edge[0] + + def get_path(self, start_state, end_state): + path = [] + state = end_state + while True: + path.append(state) + if state == start_state: + break + in_edge = self.get_in_edge(state) + if in_edge is None: + return None # failed + else: + state_pred, states_betweeen = in_edge[0], in_edge[2]['states_between'] + path.extend(states_betweeen[::-1]) + state = state_pred + return path[::-1] + + def get_root_path(self, state): + return self.get_path(self.root_node, state) + + def get_nodes(self): + return list(self.tree.nodes) + + def get_edges(self): + return list(self.tree.edges(data=True)) + + def get_predecessor(self, state): + preds = list(self.tree._pred[state].keys()) + assert len(preds) <= 1 + if len(preds) == 0: + return None + else: + return preds[0] + + def get_successors(self, state): + return list(self.tree._succ[state].keys()) + + def get_in_degree(self, state): + return self.tree.in_degree(state) + + def get_out_degree(self, state): + return self.tree.out_degree(state) + + def get_node_attr(self, node, attr_name): + return self.tree.nodes[node][attr_name] + + def set_node_attr(self, node, attr_name, attr_val): + self.tree.nodes[node][attr_name] = attr_val + + def draw(self): + from networkx.drawing.nx_pydot import graphviz_layout + import matplotlib.pyplot as plt + pos = graphviz_layout(self.tree, prog='dot') + nx.draw_networkx(self.tree, pos, arrows=True, with_labels=False, node_size=10) + plt.show() + + +def arr_to_str(arr): + return ' '.join([str(x) for x in arr]) + + +def get_xml_string(assembly_dir, move_id, still_ids, move_joint_type, sdf_dx, col_th, save_sdf): + pos_dict, quat_dict = load_pos_quat_dict(assembly_dir) + body_type = 'SDF' + all_part_ids = load_part_ids(assembly_dir) + color_map = get_color(all_part_ids) + sdf_args = 'load_sdf="true" save_sdf="true"' if save_sdf else '' + string = f''' + + + ''' + return string + + +def unit_vector(vector): + norm = np.linalg.norm(vector) + if np.isclose(norm, 0): + random_vector = np.random.random(len(vector)) + return random_vector / np.linalg.norm(random_vector) + else: + return vector / norm + + +class PathPlanner: + + def __init__(self, asset_folder, assembly_dir, move_id, still_ids, + rotation=False, sdf_dx=0.05, collision_th=0.01, min_sep=0.5, force_mag=1e3, frame_skip=100, save_sdf=False): + + # calculate collision threshold + assembly = load_assembly(assembly_dir) + move_mesh = None + still_meshes = [] + for part_id, part_data in assembly.items(): + mesh = part_data['mesh'] + phys_mesh = redmax.SDFMesh(mesh.vertices.T, mesh.faces.T, sdf_dx) + if part_id == move_id: + move_mesh = phys_mesh + elif part_id in still_ids: + still_meshes.append(phys_mesh) + + min_d = compute_move_mesh_distance(move_mesh, still_meshes, state=np.zeros(3)) + collision_th = max(-min_d, 0) + collision_th + + # build simulation + move_joint_type = 'free3d-exp' if rotation else 'translational' + model_string = get_xml_string(assembly_dir, move_id, still_ids, move_joint_type, sdf_dx, collision_th, save_sdf) + self.sim = redmax.Simulation(model_string, asset_folder) + self.rotation = rotation + self.ndof = 6 + self.force_mag = force_mag + self.frame_skip = frame_skip + self.min_sep = min_sep + + # names + self.move_id, self.still_ids = move_id, still_ids + self.move_name = f'part{move_id}' + self.still_names = [f'part{still_id}' for still_id in still_ids] + + # collision check + self.vertices_move = self.sim.get_body_vertices(self.move_name).T + self.vertices_still = np.vstack([self.sim.get_body_vertices(still_name, world_frame=True).T for still_name in self.still_names]) + self.hull_move = trimesh.convex.convex_hull(self.vertices_move) + self.hull_still = trimesh.convex.convex_hull(self.vertices_still) + self.collision_manager = trimesh.collision.CollisionManager() + self.collision_manager.add_object('hull_still', self.hull_still) + + self.E0i_move = self.sim.get_body_E0i(self.move_name) + self.E0is_still = [self.sim.get_body_E0i(still_name) for still_name in self.still_names] + + # state bounds + self.min_box_move = self.vertices_move.min(axis=0) + self.max_box_move = self.vertices_move.max(axis=0) + self.size_box_move = self.max_box_move - self.min_box_move + self.min_box_still = self.vertices_still.min(axis=0) + self.max_box_still = self.vertices_still.max(axis=0) + self.size_box_still = self.max_box_still - self.min_box_still + self.state_lower_bound = (self.min_box_still - self.max_box_move) - 0.5 * self.size_box_move + self.state_upper_bound = (self.max_box_still - self.min_box_move) + 0.5 * self.size_box_move + + # connect path planner + self.connect_path_planner = ConnectPathPlanner( + assembly_dir, min_sep=min_sep, sdf_dx=sdf_dx) + + def get_state(self): + q = self.sim.get_joint_qm(self.move_name) + qdot = self.sim.get_joint_qmdot(self.move_name) + state = State(q, qdot) + return state + + def set_state(self, state): + qm = state.q + self.sim.set_joint_qm(self.move_name, qm) + self.sim.zero_joint_qdot(self.move_name) + self.sim.update_robot() + + def select_state(self, tree): + raise NotImplementedError + + def select_action(self, tree, state): + raise NotImplementedError + + def random_action(self): + return np.random.random(self.ndof) * 2.0 - 1.0 + + def apply_action(self, action): + action = unit_vector(action) * self.force_mag # rotation, translation + if len(action) == 3: + force = np.concatenate([np.zeros(3), action]) + elif len(action) == 6: + force = np.concatenate([action[:3] * 3, action[3:]]) + else: + raise Exception + self.sim.set_body_external_force(self.move_name, force) + + def q_distance(self, q0, q1): + if self.rotation: + boxes0 = transform_pts_by_state(np.vstack([self.min_box_move, self.max_box_move]), q0) + boxes1 = transform_pts_by_state(np.vstack([self.min_box_move, self.max_box_move]), q1) + return np.linalg.norm(boxes0 - boxes1, axis=1).sum() + else: + return np.linalg.norm(q0 - q1) + + def state_distance(self, state0, state1): + return self.q_distance(state0.q, state1.q) + + # deprecated version - do not support min_sep + # def is_disassembled(self): + # E0i = self.sim.get_body_E0i(self.move_name) + # hull_move = self.hull_move.copy() + # hull_move.apply_transform(E0i) + # has_collision = self.collision_manager.in_collision_single(hull_move) + # if not has_collision: + # min_box_move, max_box_move = hull_move.vertices.min(axis=0), hull_move.vertices.max(axis=0) + # move_contain_still = (min_box_move <= self.min_box_still).all() and (max_box_move >= self.max_box_still).all() + # still_contain_move = (self.min_box_still <= min_box_move).all() and (self.max_box_still >= max_box_move).all() + # return not (move_contain_still or still_contain_move) # check if one hull fully contains another + # else: + # return False + + def is_disassembled(self): + in_contact = False + for still_name in self.still_names: # if any part in contact, then not fully disassembled + in_contact = in_contact or self.sim.body_in_contact(still_name, self.move_name, self.min_sep) + return not in_contact # if all movable parts are not in contact with fixed parts, then fully disassembled + + def get_path(self, tree, state): + states = tree.get_root_path(state) + path = [] + for state in states: + path.append(state.q) + return path + + def seed(self, seed): + random.seed(seed) + np.random.seed(seed) + + def render(self, path, record_path=None): + if path is not None: + # assume path is global coordinate + path = [self.sim.get_joint_q_from_qm(self.move_name, qm) for qm in path] + self.sim.set_state_his(path, [np.zeros(self.ndof) for _ in range(len(path))]) + if record_path is None: + SimRenderer.replay(self.sim) + else: + SimRenderer.replay(self.sim, record=True, record_path=record_path) + + def save_path(self, path, save_dir, n_save_state): + save_path(save_dir, path, n_frame=n_save_state) + + def plan(self, max_time, seed=1, return_path=False, render=False, record_path=None): + + self.seed(seed) + + self.sim.reset() + + tree = Tree() + init_state = self.get_state() + tree.add_node(init_state) + + if self.is_disassembled(): + status = 'Start with goal' + return (status, 0., None) if return_path else (status, 0.) + + status = 'Failure' + path = None + t_start = time() + step = 0 + + while True: + + if step == 0: + state = init_state + action = self.random_action() + else: + state = self.select_state(tree) + action = self.select_action(tree, state) + + self.set_state(state) + self.apply_action(action) + self.sim.update_robot() + + states_between = [] + for _ in range(self.frame_skip): + self.sim.forward(1) + state_between = self.get_state() + states_between.append(state_between) + + t_plan = time() - t_start + if t_plan > max_time: + status = 'Timeout' + break + + new_state = states_between.pop() + tree.add_node(new_state) + tree.add_edge(state, new_state, action, states_between) + + if self.is_disassembled(): + status = 'Success' + path = self.get_path(tree, new_state) + break + + if status == 'Timeout': + break + + step += 1 + + if render: + # tree.draw() + self.render(path, record_path=record_path) + + return (status, t_plan, path) if return_path else (status, t_plan) + + def get_contact_bodies(self, part_id): + return self.sim.get_contact_bodies(f'part{part_id}') + + +class BFSPathPlanner(PathPlanner): + + # NOTE: can be tuned + trans_dist_th = 0.05 + quat_dist_th = 0.5 + + def get_trans_dist(self, state, new_state): + return np.linalg.norm(state[:3] - new_state[:3]) + + def get_quat(self, state): + return Quaternion(Rotation.from_euler('xyz', state[3:]).as_quat()[[3, 0, 1, 2]]) + + def get_quat_dist(self, state, new_state): + return Quaternion.distance(self.get_quat(new_state), self.get_quat(state)) # NOTE: may use other distance functions + + def state_similar_r3(self, state, new_state): + trans_dist = self.get_trans_dist(state, new_state) + return trans_dist < self.trans_dist_th + + def state_similar_se3(self, state, new_state): + trans_dist = self.get_trans_dist(state, new_state) + quat_dist = self.get_quat_dist(state, new_state) + return trans_dist < self.trans_dist_th and quat_dist < self.quat_dist_th + + def state_similar(self, state, new_state): + if self.rotation: + return self.state_similar_se3(state, new_state) + else: + return self.state_similar_r3(state, new_state) + + def any_state_similar(self, path, new_state): + for state in path: + if self.state_similar(state, new_state): + return True + return False + + def min_dist(self, path, new_state): + min_dist_trans, min_dist_rot = np.inf, np.inf + for state in path: + min_dist_trans = min(min_dist_trans, self.get_trans_dist(state, new_state)) + min_dist_rot = min(min_dist_rot, self.get_quat_dist(state, new_state)) + return min_dist_trans, min_dist_rot + + def min_dist_separate(self, path, new_state): + min_dist_trans, cor_dist_rot = np.inf, np.inf + cor_dist_trans, min_dist_rot = np.inf, np.inf + for state in path: + dist_trans = self.get_trans_dist(state, new_state) + dist_rot = self.get_quat_dist(state, new_state) + if dist_trans < min_dist_trans: + min_dist_trans = dist_trans + cor_dist_rot = dist_rot + if dist_rot < min_dist_rot: + min_dist_rot = dist_rot + cor_dist_trans = dist_trans + return (min_dist_trans, cor_dist_rot), (cor_dist_trans, min_dist_rot) + + def random_rotate_actions(self, actions): + random_vec = np.random.random(3) + random_vec /= np.linalg.norm(random_vec) + new_actions = [] + for action in actions: + if actions.shape[1] == 3: + new_action = np.cross(action, random_vec) + elif actions.shape[1] == 6: + new_action = np.concatenate([np.cross(action[:3], random_vec), np.cross(action[3:], random_vec)]) + else: + raise Exception + new_action /= np.linalg.norm(new_action) + new_actions.append(new_action) + return np.array(new_actions) + + def plan(self, max_time, max_depth=None, seed=1, return_path=False, render=False, record_path=None): + + self.seed(seed) + + if self.rotation: + actions = np.array([ + [0, 0, 0, 0, 0, 1], + [0, 0, 0, 0, 0, -1], + [0, 0, 0, 0, 1, 0], + [0, 0, 0, 0, -1, 0], + [0, 0, 0, 1, 0, 0], + [0, 0, 0, -1, 0, 0], + [0, 0, 1, 0, 0, 0], + [0, 0, -1, 0, 0, 0], + [0, 1, 0, 0, 0, 0], + [0, -1, 0, 0, 0, 0], + [1, 0, 0, 0, 0, 0], + [-1, 0, 0, 0, 0, 0], + ]) + else: + actions = np.array([ + [0, 0, 1], + [0, 0, -1], + [0, 1, 0], + [0, -1, 0], + [1, 0, 0], + [-1, 0, 0], + ]) + + # actions = self.random_rotate_actions(actions) + + status = 'Failure' + path = None + + t_start = time() + + self.sim.reset() + states = [[self.get_state(), []]] + + n_stages = 0 + + while True: # stages + + state, curr_path = states.pop(0) + + for action in actions: + + temp_path = curr_path.copy() + + self.sim.reset() + self.set_state(state) + self.apply_action(action) + + while True: + + self.set_state(self.get_state()) + + for _ in range(self.frame_skip): + self.sim.forward(1, verbose=False) + new_state = self.get_state() + temp_path.append(new_state.q) + + t_plan = time() - t_start + if t_plan > max_time: + status = 'Timeout' + break + + if self.is_disassembled(): + status = 'Success' + path = temp_path + break + + if status == 'Timeout': + break + + if self.any_state_similar(temp_path[:-self.frame_skip], new_state.q): + break # back and forth + + if status in ['Success', 'Timeout']: + break + + states.append([new_state, temp_path]) + + if status in ['Success', 'Timeout']: + break + + n_stages += 1 + if n_stages == max_depth: + break + + if status == 'Success': + connect_path = self.connect_path_planner.plan(self.move_id, self.still_ids, [], + rotation=True, final_state=path[-1], max_time=max_time) + if connect_path is not None: + path += connect_path + + if render: + self.render(path, record_path=record_path) + + return (status, t_plan, path) if return_path else (status, t_plan) + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--id', type=str, required=True, help='assembly id (e.g. 00000)') + parser.add_argument('--dir', type=str, default='joint_assembly', help='directory storing all assemblies') + parser.add_argument('--move-id', type=str, default='0') + parser.add_argument('--still-ids', type=str, nargs='+', default=['1']) + parser.add_argument('--rotation', default=False, action='store_true') + parser.add_argument('--sdf-dx', type=float, default=0.05, help='grid resolution of SDF') + parser.add_argument('--collision-th', type=float, default=1e-2) + parser.add_argument('--min-sep', type=float, default=0.5, help='min part separation') + parser.add_argument('--force-mag', type=float, default=100, help='magnitude of force') + parser.add_argument('--frame-skip', type=int, default=100, help='control frequency') + parser.add_argument('--max-time', type=float, default=120, help='timeout') + parser.add_argument('--seed', type=int, default=1, help='random seed') + parser.add_argument('--render', default=False, action='store_true', help='if render the result') + parser.add_argument('--record-dir', type=str, default=None, help='directory to store rendering results') + parser.add_argument('--save-dir', type=str, default=None) + parser.add_argument('--n-save-state', type=int, default=100) + parser.add_argument('--save-sdf', default=False, action='store_true') + args = parser.parse_args() + + asset_folder = os.path.join(project_base_dir, './assets') + assembly_dir = os.path.join(asset_folder, args.dir, args.id) + + if args.record_dir is None: + record_path = None + elif args.render: + os.makedirs(args.record_dir, exist_ok=True) + record_path = os.path.join(args.record_dir, args.id + '.gif') + + clear_saved_sdfs(assembly_dir) + planner = BFSPathPlanner( + asset_folder, assembly_dir, args.move_id, args.still_ids, + args.rotation, args.sdf_dx, args.collision_th, args.min_sep, args.force_mag, args.frame_skip, args.save_sdf + ) + status, t_plan, path = planner.plan( + args.max_time, seed=args.seed, return_path=True, render=args.render, record_path=record_path + ) + clear_saved_sdfs(assembly_dir) + + print(f'Status: {status}, planning time: {t_plan}') + + if args.save_dir is not None: + planner.save_path(path, args.save_dir, args.n_save_state) \ No newline at end of file diff --git a/plan_path/run_multi_plan.py b/plan_path/run_multi_plan.py new file mode 100644 index 0000000..ec5e42a --- /dev/null +++ b/plan_path/run_multi_plan.py @@ -0,0 +1,203 @@ +import os +os.environ['OMP_NUM_THREADS'] = '1' +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np +import networkx as nx + +from assets.load import load_assembly +from assets.save import clear_saved_sdfs +from run_joint_plan import BFSPathPlanner + + +class SequencePlanner: + + def __init__(self, asset_folder, assembly_dir): + + self.asset_folder = asset_folder + self.assembly_dir = assembly_dir + self.assembly_id = os.path.basename(assembly_dir) + + self.graph = nx.DiGraph() + + assembly = load_assembly(assembly_dir) + + for part_id in assembly.keys(): + self.graph.add_node(part_id) + + self.num_parts = len(assembly) + assert self.num_parts > 1 + self.max_seq_count = (1 + self.num_parts) * self.num_parts // 2 - 1 + + self.success_status = ['Success', 'Start with goal'] + self.failure_status = ['Timeout', 'Failure'] + self.valid_status = self.success_status + self.failure_status + + def draw_graph(self): + import matplotlib.pyplot as plt + nx.draw(self.graph, with_labels=True) + plt.show() + + def plan_sequence(self, *args, **kwargs): + raise NotImplementedError + + def plan_path(self, move_id, still_ids, rotation, sdf_dx, collision_th, min_sep, force_mag, frame_skip, + max_time, seed, render, record_path, save_dir, n_save_state, return_contact=False): + + path_planner = BFSPathPlanner( + self.asset_folder, self.assembly_dir, + move_id, still_ids, + rotation, sdf_dx, collision_th, min_sep, force_mag, frame_skip, save_sdf=True + ) + status, t_plan, path = path_planner.plan(max_time, seed=seed, return_path=True, render=render, record_path=record_path) + + assert status in self.valid_status, f'unknown status {status}' + if save_dir is not None: + path_planner.save_path(path, save_dir, n_save_state) + + if return_contact: + contact_parts = path_planner.get_contact_bodies(move_id) + return status, t_plan, contact_parts + else: + return status, t_plan + + +class ProgressiveQueueSequencePlanner(SequencePlanner): + + def plan_path(self, move_id, still_ids, rotation, sdf_dx, collision_th, min_sep, force_mag, frame_skip, + max_time, max_depth, seed, render, record_path, save_dir, n_save_state, return_contact=False): + + path_planner = BFSPathPlanner( + self.asset_folder, self.assembly_dir, + move_id, still_ids, + rotation, sdf_dx, collision_th, min_sep, force_mag, frame_skip, save_sdf=True + ) + status, t_plan, path = path_planner.plan(max_time, max_depth=max_depth, seed=seed, return_path=True, render=render, record_path=record_path) + + assert status in self.valid_status, f'unknown status {status}' + if save_dir is not None: + path_planner.save_path(path, save_dir, n_save_state) + + if return_contact: + contact_parts = path_planner.get_contact_bodies(move_id) + return status, t_plan, contact_parts + else: + return status, t_plan + + def plan_sequence(self, rotation, sdf_dx, collision_th, min_sep, force_mag, frame_skip, + seq_max_time, path_max_time, seed, render, record_dir, save_dir, n_save_state, verbose=False): + + np.random.seed(seed) + + if render and record_dir is not None: + os.makedirs(record_dir, exist_ok=True) + + seq_status = 'Failure' + sequence = [] + seq_count = 0 + t_plan_all = 0 + + active_queue = [(node, 1) for node in self.graph.nodes] # [(id, depth)] nodes going to try + np.random.shuffle(active_queue) + inactive_queue = [] # [(id, depth)] nodes tried + + while True: + + all_ids = list(self.graph.nodes) + move_id, max_depth = active_queue.pop(0) + still_ids = all_ids.copy() + still_ids.remove(move_id) + + if record_dir is None: + record_path = None + elif render: + record_path = os.path.join(record_dir, f'{self.assembly_id}', f'{seq_count}_{move_id}.gif') + + if save_dir is not None: + curr_save_dir = os.path.join(save_dir, f'{self.assembly_id}', f'{seq_count}_{move_id}') + else: + curr_save_dir = None + + curr_seed = np.random.randint(self.max_seq_count) + + status, t_plan = self.plan_path(move_id, still_ids, + False, sdf_dx, collision_th, min_sep, force_mag, frame_skip, + path_max_time, max_depth, curr_seed, render, record_path, curr_save_dir, n_save_state) + assert status in self.valid_status + + if status in self.failure_status and rotation: + status, t_plan_rot = self.plan_path(move_id, still_ids, + True, sdf_dx, collision_th, min_sep, force_mag, frame_skip, + path_max_time, max_depth, curr_seed, render, record_path, curr_save_dir, n_save_state) + t_plan += t_plan_rot + + t_plan_all += t_plan + seq_count += 1 + + if verbose: + print(f'# trials: {seq_count} | Move id: {move_id} | Status: {status} | Current planning time: {t_plan} | Total planning time: {t_plan_all}') + + if status in self.success_status: + self.graph.remove_node(move_id) + sequence.append(move_id) + else: + inactive_queue.append([move_id, max_depth + 1]) + + if verbose: + print('Active queue:', active_queue) + print('Inactive queue:', inactive_queue) + + if len(self.graph.nodes) == 1: + seq_status = 'Success' + break + + if len(active_queue) == 0: + active_queue = inactive_queue.copy() + inactive_queue = [] + + if t_plan_all > seq_max_time: + seq_status = 'Timeout' + break + + if verbose: + print(f'Result: {seq_status} | Disassembled: {len(sequence)}/{self.num_parts - 1} | Total # trials: {seq_count} | Total planning time: {t_plan_all}') + print(f'Sequence: {sequence}') + + return seq_status, sequence, seq_count, t_plan_all + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--id', type=str, required=True, help='assembly id (e.g. 00000)') + parser.add_argument('--dir', type=str, default='multi_assembly', help='directory storing all assemblies') + parser.add_argument('--rotation', default=False, action='store_true') + parser.add_argument('--sdf-dx', type=float, default=0.05, help='grid resolution of SDF') + parser.add_argument('--collision-th', type=float, default=1e-2) + parser.add_argument('--min-sep', type=float, default=0.5, help='min part separation') + parser.add_argument('--force-mag', type=float, default=100, help='magnitude of force') + parser.add_argument('--frame-skip', type=int, default=100, help='control frequency') + parser.add_argument('--seq-max-time', type=float, default=3600, help='sequence planning timeout') + parser.add_argument('--path-max-time', type=float, default=120, help='path planning timeout') + parser.add_argument('--seed', type=int, default=1, help='random seed') + parser.add_argument('--render', default=False, action='store_true', help='if render the result') + parser.add_argument('--record-dir', type=str, default=None, help='directory to store rendering results') + parser.add_argument('--save-dir', type=str, default=None) + parser.add_argument('--n-save-state', type=int, default=100) + args = parser.parse_args() + + asset_folder = os.path.join(project_base_dir, './assets') + assembly_dir = os.path.join(asset_folder, args.dir, args.id) + + if args.rotation: args.seq_max_time *= 2 + + clear_saved_sdfs(assembly_dir) + seq_planner = ProgressiveQueueSequencePlanner(asset_folder, assembly_dir) + seq_status, sequence, seq_count, t_plan = seq_planner.plan_sequence( + args.rotation, args.sdf_dx, args.collision_th, args.min_sep, args.force_mag, args.frame_skip, + args.seq_max_time, args.path_max_time, args.seed, args.render, args.record_dir, args.save_dir, args.n_save_state, verbose=True) + clear_saved_sdfs(assembly_dir) \ No newline at end of file diff --git a/plan_robot/geometry.py b/plan_robot/geometry.py new file mode 100644 index 0000000..4c51dec --- /dev/null +++ b/plan_robot/geometry.py @@ -0,0 +1,181 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np +import trimesh +from assets.load import load_assembly +from assets.transform import get_scale_matrix, get_translate_matrix, get_revolute_matrix, get_transform_matrix_quat, get_pos_quat_from_pose + + +def load_panda_meshes(asset_folder, visual=False): + meshes = {} + dir_name = 'visual' if visual else 'collision' + meshes['panda_hand'] = trimesh.load(os.path.join(asset_folder, 'panda', dir_name, 'hand.obj')) + meshes['panda_leftfinger'] = trimesh.load(os.path.join(asset_folder, 'panda', dir_name, 'finger.obj')) + meshes['panda_rightfinger'] = trimesh.load(os.path.join(asset_folder, 'panda', dir_name, 'finger.obj')) + return meshes + + +def load_robotiq_85_meshes(asset_folder, visual=False): + meshes = {} + dir_name = 'visual' if visual else 'collision' + postfix = 'fine' if visual else 'coarse' + meshes['robotiq_base'] = trimesh.load(os.path.join(asset_folder, 'robotiq_85', dir_name, f'robotiq_base_{postfix}.obj')) + for side_i in ['left', 'right']: + for side_j in ['outer', 'inner']: + for link in ['knuckle', 'finger']: + meshes[f'robotiq_{side_i}_{side_j}_{link}'] = trimesh.load(os.path.join(asset_folder, 'robotiq_85', dir_name, f'{side_j}_{link}_{postfix}.obj')) + return meshes + + +def load_robotiq_140_meshes(asset_folder, visual=False): + meshes = {} + dir_name = 'visual' if visual else 'collision' + postfix = 'fine' if visual else 'coarse' + meshes['robotiq_base'] = trimesh.load(os.path.join(asset_folder, 'robotiq_140', dir_name, f'robotiq_base_{postfix}.obj')) + for side in ['left', 'right']: + for link in ['outer_knuckle', 'outer_finger', 'inner_finger']: + meshes[f'robotiq_{side}_{link}'] = trimesh.load(os.path.join(asset_folder, 'robotiq_140', dir_name, f'{link}_{postfix}.obj')) + meshes[f'robotiq_{side}_pad'] = trimesh.load(os.path.join(asset_folder, 'robotiq_140', dir_name, f'pad_{postfix}.obj')) + meshes[f'robotiq_{side}_inner_knuckle'] = trimesh.load(os.path.join(asset_folder, 'robotiq_140', dir_name, f'inner_knuckle_{postfix}.obj')) + return meshes + + +def load_gripper_meshes(gripper_type, asset_folder, visual=False): + if gripper_type == 'panda': + return load_panda_meshes(asset_folder, visual=visual) + elif gripper_type == 'robotiq-85': + return load_robotiq_85_meshes(asset_folder, visual=visual) + elif gripper_type == 'robotiq-140': + return load_robotiq_140_meshes(asset_folder, visual=visual) + else: + raise NotImplementedError + + +def load_arm_meshes(asset_folder, visual=False, convex=True): + meshes = {} + if visual: + meshes['linkbase'] = trimesh.load(os.path.join(asset_folder, 'xarm7', 'visual', 'linkbase_smooth.obj')) + for i in range(1, 8): + meshes[f'link{i}'] = trimesh.load(os.path.join(asset_folder, 'xarm7', 'visual', f'link{i}_smooth.obj')) + else: + meshes['linkbase'] = trimesh.load(os.path.join(asset_folder, 'xarm7', 'collision', 'linkbase_vhacd.obj')) + if convex: meshes['linkbase'] = meshes['linkbase'].convex_hull + for i in range(1, 8): + meshes[f'link{i}'] = trimesh.load(os.path.join(asset_folder, 'xarm7', 'collision', f'link{i}_vhacd.obj')) + if convex: meshes[f'link{i}'] = meshes[f'link{i}'].convex_hull + return meshes + + +def load_part_meshes(assembly_dir, transform='none'): + assembly = load_assembly(assembly_dir, transform=transform) + part_meshes = {f'part{part_id}': assembly[part_id]['mesh'] for part_id in assembly} + return part_meshes + + +def transform_panda_meshes(meshes, pos, quat, scale, pose, open_ratio): + meshes = {k: v.copy() for k, v in meshes.items()} + meshes['panda_rightfinger'].apply_transform(get_scale_matrix([1, -1, 1])) + meshes['panda_leftfinger'].apply_transform(get_translate_matrix([0, 4 * open_ratio, 5.84])) + meshes['panda_rightfinger'].apply_transform(get_translate_matrix([0, -4 * open_ratio, 5.84])) + pos, quat = get_pos_quat_from_pose(pos, quat, pose) + for name, mesh in meshes.items(): + mesh.apply_transform(get_scale_matrix(scale)) + mesh.apply_transform(get_transform_matrix_quat(pos, quat)) + return meshes + + +def transform_robotiq_85_meshes(meshes, pos, quat, scale, pose, open_ratio): + meshes = {k: v.copy() for k, v in meshes.items()} + mats = {name: np.eye(4) for name in meshes} + + close_extent = 0.8757 * (1 - open_ratio) + + mats['robotiq_left_outer_knuckle'] = get_translate_matrix([3.06011444260539, 0.0, 6.27920162695395]) @ get_revolute_matrix('Y', -close_extent) + mats['robotiq_left_outer_finger'] = mats['robotiq_left_outer_knuckle'] @ get_translate_matrix([3.16910442266543, 0.0, -0.193396375724605]) + mats['robotiq_left_inner_knuckle'] = get_translate_matrix([1.27000000001501, 0.0, 6.93074999999639]) @ get_revolute_matrix('Y', -close_extent) + mats['robotiq_left_inner_finger'] = mats['robotiq_left_inner_knuckle'] @ get_translate_matrix([3.4585310861294003, 0.0, 4.5497019381797505]) @ get_revolute_matrix('Y', close_extent) + + mats['robotiq_right_outer_knuckle'] = get_transform_matrix_quat([-3.06011444260539, 0.0, 6.27920162695395], [0, 0, 0, 1]) @ get_revolute_matrix('Y', -close_extent) + mats['robotiq_right_outer_finger'] = mats['robotiq_right_outer_knuckle'] @ get_translate_matrix([3.16910442266543, 0.0, -0.193396375724605]) + mats['robotiq_right_inner_knuckle'] = get_transform_matrix_quat([-1.27000000001501, 0.0, 6.93074999999639], [0, 0, 0, 1]) @ get_revolute_matrix('Y', -close_extent) + mats['robotiq_right_inner_finger'] = mats['robotiq_right_inner_knuckle'] @ get_translate_matrix([3.4585310861294003, 0.0, 4.5497019381797505]) @ get_revolute_matrix('Y', close_extent) + + pos, quat = get_pos_quat_from_pose(pos, quat, pose) + for name, mesh in meshes.items(): + mesh.apply_transform(mats[name]) + mesh.apply_transform(get_scale_matrix(scale)) + mesh.apply_transform(get_transform_matrix_quat(pos, quat)) + return meshes + + +def transform_robotiq_140_meshes(meshes, pos, quat, scale, pose, open_ratio): + meshes = {k: v.copy() for k, v in meshes.items()} + mats = {name: np.eye(4) for name in meshes} + + close_extent = 0.8757 * (1 - open_ratio) + + mats['robotiq_left_outer_knuckle'] = get_transform_matrix_quat([0.0, -3.0601, 5.4905], [0.41040502, 0.91190335, 0.0, 0.0]) @ get_revolute_matrix('X', -close_extent) + mats['robotiq_left_outer_finger'] = mats['robotiq_left_outer_knuckle'] @ get_translate_matrix([0.0, 1.821998610742, 2.60018192872234]) + mats['robotiq_left_inner_finger'] = mats['robotiq_left_outer_finger'] @ get_transform_matrix_quat([0.0, 8.17554015893473, -2.82203446692936], [0.93501321, -0.35461287, 0.0, 0.0]) @ get_revolute_matrix('X', close_extent) + mats['robotiq_left_pad'] = mats['robotiq_left_inner_finger'] @ get_transform_matrix_quat([0.0, 3.8, -2.3], [0, 0, 0.70710678, 0.70710678]) + mats['robotiq_left_inner_knuckle'] = get_transform_matrix_quat([0.0, -1.27, 6.142], [0.41040502, 0.91190335, 0.0, 0.0]) @ get_revolute_matrix('X', -close_extent) + + mats['robotiq_right_outer_knuckle'] = get_transform_matrix_quat([0.0, 3.0601, 5.4905], [0.0, 0.0, 0.91190335, 0.41040502]) @ get_revolute_matrix('X', -close_extent) + mats['robotiq_right_outer_finger'] = mats['robotiq_right_outer_knuckle'] @ get_translate_matrix([0.0, 1.821998610742, 2.60018192872234]) + mats['robotiq_right_inner_finger'] = mats['robotiq_right_outer_finger'] @ get_transform_matrix_quat([0.0, 8.17554015893473, -2.82203446692936], [0.93501321, -0.35461287, 0.0, 0.0]) @ get_revolute_matrix('X', close_extent) + mats['robotiq_right_pad'] = mats['robotiq_right_inner_finger'] @ get_transform_matrix_quat([0.0, 3.8, -2.3], [0, 0, 0.70710678, 0.70710678]) + mats['robotiq_right_inner_knuckle'] = get_transform_matrix_quat([0.0, 1.27, 6.142], [0.0, 0.0, -0.91190335, -0.41040502]) @ get_revolute_matrix('X', -close_extent) + + pos, quat = get_pos_quat_from_pose(pos, quat, pose) + for name, mesh in meshes.items(): + mesh.apply_transform(mats[name]) + mesh.apply_transform(get_scale_matrix(scale)) + mesh.apply_transform(get_transform_matrix_quat(pos, quat)) + return meshes + + +def transform_gripper_meshes(gripper_type, meshes, pos, quat, scale, pose, open_ratio): + if gripper_type == 'panda': + return transform_panda_meshes(meshes, pos, quat, scale, pose, open_ratio) + elif gripper_type == 'robotiq-85': + return transform_robotiq_85_meshes(meshes, pos, quat, scale, pose, open_ratio) + elif gripper_type == 'robotiq-140': + return transform_robotiq_140_meshes(meshes, pos, quat, scale, pose, open_ratio) + else: + raise NotImplementedError + + +def transform_arm_meshes(meshes, chain, q, scale): + meshes = {k: v.copy() for k, v in meshes.items()} + matrices = chain.forward_kinematics(q, full_kinematics=True) + for (name, mesh), matrix in zip(meshes.items(), matrices): + mesh.apply_scale(scale) + mesh.apply_transform(matrix) + return meshes + + +def transform_part_mesh(mesh, pos, quat, pose=None): + mesh = mesh.copy() + if pose is not None: + pos, quat = get_pos_quat_from_pose(pos, quat, pose) + mesh.apply_transform(get_transform_matrix_quat(pos, quat)) + return mesh + + +def transform_part_meshes(meshes, pos_dict, quat_dict, pose=None): + meshes = {k: v.copy() for k, v in meshes.items()} + for name, mesh in meshes.items(): + pos, quat = pos_dict[name], quat_dict[name] + if pose is not None: + pos, quat = get_pos_quat_from_pose(pos, quat, pose) + mesh.apply_transform(get_transform_matrix_quat(pos, quat)) + return meshes + + +def save_meshes(meshes, folder, include_color=False): + for name, mesh in meshes.items(): + mesh.export(os.path.join(folder, f'{name}.obj'), header=None, include_color=include_color) diff --git a/plan_robot/ik/__init__.py b/plan_robot/ik/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/plan_robot/ik/chain.py b/plan_robot/ik/chain.py new file mode 100644 index 0000000..523f3b9 --- /dev/null +++ b/plan_robot/ik/chain.py @@ -0,0 +1,108 @@ +import numpy as np +from scipy.spatial.transform import Rotation as R +from ikpy.chain import Chain as IKPyChain +from .inverse_kinematics import inverse_kinematic_optimization + + +class Chain(IKPyChain): + + def forward_kinematics_active(self, angles, **kwargs): + """Computes the forward kinematics on the active joints of the chain + + Parameters + ---------- + angles: numpy.array + The angles of the active joints of the chain + + Returns + ------- + numpy.array: + The transformation matrix of the end effector + """ + return self.forward_kinematics(self.active_to_full(angles, initial_position=[0] * len(self.links)), **kwargs) + + def check_ori_success(self, actual_q, target, orientation_mode): + + ef_actual_matrix = self.forward_kinematics(actual_q)[:3, :3] + if orientation_mode == 'X': + actual_ori = ef_actual_matrix[:3, 0] + target_ori = target[:3, 0] + elif orientation_mode == 'Y': + actual_ori = ef_actual_matrix[:3, 1] + target_ori = target[:3, 1] + elif orientation_mode == 'Z': + actual_ori = ef_actual_matrix[:3, 2] + target_ori = target[:3, 2] + else: + return True # does not support other modes + + return np.dot(actual_ori, target_ori) > 0.99 + + def inverse_kinematics_frame(self, target, initial_position=None, n_restart=3, **kwargs): + """Computes the inverse kinematic on the specified target + + Parameters + ---------- + target: numpy.array + The frame target of the inverse kinematic, in meters. It must be 4x4 transformation matrix + initial_position: numpy.array + Optional : the initial position of each joint of the chain. Defaults to 0 for each joint + kwargs: See ikpy.inverse_kinematics.inverse_kinematic_optimization + + Returns + ------- + list: + The list of the positions of each joint according to the target. Note : Inactive joints are in the list. + """ + # Checks on input + target = np.array(target) + if target.shape != (4, 4): + raise ValueError("Your target must be a 4x4 transformation matrix") + + if initial_position is None: + initial_position = [0] * len(self.links) + + success = False + n_optimized = 0 + assert n_restart >= 1 or n_restart == -1 # -1 means infinite looping + while not success and ((n_optimized < n_restart and n_restart >= 1) or n_restart == -1): + solution, success = inverse_kinematic_optimization(self, target, starting_nodes_angles=initial_position, **kwargs) + success = self.check_ori_success(solution, target, kwargs['orientation_mode']) + n_optimized += 1 + initial_position = self.sample_joint_angles() + return solution, success + + def sample_joint_angles(self): + + joint_angles = [] + + for link in self.links: + if link.joint_type != 'fixed': + joint_angle = np.random.uniform(link.bounds[0], link.bounds[1]) + joint_angles.append(joint_angle) + else: + joint_angles.append(0) + + return np.array(joint_angles) + + def sample_joint_angles_active(self): + + joint_angles = [] + + for link in self.links: + if link.joint_type != 'fixed': + joint_angle = np.random.uniform(link.bounds[0], link.bounds[1]) + joint_angles.append(joint_angle) + + return np.array(joint_angles) + + def check_neighboring_links(self, linka_name, linkb_name): + + all_link_names = [link.name for link in self.links] + linka_idx = all_link_names.index(linka_name) + linkb_idx = all_link_names.index(linkb_name) + + if linka_idx == linkb_idx - 1 or linka_idx == linkb_idx + 1: + return True + else: + return False diff --git a/plan_robot/ik/inverse_kinematics.py b/plan_robot/ik/inverse_kinematics.py new file mode 100644 index 0000000..728893c --- /dev/null +++ b/plan_robot/ik/inverse_kinematics.py @@ -0,0 +1,174 @@ +# coding= utf8 +import scipy.optimize +import numpy as np +from ikpy import logs + + +ORIENTATION_COEFF = 1. + + +def inverse_kinematic_optimization(chain, target_frame, starting_nodes_angles, regularization_parameter=None, max_iter=None, orientation_mode=None, no_position=False, optimizer="L-BFGS-B"): + """ + Computes the inverse kinematic on the specified target + + Parameters + ---------- + chain: ikpy.chain.Chain + The chain used for the Inverse kinematics. + target_frame: numpy.array + The desired target. + starting_nodes_angles: numpy.array + The initial pose of your chain. + regularization_parameter: float + The coefficient of the regularization. + max_iter: int + Maximum number of iterations for the optimisation algorithm. + orientation_mode: str + Orientation to target. Choices: + * None: No orientation + * "X": Target the X axis + * "Y": Target the Y axis + * "Z": Target the Z axis + * "all": Target the three axes + no_position: bool + Do not optimize against position + optimizer: str + The optimizer to use. Choices: + * "least_squares": Use scipy.optimize.least_squares + * "scalar": Use scipy.optimize.minimize + """ + + # Begin with the position + target = target_frame[:3, -1] + + # Initial function call when optimizing + def optimize_basis(x): + # y = np.append(starting_nodes_angles[:chain.first_active_joint], x) + y = chain.active_to_full(x, starting_nodes_angles) + fk = chain.forward_kinematics(y) + + return fk + + # Compute error to target + def optimize_target_function(fk): + target_error = fk[:3, -1] - target + + # We need to return the fk, it will be used in a later function + # This way, we don't have to recompute it + return target_error + + if orientation_mode is None: + if no_position: + raise ValueError("Unable to optimize against neither position or orientation") + + else: + def optimize_function(x): + fk = optimize_basis(x) + target_error = optimize_target_function(fk) + return target_error + else: + # Only get the first orientation vector + if orientation_mode == "X": + target_orientation = target_frame[:3, 0] + + def get_orientation(fk): + return fk[:3, 0] + + elif orientation_mode == "Y": + target_orientation = target_frame[:3, 1] + + def get_orientation(fk): + return fk[:3, 1] + + elif orientation_mode == "Z": + target_orientation = target_frame[:3, 2] + + def get_orientation(fk): + return fk[:3, 2] + + elif orientation_mode == "all": + target_orientation = target_frame[:3, :3] + + def get_orientation(fk): + return fk[:3, :3] + else: + raise ValueError("Unknown orientation mode: {}".format(orientation_mode)) + + if not no_position: + def optimize_function(x): + # Note: This function casts x into a np.float64 array, to have good precision in the computation of the gradients + fk = optimize_basis(x) + + target_error = optimize_target_function(fk) + orientation_error = (get_orientation(fk) - target_orientation).ravel() + + # Put more pressure on optimizing the distance to target, to avoid being stuck in a local minimum where the orientation is perfectly reached, but the target is nowhere to be reached + total_error = np.concatenate([target_error, ORIENTATION_COEFF * orientation_error]) + + return total_error + else: + def optimize_function(x): + fk = optimize_basis(x) + + orientation_error = (get_orientation(fk) - target_orientation).ravel() + total_error = orientation_error + + return total_error + + if starting_nodes_angles is None: + raise ValueError("starting_nodes_angles must be specified") + + # If a regularization is selected + if regularization_parameter is not None: + def optimize_total(x): + regularization = np.linalg.norm(x - chain.active_from_full(starting_nodes_angles)) + return optimize_function(x) + regularization_parameter * regularization + else: + optimize_total = optimize_function + + # Compute bounds + real_bounds = [link.bounds for link in chain.links] + # real_bounds = real_bounds[chain.first_active_joint:] + real_bounds = chain.active_from_full(real_bounds) + + logs.logger.info("Bounds: {}".format(real_bounds)) + + if max_iter is not None: + logs.logger.info("max_iter is not used anymore in the IK, using it as a parameter will raise an exception in the future") + + with np.errstate(divide='ignore', invalid='ignore', over='ignore'): # ignore numerical warnings + + def optimize_scalar(x): + return np.linalg.norm(optimize_total(x)) + + # least squares optimization + if optimizer == "L-BFGS-B": + res = scipy.optimize.minimize(optimize_scalar, chain.active_from_full(starting_nodes_angles), bounds=real_bounds, method='L-BFGS-B') + elif optimizer == 'SLSQP': + res = scipy.optimize.minimize(optimize_scalar, chain.active_from_full(starting_nodes_angles), bounds=real_bounds, method='SLSQP') + elif optimizer == 'COBYLA': + cons = [] + for factor in range(len(real_bounds)): + lower, upper = real_bounds[factor] + l = {'type': 'ineq', + 'fun': lambda x, lb=lower, i=factor: x[i] - lb} + u = {'type': 'ineq', + 'fun': lambda x, ub=upper, i=factor: ub - x[i]} + cons.append(l) + cons.append(u) + res = scipy.optimize.minimize(optimize_scalar, chain.active_from_full(starting_nodes_angles), constraints=cons, method='COBYLA', tol=1e-5) + elif optimizer == "least_squares": + # We need to unzip the bounds + real_bounds = np.moveaxis(real_bounds, -1, 0) + res = scipy.optimize.least_squares(optimize_total, chain.active_from_full(starting_nodes_angles), bounds=real_bounds) + else: + raise ValueError("Unknown solver: {}".format(optimizer)) + + if res.status != -1: + logs.logger.info("Inverse kinematic optimisation OK, termination status: {}".format(res.status)) + else: + logs.logger.warning("Inverse kinematic optimisation returned an error: termination status: {}".format(res.status)) + + # print('IK result:', res.success, res.status, res.message) + + return chain.active_to_full(res.x, starting_nodes_angles), res.success diff --git a/plan_robot/motion_plan_arm.py b/plan_robot/motion_plan_arm.py new file mode 100644 index 0000000..0680152 --- /dev/null +++ b/plan_robot/motion_plan_arm.py @@ -0,0 +1,339 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np +import trimesh +import os + +from assets.transform import get_transform_matrix_quat +from plan_path.pyplanners.rrt_connect import rrt_connect +from plan_path.pyplanners.rrt_star import rrt_star +from plan_path.pyplanners.smoothing import smooth_path +from plan_path.pyplanners.utils import compute_path_cost +from plan_robot.util_arm import get_arm_chain, get_gripper_pos_quat_from_arm_q +from plan_robot.geometry import load_arm_meshes, load_gripper_meshes, transform_arm_meshes, transform_gripper_meshes + + +def find_max_distance_index(path, distance_fn): + max_distance = 0 + max_index = None + + for i in range(len(path) - 1): + distance = distance_fn(path[i + 1], path[i]) + if distance > max_distance: + max_distance = distance + max_index = i + + return max_index + + +def interpolate_angle(start_angle, end_angle, bidirectional): + if bidirectional: # if joint angle can take [-2pi, 2pi] + angular_distance = (end_angle - start_angle) % (2 * np.pi) + if angular_distance > np.pi: + angular_distance -= 2 * np.pi + interpolated_angle = (start_angle + angular_distance / 2) % (2 * np.pi) + else: + interpolated_angle = (start_angle + end_angle) / 2 + + return interpolated_angle + + +def interpolate_angles(start_angle, end_angle, num_steps, bidirectional): + if bidirectional: # if joint angle can take [-2pi, 2pi] + angular_distance = (end_angle - start_angle) % (2 * np.pi) + if angular_distance > np.pi: + angular_distance -= 2 * np.pi + step_size = angular_distance / num_steps + interpolated_angles = [] + current_angle = start_angle + for _ in range(num_steps + 1): # including the start and end angles + interpolated_angles.append(current_angle) + current_angle = (current_angle + step_size) % (2 * np.pi) + else: + interpolated_angles = np.linspace(start_angle, end_angle, num_steps + 1) + return np.array(interpolated_angles) + + +def interpolate_q(start_q, end_q): + assert len(start_q) == 7 and len(end_q) == 7 + interpolated_q = [] + for i in range(len(start_q)): + interpolated_q.append(interpolate_angle(start_q[i], end_q[i], bidirectional=i in [0, 2, 4, 6])) # hardcoded for xarm7 + return np.array(interpolated_q) + + +def interpolate_qs(start_q, end_q, num_steps): + assert len(start_q) == 7 and len(end_q) == 7 + interpolated_qs = np.zeros((num_steps + 1, len(start_q))) + for i in range(len(start_q)): + interpolated_qs[:, i] = interpolate_angles(start_q[i], end_q[i], num_steps, bidirectional=i in [0, 2, 4, 6]) # hardcoded for xarm7 + return np.array(interpolated_qs) + + +def interpolate_arm_path(original_path, distance_fn, length): + interpolated_path = original_path.copy() + + while len(interpolated_path) < length: + max_index = find_max_distance_index(interpolated_path, distance_fn) + + start_q = interpolated_path[max_index] + end_q = interpolated_path[max_index + 1] + interpolated_q = interpolate_q(start_q, end_q) + interpolated_path.insert(max_index + 1, interpolated_q) + + return interpolated_path + + +class ArmMotionPlanner: + + def __init__(self, base_pos, base_euler, scale, gripper_type): + self.scale = scale + self.arm_chain = get_arm_chain(base_pos, base_euler, scale) + # self.step_size = 5 * scale + self.step_size = 0.2 * scale + self.min_num_steps = 10 + self.min_path_len = 300 + asset_folder = os.path.join(project_base_dir, 'assets') + self.arm_meshes = load_arm_meshes(asset_folder, visual=False, convex=True) + self.gripper_type = gripper_type + self.gripper_meshes = load_gripper_meshes(gripper_type, asset_folder, visual=False) + + def transform_meshes(self, q, open_ratio, move_mesh, move_transform): + + # calculate arm transform + q_full = self.arm_chain.active_to_full(q, initial_position=[0] * len(self.arm_chain.links)) + arm_meshes_i = transform_arm_meshes(self.arm_meshes, self.arm_chain, q_full, scale=self.scale) + + # calculate gripper transform + gripper_pos, gripper_quat = get_gripper_pos_quat_from_arm_q(self.arm_chain, q_full, self.gripper_type) + pose = np.eye(4) # TODO: check pose + gripper_meshes_i = transform_gripper_meshes(self.gripper_type, self.gripper_meshes, gripper_pos, gripper_quat, self.scale, pose, open_ratio) + + # calculate move part transform + if move_mesh is None: + move_mesh_i = None + else: + gripper_matrix = get_transform_matrix_quat(gripper_pos, gripper_quat) + move_matrix = np.matmul(gripper_matrix, move_transform) + move_mesh_i = move_mesh.copy() + move_mesh_i.apply_transform(move_matrix) + + return arm_meshes_i, gripper_meshes_i, move_mesh_i + + def visualize_meshes(self, q, open_ratio, move_mesh=None, move_transform=None, still_meshes=None): + arm_meshes_i, gripper_meshes_i, move_mesh_i = self.transform_meshes(q, open_ratio, move_mesh, move_transform) + all_meshes = [*arm_meshes_i.values(), *gripper_meshes_i.values()] + if move_mesh_i is not None: + all_meshes.append(move_mesh_i) + if still_meshes is not None: + all_meshes.extend(still_meshes) + trimesh.Scene(all_meshes).show() + + def get_fns(self, move_mesh, move_transform, still_meshes, open_ratio, verbose=False): + + part_col_manager = trimesh.collision.CollisionManager() + for idx, mesh in enumerate(still_meshes): + part_col_manager.add_object(f'part_still_{idx}', mesh) + + def distance_fn(q1, q2): + dist_sum = 0.0 + fk1 = self.arm_chain.forward_kinematics_active(q1, full_kinematics=True) + fk2 = self.arm_chain.forward_kinematics_active(q2, full_kinematics=True) + # NOTE: use all joints or only the endeffector joint + # for i in range(len(fk1)): + # dist_sum += np.linalg.norm(fk1[i][:3, 3] - fk2[i][:3, 3]) + # dist_sum += np.linalg.norm(fk1[-1][:3, 3] - fk2[-1][:3, 3]) + if move_transform is None: + dist_sum += np.linalg.norm(fk1[-1][:3, 3] - fk2[-1][:3, 3]) + else: + part_fk1 = np.matmul(fk1[-1], move_transform) + part_fk2 = np.matmul(fk2[-1], move_transform) + dist_sum += np.linalg.norm(part_fk1[:3, 3] - part_fk2[:3, 3]) + return dist_sum + + def collision_fn(q): + + # transform arm and gripper meshes + arm_meshes_i, gripper_meshes_i, move_mesh_i = self.transform_meshes(q, open_ratio, move_mesh, move_transform) + + # check collision between arm and ground + for name, mesh in arm_meshes_i.items(): + if name == 'linkbase': continue + if mesh.vertices[:, 2].min() < 0: + if verbose: + print('collision detected: arm and ground') + return True + + # check collision between gripper and ground + for mesh in gripper_meshes_i.values(): + if mesh.vertices[:, 2].min() < 0: + if verbose: + print('collision detected: gripper and ground') + return True + + # check collision between move part and ground + if move_mesh_i is not None: + if move_mesh_i.vertices[:, 2].min() < -0.05: + if verbose: + print('collision detected: move part and ground') + return True + + # check collision between arm and grippers + arm_col_manager = trimesh.collision.CollisionManager() + for name, mesh in arm_meshes_i.items(): + if name != 'link7': + arm_col_manager.add_object(name, mesh) + + gripper_col_manager = trimesh.collision.CollisionManager() + for name, mesh in gripper_meshes_i.items(): + gripper_col_manager.add_object(name, mesh) + + if gripper_col_manager.in_collision_other(arm_col_manager): + if verbose: + print('collision detected: arm and gripper') + return True + + # check collision between arm and parts + arm_col_manager.add_object('link7', arm_meshes_i['link7']) + if arm_col_manager.in_collision_other(part_col_manager): + if verbose: + print('collision detected: arm and part') + return True + + # check collision between arm and move part + if move_mesh_i is not None: + if arm_col_manager.in_collision_single(move_mesh_i): + if verbose: + print('collision detected: arm and move part') + return True + + # check collision between gripper and parts + if gripper_col_manager.in_collision_other(part_col_manager): + if verbose: + print('collision detected: gripper and part') + return True + + # check collision between move part and parts + if move_mesh_i is not None: + if part_col_manager.in_collision_single(move_mesh_i): + if verbose: + print('collision detected: move part and part') + return True + + # check arm self-intersection + _, objs_in_collision = arm_col_manager.in_collision_internal(return_names=True) + for obj_pair in objs_in_collision: + if not self.arm_chain.check_neighboring_links(obj_pair[0], obj_pair[1]): + if verbose: + print('collision detected: arm self-intersection') + return True + + if verbose: + print('no collision detected') + + return False + + def sample_fn(): + while True: + q = self.arm_chain.sample_joint_angles_active() + # ef_matrix = self.arm_chain.forward_kinematics_active(q) + # ef_pos = ef_matrix[:3, 3] + # if ef_pos[0] < -20 or ef_pos[0] > 30: + # continue + # if ef_pos[1] < -20 or ef_pos[1] > 30: + # continue + # if ef_pos[2] < 0 or ef_pos[2] > 40: + # continue + if not collision_fn(q): + return q + + def extend_fn(q1, q2): + q_dist = distance_fn(q1, q2) + num_steps = int(np.ceil(q_dist / self.step_size)) + if num_steps < self.min_num_steps: num_steps = self.min_num_steps + interpolated_qs = interpolate_qs(q1, q2, num_steps) + for i in range(num_steps): + yield interpolated_qs[i + 1] + + return distance_fn, sample_fn, extend_fn, collision_fn + + def plan_with_grasp(self, start, goal, move_mesh, move_transform, still_meshes, open_ratio, total_rrt_trials=5, max_rrt_iter=20, max_smooth_iter=1000, verbose=False): + ''' + Plan arm reaching with moving part in held and a single gripper open ratio + ---------------------------------- + start: start q of arm (active) + goal: goal q of arm (active) + move_mesh: mesh to move + still_meshes: dict of still meshes {name: mesh} + open_ratio: open ratio of gripper + ''' + distance_fn, sample_fn, extend_fn, collision_fn = self.get_fns(move_mesh, move_transform, still_meshes, open_ratio, verbose=False) + + # print('visualize start') + # self.visualize_meshes(start, open_ratio, move_mesh, move_transform, still_meshes) + # print('visualize goal') + # self.visualize_meshes(goal, open_ratio, move_mesh, move_transform, still_meshes) + + if collision_fn(start): + if verbose: + print('start is in collision') + return None + if collision_fn(goal): + if verbose: + print('goal is in collision') + return None + + paths = [] + costs = [] + for i in range(total_rrt_trials): + path = rrt_connect(start, goal, distance_fn, sample_fn, extend_fn, collision_fn, max_iterations=max_rrt_iter) + cost = compute_path_cost(path, cost_fn=distance_fn) + if path is None: + cost = np.inf + else: + paths.append(path) + costs.append(cost) + if verbose: + print('RRT trial', i, 'cost', cost) + + path = paths[np.argmin(costs)] + path.insert(0, start) + + if verbose: + print(f'path planned (len: {len(path)})') + + # smooth path + path = smooth_path(path, extend_fn, collision_fn, distance_fn, None, sample_fn, verbose=verbose, max_iterations=max_smooth_iter) + path.insert(0, start) + + in_collision = False + for q in path: + if collision_fn(q): + in_collision = True + + # interpolate path + path = interpolate_arm_path(path, distance_fn, self.min_path_len) + + if verbose: + print(f'smoothing path completed (len: {len(path)}, collision: {in_collision})') + + path = [self.arm_chain.active_to_full(q, initial_position=[0] * len(self.arm_chain.links)) for q in path] + return path + + def plan_without_grasp(self, start, goal, part_meshes, open_ratio_init, total_rrt_trials=5, max_rrt_iter=20, max_smooth_iter=1000, verbose=False): + ''' + Plan arm retracting with no part in held and multiple gripper open ratios + ''' + for open_ratio in np.linspace(open_ratio_init, 1.0, 4)[1:]: + + path = self.plan_with_grasp(start, goal, move_mesh=None, move_transform=None, still_meshes=part_meshes, open_ratio=open_ratio, + total_rrt_trials=total_rrt_trials, max_rrt_iter=max_rrt_iter, max_smooth_iter=max_smooth_iter, verbose=verbose) + + if path is not None: + return path, open_ratio + + return None, None diff --git a/plan_robot/render_grasp.py b/plan_robot/render_grasp.py new file mode 100644 index 0000000..7d7306f --- /dev/null +++ b/plan_robot/render_grasp.py @@ -0,0 +1,207 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np +import redmax_py as redmax +import os + +from utils.renderer import SimRenderer +from assets.load import load_pos_quat_dict, load_part_ids +from assets.color import get_color +from assets.transform import get_pos_quat_from_pose +from plan_robot.util_grasp import get_gripper_finger_states, get_gripper_base_name, get_gripper_path_from_part_path + + +def arr_to_str(arr): + return ' '.join([str(x) for x in arr]) + + +def create_gripper_with_assembly_posed_xml(assembly_dir, move_id, still_ids, removed_ids, pose=None, gripper_type=None, gripper_pos=[0, 0, 5], gripper_quat=[1, 0, 0, 0], gripper_scale=1): + part_ids = [move_id] + still_ids + removed_ids + all_part_ids = load_part_ids(assembly_dir) + color_map = get_color(all_part_ids) + pos_dict_final, quat_dict_final = load_pos_quat_dict(assembly_dir, transform='final') + pos_dict_initial, quat_dict_initial = load_pos_quat_dict(assembly_dir, transform='initial') + string = f''' + + +''' + return string + + +def render_path_with_grasp(asset_folder, assembly_dir, move_id, still_ids, removed_ids, pose, part_path, gripper_type, gripper_scale, grasp, + camera_lookat=None, camera_pos=None, body_color_map=None, reverse=False, render=True, record_path=None, make_video=False): + if part_path is None: + print('no path found') + return + + gripper_pos, gripper_quat = grasp['gripper_pos'], grasp['gripper_quat'] + + xml_string = create_gripper_with_assembly_posed_xml( + assembly_dir=assembly_dir, move_id=move_id, still_ids=still_ids, removed_ids=removed_ids, pose=pose, + gripper_type=gripper_type, gripper_pos=gripper_pos, gripper_quat=gripper_quat, gripper_scale=gripper_scale) + sim = redmax.Simulation(xml_string, asset_folder) + if camera_lookat is not None: + sim.viewer_options.camera_lookat = camera_lookat + if camera_pos is not None: + sim.viewer_options.camera_pos = camera_pos + + finger_states = get_gripper_finger_states(gripper_type, grasp['open_ratio'], gripper_scale) + for finger_name, finger_state in finger_states.items(): + sim.set_joint_q_init(finger_name, np.array(finger_state)) + sim.reset(backward_flag=False) + + if body_color_map is not None: + sim.set_body_color_map(body_color_map) + + # get gripper path + gripper_pos, gripper_quat = get_pos_quat_from_pose(gripper_pos, gripper_quat, pose) + gripper_path = get_gripper_path_from_part_path(part_path, gripper_pos, gripper_quat) + + # transform from global coordinate to local coordinate + part_path_local = [sim.get_joint_q_from_qm(f'part{move_id}', qm) for qm in part_path] + gripper_base_name = get_gripper_base_name(gripper_type) + gripper_path_local = [sim.get_joint_q_from_qm(gripper_base_name, qm) for qm in gripper_path] + + states = [np.concatenate([part_state, gripper_state, np.concatenate(list(finger_states.values()))]) for part_state, gripper_state in zip(part_path_local, gripper_path_local)] + if reverse: + states = states[::-1] + sim.set_state_his(states, [np.zeros_like(states[0]) for _ in range(len(states))]) + + if render: + SimRenderer.replay(sim, record=record_path is not None, record_path=record_path, make_video=make_video) + + return sim.export_replay_matrices() diff --git a/plan_robot/render_grasp_arm.py b/plan_robot/render_grasp_arm.py new file mode 100644 index 0000000..008e53b --- /dev/null +++ b/plan_robot/render_grasp_arm.py @@ -0,0 +1,324 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np +import redmax_py as redmax +import os +import json +from scipy.spatial.transform import Rotation as R +from tqdm import tqdm + +from utils.renderer import SimRenderer +from assets.load import load_pos_quat_dict, load_assembly_all_transformed, load_part_ids +from assets.color import get_color +from assets.transform import get_pos_quat_from_pose, get_transform_matrix_euler +from plan_robot.util_arm import get_arm_chain, get_arm_path_from_gripper_path, get_gripper_path_from_arm_path, get_gripper_part_path_from_arm_path, get_default_arm_rest_q, get_gripper_qm_from_arm_q +from plan_robot.util_grasp import get_gripper_finger_states, get_gripper_base_name, get_gripper_path_from_part_path +from plan_robot.motion_plan_arm import ArmMotionPlanner + + +def arr_to_str(arr): + return ' '.join([str(x) for x in arr]) + + +def create_gripper_arm_with_assembly_posed_xml(assembly_dir, move_id, still_ids, removed_ids, pose=None, gripper_type=None, gripper_pos=[0, 0, 5], gripper_quat=[1, 0, 0, 0], gripper_scale=1, + arm_pos=[-10, 10, 0], arm_euler=[0, 0, 0], arm_scale=1): + part_ids = [move_id] + still_ids + removed_ids + all_part_ids = load_part_ids(assembly_dir) + color_map = get_color(all_part_ids) + pos_dict_final, quat_dict_final = load_pos_quat_dict(assembly_dir, transform='final') + pos_dict_initial, quat_dict_initial = load_pos_quat_dict(assembly_dir, transform='initial') + arm_quat = R.from_euler('xyz', arm_euler).as_quat()[[3, 0, 1, 2]] + string = f''' + + + ''' + return string + + +def get_finger_open_path(gripper_type, gripper_scale, open_ratio_start, open_ratio_end, n_frame): + finger_path = [] + for i in range(n_frame): + open_ratio = open_ratio_start + (open_ratio_end - open_ratio_start) * (i + 1) / (n_frame + 1) + finger_states = np.concatenate(list(get_gripper_finger_states(gripper_type, open_ratio, gripper_scale).values())) + finger_path.append(finger_states) + return finger_path + + +def get_all_paths_from_arm_path(sim, arm_chain, arm_path, gripper_type, open_ratio, gripper_scale, gripper_to_part_transform=None, move_id=None, truncate=None): + + gripper_base_name = get_gripper_base_name(gripper_type) + if gripper_to_part_transform is None: + gripper_path = get_gripper_path_from_arm_path(arm_chain, arm_path, gripper_type) + part_path = None + else: + gripper_path, part_path = get_gripper_part_path_from_arm_path(arm_chain, arm_path, gripper_type, gripper_to_part_transform) + part_path = [sim.get_joint_q_from_qm(f'part{move_id}', qm) for qm in part_path] + + gripper_path = [sim.get_joint_q_from_qm(gripper_base_name, qm) for qm in gripper_path] + finger_states = get_gripper_finger_states(gripper_type, open_ratio, gripper_scale) + finger_path = [np.concatenate(list(finger_states.values())) for _ in range(len(gripper_path))] + arm_path = [arm_q[1:] for arm_q in arm_path] + + if truncate == 'start': + gripper_path, finger_path, arm_path = gripper_path[1:], finger_path[1:], arm_path[1:] + if part_path is not None: part_path = part_path[1:] + elif truncate == 'end': + gripper_path, finger_path, arm_path = gripper_path[:-1], finger_path[:-1], arm_path[:-1] + if part_path is not None: part_path = part_path[:-1] + + if part_path is None: + return arm_path, gripper_path, finger_path + else: + return arm_path, gripper_path, finger_path, part_path + + +def render_path_with_grasp_and_arm(asset_folder, assembly_dir, move_id, still_ids, removed_ids, pose, part_path, gripper_type, gripper_scale, grasp, optimizer, + camera_lookat=None, camera_pos=None, body_color_map=None, reverse=False, render=True, record_path=None, make_video=False): + if part_path is None: + print('no path found') + return + + gripper_pos, gripper_quat = grasp['gripper_pos'], grasp['gripper_quat'] + arm_pos, arm_euler, arm_q_pre = grasp['arm_pos'], grasp['arm_euler'], grasp['arm_q'] # full + arm_scale = gripper_scale + + xml_string = create_gripper_arm_with_assembly_posed_xml( + assembly_dir=assembly_dir, move_id=move_id, still_ids=still_ids, removed_ids=removed_ids, pose=pose, + gripper_type=gripper_type, gripper_pos=gripper_pos, gripper_quat=gripper_quat, gripper_scale=gripper_scale, + arm_pos=arm_pos, arm_euler=arm_euler, arm_scale=arm_scale) + sim = redmax.Simulation(xml_string, asset_folder) + if camera_lookat is not None: + sim.viewer_options.camera_lookat = camera_lookat + if camera_pos is not None: + sim.viewer_options.camera_pos = camera_pos + + finger_states = get_gripper_finger_states(gripper_type, grasp['open_ratio'], gripper_scale) + for finger_name, finger_state in finger_states.items(): + sim.set_joint_q_init(finger_name, np.array(finger_state)) + sim.reset(backward_flag=False) + + if body_color_map is not None: + sim.set_body_color_map(body_color_map) + + # get gripper path + gripper_pos, gripper_quat = get_pos_quat_from_pose(gripper_pos, gripper_quat, pose) + gripper_path = get_gripper_path_from_part_path(part_path, gripper_pos, gripper_quat) + + # get part to gripper transform + part_transform_pre = get_transform_matrix_euler(part_path[0][:3], part_path[0][3:]) + gripper_transform_pre = get_transform_matrix_euler(gripper_path[0][:3], gripper_path[0][3:]) + gripper_to_part_transform = np.linalg.inv(gripper_transform_pre) @ part_transform_pre # TODO: check + + # transform from global coordinate to local coordinate + part_path_local = [sim.get_joint_q_from_qm(f'part{move_id}', qm) for qm in part_path] + gripper_base_name = get_gripper_base_name(gripper_type) + gripper_path_local = [sim.get_joint_q_from_qm(gripper_base_name, qm) for qm in gripper_path] + finger_path_local = [np.concatenate(list(finger_states.values())) for _ in range(len(gripper_path_local))] + + # get arm path + arm_chain = get_arm_chain(base_pos=arm_pos, base_euler=arm_euler, scale=arm_scale) + arm_path_local = get_arm_path_from_gripper_path(gripper_path, gripper_type, arm_chain, arm_q_pre, optimizer) # full + arm_path_local = [arm_q[1:] for arm_q in arm_path_local] # active + + # set state history + states = [np.concatenate([part_state, gripper_state, finger_state, arm_state]) for part_state, gripper_state, finger_state, arm_state in zip(part_path_local, gripper_path_local, finger_path_local, arm_path_local)] + if reverse: + states = states[::-1] + sim.set_state_his(states, [np.zeros_like(states[0]) for _ in range(len(states))]) + + if render: + SimRenderer.replay(sim, record=record_path is not None, record_path=record_path, make_video=make_video) + + return sim.export_replay_matrices() diff --git a/plan_robot/run_grasp_arm_plan.py b/plan_robot/run_grasp_arm_plan.py new file mode 100644 index 0000000..438c04e --- /dev/null +++ b/plan_robot/run_grasp_arm_plan.py @@ -0,0 +1,233 @@ +''' +Grasp planning with stable pose, accelerated collision detection by specifying assembly directory and move/still parts +''' + +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np +import os +from argparse import ArgumentParser +from tqdm import tqdm +import trimesh +from time import time +from scipy.spatial.transform import Rotation as R + +from assets.transform import get_transform_from_path +from plan_sequence.stable_pose import get_stable_poses +from plan_sequence.feasibility_check import check_assemblable +from plan_robot.util_grasp import get_gripper_base_name +from plan_robot.render_grasp_arm import render_path_with_grasp_and_arm +from plan_robot.util_arm import get_arm_chain, get_arm_pos_candidates, get_arm_euler, inverse_kinematics_correction, get_default_arm_rest_q +from plan_robot.geometry import load_arm_meshes, transform_gripper_meshes, transform_arm_meshes, transform_part_meshes +from plan_robot.run_grasp_plan import GraspPlanner +from utils.seed import set_seed + + +class GraspArmPlanner(GraspPlanner): + + def __init__(self, asset_folder, assembly_dir, gripper_type=None, gripper_scale=None, seed=0, n_surface_pt=100, n_angle=10, ik_optimizer='L-BFGS-B'): + super().__init__(asset_folder, assembly_dir, gripper_type=gripper_type, gripper_scale=gripper_scale, seed=seed, n_surface_pt=n_surface_pt, n_angle=n_angle) + + # load arm meshes + self.arm_meshes = load_arm_meshes(asset_folder) + self.arm_scale = gripper_scale + self.arm_q_default = [0] + list(get_default_arm_rest_q()) # full + self.ik_optimizer = ik_optimizer + self.center = None + + def check_arm_feasible(self, grasp, move_mesh, still_mesh, arm_pos, arm_q_default=None, verbose=False, render=False): + gripper_pos, gripper_quat, open_ratio = grasp.pos, grasp.quat, grasp.open_ratio + gripper_ori = R.from_quat(gripper_quat[[1, 2, 3, 0]]).apply([0, 0, 1]) + + # check IK + arm_euler = get_arm_euler(arm_pos, center=self.center) + arm_chain = get_arm_chain(base_pos=arm_pos, base_euler=arm_euler, scale=self.arm_scale) + if arm_q_default is None: arm_q_default = self.arm_q_default + arm_q, ik_success = arm_chain.inverse_kinematics(target_position=gripper_pos, target_orientation=gripper_ori, orientation_mode='Z', n_restart=3, initial_position=arm_q_default, optimizer=self.ik_optimizer) + if ik_success: + arm_q = inverse_kinematics_correction(arm_chain, arm_q, self.gripper_type, gripper_quat) + else: + if verbose: print('[check_arm_feasible] IK failed') + return False + + # gripper collision manager + gripper_meshes_i = transform_gripper_meshes(self.gripper_type, self.gripper_meshes, gripper_pos, gripper_quat, self.gripper_scale, np.eye(4), open_ratio) + gripper_col_manager = trimesh.collision.CollisionManager() + for gripper_part_name, gripper_part_mesh in gripper_meshes_i.items(): + gripper_col_manager.add_object(gripper_part_name, gripper_part_mesh) + + # arm collision manager + arm_meshes_i = transform_arm_meshes(self.arm_meshes, arm_chain, arm_q, self.arm_scale) + arm_col_manager = trimesh.collision.CollisionManager() + for name, mesh in arm_meshes_i.items(): + arm_col_manager.add_object(name, mesh) + + # check arm-ground collision + for arm_part_name, arm_part_mesh in arm_meshes_i.items(): + if arm_part_name != 'linkbase' and arm_part_mesh.vertices[:, 2].min() <= 0.0: + if verbose: print('[check_arm_feasible] arm-ground collision') + return False + + # check arm-move part collision + if arm_col_manager.in_collision_single(move_mesh): + if verbose: print('[check_arm_feasible] arm-move part collision') + return False + + # check arm-still part collision + if arm_col_manager.in_collision_single(still_mesh): + if verbose: print('[check_arm_feasible] arm-still part collision') + return False + + # check arm-gripper collision + _, collision_names = gripper_col_manager.in_collision_other(arm_col_manager, return_names=True) + for (col_gripper_name, col_arm_name) in collision_names: + if col_arm_name == 'link7': + if col_gripper_name != get_gripper_base_name(self.gripper_type): + if verbose: print('[check_arm_feasible] arm-gripper collision') + return False + else: + if verbose: print('[check_arm_feasible] arm-gripper collision') + return False + + # check arm self-collision + _, collision_names = arm_col_manager.in_collision_internal(return_names=True) + for (col_arm_name1, col_arm_name2) in collision_names: + if not arm_chain.check_neighboring_links(col_arm_name1, col_arm_name2): + if verbose: print('[check_arm_feasible] arm self-collision') + return False + + grasp.arm_pos = arm_pos + grasp.arm_euler = arm_euler + grasp.arm_q = arm_q + return True + + def render(self, grasp, object_meshes): + gripper_meshes_i = transform_gripper_meshes(self.gripper_type, self.gripper_meshes, grasp.pos, grasp.quat, self.gripper_scale, np.eye(4), grasp.open_ratio) + if grasp.arm_pos is not None: + arm_chain = get_arm_chain(base_pos=grasp.arm_pos, base_euler=grasp.arm_euler, scale=self.arm_scale) + arm_meshes_i = transform_arm_meshes(self.arm_meshes, arm_chain, grasp.arm_q, self.arm_scale) + else: + arm_meshes_i = {} + trimesh.Scene(object_meshes + list(gripper_meshes_i.values()) + list(arm_meshes_i.values())).show() + + def plan(self, move_id, still_ids, removed_ids, pose, path, early_terminate=True, seed=0, verbose=False): + set_seed(seed) + + part_meshes_final = transform_part_meshes(self.part_meshes, self.part_pos_dict, self.part_quat_dict, pose) + move_mesh_final = part_meshes_final[move_id] + still_mesh_final = trimesh.util.concatenate([part_meshes_final[still_id] for still_id in still_ids]) + self.center = trimesh.util.concatenate(list(part_meshes_final.values())).centroid.copy() + self.center[2] = 0 + + part_transforms = get_transform_from_path(path, n_sample=None) + part_rel_transforms = [T @ np.linalg.inv(part_transforms[0]) for T in part_transforms] + + disassembly_direction = path[-1][:3] - path[0][:3] + disassembly_direction /= np.linalg.norm(disassembly_direction) + disassembly_direction_local = pose[:3, :3].T @ disassembly_direction if pose is not None else disassembly_direction + grasps_final = self.generate_grasps(move_mesh_final, disassembly_direction_local) + + grasps = [] + success = False + + # Every grasp + for grasp_idx, grasp in enumerate(grasps_final): + + gripper_pos, gripper_quat, open_ratio = grasp.pos, grasp.quat, grasp.open_ratio + if verbose: + print('-' * 10 + f' {grasp_idx + 1}/{len(grasps_final)} gripper state ' + '-' * 10) + + # Every arm position + gripper_ori = R.from_quat(gripper_quat[[1, 2, 3, 0]]).apply([0, 0, 1]) + arm_pos_candidates = get_arm_pos_candidates(gripper_pos, gripper_ori, self.gripper_scale, center=self.center) + for arm_pos in arm_pos_candidates: + + # Every time step + grasps_t = [] + arm_q_default = None + for part_transform in part_rel_transforms: + grasp_t = self.transform_grasp(grasp, part_transform) + move_mesh_t = move_mesh_final.copy() + move_mesh_t.apply_transform(part_transform) + + feasible = self.check_grasp_feasible(grasp_t, move_mesh_t, still_mesh_final, verbose=verbose) and \ + self.check_arm_feasible(grasp_t, move_mesh_t, still_mesh_final, arm_pos, arm_q_default, verbose=verbose) + if not feasible: + # self.render(grasp_t, [move_mesh_t, still_mesh_final]) + break + grasps_t.append(grasp_t) + arm_q_default = grasp_t.arm_q + # self.render(grasp_t, [move_mesh_t, still_mesh_final]) + + else: + grasps.append(grasps_t) + success = True + + if early_terminate and success: + break + + if early_terminate and success: + break + + return grasps + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--assembly-dir', type=str, required=True, help='directory of assembly') + parser.add_argument('--move-id', type=str, required=True, help='move part id') + parser.add_argument('--still-ids', type=str, nargs='+', default=None, help='still part ids') + parser.add_argument('--removed-ids', type=str, nargs='+', default=[], help='removed part ids') + parser.add_argument('--gripper', type=str, default='robotiq-140', choices=['panda', 'robotiq-85', 'robotiq-140'], help='gripper type') + parser.add_argument('--scale', type=float, default=0.4, help='gripper scale') + parser.add_argument('--n-pose', type=int, default=5, help='number of pose samples') + parser.add_argument('--n-surface-pt', type=int, default=100, help='number of surface point samples for generating antipodal pairs') + parser.add_argument('--n-angle', type=int, default=10, help='number of grasp angle samples') + parser.add_argument('--optimizer', type=str, default='L-BFGS-B', help='optimizer') + parser.add_argument('--early-terminate', action='store_true', default=False, help='early terminate') + parser.add_argument('--seed', type=int, default=0, help='random seed') + parser.add_argument('--camera-lookat', type=float, nargs=3, default=None, help='camera lookat') + parser.add_argument('--camera-pos', type=float, nargs=3, default=None, help='camera position') + parser.add_argument('--verbose', action='store_true', default=False, help='verbose') + parser.add_argument('--render', action='store_true', default=False, help='render grasps') + args = parser.parse_args() + + asset_folder = os.path.join(project_base_dir, './assets') + + grasp_planner = GraspArmPlanner(asset_folder, args.assembly_dir, args.gripper, args.scale, + args.seed, args.n_surface_pt, args.n_angle, args.optimizer) + + move_id = args.move_id + still_ids = [part_id for part_id in grasp_planner.assembly.keys() if part_id != move_id] if args.still_ids is None else args.still_ids + removed_ids = args.removed_ids + + part_meshes_combined = trimesh.util.concatenate(list(grasp_planner.part_meshes_final.values())) + poses = get_stable_poses(part_meshes_combined, max_num=args.n_pose) + + for pose_idx, pose in enumerate(poses): + print('=' * 10 + f' {pose_idx + 1}/{len(poses)} pose ' + '=' * 10) + + _, path = check_assemblable(asset_folder, args.assembly_dir, still_ids, move_id, pose=pose, return_path=True) + if path is None: continue + + grasps = grasp_planner.plan(move_id, still_ids, removed_ids, pose, path, early_terminate=args.early_terminate, seed=args.seed, verbose=args.verbose) + print(f'{len(grasps)} feasible grasps found') + + # import pickle + # grasp_path = os.path.join('grasps', f'grasp.pkl') + # os.makedirs(os.path.dirname(grasp_path), exist_ok=True) + # with open(grasp_path, 'wb') as f: + # pickle.dump(grasps, f) + # with open(grasp_path, 'rb') as f: + # grasps = pickle.load(f) + + if args.render: + n_render = min(1, len(grasps)) + random_indices = np.random.choice(len(grasps), n_render, replace=False) + for idx in random_indices: + grasp = grasps[idx] + render_path_with_grasp_and_arm(asset_folder, args.assembly_dir, move_id, still_ids, removed_ids, pose, path, args.gripper, args.scale, grasp, args.camera_lookat, args.camera_pos) diff --git a/plan_robot/run_grasp_plan.py b/plan_robot/run_grasp_plan.py new file mode 100644 index 0000000..d3fb9c6 --- /dev/null +++ b/plan_robot/run_grasp_plan.py @@ -0,0 +1,211 @@ +''' +Grasp planning with stable pose, accelerated collision detection by specifying assembly directory and move/still parts +''' + +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np +import os +from argparse import ArgumentParser +from tqdm import tqdm +import trimesh +from time import time +from scipy.spatial.transform import Rotation as R + +from assets.load import load_assembly_all_transformed, load_pos_quat_dict +from assets.transform import get_pos_quat_from_pose, get_transform_from_path +from plan_sequence.stable_pose import get_stable_poses +from plan_sequence.feasibility_check import check_assemblable +from plan_robot.util_grasp import Grasp, compute_antipodal_pairs, generate_gripper_states, get_gripper_open_ratio +from plan_robot.render_grasp import render_path_with_grasp +from plan_robot.geometry import load_gripper_meshes, transform_gripper_meshes, transform_part_meshes +from utils.seed import set_seed + + +class GraspPlanner: + + def __init__(self, asset_folder, assembly_dir, gripper_type=None, gripper_scale=None, seed=0, n_surface_pt=100, n_angle=10): + set_seed(seed) + + # load assembly meshes + self.assembly = load_assembly_all_transformed(assembly_dir) + self.part_pos_dict, self.part_quat_dict = load_pos_quat_dict(assembly_dir, transform='final') + self.part_meshes = {part_id: self.assembly[part_id]['mesh'] for part_id in self.assembly.keys()} + self.part_meshes_initial = {part_id: self.assembly[part_id]['mesh_initial'] for part_id in self.assembly.keys()} + self.part_meshes_final = {part_id: self.assembly[part_id]['mesh_final'] for part_id in self.assembly.keys()} + + # load gripper meshes + self.gripper_type = gripper_type + self.gripper_meshes = load_gripper_meshes(self.gripper_type, asset_folder) + self.gripper_scale = gripper_scale + + # sampling budget + self.n_surface_pt = n_surface_pt + self.n_angle = n_angle + + def generate_grasps(self, part_mesh, disassembly_direction=None): + grasps = [] + + # compute antipodal points + antipodal_pairs = compute_antipodal_pairs(part_mesh, sample_budget=self.n_surface_pt) + for antipodal_points in antipodal_pairs: + open_ratio = get_gripper_open_ratio(self.gripper_type, antipodal_points, self.gripper_scale) + if open_ratio is None: continue + + # compute grasps + gripper_pos_list, gripper_quat_list = generate_gripper_states(self.gripper_type, antipodal_points, self.gripper_scale, open_ratio, self.n_angle, disassembly_direction=disassembly_direction) + for gripper_pos, gripper_quat in zip(gripper_pos_list, gripper_quat_list): + grasps.append(Grasp(gripper_pos, gripper_quat, open_ratio)) + + return grasps + + def transform_grasp(self, grasp, pose): + grasp = grasp.copy() + grasp.pos, grasp.quat = get_pos_quat_from_pose(grasp.pos, grasp.quat, pose) + return grasp + + def check_grasp_feasible(self, grasp, move_mesh, still_mesh, verbose=False, render=False): + gripper_pos, gripper_quat, open_ratio = grasp.pos, grasp.quat, grasp.open_ratio + + # gripper collision manager (loose hold) + gripper_meshes_i = transform_gripper_meshes(self.gripper_type, self.gripper_meshes, gripper_pos, gripper_quat, self.gripper_scale, np.eye(4), open_ratio) + gripper_col_manager = trimesh.collision.CollisionManager() + for gripper_part_name, gripper_part_mesh in gripper_meshes_i.items(): + gripper_col_manager.add_object(gripper_part_name, gripper_part_mesh) + + # check gripper-ground collision + for gripper_part_mesh in gripper_meshes_i.values(): + if gripper_part_mesh.vertices[:, 2].min() <= 0.0: + if verbose: print('[check_grasp_feasible] gripper-ground collision') + return False + + # check gripper-move part collision + if gripper_col_manager.in_collision_single(move_mesh): + if verbose: print('[check_grasp_feasible] gripper-move part collision') + return False + + # gripper collision manager (tight hold) + gripper_meshes_i = transform_gripper_meshes(self.gripper_type, self.gripper_meshes, gripper_pos, gripper_quat, self.gripper_scale, np.eye(4), open_ratio - 0.005) + gripper_col_manager = trimesh.collision.CollisionManager() + for gripper_part_name, gripper_part_mesh in gripper_meshes_i.items(): + gripper_col_manager.add_object(gripper_part_name, gripper_part_mesh) + + # check gripper-still part collision + if gripper_col_manager.in_collision_single(still_mesh): + if verbose: print('[check_grasp_feasible] gripper-still part collision') + return False + + return True + + def render(self, grasp, object_meshes): + gripper_meshes_i = transform_gripper_meshes(self.gripper_type, self.gripper_meshes, grasp.pos, grasp.quat, self.gripper_scale, np.eye(4), grasp.open_ratio) + trimesh.Scene(object_meshes + list(gripper_meshes_i.values())).show() + + def plan(self, move_id, still_ids, removed_ids, pose, path, early_terminate=True, seed=0, verbose=False): + set_seed(seed) + + part_meshes_final = transform_part_meshes(self.part_meshes, self.part_pos_dict, self.part_quat_dict, pose) + move_mesh_final = part_meshes_final[move_id] + still_mesh_final = trimesh.util.concatenate([part_meshes_final[still_id] for still_id in still_ids]) + self.center = trimesh.util.concatenate(list(part_meshes_final.values())).centroid.copy() + self.center[2] = 0 + + part_transforms = get_transform_from_path(path, n_sample=None) + part_rel_transforms = [T @ np.linalg.inv(part_transforms[0]) for T in part_transforms] + + disassembly_direction = path[-1][:3] - path[0][:3] + disassembly_direction /= np.linalg.norm(disassembly_direction) + disassembly_direction_local = pose[:3, :3].T @ disassembly_direction if pose is not None else disassembly_direction + grasps_final = self.generate_grasps(move_mesh_final, disassembly_direction_local) + + grasps = [] + success = False + + # Every grasp + for grasp_idx, grasp in enumerate(grasps_final): + + if verbose: + print('-' * 10 + f' {grasp_idx + 1}/{len(grasps_final)} gripper state ' + '-' * 10) + + # Every time step + grasps_t = [] + for part_transform in part_rel_transforms: + grasp_t = self.transform_grasp(grasp, part_transform) + move_mesh_t = move_mesh_final.copy() + move_mesh_t.apply_transform(part_transform) + + feasible = self.check_grasp_feasible(grasp_t, move_mesh_t, still_mesh_final, verbose=verbose) + if not feasible: + # self.render(grasp_t, [move_mesh_t, still_mesh_final]) + break + grasps_t.append(grasp_t) + # self.render(grasp_t, [move_mesh_t, still_mesh_final]) + + else: + grasps.append(grasps_t) + success = True + + if early_terminate and success: + break + + return grasps + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--assembly-dir', type=str, required=True, help='directory of assembly') + parser.add_argument('--move-id', type=str, required=True, help='move part id') + parser.add_argument('--still-ids', type=str, nargs='+', default=None, help='still part ids') + parser.add_argument('--removed-ids', type=str, nargs='+', default=[], help='removed part ids') + parser.add_argument('--gripper', type=str, default='robotiq-140', choices=['panda', 'robotiq-85', 'robotiq-140'], help='gripper type') + parser.add_argument('--scale', type=float, default=0.4, help='gripper scale') + parser.add_argument('--n-pose', type=int, default=5, help='number of pose samples') + parser.add_argument('--n-surface-pt', type=int, default=100, help='number of surface point samples for generating antipodal pairs') + parser.add_argument('--n-angle', type=int, default=10, help='number of grasp angle samples') + parser.add_argument('--early-terminate', action='store_true', default=False, help='early terminate') + parser.add_argument('--seed', type=int, default=0, help='random seed') + parser.add_argument('--camera-lookat', type=float, nargs=3, default=None, help='camera lookat') + parser.add_argument('--camera-pos', type=float, nargs=3, default=None, help='camera position') + parser.add_argument('--verbose', action='store_true', default=False, help='verbose') + parser.add_argument('--render', action='store_true', default=False, help='render grasps') + args = parser.parse_args() + + asset_folder = os.path.join(project_base_dir, './assets') + + grasp_planner = GraspPlanner(asset_folder, args.assembly_dir, args.gripper, args.scale, + args.seed, args.n_surface_pt, args.n_angle) + + move_id = args.move_id + still_ids = [part_id for part_id in grasp_planner.assembly.keys() if part_id != move_id] if args.still_ids is None else args.still_ids + removed_ids = args.removed_ids + + part_meshes_combined = trimesh.util.concatenate(list(grasp_planner.part_meshes_final.values())) + poses = get_stable_poses(part_meshes_combined, max_num=args.n_pose) + + for pose_idx, pose in enumerate(poses): + print('=' * 10 + f' {pose_idx + 1}/{len(poses)} pose ' + '=' * 10) + + _, path = check_assemblable(asset_folder, args.assembly_dir, still_ids, move_id, pose=pose, return_path=True) + if path is None: continue + + grasps = grasp_planner.plan(move_id, still_ids, removed_ids, pose, path, early_terminate=args.early_terminate, seed=args.seed, verbose=args.verbose) + print(f'{len(grasps)} feasible grasps found') + + # import pickle + # grasp_path = os.path.join('grasps', f'grasp.pkl') + # os.makedirs(os.path.dirname(grasp_path), exist_ok=True) + # with open(grasp_path, 'wb') as f: + # pickle.dump(grasps, f) + # with open(grasp_path, 'rb') as f: + # grasps = pickle.load(f) + + if args.render: + n_render = min(1, len(grasps)) + random_indices = np.random.choice(len(grasps), n_render, replace=False) + for idx in random_indices: + grasp = grasps[idx] + render_path_with_grasp(asset_folder, args.assembly_dir, move_id, still_ids, removed_ids, pose, path, args.gripper, args.scale, grasp, args.camera_lookat, args.camera_pos) diff --git a/plan_robot/util_arm.py b/plan_robot/util_arm.py new file mode 100644 index 0000000..d6face7 --- /dev/null +++ b/plan_robot/util_arm.py @@ -0,0 +1,320 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np +from scipy.spatial.transform import Rotation as R +from .ik.chain import Chain +from ikpy.link import URDFLink + +from assets.transform import get_transform_matrix_quat, get_pos_euler_from_transform_matrix +from plan_robot.util_grasp import get_gripper_basis_directions + + +def get_arm_chain(base_pos=[0, 0, 0], base_euler=[0, 0, 0], scale=1): + + scale *= 100 # since urdf info are defined in m, convert to cm + symbolic = True + + links = [ + URDFLink( + name="linkbase", + bounds=tuple([-np.inf, np.inf]), + origin_translation=np.array(base_pos), + origin_orientation=np.array(base_euler), + rotation=None, + translation=None, + use_symbolic_matrix=symbolic, + joint_type='fixed' + ), + + URDFLink( + name="link1", + bounds=tuple([-6.28318530718, 6.28318530718]), + origin_translation=np.array([0, 0, 0.267]) * scale, + origin_orientation=np.array([0, 0, 0]), + rotation=np.array([0, 0, 1]), + translation=None, + use_symbolic_matrix=symbolic, + joint_type='revolute' + ), + + URDFLink( + name="link2", + bounds=tuple([-2.059, 2.0944]), + origin_translation=np.array([0, 0, 0]) * scale, + origin_orientation=np.array([-1.5708, 0, 0]), + rotation=np.array([0, 0, 1]), + translation=None, + use_symbolic_matrix=symbolic, + joint_type='revolute' + ), + + URDFLink( + name="link3", + bounds=tuple([-6.28318530718, 6.28318530718]), + origin_translation=np.array([0, -0.293, 0]) * scale, + origin_orientation=np.array([1.5708, 0, 0]), + rotation=np.array([0, 0, 1]), + translation=None, + use_symbolic_matrix=symbolic, + joint_type='revolute' + ), + + URDFLink( + name="link4", + bounds=tuple([-0.19198, 3.927]), + origin_translation=np.array([0.0525, 0, 0]) * scale, + origin_orientation=np.array([1.5708, 0, 0]), + rotation=np.array([0, 0, 1]), + translation=None, + use_symbolic_matrix=symbolic, + joint_type='revolute' + ), + + URDFLink( + name="link5", + bounds=tuple([-6.28318530718, 6.28318530718]), + origin_translation=np.array([0.0775, -0.3425, 0]) * scale, + origin_orientation=np.array([1.5708, 0, 0]), + rotation=np.array([0, 0, 1]), + translation=None, + use_symbolic_matrix=symbolic, + joint_type='revolute' + ), + + URDFLink( + name="link6", + bounds=tuple([-1.69297, 3.14159265359]), + origin_translation=np.array([0, 0, 0]) * scale, + origin_orientation=np.array([1.5708, 0, 0]), + rotation=np.array([0, 0, 1]), + translation=None, + use_symbolic_matrix=symbolic, + joint_type='revolute' + ), + + URDFLink( + name="link7", + bounds=tuple([-6.28318530718, 6.28318530718]), + origin_translation=np.array([0.076, 0.097, 0]) * scale, + origin_orientation=np.array([-1.5708, 0, 0]), + rotation=np.array([0, 0, 1]), + translation=None, + use_symbolic_matrix=symbolic, + joint_type='revolute' + ), + ] + + return Chain(links, active_links_mask=[False] + [True] * (len(links) - 1)) + + +def get_default_arm_rest_q(): + return [2.35618014, -0.56582579, 6.28318531, 0.35527904, -6.28318531, 0.92109843, 0.] # NOTE: active, hardcoded + + +def intersecting_point_on_circle(x, y, ray_x, ray_y, R): + # Calculate the coefficients of the quadratic equation in t + a = ray_x**2 + ray_y**2 + b = 2 * (x * ray_x + y * ray_y) + c = x**2 + y**2 - R**2 + + # Calculate the discriminant + discriminant = b**2 - 4 * a * c + assert discriminant >= 0, 'No intersection between the ray and the circle' + + # Calculate the positive solution for t + t = (-b + np.sqrt(discriminant)) / (2 * a) + + # Calculate the intersecting point coordinates + x_int = x + t * ray_x + y_int = y + t * ray_y + + return x_int, y_int + + +def get_arm_pos(gripper_pos, gripper_ori, arm_scale, center=np.zeros(3)): + + radius = 50 * arm_scale # TODO: update radius + + # project all directions onto a 2d plane + gripper_pos = gripper_pos.copy() - center + gripper_pos[2] = 0 + gripper_ori = gripper_ori.copy() + gripper_ori[2] = 0 + + # calculate norms + gripper_pos_norm = np.linalg.norm(gripper_pos) + gripper_ori_norm = np.linalg.norm(gripper_ori) + + # determine arm direction (gripper -> arm) + if np.isclose(gripper_ori_norm, 0): + if np.isclose(gripper_pos_norm, 0): + + # if gripper is top-down at origin, use random direction + arm_direction = np.random.random(3) + arm_direction[2] = 0 + arm_direction /= np.linalg.norm(arm_direction) + + else: + # if gripper is top-down at non-origin, use gripper position + arm_direction = gripper_pos / gripper_pos_norm + + else: + # if gripper is not top-down, arm should be aligned with gripper orientation + x_int, y_int = intersecting_point_on_circle(gripper_pos[0], gripper_pos[1], -gripper_ori[0], -gripper_ori[1], radius) + arm_direction = np.array([x_int, y_int, 0]) / radius + + arm_pos = radius * arm_direction + center + return arm_pos + + +def get_arm_pos_candidates(gripper_pos, gripper_ori, arm_scale, center=np.zeros(3), n_angle=4): + + arm_pos_init = get_arm_pos(gripper_pos, gripper_ori, arm_scale, center) - center + arm_pos_candidates = [] + + for i in range(n_angle): + angle = 2 * np.pi * i / n_angle + rot_mat = np.array([[np.cos(angle), -np.sin(angle), 0], + [np.sin(angle), np.cos(angle), 0], + [0, 0, 1]]) + arm_pos_candidates.append(rot_mat.dot(arm_pos_init) + center) + + return arm_pos_candidates + + +def get_arm_euler(arm_pos, center=np.zeros(3)): + + # get orientation + arm_ori = arm_pos - center + arm_ori[2] = 0 + arm_ori /= np.linalg.norm(arm_ori) + + # get euler angle + yaw = np.arccos(np.clip(-arm_ori[0], -1, 1)) + if arm_ori[1] > 0: + yaw = -yaw + euler = np.array([0, 0, yaw]) + + return euler + + +def get_gripper_pos_quat_from_arm_q(arm_chain, arm_q, gripper_type): + + ef_target_matrix = arm_chain.forward_kinematics(arm_q) + ef_init_matrix = arm_chain.forward_kinematics([0] * len(arm_chain.links))[:3, :3] + arm_euler = arm_chain.links[0].origin_orientation + base_init_direction, l2r_init_direction = [0, 0, 1], R.from_euler('xyz', arm_euler).apply([0, -1, 0]) + gripper_init_matrix = R.align_vectors([base_init_direction, l2r_init_direction], [*get_gripper_basis_directions(gripper_type)])[0].as_matrix() + gripper_target_matrix = ef_target_matrix[:3, :3] @ ef_init_matrix.T @ gripper_init_matrix + gripper_pos, gripper_quat = ef_target_matrix[:3, 3], R.from_matrix(gripper_target_matrix).as_quat()[[3, 0, 1, 2]] + + return gripper_pos, gripper_quat + + +def get_gripper_qm_from_arm_q(arm_chain, arm_q, gripper_type): + + gripper_pos, gripper_quat = get_gripper_pos_quat_from_arm_q(arm_chain, arm_q, gripper_type) + gripper_matrix = get_transform_matrix_quat(gripper_pos, gripper_quat) + gripper_qm = get_pos_euler_from_transform_matrix(gripper_matrix) + + return gripper_qm + + +def get_gripper_path_from_arm_path(arm_chain, arm_path, gripper_type): + + gripper_path = [] + for arm_q in arm_path: + gripper_path.append(get_gripper_qm_from_arm_q(arm_chain, arm_q, gripper_type)) + + return gripper_path + + +def get_gripper_part_qm_from_arm_q(arm_chain, arm_q, gripper_type, part_transform): + + gripper_pos, gripper_quat = get_gripper_pos_quat_from_arm_q(arm_chain, arm_q, gripper_type) + gripper_matrix = get_transform_matrix_quat(gripper_pos, gripper_quat) + gripper_qm = get_pos_euler_from_transform_matrix(gripper_matrix) + + part_matrix = gripper_matrix @ part_transform + part_qm = get_pos_euler_from_transform_matrix(part_matrix) + + return gripper_qm, part_qm + + +def get_gripper_part_path_from_arm_path(arm_chain, arm_path, gripper_type, part_transform): + + gripper_path, part_path = [], [] + for arm_q in arm_path: + gripper_qm, part_qm = get_gripper_part_qm_from_arm_q(arm_chain, arm_q, gripper_type, part_transform) + gripper_path.append(gripper_qm) + part_path.append(part_qm) + + return gripper_path, part_path + + +def inverse_kinematics_correction(arm_chain, arm_q, gripper_type, gripper_quat): + ''' + Computes the inverse kinematic on the specified target with correction on the last joint angle + ''' + arm_q = arm_q.copy() + arm_euler = arm_chain.links[0].origin_orientation + + ef_init_matrix = arm_chain.forward_kinematics([0] * len(arm_chain.links))[:3, :3] # end effector initial rotation when arm has all 0 joint angles + base_init_direction, l2r_init_direction = [0, 0, 1], R.from_euler('xyz', arm_euler).apply([0, -1, 0]) + gripper_init_matrix = R.align_vectors([base_init_direction, l2r_init_direction], [*get_gripper_basis_directions(gripper_type)])[0].as_matrix() # gripper initial rotation + + ef_target_matrix = R.from_quat(gripper_quat[[1, 2, 3, 0]]).as_matrix() @ gripper_init_matrix.T @ ef_init_matrix # end effector target rotation for given gripper state + ef_curr_matrix = arm_chain.forward_kinematics(arm_q) # end effector current rotation from current joint angles + + correct_rotvec = R.from_matrix(ef_curr_matrix[:3, :3].T @ ef_target_matrix).as_rotvec() # rotation vector for last joint angle correction (NOTE: ideally should be 0, 0, theta) + + arm_q[-1] += correct_rotvec[-1] + if arm_q[-1] < -np.pi * 2: + arm_q[-1] += np.pi * 2 + elif arm_q[-1] > np.pi * 2: + arm_q[-1] -= np.pi * 2 + + return arm_q + + +def check_inverse_kinematics_success(arm_chain, arm_q, gripper_type, gripper_quat, eps=1e-3, verbose=False): + + arm_q = arm_q.copy() + arm_euler = arm_chain.links[0].origin_orientation + + ef_init_matrix = arm_chain.forward_kinematics([0] * len(arm_chain.links))[:3, :3] # end effector initial rotation when arm has all 0 joint angles + base_init_direction, l2r_init_direction = [0, 0, 1], R.from_euler('xyz', arm_euler).apply([0, -1, 0]) + gripper_init_matrix = R.align_vectors([base_init_direction, l2r_init_direction], [*get_gripper_basis_directions(gripper_type)])[0].as_matrix() # gripper initial rotation + + ef_target_matrix = R.from_quat(gripper_quat[[1, 2, 3, 0]]).as_matrix() @ gripper_init_matrix.T @ ef_init_matrix # end effector target rotation for given gripper state + ef_curr_matrix = arm_chain.forward_kinematics(arm_q) # end effector current rotation from current joint angles + + correct_rotvec = R.from_matrix(ef_curr_matrix[:3, :3].T @ ef_target_matrix).as_rotvec() # rotation vector for last joint angle correction (NOTE: ideally should be 0, 0, theta) + deviation_norm = np.linalg.norm(correct_rotvec[:2]) + + if verbose: + print('IK rotation deviation: {:.4f}'.format(deviation_norm) + f', Success: {deviation_norm < eps}') + + return deviation_norm < eps + + +def get_arm_path_from_gripper_path(gripper_path, gripper_type, arm_chain, arm_q_init, optimizer='L-BFGS-B'): + arm_path_local = [] + arm_q = arm_q_init.copy() if arm_q_init is not None else None # full + for qm in gripper_path: + gripper_pos = qm[:3] + gripper_rot = R.from_euler('xyz', qm[3:]) + gripper_ori = gripper_rot.apply([0, 0, 1]) + gripper_quat = gripper_rot.as_quat()[[3, 0, 1, 2]] + + arm_q, ik_success = arm_chain.inverse_kinematics(target_position=gripper_pos, target_orientation=gripper_ori, orientation_mode='Z', n_restart=3, initial_position=arm_q, optimizer=optimizer) + arm_q = inverse_kinematics_correction(arm_chain, arm_q, gripper_type, gripper_quat) + + if not ik_success: # IK not fully checked for every step in the path during planning + print('inverse kinematics failed') + arm_path_local.append(arm_q) + return arm_path_local diff --git a/plan_robot/util_grasp.py b/plan_robot/util_grasp.py new file mode 100644 index 0000000..b58259b --- /dev/null +++ b/plan_robot/util_grasp.py @@ -0,0 +1,331 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import copy +import trimesh +import numpy as np +from scipy.spatial.transform import Rotation as R +from argparse import ArgumentParser + +from assets.transform import get_transform_matrix_quat, get_transform_matrix_euler, get_pos_euler_from_transform_matrix + + +class Grasp: + + def __init__(self, pos, quat, open_ratio, arm_pos=None, arm_euler=None, arm_q=None, arm_q_init=None): + self.pos = pos + self.quat = quat + self.open_ratio = open_ratio + self.arm_pos = arm_pos + self.arm_euler = arm_euler + self.arm_q = arm_q + self.arm_q_init = arm_q_init + + def copy(self): + return copy.deepcopy(self) + + +def compute_antipodal_pairs(obj, sample_budget=100, visualize=False, verbose=False): + ''' + Compute pairs of antipodal points for a given mesh through ray casting and surface sampling + ''' + # load mesh + if type(obj) == str: + mesh = trimesh.load(obj) + elif type(obj) == trimesh.Trimesh: + mesh = obj + else: + raise NotImplementedError + + # randomly sample surface points + sample_points, sample_face_idx = mesh.sample(sample_budget, return_index=True) + sample_normals = mesh.face_normals[sample_face_idx] + + # ray casting for computing antipodal points + init_offset = 0.05 # move ray origins slightly inside the surface + ray_caster = trimesh.ray.ray_triangle.RayMeshIntersector(mesh) + intersect_points, ray_idx, intersect_face_idx = ray_caster.intersects_location(sample_points - init_offset * sample_normals, -sample_normals) + intersect_normals = mesh.face_normals[intersect_face_idx] + + antipodal_idx = np.einsum('ij,ij->i', intersect_normals, -sample_normals[ray_idx]) > 0.95 + antipodal_pairs = np.stack([sample_points[ray_idx][antipodal_idx], intersect_points[antipodal_idx]], axis=1) + antipodal_pairs = sort_antipodal_pairs(mesh, antipodal_pairs) + grasping_widths = np.linalg.norm(antipodal_pairs[:, 0, :] - antipodal_pairs[:, 1, :], axis=1) + # TODO: what if cannot find antipodal pairs? + + if visualize: + pts = [antipodal_pairs[i][0] for i in range(len(antipodal_pairs))] + pc = trimesh.PointCloud(pts, colors=[255, 0, 0, 255]) + trimesh.Scene([mesh, pc]).show() + + if verbose: + print(f'Found {len(antipodal_pairs)} pairs of antipodal points') + + return antipodal_pairs + + +def sort_antipodal_pairs(mesh, antipodal_pairs): + ''' + Sort antipodal pairs based on the distance from center of mesh to center of antipodal points + ''' + if len(antipodal_pairs) == 0: return antipodal_pairs + antipodal_center = np.mean(antipodal_pairs, axis=1) + dist = np.linalg.norm(antipodal_center - mesh.centroid, axis=1) + sorted_idx = np.argsort(dist) + return antipodal_pairs[sorted_idx] + + +def get_panda_grasp_base_offset(): + return 10.4 + + +def get_robotiq_85_grasp_base_offset(open_ratio): + return 3.5 + np.sin(0.9208 + (1 - open_ratio) * 0.8757) * 5.715 + 6.93075 + + +def get_robotiq_140_grasp_base_offset(open_ratio): + return 1.5 + 3.8 + np.sin(0.8680 + (1 - open_ratio) * 0.8757) * 10 + 5.4905 + 0.5 # NOTE: extra 0.5 for the finger tip + + +def get_gripper_grasp_base_offset(gripper_type, open_ratio): + if gripper_type == 'panda': + return get_panda_grasp_base_offset() + elif gripper_type == 'robotiq-85': + return get_robotiq_85_grasp_base_offset(open_ratio) + elif gripper_type == 'robotiq-140': + return get_robotiq_140_grasp_base_offset(open_ratio) + else: + raise NotImplementedError + + +def get_panda_basis_directions(): + return [0, 0, -1], [0, -1, 0] + + +def get_robotiq_85_basis_directions(): + return [0, 0, -1], [-1, 0, 0] + + +def get_robotiq_140_basis_directions(): + return [0, 0, -1], [0, 1, 0] + + +def get_gripper_basis_directions(gripper_type): + if gripper_type == 'panda': + return get_panda_basis_directions() + elif gripper_type == 'robotiq-85': + return get_robotiq_85_basis_directions() + elif gripper_type == 'robotiq-140': + return get_robotiq_140_basis_directions() + else: + raise NotImplementedError + + +def get_gripper_pos_quat(gripper_type, grasp_center, base_direction, l2r_direction, open_ratio, scale): + offset = get_gripper_grasp_base_offset(gripper_type, open_ratio) + pos = grasp_center + base_direction * offset * scale + rotation = R.align_vectors([base_direction, l2r_direction], [*get_gripper_basis_directions(gripper_type)])[0] + quat = rotation.as_quat()[[3, 0, 1, 2]] + return pos, quat + + +def generate_gripper_states(gripper_type, antipodal_points, scale, open_ratio, sample_budget=10, disassembly_direction=None): + antipodal_points = np.array(antipodal_points, dtype=float) + grasp_center = np.mean(antipodal_points, axis=0) + l2r_direction = antipodal_points[1] - antipodal_points[0] + l2r_direction /= np.linalg.norm(l2r_direction) + + # get one base direction + if disassembly_direction is None: + random_direction = np.random.rand(3) + random_direction /= np.linalg.norm(random_direction) + base_direction_basis = np.cross(l2r_direction, random_direction) + else: + disassembly_direction = np.array(disassembly_direction, dtype=float) + disassembly_direction /= np.linalg.norm(disassembly_direction) + if np.dot(disassembly_direction, l2r_direction) in [1, -1]: # disassembly direction is parallel to l2r direction + random_direction = np.random.rand(3) + random_direction /= np.linalg.norm(random_direction) + base_direction_basis = np.cross(disassembly_direction, random_direction) + else: + base_direction_basis = np.cross(disassembly_direction, l2r_direction) + base_direction_basis /= np.linalg.norm(base_direction_basis) + + base_direction_list = [] + # generate base directions by sampling angles + for angle in np.linspace(0, 2 * np.pi, sample_budget + 1)[:-1]: + base_rotation = R.from_rotvec(angle * l2r_direction) + base_direction = base_rotation.apply(base_direction_basis) + base_direction /= np.linalg.norm(base_direction) + if disassembly_direction is not None and np.dot(base_direction, disassembly_direction) < 0: + continue + base_direction_list.append(base_direction) + + # sort base directions by angle with disassembly direction + if disassembly_direction is not None: + base_direction_list.sort(key=lambda x: np.dot(x, disassembly_direction), reverse=True) + + # generate state candidates from base directions + pos_list, quat_list = [], [] + for base_direction in base_direction_list: + pos, quat = get_gripper_pos_quat(gripper_type, grasp_center, base_direction, l2r_direction, open_ratio, scale) + pos_list.append(pos) + quat_list.append(quat) + return pos_list, quat_list + + +def get_panda_open_ratio(antipodal_points, scale): + antipodal_points = np.array(antipodal_points, dtype=float) + antipodal_width = np.linalg.norm(antipodal_points[1] - antipodal_points[0]) + open_ratio = antipodal_width / 8 / scale + if open_ratio > 1: + return None + else: + return open_ratio + + +def get_robotiq_85_open_ratio(antipodal_points, scale): + antipodal_points = np.array(antipodal_points, dtype=float) + antipodal_width = np.linalg.norm(antipodal_points[1] - antipodal_points[0]) + if antipodal_width / scale > 3.92853109 * 2: + return None + else: + return 1.0 - (np.arccos((antipodal_width / scale / 2 + 0.8 - 1.27) / 5.715) - 0.9208) / 0.8757 + + +def get_robotiq_140_open_ratio(antipodal_points, scale): + antipodal_points = np.array(antipodal_points, dtype=float) + antipodal_width = np.linalg.norm(antipodal_points[1] - antipodal_points[0]) + if antipodal_width / scale > 7.22376574 * 2: + return None + else: + return 1.0 - (np.arccos((antipodal_width / scale / 2 + 0.325 + 2.3 - 1.7901 - 1.27) / 10) - 0.8680) / 0.8757 + + +def get_gripper_open_ratio(gripper_type, antipodal_points, scale): + if gripper_type == 'panda': + return get_panda_open_ratio(antipodal_points, scale) + elif gripper_type == 'robotiq-85': + return get_robotiq_85_open_ratio(antipodal_points, scale) + elif gripper_type == 'robotiq-140': + return get_robotiq_140_open_ratio(antipodal_points, scale) + else: + raise NotImplementedError + + +def get_panda_finger_states(open_ratio, gripper_scale): + finger_open_extent = 4 * open_ratio * gripper_scale + return { + 'panda_leftfinger': [finger_open_extent], + 'panda_rightfinger': [finger_open_extent], + } + + +def get_robotiq_85_finger_states(open_ratio): + finger_states = {} + for side_i in ['left', 'right']: + for side_j in ['outer', 'inner']: + for link in ['knuckle', 'finger']: + name = f'{side_i}_{side_j}_{link}' + if name in ['left_outer_finger', 'right_outer_finger']: continue + sign = -1 if name in ['left_inner_finger', 'right_inner_knuckle'] else 1 + finger_states[f'robotiq_{name}'] = [sign * (1 - open_ratio) * 0.8757] + return finger_states + + +def get_robotiq_140_finger_states(open_ratio): + finger_states = {} + for side in ['left', 'right']: + for link in ['outer_knuckle', 'inner_finger', 'inner_knuckle']: + name = f'{side}_{link}' + sign = 1 if link == 'inner_finger' or name == 'left_outer_knuckle' else -1 + finger_states[f'robotiq_{name}'] = [sign * (1 - open_ratio) * 0.8757] + return finger_states + + +def get_gripper_finger_states(gripper_type, open_ratio, gripper_scale, suffix=None): + if gripper_type == 'panda': + finger_states = get_panda_finger_states(open_ratio, gripper_scale) + elif gripper_type == 'robotiq-85': + finger_states = get_robotiq_85_finger_states(open_ratio) + elif gripper_type == 'robotiq-140': + finger_states = get_robotiq_140_finger_states(open_ratio) + else: + raise NotImplementedError + if suffix is not None: + finger_states = {f'{key}_{suffix}': value for key, value in finger_states.items()} + return finger_states + + +def get_gripper_base_name(gripper_type, suffix=None): + if gripper_type == 'panda': + name = 'panda_hand' + elif gripper_type in ['robotiq-85', 'robotiq-140']: + name = 'robotiq_base' + else: + raise NotImplementedError + if suffix is not None: + name = f'{name}_{suffix}' + return name + + +def get_gripper_hand_names(gripper_type, suffix=None): + if gripper_type == 'panda': + names = ['panda_hand'] + elif gripper_type == 'robotiq-85': + names = ['robotiq_base'] + for side_i in ['left', 'right']: + for side_j in ['outer', 'inner']: + for link in ['knuckle', 'finger']: + name = f'{side_i}_{side_j}_{link}' + if name not in ['left_inner_finger', 'right_inner_finger']: + names.append(f'robotiq_{name}') + elif gripper_type == 'robotiq-140': + names = ['robotiq_base'] + for side_i in ['left', 'right']: + for side_j in ['outer', 'inner']: + for link in ['knuckle', 'finger']: + name = f'{side_i}_{side_j}_{link}' + names.append(f'robotiq_{name}') + else: + raise NotImplementedError + if suffix is not None: + names = [f'{name}_{suffix}' for name in names] + return names + + +def get_gripper_finger_names(gripper_type, suffix=None): + if gripper_type == 'panda': + names = ['panda_leftfinger', 'panda_rightfinger'] + elif gripper_type == 'robotiq-85': + names = ['robotiq_left_inner_finger', 'robotiq_right_inner_finger'] + elif gripper_type == 'robotiq-140': + names = ['robotiq_left_pad', 'robotiq_right_pad'] + else: + raise NotImplementedError + if suffix is not None: + names = [f'{name}_{suffix}' for name in names] + return names + + +def get_gripper_path_from_part_path(part_path, gripper_pos, gripper_quat): + T_g_0 = get_transform_matrix_quat(gripper_pos, gripper_quat) # get initial transform matrix of gripper + T_p = [get_transform_matrix_euler(p[:3], p[3:]) for p in part_path] # get transform matrix of part path + T_p_0 = T_p[0] # initial transform matrix of part + T_p_g = np.linalg.inv(T_p_0) @ T_g_0 # get transform matrix from path to gripper + T_g = [T_p_i @ T_p_g for T_p_i in T_p] # get transform matrix of gripper in global coordinate + gripper_path = [get_pos_euler_from_transform_matrix(T_g_i) for T_g_i in T_g] # get gripper path in global coordinate + return gripper_path + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--obj-path', type=str, required=True) + parser.add_argument('--sample-budget', type=int, default=100) + parser.add_argument('--visualize', action='store_true') + args = parser.parse_args() + + compute_antipodal_pairs(args.obj_path, args.sample_budget, args.visualize) diff --git a/plan_sequence/assets/build_contact_graph.py b/plan_sequence/assets/build_contact_graph.py new file mode 100644 index 0000000..1b06a75 --- /dev/null +++ b/plan_sequence/assets/build_contact_graph.py @@ -0,0 +1,50 @@ +import os +os.environ['OMP_NUM_THREADS'] = '1' +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')) +sys.path.append(project_base_dir) + +import networkx as nx +import matplotlib.pyplot as plt + +from plan_sequence.physics_planner import CONTACT_EPS, get_distance_all_bodies + + +def build_contact_graph(obj_dir, plot=False): + asset_folder = os.path.join(project_base_dir, './assets') + + G = nx.Graph() + distance = get_distance_all_bodies(asset_folder, obj_dir) + + # check contact and penetration + for (part_i, part_j), dist in distance.items(): + if not G.has_node(part_i): G.add_node(part_i, color='gray') + if not G.has_node(part_j): G.add_node(part_j, color='gray') + if dist < CONTACT_EPS: + color = 'blue' if dist < 0 else 'black' + G.add_edge(part_i, part_j, color=color, dist=dist) + G.nodes[part_i]['color'] = 'green' # good + G.nodes[part_j]['color'] = 'green' # good + + if plot: + from networkx.drawing.nx_agraph import graphviz_layout + node_colors = list(nx.get_node_attributes(G, 'color').values()) + edge_colors = list(nx.get_edge_attributes(G, 'color').values()) + pos = graphviz_layout(G) + nx.draw(G, pos, node_color=node_colors, edge_color=edge_colors, with_labels=True) + edge_labels = {edge: str(round(G.edges[edge]['dist'],2)) for edge in G.edges if G.edges[edge]['dist'] < 0} + nx.draw_networkx_edge_labels(G, pos, edge_labels=edge_labels) + plt.show() + + return G + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--dir', type=str, required=True) + args = parser.parse_args() + + build_contact_graph(args.dir, plot=True) diff --git a/plan_sequence/assets/check_stability.py b/plan_sequence/assets/check_stability.py new file mode 100644 index 0000000..a9d067f --- /dev/null +++ b/plan_sequence/assets/check_stability.py @@ -0,0 +1,66 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')) +sys.path.append(project_base_dir) + +from plan_sequence.stable_pose import get_combined_mesh, get_stable_poses +from plan_sequence.feasibility_check import get_stable_plan_1pose_serial, check_stable_noforce +from assets.load import load_part_ids +from assets.save import clear_saved_sdfs + + +def check_stability(assembly_dir, save_sdf=False, debug=0, render=False, verbose=False): + + asset_folder = os.path.join(project_base_dir, 'assets') + parts = load_part_ids(assembly_dir) + + try: + success, _ = check_stable_noforce(asset_folder, assembly_dir, parts, save_sdf=save_sdf, debug=debug, render=render) + + if verbose: + print(f'[check_stability] no force, success: {success}') + if not success: + if save_sdf: + clear_saved_sdfs(assembly_dir) + return False + + mesh = get_combined_mesh(assembly_dir, parts) + poses = get_stable_poses(mesh) + + for i, pose in enumerate(poses): + + parts_fix_list = get_stable_plan_1pose_serial(asset_folder, assembly_dir, parts, None, pose, max_fix=3, save_sdf=save_sdf, debug=debug, render=render) + success = parts_fix_list is not None + if verbose: + print(f'[check_stability] {i+1}/{len(poses)} stable pose, success: {success}') + + if success: + if save_sdf: + clear_saved_sdfs(assembly_dir) + return True + + except (Exception, KeyboardInterrupt) as e: + if type(e) == KeyboardInterrupt: + print('[check_stability] interrupt') + else: + print('[check_stability] exception:', e) + + if save_sdf: + clear_saved_sdfs(assembly_dir) + + return False + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--dir', type=str, help='assembly dir') + parser.add_argument('--debug', type=int, default=0) + parser.add_argument('--render', default=False, action='store_true') + parser.add_argument('--disable-save-sdf', default=False, action='store_true') + args = parser.parse_args() + + success = check_stability(args.dir, save_sdf=not args.disable_save_sdf, debug=args.debug, render=args.render, verbose=True) + print(f'Success: {success}') diff --git a/plan_sequence/assets/check_validity.py b/plan_sequence/assets/check_validity.py new file mode 100644 index 0000000..9ce92d9 --- /dev/null +++ b/plan_sequence/assets/check_validity.py @@ -0,0 +1,120 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')) +sys.path.append(project_base_dir) + +import matplotlib +import json +import pickle +import networkx as nx +import matplotlib.pyplot as plt +import trimesh + +from plan_sequence.feasibility_check import check_given_connection_assemblable +from plan_sequence.physics_planner import CONTACT_EPS, get_distance_all_bodies +from assets.load import load_part_ids + + +def check_validity(assembly_dir, num_proc=1, contact_eps=CONTACT_EPS, collision_th=0.01, save_graph_path=None, save_fig_path=None, skip_draw=False, save_sdf=False, verbose=False): + violations = set() + + asset_folder = os.path.join(project_base_dir, './assets') + + G = nx.Graph() + distance = get_distance_all_bodies(asset_folder, assembly_dir, save_sdf=save_sdf) + good_pairs = [] + + if verbose: + print('Computed distance') + + # check contact and penetration + for (part_i, part_j), dist in distance.items(): + if not G.has_node(part_i): G.add_node(part_i, color='gray') + if not G.has_node(part_j): G.add_node(part_j, color='gray') + if dist < contact_eps: + G.add_edge(part_i, part_j, color='black') # good + if dist < -collision_th: + G.edges[part_i, part_j]['color'] = 'blue' # penetrated + G.edges[part_i, part_j]['dist'] = dist + violations.add('penetration') + else: + good_pairs.append([part_i, part_j]) + G.nodes[part_i]['color'] = 'green' # good + G.nodes[part_j]['color'] = 'green' # good + + if verbose: + print('Checked contact and penetration') + + # check assemblable + _, failures = check_given_connection_assemblable(asset_folder, assembly_dir, good_pairs, bidirection=True, num_proc=num_proc, save_sdf=save_sdf, debug=0) + for (part_i, part_j) in failures: + if (part_j, part_i) in failures: + G.edges[part_i, part_j]['color'] = 'red' # unassemblable + violations.add('unassemblable') + + if verbose: + print('Checked assemblability') + + # check thickness + min_thickness = 0.05 + parts = load_part_ids(assembly_dir) + for part_i in parts: + mesh = trimesh.load_mesh(f'{assembly_dir}/{part_i}.obj', process=False, maintain_order=True) + _, bbox = trimesh.bounds.oriented_bounds(mesh) + if bbox.min() < min_thickness: + G.nodes[part_i]['color'] = 'red' # thin + violations.add('thin part') + + if verbose: + print('Checked thickness') + + node_colors = list(nx.get_node_attributes(G, 'color').values()) + if 'gray' in node_colors: + violations.add('disconnected part') + + if save_graph_path is not None: + save_dir = os.path.dirname(os.path.abspath(save_graph_path)) + os.makedirs(save_dir, exist_ok=True) + if not save_graph_path.endswith('.pkl'): + save_graph_path += '.pkl' + with open(save_graph_path, 'wb') as fp: + pickle.dump(G, fp) + + if not skip_draw: + if save_fig_path is not None: + matplotlib.use('agg') + + from networkx.drawing.nx_agraph import graphviz_layout + edge_colors = list(nx.get_edge_attributes(G, 'color').values()) + pos = graphviz_layout(G) + nx.draw(G, pos, node_color=node_colors, edge_color=edge_colors, with_labels=True) + edge_labels = {edge: str(round(G.edges[edge]['dist'],2)) for edge in G.edges if 'dist' in G.edges[edge]} + nx.draw_networkx_edge_labels(G, pos, edge_labels=edge_labels) + + if save_fig_path is None: + plt.show() + else: + save_dir = os.path.dirname(os.path.abspath(save_fig_path)) + os.makedirs(save_dir, exist_ok=True) + plt.savefig(save_fig_path) + + return sorted(list(violations)) + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--dir', type=str, help='assembly dir') + parser.add_argument('--num-proc', type=int, default=1) + parser.add_argument('--contact-eps', type=float, default=CONTACT_EPS) + parser.add_argument('--collision-th', type=float, default=0.01) + parser.add_argument('--save-graph-path', type=str, default=None) + parser.add_argument('--save-fig-path', type=str, default=None) + parser.add_argument('--skip-draw', default=False, action='store_true') + parser.add_argument('--disable-save-sdf', default=False, action='store_true') + args = parser.parse_args() + + violations = check_validity(args.dir, args.num_proc, args.contact_eps, args.collision_th, args.save_graph_path, args.save_fig_path, args.skip_draw, not args.disable_save_sdf, verbose=True) + print(f'violations: {violations}') diff --git a/plan_sequence/assets/fix_explode.py b/plan_sequence/assets/fix_explode.py new file mode 100644 index 0000000..6a92800 --- /dev/null +++ b/plan_sequence/assets/fix_explode.py @@ -0,0 +1,55 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')) +sys.path.append(project_base_dir) + +import networkx as nx + +from assets.load import load_part_ids +from plan_sequence.feasibility_check import check_stable_noforce +from plan_sequence.assets.fix_invalid import save_new_parts + + +def fix_explode(source_dir, target_dir, debug=0, render=False, verbose=False): + + asset_folder = os.path.join(project_base_dir, 'assets') + parts = load_part_ids(source_dir) + + success, G = check_stable_noforce(asset_folder, source_dir, parts, debug=debug, render=render) + if verbose: + if success: + print(f'[fix_explode] all parts are stable') + else: + print(f'[fix_explode] exist unstable parts') + + if len(G.nodes) < 3: + if verbose: + print(f'[fix_explode] less than 3 parts after fix') + return False + + Gs = sorted(nx.connected_components(G), key=len, reverse=True) + G = G.subgraph(Gs[0]) + + if len(G.nodes) < 3: + if verbose: + print(f'[fix_explode] less than 3 parts after fix') + return False + + save_new_parts(source_dir, target_dir, [str(node) for node in G.nodes]) + + return True + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--source-dir', type=str, required=True) + parser.add_argument('--target-dir', type=str, required=True) + parser.add_argument('--debug', type=int, default=0) + parser.add_argument('--render', default=False, action='store_true') + args = parser.parse_args() + + success = fix_explode(args.source_dir, args.target_dir, debug=args.debug, render=args.render, verbose=True) + print(f'Success: {success}') diff --git a/plan_sequence/assets/fix_invalid.py b/plan_sequence/assets/fix_invalid.py new file mode 100644 index 0000000..ab7ce1f --- /dev/null +++ b/plan_sequence/assets/fix_invalid.py @@ -0,0 +1,151 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')) +sys.path.append(project_base_dir) + +import matplotlib +import networkx as nx +import matplotlib.pyplot as plt +import shutil +import pickle +import json + + +def save_new_parts(source_dir, target_dir, parts): + + os.makedirs(target_dir, exist_ok=True) + for file_name in os.listdir(source_dir): + source_path = os.path.join(source_dir, file_name) + target_path = os.path.join(target_dir, file_name) + + if file_name.endswith('.obj'): + part_id = file_name.replace('.obj', '') + if part_id in parts: + shutil.copyfile(source_path, target_path) + + elif file_name == 'config.json': + + with open(source_path, 'r') as fp: + config = json.load(fp) + new_config = {key: val for key, val in config.items() if key in parts} + with open(target_path, 'w') as fp: + json.dump(new_config, fp) + + +def fix_invalid_graph(G): + + # remove thin parts + bad_parts = set() + for part_i in G.nodes: + if G.nodes[part_i]['color'] == 'red': + bad_parts.add(part_i) + for part_i in bad_parts: + G.remove_node(part_i) + if len(G.nodes) < 3: + return None + + # remove most unassemblable parts + bad_count = {} + for part_i, part_j in G.edges: + if G.edges[part_i, part_j]['color'] == 'red': + if part_i not in bad_count: + bad_count[part_i] = 1 + else: + bad_count[part_i] += 1 + if part_j not in bad_count: + bad_count[part_j] = 1 + else: + bad_count[part_j] += 1 + while len(bad_count) > 0: + part_worst = max(bad_count, key=bad_count.get) + for part_i in G.neighbors(part_worst): + if G.edges[part_worst, part_i]['color'] == 'red': + bad_count[part_i] -= 1 + assert bad_count[part_i] >= 0 + if bad_count[part_i] == 0: + bad_count.pop(part_i) + bad_count.pop(part_worst) + G.remove_node(part_worst) + if len(G.nodes) < 3: + return None + + # take the biggest subgraph + Gs = sorted(nx.connected_components(G), key=len, reverse=True) + G = G.subgraph(Gs[0]) + if len(G.nodes) < 3: + return None + + return G + + +def fix_invalid_assembly(assembly_dir_src, assembly_dir_tgt, save_dir_src, save_dir_tgt, skip_draw=False, verbose=False): + + assembly_id = os.path.basename(assembly_dir_src) + graph_dir_src = os.path.join(save_dir_src, 'graph') + graph_dir_tgt = os.path.join(save_dir_tgt, 'graph') + graph_path_src = os.path.join(graph_dir_src, f'{assembly_id}.pkl') + graph_path_tgt = os.path.join(graph_dir_tgt, f'{assembly_id}.pkl') + fig_dir_tgt = os.path.join(save_dir_tgt, 'fig') + fig_path_tgt = os.path.join(fig_dir_tgt, assembly_id) + + with open(graph_path_src, 'rb') as fp: + G = pickle.load(fp) + + G_new = fix_invalid_graph(G) + + success, n_parts, penetration = False, None, None + + if G_new is not None: + os.makedirs(assembly_dir_tgt, exist_ok=True) + os.makedirs(graph_dir_tgt, exist_ok=True) + os.makedirs(fig_dir_tgt, exist_ok=True) + + # save new assembly + save_new_parts(assembly_dir_src, assembly_dir_tgt, list(G_new.nodes)) + + # save new graph + with open(graph_path_tgt, 'wb') as fp: + pickle.dump(G_new, fp) + + # save new figure + if not skip_draw: + matplotlib.use('agg') + + from networkx.drawing.nx_agraph import graphviz_layout + node_colors = list(nx.get_node_attributes(G_new, 'color').values()) + edge_colors = list(nx.get_edge_attributes(G_new, 'color').values()) + pos = graphviz_layout(G_new) + nx.draw(G_new, pos, node_color=node_colors, edge_color=edge_colors, with_labels=True) + edge_labels = {edge: str(round(G_new.edges[edge]['dist'],2)) for edge in G_new.edges if 'dist' in G_new.edges[edge]} + nx.draw_networkx_edge_labels(G_new, pos, edge_labels=edge_labels) + plt.savefig(fig_path_tgt) + + # compute stats + success = True + n_parts = len(G_new.nodes) + for edge in G_new.edges: + if G_new.edges[edge]['color'] == 'blue': + if penetration is None: + penetration = G_new.edges[edge]['dist'] + else: + penetration = min(G_new.edges[edge]['dist'], penetration) + + if verbose: + print(f'Success: {success}, n_parts: {n_parts}, penetration: {penetration}') + + return success, n_parts, penetration + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--dir-src', type=str, required=True, help='source assembly dir') + parser.add_argument('--dir-tgt', type=str, required=True, help='target assembly dir') + parser.add_argument('--save-dir-src', type=str, required=True) + parser.add_argument('--save-dir-tgt', type=str, required=True) + parser.add_argument('--skip-draw', default=False, action='store_true') + args = parser.parse_args() + + fix_invalid_assembly(args.dir_src, args.dir_tgt, args.save_dir_src, args.save_dir_tgt, args.skip_draw, verbose=True) diff --git a/plan_sequence/assets/subtract_mesh.py b/plan_sequence/assets/subtract_mesh.py new file mode 100644 index 0000000..1943312 --- /dev/null +++ b/plan_sequence/assets/subtract_mesh.py @@ -0,0 +1,191 @@ +import os +os.environ['OMP_NUM_THREADS'] = '1' +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')) +sys.path.append(project_base_dir) + +import numpy as np +import trimesh +import shutil + +from assets.load import load_assembly, get_transform_matrix +from plan_sequence.assets.build_contact_graph import build_contact_graph +from utils.output_grabber import OutputGrabber + + +def load_assembly_for_subtract(obj_dir, obj_ids, apply_transform=False, revert_transform=False): + + meshes = {} + assembly = load_assembly(obj_dir, transform='none') + for obj_id in obj_ids: + obj_data = assembly[obj_id] + mesh = obj_data['mesh'] + if apply_transform: + mesh.apply_transform(get_transform_matrix(obj_data['final_state'])) + if revert_transform: + mesh.apply_transform(np.linalg.inv(get_transform_matrix(obj_data['final_state']))) + meshes[obj_id] = mesh + + return meshes + + +def save_assembly(obj_dir, meshes, temp=False): + + os.makedirs(obj_dir, exist_ok=True) + + for obj_id, mesh in meshes.items(): + save_path = os.path.join(obj_dir, f'{obj_id}.obj') if not temp else os.path.join(obj_dir, f'{obj_id}_temp.obj') + mesh.export(save_path, header=None, include_color=False) + + +def copy_config(source_dir, target_dir): + + os.makedirs(target_dir, exist_ok=True) + + source_path = os.path.join(source_dir, 'config.json') + target_path = os.path.join(target_dir, 'config.json') + if os.path.exists(source_path): + shutil.copyfile(source_path, target_path) + + +def run_mesh_boolean(obj_dir, subtract_pairs, boolean_path): + + assert os.path.exists(boolean_path) + + error_ids = [] + + for (part_i, part_j) in subtract_pairs: + path_i = os.path.join(obj_dir, f'{part_i}.obj') + path_j = os.path.join(obj_dir, f'{part_j}.obj') + assert os.path.exists(path_i) + assert os.path.exists(path_j) + + out = OutputGrabber() + out.start() + os.system(f'{boolean_path} subtraction {path_i} {path_j} {path_i}_temp.obj') + out.stop() + + if 'WARNING' in out.capturedtext: + error_ids.append(part_i) + os.system(f'rm {path_i}_temp.obj') + else: + os.system(f'mv {path_i}_temp.obj {path_i}') + + return error_ids + + +def copy_remaining_meshes(source_dir, target_dir, obj_ids): + + for obj_id in obj_ids: + source_path = os.path.join(source_dir, f'{obj_id}.obj') + target_path = os.path.join(target_dir, f'{obj_id}.obj') + assert os.path.exists(source_path) + shutil.copyfile(source_path, target_path) + + +def sanity_check_files(obj_dir, obj_ids): + + for obj_id in obj_ids: + obj_path = os.path.join(obj_dir, f'{obj_id}.obj') + assert os.path.exists(obj_path) + + assert os.path.exists(os.path.join(obj_dir, 'config.json')) + + +def subtract_mesh(source_dir, target_dir, boolean_path, verbose=False): + + # build contact graph + G = build_contact_graph(source_dir, plot=False) + + # compute a list of subtract pairs + subtract_pairs = [] + pene_count = {} + for part_i in G.nodes: + for part_j in G.neighbors(part_i): + if G.edges[part_i, part_j]['dist'] < 0: + if part_i not in pene_count: + pene_count[part_i] = 1 + else: + pene_count[part_i] += 1 + if part_j not in pene_count: + pene_count[part_j] = 1 + else: + pene_count[part_j] += 1 + G_temp = G.copy() + while len(pene_count) > 0: + part_worst = max(pene_count, key=pene_count.get) + for part_i in G_temp.neighbors(part_worst): + if G_temp.edges[part_worst, part_i]['dist'] < 0: + subtract_pairs.append((part_worst, part_i)) + pene_count[part_i] -= 1 + assert pene_count[part_i] >= 0 + if pene_count[part_i] == 0: + pene_count.pop(part_i) + pene_count.pop(part_worst) + G_temp.remove_node(part_worst) + + # extract subtract related (all) and applied (main) parts + subtract_ids_all = set() + subtract_ids_main = set() + for part_i, part_j in subtract_pairs: + subtract_ids_main.add(part_i) + subtract_ids_all.add(part_i) + subtract_ids_all.add(part_j) + other_ids = [part_i for part_i in G.nodes if part_i not in subtract_ids_main] + + if verbose: + print('Parts to be subtracted:', subtract_ids_main) + + # load meshes related to subtraction with transform applied + meshes = load_assembly_for_subtract(source_dir, subtract_ids_all, apply_transform=True) + + for mesh in meshes.values(): + assert mesh.is_watertight + + # save translated meshes + save_assembly(target_dir, meshes, temp=False) + + # run mesh boolean + error_ids = run_mesh_boolean(target_dir, subtract_pairs, boolean_path) + + # copy config + copy_config(source_dir, target_dir) + + # load meshes subtracted with transform reverted + meshes_subtracted = load_assembly_for_subtract(target_dir, subtract_ids_main, revert_transform=True) + + # fix normals + for part_i, mesh in meshes_subtracted.items(): + + try: + trimesh.repair.fix_normals(mesh) + assert mesh.is_watertight + except Exception as e: + error_ids.append(part_i) + other_ids.append(part_i) # skip this part, has some issues + if verbose: + print(f'Error: mesh {part_i} has exception', e) + + meshes_subtracted = {key: val for key, val in meshes_subtracted.items() if key not in error_ids} + + # save untranslated meshes + save_assembly(target_dir, meshes_subtracted, temp=False) + + # copy other meshes that are not subtracted + copy_remaining_meshes(source_dir, target_dir, other_ids) + + # sanity check if all objs are written + sanity_check_files(target_dir, G.nodes) + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--source-dir', type=str, required=True) + parser.add_argument('--target-dir', type=str, required=True) + parser.add_argument('--boolean-path', type=str, required=True) + args = parser.parse_args() + + subtract_mesh(args.source_dir, args.target_dir, args.boolean_path, verbose=True) diff --git a/plan_sequence/check_success_rate_batch.py b/plan_sequence/check_success_rate_batch.py new file mode 100644 index 0000000..638a322 --- /dev/null +++ b/plan_sequence/check_success_rate_batch.py @@ -0,0 +1,45 @@ +import os +import json +from argparse import ArgumentParser + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--log-dir', type=str, required=True, help='directory storing logs') + parser.add_argument('--budget', type=int, default=None, help='maximum number of evaluations') + args = parser.parse_args() + + for method in os.listdir(args.log_dir): + method_dir = os.path.join(args.log_dir, method) + if not os.path.isdir(method_dir): continue + for seed in os.listdir(method_dir): + seed_dir = os.path.join(method_dir, seed) + if not os.path.isdir(seed_dir): continue + + success_ids = {} + failed_ids = {} + + for assembly_id in os.listdir(seed_dir): + assembly_dir = os.path.join(seed_dir, assembly_id) + if os.path.isdir(assembly_dir): + json_path = os.path.join(assembly_dir, 'stats.json') + if not os.path.exists(json_path): + print(f'{assembly_dir} does not have stats.json') + continue + with open(json_path, 'r') as fp: + stats = json.load(fp) + if stats['success']: + if args.budget is not None: + success = stats['n_eval'] <= args.budget + if success: + success_ids[assembly_id] = stats['time'] + else: + failed_ids[assembly_id] = stats['time'] + + else: + success_ids[assembly_id] = stats['time'] + else: + failed_ids[assembly_id] = stats['time'] + + success_rate = '{:.2f}'.format(100 * len(success_ids) / (len(success_ids) + len(failed_ids))) + print(f'Method: {method}, seed: {seed} | success: {len(success_ids)}, failed: {len(failed_ids)}, success rate: ' + success_rate) \ No newline at end of file diff --git a/plan_sequence/combine_animation.py b/plan_sequence/combine_animation.py new file mode 100644 index 0000000..891224f --- /dev/null +++ b/plan_sequence/combine_animation.py @@ -0,0 +1,49 @@ +import imageio.v3 as iio +import numpy as np +import os + + +def combine_animation(record_dir, output_path, reverse): + + frames = [] + file_path_list = [] + for file_name in os.listdir(record_dir): + if file_name.endswith('.gif'): + file_path = os.path.join(record_dir, file_name) + file_path_list.append(file_path) + file_path_list.sort(key=lambda x: int(os.path.basename(x).split('_')[0])) + if reverse: + file_path_list = file_path_list[::-1] + + for file_path in file_path_list: + frame = iio.imread(file_path) + if frame.shape[1] == 1536: # NOTE: hardcoded due to resolution differences between my screens + frame = frame[:, ::2, ::2, :] + frames.append(frame) + + print(file_path, len(frames)) + + if len(frames) == 0: + return + + frames = np.vstack(frames) + + # get duration each frame is displayed + duration = iio.immeta(file_path)["duration"] + + output_dir = os.path.abspath(os.path.join(output_path, os.pardir)) + os.makedirs(output_dir, exist_ok=True) + iio.imwrite(output_path, frames, duration=duration) + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--record-dir', type=str, required=True) + parser.add_argument('--output-path', type=str, required=True) + parser.add_argument('--reverse', default=False, action='store_true') + args = parser.parse_args() + + combine_animation(args.record_dir, args.output_path, args.reverse) + \ No newline at end of file diff --git a/plan_sequence/feasibility_check.py b/plan_sequence/feasibility_check.py new file mode 100644 index 0000000..414f125 --- /dev/null +++ b/plan_sequence/feasibility_check.py @@ -0,0 +1,276 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np +from itertools import combinations +from time import time + +from utils.renderer import SimRenderer +from utils.parallel import parallel_execute +from plan_sequence.physics_planner import MultiPartPathPlanner, MultiPartStabilityPlanner, MultiPartNoForceStabilityPlanner, get_contact_graph, CONTACT_EPS + + +def get_R3_actions(): + actions = [ + np.array([0, 0, 1]), # +Z + np.array([0, 0, -1]), # -Z + np.array([1, 0, 0]), # +X + np.array([-1, 0, 0]), # -X + np.array([0, 1, 0]), # +Y + np.array([0, -1, 0]), # -Y + ] + return actions + + +def check_assemblable(asset_folder, assembly_dir, parts_fix, part_move, pose=None, save_sdf=False, debug=0, render=False, return_path=False, optimize_path=False, min_sep=None): + ''' + Check if certain parts are disassemblable + ''' + planner = MultiPartPathPlanner(asset_folder, assembly_dir, parts_fix, part_move, pose=pose, save_sdf=save_sdf) + + actions = get_R3_actions() + best_action = None + best_path = None + best_path_len = np.inf + for action in actions: + success, path = planner.check_success(action, return_path=True, min_sep=None if optimize_path else min_sep) + if debug > 0: + print(f'[check_assemblable] success: {success}, parts_fix: {parts_fix}, part_move: {part_move}, action: {action}, path_len: {len(path)}') + if render: + SimRenderer().replay(planner.sim) + if success: + if len(path) < best_path_len: + best_path_len = len(path) + best_path = path + best_action = action + + if best_path is not None: + best_path = np.array(best_path) + if optimize_path: # optimize action based on the path found + best_dirs = best_path[1:, :3] - best_path[0, :3] + opt_action = (best_dirs / np.linalg.norm(best_dirs, axis=1)[:, None]).mean(axis=0) + opt_action = opt_action / np.linalg.norm(opt_action) + success, opt_path = planner.check_success(opt_action, return_path=True, min_sep=min_sep) + if debug > 0: + print(f'[check_assemblable] success: {success}, parts_fix: {parts_fix}, part_move: {part_move}, action (optimized): {opt_action}, path_len (optimized): {len(opt_path)}') + if render: + SimRenderer().replay(planner.sim) + if success: + best_path_len = len(opt_path) + best_path = opt_path + best_action = opt_action + else: # just in case, plan again with min_sep + success, best_path = planner.check_success(best_action, return_path=True, min_sep=min_sep) + assert success + best_path = np.array(best_path) + + if return_path: + return best_action, best_path + else: + return best_action + + +def check_all_connection_assemblable(asset_folder, assembly_dir, parts=None, contact_eps=CONTACT_EPS, save_sdf=False, num_proc=1, debug=0, render=False): + ''' + Check if all connected pairs of parts are disassemblable + ''' + G = get_contact_graph(asset_folder, assembly_dir, parts, contact_eps=contact_eps, save_sdf=save_sdf) + + worker_args = [] + for pair in G.edges: + part_a, part_b = pair + worker_args.append([asset_folder, assembly_dir, [part_a], part_b, None, save_sdf, debug, render]) + + failures = [] + for action, args in parallel_execute(check_assemblable, worker_args, num_proc, show_progress=debug > 0, desc='check_all_connection_assemblable', return_args=True): + success = action is not None + part_fix, part_move = args[2][0], args[3] + if debug > 0: + print(f'[check_all_connection_assemblable] success: {success}, part_fix: {part_fix}, part_move: {part_move}, action: {action}') + if not success: + failures.append((part_fix, part_move)) + + all_success = len(failures) == 0 + return all_success, failures + + +def check_given_connection_assemblable(asset_folder, assembly_dir, part_pairs, bidirection=False, save_sdf=False, num_proc=1, debug=0, render=False): + ''' + Check if given connected pairs of parts are disassemblable + ''' + worker_args = [] + for pair in part_pairs: + part_a, part_b = pair + worker_args.append([asset_folder, assembly_dir, [part_a], part_b, None, save_sdf, debug, render]) + if bidirection: + worker_args.append([asset_folder, assembly_dir, [part_b], part_a, None, save_sdf, debug, render]) + + failures = [] + for action, args in parallel_execute(check_assemblable, worker_args, num_proc, show_progress=debug > 0, desc='check_given_connection_assemblable', return_args=True): + success = action is not None + part_fix, part_move = args[2][0], args[3] + if debug > 0: + print(f'[check_given_connection_assemblable] success: {success}, part_fix: {part_fix}, part_move: {part_move}, action: {action}') + if not success: + failures.append((part_fix, part_move)) + + all_success = len(failures) == 0 + return all_success, failures + + +def check_stable_noforce(asset_folder, assembly_dir, parts, save_sdf=False, timeout=None, allow_gap=False, debug=0, render=False): + ''' + Check if stable without any external force + ''' + planner = MultiPartNoForceStabilityPlanner(asset_folder, assembly_dir, parts, save_sdf=save_sdf, allow_gap=allow_gap) + + success, G = planner.check_success(timeout=timeout) + if debug > 0: + print(f'[check_stable_noforce] success: {success}') + if render: + SimRenderer().replay(planner.sim) + + return success, G + + +def check_stable(asset_folder, assembly_dir, parts_fix, parts_move, pose=None, save_sdf=False, timeout=None, allow_gap=False, debug=0, render=False): + ''' + Check if gravitationally stable for a given fixed part + ''' + planner = MultiPartStabilityPlanner(asset_folder, assembly_dir, parts_fix, parts_move, pose=pose, save_sdf=save_sdf, allow_gap=allow_gap) + + success, parts_fall = planner.check_success(timeout=timeout) + if debug > 0: + print(f'[check_stable] success: {success}, parts_fall: {parts_fall}, parts_fix: {parts_fix}, parts_move: {parts_move}') + if render: + SimRenderer().replay(planner.sim) + + return success, parts_fall + + +def get_stable_plan_1pose_serial(asset_folder, assembly_dir, parts, base_part, pose, max_fix=None, save_sdf=False, timeout=None, allow_gap=False, debug=0, render=False, return_count=False): + ''' + Get all gravitationally stable plans given 1 pose through serial greedy search + ''' + t_start = time() + count = 0 + + max_fix = len(parts) if max_fix is None else min(max_fix, len(parts)) + parts_fix = [] if base_part is None else [base_part] + + while True: + + parts_move = parts.copy() + for part_fix in parts_fix: + parts_move.remove(part_fix) + + if timeout is not None: + timeout -= (time() - t_start) + if timeout < 0: + if return_count: + return None, count + else: + return None + t_start = time() + + success, parts_fall = check_stable(asset_folder, assembly_dir, parts_fix, parts_move, pose, save_sdf, timeout, allow_gap, debug, render) + count += 1 + + if debug > 0: + print(f'[get_stable_plan_1pose_serial] success: {success}, n_fix: {len(parts_fix)}, parts_fall: {parts_fall}, parts_fix: {parts_fix}, parts_move: {parts_move}') + + if success: + break + else: + if parts_fall is None: + if return_count: + return None, count # timeout + else: + return None + parts_fix.extend(parts_fall) + + if len(parts_fix) > max_fix: + if return_count: + return None, count # failed + else: + return None + + if base_part is not None: + parts_fix.remove(base_part) + + if return_count: + return parts_fix, count + else: + return parts_fix + + +def get_stable_plan_1pose_parallel(asset_folder, assembly_dir, parts, base_part, pose=None, max_fix=None, save_sdf=False, timeout=None, allow_gap=False, num_proc=1, debug=0, render=False): + ''' + Get all gravitationally stable plans given 1 pose through parallel greedy search + ''' + t_start = time() + + max_fix = len(parts) if max_fix is None else min(max_fix, len(parts)) + + if pose is not None: + parts_fix = [] if base_part is None else [base_part] + success, parts_fall = check_stable(asset_folder, assembly_dir, parts_fix, parts, pose, save_sdf, timeout, allow_gap, debug, render) # check if stable without any grippers + if debug > 0: + print(f'[get_stable_plan_1pose_parallel] success: {success}, n_fix: 0, parts_fall: {parts_fall}, parts_fix: {parts_fix}, parts_move: {parts}') + if success: + return [] + else: + if parts_fall is None: + return None # timeout + + if base_part is None: + parts_fix_list = [[part_fix] for part_fix in parts] + else: + parts_fix_list = [[part_fix, base_part] for part_fix in parts if part_fix != base_part] + + while True: + success_any = False + + if timeout is not None: + timeout -= (time() - t_start) + if timeout < 0: + return None + t_start = time() + + worker_args = [] + for parts_fix in parts_fix_list: + if len(parts_fix) > max_fix: continue + parts_move = parts.copy() + for part_fix in parts_fix: + parts_move.remove(part_fix) + worker_args.append([asset_folder, assembly_dir, parts_fix, parts_move, pose, save_sdf, timeout, allow_gap, debug, render]) + + if len(worker_args) == 0: + return None # failed + + for (success, parts_fall), args in parallel_execute(check_stable, worker_args, num_proc, show_progress=debug > 0, desc='get_stable_plan_1pose_parallel', return_args=True): + parts_fix, parts_move = args[2], args[3] + if debug > 0: + print(f'[get_stable_plan_1pose_parallel] success: {success}, n_fix: {len(parts_fix)}, parts_fall: {parts_fall}, parts_fix: {parts_fix}, parts_move: {parts_move}') + if success: + success_any = True + else: + if parts_fall is None: + return None # timeout + index = parts_fix_list.index(parts_fix) + parts_fix_list[index].extend(parts_fall) + if timeout is not None and time() - t_start > timeout: + return None + + if success_any: + break + + parts_fix_list = [parts_fix for parts_fix in parts_fix_list if len(parts_fix) <= max_fix] + for parts_fix in parts_fix_list: + if base_part is not None: + parts_fix.remove(base_part) + parts_fix_list = sorted(parts_fix_list, key=lambda x: len(x)) + return parts_fix_list diff --git a/plan_sequence/generator/__init__.py b/plan_sequence/generator/__init__.py new file mode 100644 index 0000000..ab04269 --- /dev/null +++ b/plan_sequence/generator/__init__.py @@ -0,0 +1,11 @@ +from .random import RandomGenerator +from .heuristic import HeuristicsVolumeGenerator, HeuristicsOutsidenessGenerator +from .learning import LearningBasedGenerator + + +generators = { + 'rand': RandomGenerator, + 'heur-vol': HeuristicsVolumeGenerator, + 'heur-out': HeuristicsOutsidenessGenerator, + 'learn': LearningBasedGenerator, +} diff --git a/plan_sequence/generator/base.py b/plan_sequence/generator/base.py new file mode 100644 index 0000000..5866511 --- /dev/null +++ b/plan_sequence/generator/base.py @@ -0,0 +1,22 @@ +class Generator: + ''' + Candidate part generator + ''' + def __init__(self, asset_folder, assembly_dir, base_part=None, save_sdf=False): + self.asset_folder = asset_folder + self.assembly_dir = assembly_dir + self.base_part = base_part + self.save_sdf = save_sdf + + def _remove_base_part(self, assembled_parts): + if self.base_part is not None: + assembled_parts = [part for part in assembled_parts if part != self.base_part] + return assembled_parts + + def generate_candidate_part(self, assembled_parts): + ''' + Generate the next candidate part to disassemble + Input: + assembled_parts: parts that are still assembled but need to be disassembled + ''' + raise NotImplementedError diff --git a/plan_sequence/generator/heuristic.py b/plan_sequence/generator/heuristic.py new file mode 100644 index 0000000..3bb0fd7 --- /dev/null +++ b/plan_sequence/generator/heuristic.py @@ -0,0 +1,62 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')) +sys.path.append(project_base_dir) + +import numpy as np +import trimesh + +from plan_sequence.feasibility_check import get_contact_graph +from assets.load import load_assembly +from .base import Generator + + +class HeuristicsGenerator(Generator): + ''' + Generate candidate parts by heuristics + ''' + def __init__(self, asset_folder, assembly_dir, base_part=None, save_sdf=False): + super().__init__(asset_folder, assembly_dir, base_part=base_part, save_sdf=save_sdf) + self.contact_graph = get_contact_graph(self.asset_folder, self.assembly_dir, save_sdf=save_sdf) + assembly = load_assembly(self.assembly_dir) + self.mesh_dict = {part_id: part_data['mesh'] for part_id, part_data in assembly.items()} + + def heuristic_func(self, part): + raise NotImplementedError + + def generate_candidate_part(self, assembled_parts): + assembled_parts = self._remove_base_part(assembled_parts) + + eps = 0.0 + if np.random.random() < eps: + sorted_parts = np.random.permutation(np.array(assembled_parts, dtype=object)) + else: + sorted_parts = sorted(np.random.permutation(np.array(assembled_parts, dtype=object)), key=self.heuristic_func) + for part in sorted_parts: + yield part + + +class HeuristicsVolumeGenerator(HeuristicsGenerator): + + def heuristic_func(self, part): + return self.mesh_dict[part].volume + + +class HeuristicsOutsidenessGenerator(HeuristicsGenerator): + + def get_center(self, parts): + meshes = [self.mesh_dict[part] for part in parts] + centroid = trimesh.Scene(meshes).centroid + return centroid + + def heuristic_func(self, part, center): + return -np.linalg.norm(self.mesh_dict[part].center_mass - center) + + def generate_candidate_part(self, assembled_parts): + assembled_parts = self._remove_base_part(assembled_parts) + + center = self.get_center(assembled_parts) + sorted_parts = sorted(np.random.permutation(np.array(assembled_parts, dtype=object)), key=lambda x: self.heuristic_func(x, center)) + for part in sorted_parts: + yield part diff --git a/plan_sequence/generator/learning.py b/plan_sequence/generator/learning.py new file mode 100644 index 0000000..a3ea506 --- /dev/null +++ b/plan_sequence/generator/learning.py @@ -0,0 +1,66 @@ +import os +from urllib.request import urlretrieve +import numpy as np +import torch +from torch_geometric.utils import from_networkx + +from plan_sequence.feasibility_check import get_contact_graph + +from .base import Generator +from .network.model import ModelGraph +from .network.data import AssemblyDataGraph +from .network.args import get_args, curr_dir + + +def nx_to_pyg_graph(nx_graph): + subgraph = nx_graph + for node in subgraph: + # Add additional feature for the number of edges connected to this node + edge_count = torch.tensor(len(subgraph.edges(node))).float() + subgraph.nodes[node]["edge_count"] = edge_count + # Also add the file name + subgraph.nodes[node]["file"] = node + # Convert to a pytorch geometric graph + pyg_subgraph = from_networkx(subgraph) + # Randomly rotate the graph points if requested and only with training data + # pyg_subgraph.x = AssemblyDataGraph.random_rotate_points(pyg_subgraph.x) + return pyg_subgraph + + +class LearningBasedGenerator(Generator): + ''' + Generate candidate parts by learned network + ''' + model_ckpt = 'pretrained_model' + + def __init__(self, asset_folder, assembly_dir, base_part=None, save_sdf=False): + super().__init__(asset_folder, assembly_dir, base_part=base_part, save_sdf=save_sdf) + args = get_args() + # from pathlib import Path + # contact_graph = AssemblyDataGraph.load_contact_graph(Path(assembly_dir)) + contact_graph = get_contact_graph(self.asset_folder, self.assembly_dir, save_sdf=save_sdf) + self.nx_graph = AssemblyDataGraph.load_assembly_graph(assembly_dir, max_pc_size=args.max_pc_size, contact_graph=contact_graph) + self.model = ModelGraph(args) + model_path = os.path.join(curr_dir, f'{self.model_ckpt}.pt') + if not os.path.exists(model_path): + urlretrieve('https://people.csail.mit.edu/yunsheng/ASAP/pretrained_model.pt', model_path) + self.model.load_state_dict(torch.load(model_path, map_location='cpu')['model_state_dict']) + self.model.eval() + + def generate_candidate_part(self, assembled_parts): + assembled_parts = self._remove_base_part(assembled_parts) + + eps = 0.0 + if np.random.random() < eps: + ordered_parts = np.random.permutation(np.array(assembled_parts, dtype=object)) + else: + node_list = [p for p in assembled_parts] + nx_subgraph = self.nx_graph.subgraph(node_list) + pyg_subgraph = nx_to_pyg_graph(nx_subgraph) + with torch.no_grad(): + logits = self.model.forward_logits(pyg_subgraph) + probs = torch.sigmoid(logits).squeeze().detach().numpy() + ordered_parts = np.array(pyg_subgraph.file, dtype=str)[np.argsort(probs)][::-1] + + return ordered_parts + diff --git a/plan_sequence/generator/network/args.py b/plan_sequence/generator/network/args.py new file mode 100644 index 0000000..75b63db --- /dev/null +++ b/plan_sequence/generator/network/args.py @@ -0,0 +1,22 @@ +""" + +Command line args + +""" + +import argparse +import os + +curr_dir = os.path.abspath(os.path.dirname(os.path.abspath(__file__))) + + +def get_args(): + + args = argparse.Namespace() + + args.max_pc_size = 1000 + args.feat_len = 512 + args.dropout = 0.0 + args.batch_norm = 1 + + return args diff --git a/plan_sequence/generator/network/data.py b/plan_sequence/generator/network/data.py new file mode 100644 index 0000000..10d639c --- /dev/null +++ b/plan_sequence/generator/network/data.py @@ -0,0 +1,347 @@ +import os +from pathlib import Path +import json +import copy +import random +import torch +import numpy as np +import torch.nn.functional as F +from torch.utils.data import Dataset +import trimesh +from torch_geometric.data import Batch +from torch_geometric.utils import from_networkx +from tqdm import tqdm +import matplotlib.pyplot as plt +import seaborn as sns +from networkx.readwrite import node_link_graph +from scipy.spatial.transform import Rotation +from sklearn.model_selection import train_test_split + +import sys +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')) +sys.path.append(project_base_dir) + +from assets import load + + +class AssemblyDataBase(Dataset): + def __init__(self, args, shuffle_dataset=True, split="train"): + self.max_pc_size = args.max_pc_size #1000 + self.max_num_parts = args.max_num_parts #20 + self.seed = args.seed + self.random_rotate = args.random_rotate + self.split = split + self.val_fraction = args.val_fraction + label_path = os.path.join(args.data_dir, args.data_file) + with open(label_path, 'r') as fp: + all_data = json.load(fp) + + # Get the split we want + self.dataset = self.get_split(all_data['data']) + + # Limit the number of data samples to load + if args.data_limit > 0: + self.dataset = self.dataset[:args.data_limit] + + def __getitem__(self, idx): + # To be implemented by the child class + pass + + def __len__(self): + return len(self.dataset) + + def get_split(self, all_samples): + """Get the train/test split""" + if self.split != "all": + train_ratio = 1.0 - self.val_fraction * 2 + validation_ratio = self.val_fraction + test_ratio = self.val_fraction + + train_samples, testval_samples = train_test_split(all_samples, test_size=1.0 - train_ratio) + val_samples, test_samples = train_test_split(testval_samples, test_size=test_ratio/(test_ratio + validation_ratio)) + + if self.split == "train": + split_samples = train_samples + elif self.split == "val" or self.split == "valid" or self.split == "validation": + split_samples = val_samples + elif self.split == "test": + split_samples = test_samples + elif self.split == "all": + split_samples = all_samples + else: + raise Exception("Unknown split name") + return split_samples + + +class AssemblyData(AssemblyDataBase): + def __init__(self, args, shuffle_dataset=True, split="train"): + super().__init__(args, shuffle_dataset, split) + self.data_path = os.path.join(args.data_dir, 'part_pc') + + def __getitem__(self, index): + mesh_id = self.dataset[index]['assembly-id'] + parts = sorted(self.dataset[index]["parts-included"]) + part_removed = self.dataset[index]["part-removed"] + + removal_index = parts.index(part_removed) + part_pc_size = self.max_pc_size // len(parts) + part_pointcloud = [] + counter = 0 + for part_id in parts : + # (num_points, xyz) i.e. (2048, 3) + cur_part_pc = np.load(os.path.join(self.data_path, mesh_id, str(part_id.split('.')[0])+'.npy')) + assert cur_part_pc.shape[-1] == 3 + # (num_points, xyza) i.e. (2048, 4) + # where the 4 is xyz followed by a counter for each part index + cur_part_pc = np.hstack([cur_part_pc, counter * np.ones((cur_part_pc.shape[0], 1))]) + # Downsampling so the full assembly has self.max_pc_size total points + chosen_idx = np.random.choice(cur_part_pc.shape[0], part_pc_size, replace=False) + # (part_pc_size, xyza) e.g. (125, 4) + cur_part_pc = cur_part_pc[chosen_idx] + part_pointcloud.append(cur_part_pc) + counter += 1 + + # Combine the individual parts into a single point cloud + # (self.max_pc_size, 4) + part_pointcloud = np.vstack(part_pointcloud) + # TODO: Randomly rotate the pointcloud xyz if self.random_rotate and self.split == train + if part_pointcloud.shape[0] < self.max_pc_size: part_pointcloud = np.vstack([part_pointcloud, np.zeros( (self.max_pc_size - part_pointcloud.shape[0], 4))]) + + assert part_pointcloud.shape[0] == self.max_pc_size + + part_pointcloud = torch.tensor(part_pointcloud) + gt = F.one_hot(torch.tensor(removal_index).long(), self.max_num_parts ) + + return part_pointcloud, gt + + +class AssemblyDataGraph(AssemblyDataBase): + + def __init__(self, args, shuffle_dataset=True, split="train"): + super().__init__(args, shuffle_dataset, split) + self.data_path = os.path.join(args.data_dir, "assembly_obj") + # Preload the full graphs used to generate the subgraphs + self.graphs_full, failed_graphs = self.load_assembly_graphs() + # Remove failed graphs from self.dataset + if len(failed_graphs) > 0: + assembly_ids = set(failed_graphs) + # Keep only the assemblies not listed in assembly_ids + self.dataset = AssemblyDataGraph.remove_assemblies_from_dataset(self.dataset, assembly_ids) + + @staticmethod + def remove_assemblies_from_dataset(dataset, assembly_ids): + """Remove any subassembly from the dataset from any of the given assembly ids""" + dataset[:] = [x for x in dataset if not x["assembly-id"] in assembly_ids] + return dataset + + @staticmethod + def get_assembly_dirs(input_dir): + """Get a list of assembly directories""" + if not isinstance(input_dir, Path): + input_dir = Path(input_dir) + # Looking for e.g. 00014 + pattern = "[0-9][0-9][0-9][0-9][0-9]" + return [f for f in input_dir.glob(pattern)] + + @staticmethod + def remove_assemblies_not_in_dataset(dataset, assembly_dirs): + """Remove any assemblies that aren't in the dataset""" + assembly_ids_in_dataset = {x["assembly-id"] for x in dataset} + # print(f"Dataset contains {len(dataset)} samples from {len(assembly_ids_in_dataset)} assemblies") + assembly_dirs[:] = [x for x in assembly_dirs if x.stem in assembly_ids_in_dataset] + return assembly_dirs + + def load_assembly_graphs(self): + """Load a directory of assemblies into a graph""" + # TODO: Currently we load all the data once for each split we have :( + assembly_dirs = AssemblyDataGraph.get_assembly_dirs(self.data_path) + # We don't want to waste time loading any graphs that aren't in the dataset + # so filter them out. Useful when --data_limit is set + assembly_dirs = AssemblyDataGraph.remove_assemblies_not_in_dataset(self.dataset, assembly_dirs) + # First load the full graphs without any parts removed + graphs_full = {} + # Keep track of the graphs that failed to remove them later + failed_graphs = [] + print(f"Loading {len(assembly_dirs)} full assemblies for {len(self.dataset)} subgraphs in the {self.split} split...") + pbar = tqdm(assembly_dirs) + for assembly_dir in pbar: + pbar.set_description(assembly_dir.stem) + try: + graph = AssemblyDataGraph.load_assembly_graph(assembly_dir, self.max_pc_size) + except Exception as ex: + print(f"Failed to load assembly {assembly_dir.stem} into a graph", ex) + failed_graphs.append(assembly_dir.stem) + continue + graphs_full[assembly_dir.stem] = graph + return graphs_full, failed_graphs + + @staticmethod + def load_assembly_graph(assembly_dir, max_pc_size, contact_graph=None): + """Load a single assembly into a graph""" + if not isinstance(assembly_dir, Path): + assembly_dir = Path(assembly_dir) + # Load the meshes + assembly = load.load_assembly(assembly_dir) + name_to_mesh = {part_id: part_data['mesh'] for part_id, part_data in assembly.items()} + # Load the contact graph + if contact_graph is None: # NOTE: differ from the baseline code + g = AssemblyDataGraph.load_contact_graph(assembly_dir) + else: + g = contact_graph.copy() + # Add a point cloud to each node in the graph + pcs = [] + for node in g.nodes: + mesh = name_to_mesh[node] + # ------------------ + # Part point cloud + pc, _ = trimesh.sample.sample_surface(mesh, max_pc_size) + # Convert to float for downstream NN + pc = torch.from_numpy(pc).float() + pcs.append(pc) + g.nodes[node]["x"] = pc + # ------------------ + # Part volume + assert mesh.is_watertight + g.nodes[node]["volume"] = torch.tensor(mesh.volume).float() + # ------------------ + # Part center of mass + g.nodes[node]["center_mass"] = torch.tensor(mesh.center_mass).float() + + # Combine all the point clouds and work out the center and scale + # at the assembly level + pcs = torch.vstack(pcs) + center, scale = AssemblyDataGraph.get_center_and_scale(pcs) + # Apply the scale to each individual part + # so the assembly should be at the origin, rather than the individual parts + for node in g.nodes: + g.nodes[node]["x"][..., :3] -= center + g.nodes[node]["x"][..., :3] *= scale + g.nodes[node]["volume"] *= scale + g.nodes[node]["center_mass"] -= center + g.nodes[node]["center_mass"] *= scale + # Distance from the assembly center to the part center of mass + g.nodes[node]["distance"] = torch.linalg.norm(g.nodes[node]["center_mass"]) + return g + + @staticmethod + def load_contact_graph(assembly_dir): + """Load the contact graph stored in networkx node link json format""" + contact_graph_file = assembly_dir / "contact_graph.json" + assert contact_graph_file.exists() + with open(contact_graph_file, 'r') as fp: + contact_graph_dict = json.load(fp) + g = node_link_graph(contact_graph_dict) + return g + + @staticmethod + def get_center_and_scale(pts): + """Get the center and scale of a point cloud""" + x = pts[:, 0] + y = pts[:, 1] + z = pts[:, 2] + bbox = torch.tensor([[x.min(), y.min(), z.min()], [x.max(), y.max(), z.max()]]) + diag = bbox[1] - bbox[0] + scale = 2.0 / max(diag[0], diag[1], diag[2]) + center = 0.5 * (bbox[0] + bbox[1]) + return center, scale + + @staticmethod + def get_random_rotation(): + """Get a random rotation in 45 degree increments along the canonical axes""" + axes = [ + np.array([1.0, 0.0, 0.0]), + np.array([0.0, 1.0, 0.0]), + np.array([0.0, 0.0, 1.0]), + ] + angles = [0.0, 90.0, 180.0, 270.0] + axis = random.choice(axes) + angle_radians = np.radians(random.choice(angles)) + return Rotation.from_rotvec(angle_radians * axis) + + @staticmethod + def random_rotate_points(pc, rotation=None): + """ + Randomly rotate a batch of pointclouds + of shape (num_pointclouds, num_points, 3) + """ + if rotation is None: + rotation = AssemblyDataGraph.get_random_rotation() + Rmat = torch.tensor(rotation.as_matrix()).float() + Rmat = Rmat.to(pc.device) + orig_size = pc.size() + return torch.mm(pc.view(-1, 3), Rmat).view(orig_size) + + def __getitem__(self, index): + """ + Constructs a subgraph from the full (preloaded) assembly contact graph + based on which parts have been removed + + Returns a pytorch geometric graph with the following attributes: + - x: Per node point clouds with shape (num_nodes, max_pc_size, 3) + - y: Per node binary labels indicating if this part should be removed, + with shape (num_nodes) + - file: A list of original file names for each part as integers + e.g. [0, 1, ...] + """ + meta_data = self.dataset[index] + # Get the full graph from which we derive the data sample from + assembly_id = meta_data["assembly-id"] + graph_full = self.graphs_full[assembly_id] + # No we remove all the parts that aren't in the sub-assembly + # we do this by removing each node + parts_included = set(meta_data["parts-included"]) + # Remove zero padding + parts_included = set(str(Path(s).stem) for s in parts_included) + parts_all = set(graph_full.nodes) + # Use set difference to find the parts we want to remove + parts_difference = parts_all - parts_included + # Remove the parts that don't exist in the sub-assembly + # to form a subgraph + subgraph = copy.deepcopy(graph_full) + for part in parts_difference: + subgraph.remove_node(part) + # Add the labels to the graph + part_removed = str(Path(meta_data['part-removed']).stem) + positive_label_count = 0 + for node in subgraph: + label = float(part_removed == node) + subgraph.nodes[node]["y"] = label + if label == 1: + positive_label_count += 1 + # Sanity check that we don't have any incorrect nodes + assert node not in parts_difference + assert node in parts_included + # Add additional feature for the number of edges connected to this node + edge_count = torch.tensor(len(subgraph.edges(node))).float() + subgraph.nodes[node]["edge_count"] = edge_count + # Also add the file name + subgraph.nodes[node]["file"] = node + # Check we have exactly one positive label + assert positive_label_count == 1 + # Convert to a pytorch geometric graph + pyg_subgraph = from_networkx(subgraph) + # Randomly rotate the graph points if requested and only with training data + if self.random_rotate and self.split == "train": + pyg_subgraph.x = AssemblyDataGraph.random_rotate_points(pyg_subgraph.x) + return pyg_subgraph + + @staticmethod + def collate_fn(batch): + return Batch.from_data_list(batch) + + def plot(self, index): + """Debug functionality to plot the point clouds in a graph at a given index""" + graph = self[index] + pts = graph.x + labels = graph.y + fig = plt.figure() + ax = plt.axes(projection="3d") + colors = sns.color_palette("husl", len(labels)) + # Draw each point cloud with a unique color + for i, node_pts in enumerate(pts): + color = colors[i] + ax.scatter(node_pts[:, 0], node_pts[:, 1], node_pts[:, 2], c=color) + ax.set_box_aspect([ub - lb for lb, ub in (getattr(ax, f'get_{a}lim')() for a in 'xyz')]) + ax.set_title(self.dataset[index]["assembly-id"]) + plt.show() + \ No newline at end of file diff --git a/plan_sequence/generator/network/model.py b/plan_sequence/generator/network/model.py new file mode 100644 index 0000000..21f6294 --- /dev/null +++ b/plan_sequence/generator/network/model.py @@ -0,0 +1,184 @@ +import math +import torch +import torch.nn as nn +import torch.nn.functional as F +from torch_geometric.nn import GATv2Conv +from torch_geometric.data import Batch + + +class PN(nn.Module): + def __init__(self, feat_len=1024, channels=4, batch_norm=True): + super(PN, self).__init__() + self.batch_norm = batch_norm + bn_layer = nn.BatchNorm1d if batch_norm else nn.Identity + + self.conv1 = nn.Conv1d(channels, 64, kernel_size=1, bias=False) + self.conv2 = nn.Conv1d(64, 64, kernel_size=1, bias=False) + self.conv3 = nn.Conv1d(64, 64, kernel_size=1, bias=False) + self.conv4 = nn.Conv1d(64, 128, kernel_size=1, bias=False) + self.conv5 = nn.Conv1d(128, feat_len, kernel_size=1, bias=False) + self.bn1 = bn_layer(64) + self.bn2 = bn_layer(64) + self.bn3 = bn_layer(64) + self.bn4 = bn_layer(128) + self.bn5 = bn_layer(feat_len) + + def forward(self, pcd, normals=None): + # From (batch_size, num_points, 3) + # to (batch_size, 3, num_points) + x = pcd.permute(0, 2, 1) + x = F.relu(self.bn1(self.conv1(x))) + x = F.relu(self.bn2(self.conv2(x))) + x = F.relu(self.bn3(self.conv3(x))) + x = F.relu(self.bn4(self.conv4(x))) + x = F.relu(self.bn5(self.conv5(x))) + x = F.adaptive_max_pool1d(x, 1).squeeze(dim=-1) + return x + + +class MLP(nn.Module): + def __init__(self, feat_len, max_num_parts=20): + super(MLP, self).__init__() + self.mlp1 = nn.Linear(feat_len, 64) + self.mlp2 = nn.Linear(64, 64) + self.mlp3 = nn.Linear(64, max_num_parts) + self.relu = nn.ReLU() + self.softmax = nn.Softmax(dim=-1) + + def forward(self, x): + x = self.relu(self.mlp1(x)) + x = self.relu(self.mlp2(x)) + x = torch.sigmoid(self.mlp3(x)) + softmax_x = self.softmax(x) + return softmax_x, x + + +class Model(nn.Module): + def __init__(self, args): + super(Model, self).__init__() + feat_len = args.feat_len + max_num_parts = args.max_num_parts + self.encoder = PN(feat_len, batch_norm=bool(args.batch_norm)) + self.classifier = MLP(feat_len, max_num_parts=max_num_parts) + self.criterion = nn.BCELoss() + + def forward(self, batch): + pc, gt = batch + # pc: point cloud with shape (batch_size, max_pc_size, 4) + # where the 4 is xyz followed by a counter for each part index + feat = self.encoder(pc) + label, logits = self.classifier(feat) + # try MSE loss: + # loss = ((gt - logits)**2).mean() + # CE loss + loss = self.criterion(logits, gt) + # TODO: Implement accuracy metric + acc = torch.tensor(0.0, device=pc.device).float() + return loss, acc + + +class MLPMultiFeature(nn.Module): + def __init__(self, feat_len, hand_feat_len, batch_norm=False): + super(MLPMultiFeature, self).__init__() + bn_layer = nn.BatchNorm1d if batch_norm else nn.Identity + self.mlp1 = nn.Linear(hand_feat_len, feat_len) + self.mlp2 = nn.Linear(feat_len * 2, feat_len) + self.relu = nn.ReLU() + self.bn1 = bn_layer(feat_len) + self.bn2 = bn_layer(feat_len) + + def forward(self, pc_feat, volume, distance, edge_count): + # Combine the hand crafted features and + # make them the same size as the point cloud features + vol_dist = torch.column_stack([volume, distance, edge_count]) + vol_dist_feat = self.relu(self.bn1(self.mlp1(vol_dist))) + # Combine the hand crafted and point cloud features + # then scale them to the desired feature size + vol_dist_pc = torch.cat([pc_feat, vol_dist_feat], dim=1) + vol_dist_pc_feat = self.relu(self.bn2(self.mlp2(vol_dist_pc))) + return vol_dist_pc_feat + + +class GAT(torch.nn.Module): + def __init__(self, hidden_dim, dropout=0.0, batch_norm=False): + super(GAT, self).__init__() + bn_layer = nn.BatchNorm1d if batch_norm else nn.Identity + self.conv1 = GATv2Conv(hidden_dim, hidden_dim // 8, heads=8, dropout=dropout) + self.conv2 = GATv2Conv(hidden_dim, hidden_dim // 8, heads=8, dropout=dropout) + self.relu = nn.ReLU() + self.bn1 = bn_layer(hidden_dim) + self.dropout = nn.Dropout(dropout) + + def forward(self, x, edges_idx): + x = self.dropout(x) + x = self.relu(self.bn1(self.conv1(x, edges_idx))) + x = self.dropout(x) + x = self.conv2(x, edges_idx) + return x + + +class MLPNodeClassifier(nn.Module): + def __init__(self, feat_len, batch_norm=False): + super(MLPNodeClassifier, self).__init__() + bn_layer = nn.BatchNorm1d if batch_norm else nn.Identity + self.mlp1 = nn.Linear(feat_len, 64) + self.mlp2 = nn.Linear(64, 64) + self.mlp3 = nn.Linear(64, 1) + self.relu = nn.ReLU() + self.bn1 = bn_layer(64) + self.bn2 = bn_layer(64) + + def forward(self, x): + x = self.relu(self.bn1(self.mlp1(x))) + x = self.relu(self.bn2(self.mlp2(x))) + x = self.mlp3(x) + return x + + +class ModelGraph(nn.Module): + def __init__(self, args): + super(ModelGraph, self).__init__() + bn = bool(args.batch_norm) + self.pointnet = PN(args.feat_len, channels=3, batch_norm=bn) + self.multi_feat = MLPMultiFeature(args.feat_len, 3, batch_norm=bn) + self.gnn = GAT(args.feat_len, args.dropout, batch_norm=bn) + self.classifier = MLPNodeClassifier(args.feat_len, batch_norm=bn) + self.criterion = nn.BCEWithLogitsLoss() + + def forward(self, graph): + # Pass the graph and get the logits + logits = self.forward_logits(graph) + # Calculate hits for each graph in the batch + top1_hits = torch.zeros(graph.num_graphs) + for graph_index in range(graph.num_graphs): + # Find the indices of the graph to slice + graph_mask = (graph.batch == graph_index).float() + mask_indices = torch.nonzero(graph_mask) + mask_min = mask_indices.min() + mask_max = mask_indices.max() + # See if we have a top-1 hit in just this graph + top1_index = torch.argmax(logits[mask_min:mask_max]) + gt_index = torch.argmax(graph.y[mask_min:mask_max]) + top1_hits[graph_index] = top1_index == gt_index + + # Calculate loss from logits + loss = self.criterion(logits, graph.y) + return loss, torch.mean(top1_hits) + + def forward_logits(self, graph): + # graph.x contains an xyz point cloud for each node in the graph + # i.e. part in the assembly, with shape (num_nodes, max_pc_size, 3) + x = self.pointnet(graph.x) + # shape: (num_nodes, feat_len) + # Add our hand crafted features, i.e. volume and distance, + # these are just scalar values calculated for each part + x = self.multi_feat(x, graph.volume, graph.distance, graph.edge_count) + # shape: (num_nodes, feat_len) + x = self.gnn(x, graph.edge_index) + # shape: (num_nodes, feat_len) + logits = self.classifier(x).squeeze() + # shape: (num_nodes) + # probs = torch.sigmoid(logits).squeeze() + return logits + + \ No newline at end of file diff --git a/plan_sequence/generator/random.py b/plan_sequence/generator/random.py new file mode 100644 index 0000000..cfb8b4f --- /dev/null +++ b/plan_sequence/generator/random.py @@ -0,0 +1,15 @@ +import numpy as np + +from .base import Generator + + +class RandomGenerator(Generator): + ''' + Generate candidate parts by random permutation + ''' + def generate_candidate_part(self, assembled_parts): + assembled_parts = self._remove_base_part(assembled_parts) + + candidate_parts = np.random.permutation(assembled_parts) + for part in candidate_parts: + yield part diff --git a/plan_sequence/physics_planner.py b/plan_sequence/physics_planner.py new file mode 100644 index 0000000..fa825cc --- /dev/null +++ b/plan_sequence/physics_planner.py @@ -0,0 +1,537 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +from time import time +import numpy as np +import redmax_py as redmax +import networkx as nx +import matplotlib.pyplot as plt +from tqdm import tqdm + +from assets.load import load_assembly, load_part_ids +from assets.transform import transform_pt_by_matrix +from plan_path.run_connect import ConnectPathPlanner +from plan_sequence.sim_string import get_path_sim_string, get_stability_sim_string, get_contact_sim_string +from utils.renderer import SimRenderer + + +# Parameters for physics-based planner + +FORCE_MAG = 1e2 +FRAME_SKIP = 100 +MAX_TIME = 60 +CONTACT_EPS = 1e-1 +POS_FAR_THRESHOLD = 0.2 +POS_NEAR_THRESHOLD = 0.05 +NEAR_STEP = 100 +MAX_STEP = 1000 +CHECK_FREQ = 20 +COL_TH_PATH = 0.01 +COL_TH_STABLE = 0.00 +MIN_SEP = 0.5 +DEBUG_SIM = False + + +class State: + + def __init__(self, q, qdot): + self.q = q + self.qdot = qdot + + def __repr__(self): + return f'[State object at {hex(id(self))}]' + + +class MultiPartPathPlanner: + + frame_skip = FRAME_SKIP + max_time = MAX_TIME + contact_eps = CONTACT_EPS + col_th_base = COL_TH_PATH + min_sep = MIN_SEP + + def __init__(self, asset_folder, assembly_dir, parts_fix, part_move, parts_removed=[], pose=None, force_mag=FORCE_MAG, save_sdf=False, + camera_pos=None, camera_lookat=None): + model_string = get_contact_sim_string(assembly_dir, parts_fix + [part_move] + parts_removed, save_sdf=save_sdf) + sim = redmax.Simulation(model_string, asset_folder) + col_th_dict = self._compute_col_th_dict(sim, parts_fix + parts_removed, part_move) + + model_string = get_path_sim_string(assembly_dir, parts_fix, part_move, parts_removed=parts_removed, + save_sdf=save_sdf, pose=pose, col_th=col_th_dict) + self.sim = redmax.Simulation(model_string, asset_folder) + if camera_pos is not None: self.sim.viewer_options.camera_pos = camera_pos + if camera_lookat is not None: self.sim.viewer_options.camera_lookat = camera_lookat + self.parts_fix = parts_fix + self.part_move = part_move + self.parts_removed = parts_removed + self.pose = pose + self.force_mag = force_mag + + # connect path planner + self.connect_path_planner = ConnectPathPlanner(assembly_dir, min_sep=self.min_sep) + + def _compute_col_th_dict(self, sim, parts_fix, part_move): + col_th_dict = {} + for part_fix in parts_fix: + d_mf = sim.get_body_distance(f'part{part_move}', f'part{part_fix}') + d_fm = sim.get_body_distance(f'part{part_fix}', f'part{part_move}') + col_th_dict[part_fix] = max(0, max(-d_mf, -d_fm)) + self.col_th_base + col_th_dict[part_move] = max(col_th_dict.values()) + return col_th_dict + + def get_state(self): + q = self.sim.get_joint_qm(f'part{self.part_move}') + qdot = self.sim.get_joint_qmdot(f'part{self.part_move}') + return State(q, qdot) + + def set_state(self, state): + qm = state.q + self.sim.set_joint_qm(f'part{self.part_move}', qm) + self.sim.zero_joint_qdot(f'part{self.part_move}') + self.sim.update_robot() + + def apply_action(self, action): + assert len(action) == 3 + action = action * self.force_mag + force = np.concatenate([np.zeros(3), action]) + self.sim.set_body_external_force(f'part{self.part_move}', force) + + def is_disassembled(self, min_sep=None): + in_contact = False + if min_sep is None: min_sep = self.min_sep + for part_fix in self.parts_fix: # if any part in contact, then not fully disassembled + in_contact = in_contact or self.sim.body_in_contact(f'part{part_fix}', f'part{self.part_move}', min_sep) + return not in_contact # if all movable parts are not in contact with fixed parts, then fully disassembled + + def check_success(self, action, return_path=False, min_sep=None): + + self.sim.reset() + self.apply_action(action) + + t_start = time() + step = 0 + path = [] + + while True: + + self.set_state(self.get_state()) + state = self.get_state() + last_qdot = state.qdot[:3] + path.append(state.q) + + for _ in range(self.frame_skip): + self.sim.forward(1, verbose=False) + new_state = self.get_state() + path.append(new_state.q) + + t_plan = time() - t_start + if t_plan > self.max_time: + if return_path: + return False, path + else: + return False + + if self.is_disassembled(min_sep): + break + + qdot = new_state.qdot[:3] # measure translation qdot only + qdotdot = (qdot - last_qdot) / self.sim.options.h / self.frame_skip + # if self.pose is not None: + # qdotdot = np.dot(qdotdot, self.pose[:3, :3].T) # revert to local frame + # qdotdot = np.dot(qdotdot, action) + + if np.linalg.norm(qdotdot) < 0.01 * self.force_mag: + if return_path: + return False, path + else: + return False + + step += 1 + + if return_path: + return True, path + else: + return True + + def plan_path(self, action, rotation=False): + success, path = self.check_success(action, return_path=True) + # if success: + # connect_path = self.connect_path_planner.plan(self.part_move, self.parts_fix, self.parts_removed, + # rotation=rotation, final_state=path[-1]) + # if connect_path is not None: + # path += connect_path + return success, path + + def render(self, path=None, reverse=False, record_path=None, make_video=False): + q_his, qdot_his = self.sim.get_q_his(), self.sim.get_qdot_his() + if path is not None: + # assume path is global coordinate + path = [self.sim.get_joint_q_from_qm(f'part{self.part_move}', qm) for qm in path] + if reverse: + path = q_his[::-1] if path is None else path[::-1] + self.sim.set_state_his(path, [np.zeros(6) for _ in range(len(path))]) + else: + if path is not None: + self.sim.set_state_his(path, [np.zeros(6) for _ in range(len(path))]) + SimRenderer.replay(self.sim, record=record_path is not None, record_path=record_path, make_video=make_video) + self.sim.set_state_his(q_his, qdot_his) + return self.sim.export_replay_matrices() + + +class StabilityChecker: + + contact_eps = CONTACT_EPS + pos_far_threshold = POS_FAR_THRESHOLD + pos_near_threshold = POS_NEAR_THRESHOLD + near_step = NEAR_STEP + + def __init__(self, allow_gap): + self.sim = None + self.parts_move = None + self.parts_fix = None + self.G = None + self.pos_his_map = None + self.dist_his_map = None + self.n_step = 0 + if allow_gap: + self.pos_far_threshold = np.inf + + def get_part_pos(self, part): + return self.sim.get_joint_qm(f'part{part}')[:3] + + def derive_contact_graph(self): + G = nx.Graph() + for i in range(len(self.parts_move)): + G.add_node(self.parts_move[i]) + for j in range(i + 1, len(self.parts_move)): + in_contact = self.sim.body_in_contact(f'part{self.parts_move[i]}', f'part{self.parts_move[j]}', self.contact_eps) + if in_contact: + G.add_edge(self.parts_move[i], self.parts_move[j]) + for part_fix in self.parts_fix: + in_contact = self.sim.body_in_contact(f'part{self.parts_move[i]}', f'part{part_fix}', self.contact_eps) + if in_contact: + G.add_edge(self.parts_move[i], part_fix) + return G + + def update_sim(self, sim, parts_move, parts_fix): + self.sim = sim + self.parts_move = parts_move + self.parts_fix = parts_fix + self.G = self.derive_contact_graph() + if self.pos_his_map is None: + self.pos_his_map = {part: [self.get_part_pos(part)] for part in self.parts_move} + if self.dist_his_map is None: + self.dist_his_map = {part: [0.0] for part in self.parts_move} + + def update_status(self): + for part_move in self.parts_move: + pos = self.get_part_pos(part_move) + self.pos_his_map[part_move].append(pos) + self.dist_his_map[part_move].append(np.linalg.norm(pos - self.pos_his_map[part_move][0])) + self.n_step += 1 + + def check_disconnected_parts(self): + parts_disconnected = [] + for part_move in self.parts_move: + if self.G.degree(part_move) == 0: + parts_disconnected.append(part_move) + return parts_disconnected + + def check_fallen_parts(self, group=True): + parts_fallen = [] + for part_move in self.parts_move: + if self.dist_his_map[part_move][-1] > self.pos_far_threshold: # check distance + parts_fallen.append(part_move) + continue + for part_other in self.G.neighbors(part_move): # check connectivity + in_contact = self.sim.body_in_contact(f'part{part_other}', f'part{part_move}', self.contact_eps) + if not in_contact: + parts_fallen.append(part_move) + break + if group and len(parts_fallen) > 1: + parts_fallen_grouped = [] + G = self.derive_contact_graph() + G = G.subgraph([x for x in parts_fallen]) + for G_sub in nx.connected_components(G): + G_sub = list(G_sub) + if len(G_sub) > 1: + G_sub_sorted = sorted(G_sub, key=lambda x: self.sim.get_body_mass(f'part{x}'), reverse=True) + parts_fallen_grouped.append(G_sub_sorted[0]) + else: + parts_fallen_grouped.append(G_sub[0]) + return parts_fallen_grouped + else: + return parts_fallen + + def check_stable_parts(self): + parts_stable = [] + if self.n_step >= self.near_step: + for part_move in self.parts_move: + dist_interval = self.dist_his_map[part_move][self.n_step - self.near_step:self.n_step] + if np.max(dist_interval) - np.min(dist_interval) < self.pos_near_threshold: + parts_stable.append(part_move) + return parts_stable + + def plot_his(self): + import matplotlib.pyplot as plt + fig, axes = plt.subplots(4, len(self.parts_move), figsize=(3 * len(self.parts_move), 3 * 3)) + axis_names = ['X', 'Y', 'Z'] + for i, part_id in enumerate(self.parts_move): + for j in range(3): + axes[j][i].plot(list(range(len(self.pos_his_map[part_id]))), np.array(self.pos_his_map[part_id])[:, j].round(3)) + if i == 0: + axes[j][i].set_ylabel(f'{axis_names[j]}') + if j == 0: + axes[j][i].set_title(f'Part {part_id}') + axes[3][i].plot(list(range(len(self.dist_his_map[part_id]))), np.array(self.dist_his_map[part_id]).round(3)) + axes[3][i].set_ylabel(f'Dist') + axes[3][i].set_xlabel('Time step') + plt.tight_layout() + plt.show() + + +class MultiPartStabilityPlanner: + + max_step = MAX_STEP + col_th = COL_TH_STABLE + + def __init__(self, asset_folder, assembly_dir, parts_fix, parts_move, pose=None, save_sdf=False, allow_gap=False): + model_string = get_stability_sim_string(assembly_dir, parts_fix, parts_move, pose=pose, save_sdf=save_sdf, col_th=self.col_th) + self.sim = redmax.Simulation(model_string, asset_folder) + self.parts_fix = parts_fix.copy() + self.parts_move = parts_move.copy() + self.allow_gap = allow_gap + + def check_success(self, max_step=MAX_STEP, timeout=None): + + t_start = time() + + # initialize sim and stability checker + self.sim.reset() + checker = StabilityChecker(self.allow_gap) + checker.update_sim(self.sim, self.parts_move, self.parts_fix) + + # check initial connectivity + parts_disconnected = checker.check_disconnected_parts() + if len(parts_disconnected) > 0: + return False, parts_disconnected + + # iterate until max step + iterator = tqdm(range(max_step)) if DEBUG_SIM else range(max_step) + for i in iterator: + + # simulate and update status + self.sim.forward(1, verbose=DEBUG_SIM) + checker.update_status() + + if (i + 1) % CHECK_FREQ == 0: + # check fallen parts + parts_fall = checker.check_fallen_parts() + if len(parts_fall) > 0: + # checker.plot_his() + # self.render() + return False, parts_fall + + if timeout is not None and time() - t_start > timeout: + return False, None + + # checker.plot_his() + # self.render() + + return True, None + + def render(self, record_path=None, make_video=False): + SimRenderer.replay(self.sim, record=record_path is not None, record_path=record_path, make_video=make_video) + + +class MultiPartNoForceStabilityPlanner(MultiPartStabilityPlanner): + + def __init__(self, asset_folder, assembly_dir, parts, save_sdf=False, allow_gap=False): + model_string = get_stability_sim_string(assembly_dir, [], parts, gravity=False, save_sdf=save_sdf, col_th=self.col_th) + self.sim = redmax.Simulation(model_string, asset_folder) + self.parts_fix = [] + self.parts_move = parts.copy() + self.allow_gap = allow_gap + + def check_success(self, max_step=MAX_STEP, timeout=None): + + t_start = time() + + # initialize sim and stability checker + self.sim.reset() + checker = StabilityChecker(self.allow_gap) + checker.update_sim(self.sim, self.parts_move, self.parts_fix) + + # check initial connectivity + parts_fall = checker.check_disconnected_parts() + + # iterate until max step + iterator = tqdm(range(max_step)) if DEBUG_SIM else range(max_step) + for i in iterator: + + # simulate and update status + self.sim.forward(1, verbose=DEBUG_SIM) + checker.update_status() + + if (i + 1) % CHECK_FREQ == 0: + # check fallen parts + parts_fall_i = checker.check_fallen_parts() + for part_fall in parts_fall_i: + if part_fall not in parts_fall: + parts_fall.append(part_fall) + + if timeout is not None and time() - t_start > timeout: + return False, nx.Graph() + + # get result graph + for part_fall in parts_fall: + self.parts_move.remove(part_fall) + checker.update_sim(self.sim, self.parts_move, self.parts_fix) + + success = (len(parts_fall) == 0) + return success, checker.G + + +class MultiPartAdaptiveStabilityPlanner(MultiPartStabilityPlanner): + + def __init__(self, asset_folder, assembly_dir, parts_fix, parts_move, pose=None, save_sdf=False, allow_gap=False): + self.asset_folder = asset_folder + self.assembly_dir = assembly_dir + self.parts_fix = parts_fix.copy() + self.parts_move = parts_move.copy() + self.pose = pose + self.save_sdf = save_sdf + self.allow_gap = allow_gap + + def check_success(self, max_step=MAX_STEP, timeout=None): + + t_start = time() + + # initialize sim and stability checker + model_string = get_stability_sim_string(self.assembly_dir, self.parts_fix, self.parts_move, gravity=True, + save_sdf=self.save_sdf, pose=self.pose, col_th=self.col_th) + self.sim = redmax.Simulation(model_string, self.asset_folder) + self.sim.reset() + checker = StabilityChecker(self.allow_gap) + checker.update_sim(self.sim, self.parts_move, self.parts_fix) + + parts_stable_all = [] + + # check initial connectivity + parts_disconnected = checker.check_disconnected_parts() + if len(parts_disconnected) > 0: + return False, parts_disconnected, parts_stable_all + + # iterate until max step + iterator = tqdm(range(max_step)) if DEBUG_SIM else range(max_step) + for i in iterator: + + # simulate and update status + self.sim.forward(1, verbose=DEBUG_SIM) + checker.update_status() + + if (i + 1) % CHECK_FREQ == 0: + # check fallen parts + parts_fall = checker.check_fallen_parts() + if len(parts_fall) > 0: + return False, parts_fall, parts_stable_all + + # check stable parts + parts_stable = checker.check_stable_parts() + if len(parts_stable) > 0: + parts_stable_all.extend(parts_stable) + + # fix stable parts + self.parts_fix.extend(parts_stable) + for part_stable in parts_stable: + self.parts_move.remove(part_stable) + + # re-initialize simulation + mat_dict = self.sim.get_body_E0j_map() + mat_dict = {key.replace('part', ''): val for key, val in mat_dict.items()} + q_map = self.sim.get_q_map() + qdot_map = self.sim.get_qdot_map() + + model_string = get_stability_sim_string(self.assembly_dir, self.parts_fix, self.parts_move, gravity=True, + save_sdf=self.save_sdf, pose=self.pose, mat_dict=mat_dict, col_th=self.col_th) + self.sim = redmax.Simulation(model_string, self.asset_folder) + self.sim.reset() + self.sim.set_q_map(q_map) + self.sim.set_qdot_map(qdot_map) + + # self.render() + + # update checker with new sim + checker.update_sim(self.sim, self.parts_move, self.parts_fix) + + if timeout is not None and time() - t_start > timeout: + return False, None, None # NOTE + + return True, None, parts_stable_all + + +def plot_stability_curve(pos_list_map): + fig, axes = plt.subplots(3, len(pos_list_map), figsize=(3 * len(pos_list_map), 2 * 3)) + axis_names = ['X', 'Y', 'Z'] + for i, part_id in enumerate(pos_list_map.keys()): + for j in range(3): + axes[j][i].plot(list(range(len(pos_list_map[part_id]))), np.array(pos_list_map[part_id])[:, j].round(3)) + if i == 0: + axes[j][i].set_ylabel(f'{axis_names[j]}') + if j == 0: + axes[j][i].set_title(f'Part {part_id}') + if j == 2: + axes[j][i].set_xlabel('Time step') + plt.tight_layout() + plt.show() + + +def get_contact_graph(asset_folder, assembly_dir, parts=None, contact_eps=CONTACT_EPS, save_sdf=False): + ''' + Get contact graph for assembly + ''' + if parts is None: parts = load_part_ids(assembly_dir) + + model_string = get_contact_sim_string(assembly_dir, parts, save_sdf=save_sdf) + sim = redmax.Simulation(model_string, asset_folder) + + G = nx.Graph() + for i in range(len(parts)): + G.add_node(parts[i]) + for j in range(i + 1, len(parts)): + in_contact = sim.body_in_contact(f'part{parts[i]}', f'part{parts[j]}', contact_eps) + if in_contact: + G.add_edge(parts[i], parts[j]) + return G + + +def get_distance_all_bodies(asset_folder, assembly_dir, parts=None, save_sdf=False): + if parts is None: parts = load_part_ids(assembly_dir) + + model_string = get_contact_sim_string(assembly_dir, parts, save_sdf=save_sdf) + sim = redmax.Simulation(model_string, asset_folder) + + distance = {} + for i in range(len(parts)): + for j in range(i + 1, len(parts)): + dist_ij = sim.get_body_distance(f'part{parts[i]}', f'part{parts[j]}') + dist_ji = sim.get_body_distance(f'part{parts[j]}', f'part{parts[i]}') + distance[(parts[i], parts[j])] = min(dist_ij, dist_ji) + + return distance + + +def get_body_mass(asset_folder, assembly_dir, parts=None, save_sdf=False): + if parts is None: parts = load_part_ids(assembly_dir) + + model_string = get_contact_sim_string(assembly_dir, parts, save_sdf=save_sdf) + sim = redmax.Simulation(model_string, asset_folder) + + mass_dict = {} + for part in parts: + mass_dict[part] = sim.get_body_mass(f'part{part}') + + return mass_dict diff --git a/plan_sequence/planner/__init__.py b/plan_sequence/planner/__init__.py new file mode 100644 index 0000000..be6a98d --- /dev/null +++ b/plan_sequence/planner/__init__.py @@ -0,0 +1,10 @@ +from .dfs import DFSSequencePlanner +from .beam import BeamSearchSequencePlanner +from .random import RandomSequencePlanner + + +planners = { + 'dfs': DFSSequencePlanner, + 'beam': BeamSearchSequencePlanner, + 'randseq': RandomSequencePlanner, +} diff --git a/plan_sequence/planner/base.py b/plan_sequence/planner/base.py new file mode 100644 index 0000000..94180b7 --- /dev/null +++ b/plan_sequence/planner/base.py @@ -0,0 +1,443 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')) +sys.path.append(project_base_dir) + +import numpy as np +import random +import torch +import json +import pickle +import networkx as nx +import matplotlib.pyplot as plt +from time import time +import traceback + +from assets.load import load_part_ids +from plan_sequence.sim_string import get_body_color_dict +from plan_sequence.physics_planner import MultiPartPathPlanner, get_body_mass +from plan_sequence.feasibility_check import check_assemblable, get_stable_plan_1pose_parallel, get_stable_plan_1pose_serial +from plan_sequence.stable_pose import get_combined_mesh, get_stable_poses +from plan_robot.run_grasp_plan import GraspPlanner +from plan_robot.run_grasp_arm_plan import GraspArmPlanner + + +class NumpyEncoder(json.JSONEncoder): + def default(self, obj): + if isinstance(obj, np.ndarray): + return obj.tolist() + return json.JSONEncoder.default(self, obj) + + +class SequencePlanner: + ''' + Disassembly sequence planning (without ground, 1 direction gravity, 1 part at a time) + ''' + def __init__(self, seq_generator, num_proc=1, save_sdf=False): + self.seq_generator = seq_generator + self.asset_folder = seq_generator.asset_folder + self.assembly_dir = seq_generator.assembly_dir + self.base_part = seq_generator.base_part + self.parts = sorted(load_part_ids(self.assembly_dir)) + assert len(self.parts) >= 2 + self.num_proc = num_proc + self.save_sdf = save_sdf + self.part_mass = get_body_mass(self.asset_folder, self.assembly_dir, self.parts, save_sdf=self.save_sdf) + self.t_start = None + self.n_eval = None + self.stop_msg = None + + def seed(self, seed): + random.seed(seed) + np.random.seed(seed) + torch.manual_seed(seed) + + def _simulate(self, part_move, parts_rest, parts_removed, pose, max_grippers, timeout=None, grasp_planner=None, optimizer='L-BFGS-B', debug=0, render=False): + assert len(parts_rest) > 0 + action, path = check_assemblable(self.asset_folder, self.assembly_dir, parts_rest, part_move, pose=pose, save_sdf=self.save_sdf, + return_path=True, debug=debug, render=render) + + if action is not None: + max_fix = max_grippers - 1 if max_grippers is not None else None + parts_fix_list = get_stable_plan_1pose_serial(self.asset_folder, self.assembly_dir, parts_rest, self.base_part, pose=pose, max_fix=max_fix, save_sdf=self.save_sdf, timeout=timeout, debug=debug, render=render) + if parts_fix_list is not None: parts_fix_list = [parts_fix_list] + else: + parts_fix_list = None + + if parts_fix_list is None: + parts_fix = None + elif len(parts_fix_list) == 0: + parts_fix = [] + else: + parts_fix = parts_fix_list[0] # NOTE: only pick the first feasible fix list, can be changed + + feasible = action is not None and parts_fix is not None + + if feasible and grasp_planner is not None: + grasps = grasp_planner.plan(part_move, parts_rest, parts_removed, pose, path, optimizer) + if len(grasps) == 0: + grasps = None + feasible = False + else: + grasps = None + + sim_info = { + 'feasible': feasible, + 'action': action, + 'base_part': self.base_part, + 'parts_fix': parts_fix, + 'part_move': part_move, + 'pose': pose, + 'grasp': grasps, + } + return sim_info + + def _update_tree(self, tree, parts_parent, parts_child, n_eval, sim_info): + if sim_info['feasible']: + assert tree.nodes[tuple(parts_parent)]['n_gripper'] is not None, f'[error] parent {parts_parent} not feasible' + if tree.has_node(tuple(parts_child)): + assert tree.nodes[tuple(parts_child)]['n_eval'] < n_eval, f'[error] child {parts_child} incorrectly updated' + if sim_info['feasible']: + child_n_gripper, parent_n_gripper = tree.nodes[tuple(parts_child)]['n_gripper'], tree.nodes[tuple(parts_parent)]['n_gripper'] + child_n_gripper_new = max(parent_n_gripper, len(sim_info['parts_fix']) + 1) + if child_n_gripper is None: + tree.nodes[tuple(parts_child)]['n_gripper'] = child_n_gripper_new + else: + tree.nodes[tuple(parts_child)]['n_gripper'] = min(child_n_gripper, child_n_gripper_new) + for pose in tree.nodes[tuple(parts_child)]['poses']: # check if pose is already in node attr + if sim_info['pose'] is None: + if pose is None: + break # both None -> in node attr + else: + if pose is not None and np.allclose(pose, sim_info['pose']): + break # both not None and allclose -> in node attr + else: + tree.nodes[tuple(parts_child)]['poses'].insert(0, sim_info['pose']) # not in node attr, prioritize later poses + else: + if sim_info['feasible']: + tree.add_node(tuple(parts_child), n_eval=n_eval, n_gripper=\ + max(tree.nodes[tuple(parts_parent)]['n_gripper'], len(sim_info['parts_fix']) + 1), poses=[sim_info['pose']]) + else: + tree.add_node(tuple(parts_child), n_eval=n_eval, n_gripper=None, poses=[]) + tree.add_edge(tuple(parts_parent), tuple(parts_child), n_eval=n_eval, sim_info=sim_info) + + def _check_fully_explored(self, tree, root_node): # code can be optimized + # if all childs are recursively explored and failed, then fully explored + assert tree.has_node(tuple(root_node)) + assert len(root_node) >= 2 + if len(root_node) == 2: return True # NOTE: assume max_gripper >= 2 + + for part_move in root_node: + if self.base_part is not None and part_move == self.base_part: continue + child_node = root_node.copy() + child_node.remove(part_move) + if tree.has_edge(tuple(root_node), tuple(child_node)): + if tree.edges[tuple(root_node), tuple(child_node)]['sim_info']['feasible']: + if not self._check_fully_explored(tree, child_node): return False # child not fully explored + else: + return False # no such child + return True + + def plan(self, budget, max_grippers, max_poses=3, pose_reuse=0, early_term=False, timeout=None, plan_grasp=False, plan_arm=False, gripper_type=None, gripper_scale=None, optimizer='L-BFGS-B', debug=0, render=False, log_dir=None): + ''' + Main planning function + Input: + budget: max # simulations allowed + max_grippers: max # grippers allowed to use + Output: + tree: disassembly tree including all disassembly attempts + ''' + self.t_start = time() + solution_found = False + self.stop_msg = None + assert budget is not None or timeout is not None + + self._reset() + + self.n_eval = 0 + G0 = self.parts.copy() + tree = nx.DiGraph() + tree.add_node(tuple(G0), n_eval=0, n_gripper=1, poses=[]) + + if plan_arm: + grasp_planner = GraspArmPlanner(self.asset_folder, self.assembly_dir, gripper_type, gripper_scale) + elif plan_grasp: + grasp_planner = GraspPlanner(self.asset_folder, self.assembly_dir, gripper_type, gripper_scale) + else: + grasp_planner = None + + try: + + while True: + + if early_term and solution_found: + self.stop_msg = 'solution found' + break + + if budget is not None and self.n_eval >= budget: + self.stop_msg = 'budget reached' + break + + if self._check_fully_explored(tree, G0): + self.stop_msg = 'tree fully explored' + break + + if timeout is not None and (time() - self.t_start) > timeout: + self.stop_msg = 'timeout' + break + + G = self._select_node(tree) + parts_removed = [part for part in G0 if part not in G] + + if self.base_part is not None: + poses = [None] + else: + poses = tree.nodes[tuple(G)]['poses'][:pose_reuse] + G_mesh = get_combined_mesh(self.assembly_dir, G) + poses.extend(get_stable_poses(G_mesh, max_num=max_poses - pose_reuse)) + if len(poses) == 0: + poses = [None] + + for p in self.seq_generator.generate_candidate_part(G): # NOTE: maybe can specify which parts to exclude + G_prime = G.copy() + G_prime.remove(p) + + if tree.has_edge(tuple(G), tuple(G_prime)): continue + + for pose in poses: + + sim_timeout = None if timeout is None else timeout - (time() - self.t_start) # allocate for this step of simulation + if sim_timeout is not None and sim_timeout < 0: + break + + sim_info = self._simulate(p, G_prime, parts_removed, pose, max_grippers=max_grippers, timeout=sim_timeout, + grasp_planner=grasp_planner, optimizer=optimizer, debug=debug - 1, render=render) + self.n_eval += 1 + self._update_tree(tree, G, G_prime, self.n_eval, sim_info) + + if sim_info['feasible']: + if len(G_prime) == 2: + solution_found = True + break + + if debug > 0: + print(f'[planner.base.plan] add edge: ({G}, {G_prime}), feasible: {sim_info["feasible"]}') + print(f'[planner.base.plan] progress: {self.n_eval}/{budget} evaluations') + + # self.plot_tree(tree) + break + + if log_dir is not None: + stats = self.get_stats(tree) + self.log(tree, stats, log_dir) + + self._expand_leaf(tree, max_poses, pose_reuse, grasp_planner, optimizer, debug, render) + # self.plot_tree(tree) + + except (Exception, KeyboardInterrupt) as e: + if type(e) == KeyboardInterrupt: + self.stop_msg = 'interrupt' + else: + self.stop_msg = 'exception' + print(e, f'from {self.assembly_dir}') + print(traceback.format_exc()) + + assert self.stop_msg is not None, '[planner.base.plan] bug: unexpectedly stopped' + if debug > 0: + print(f'[planner.base.plan] stopped: {self.stop_msg}') + + return tree + + def _reset(self): + pass + + def _select_node(self, tree): + raise NotImplementedError + + def _expand_leaf(self, tree, max_poses, pose_reuse, grasp_planner, optimizer, debug, render): + for node in tree.nodes: + assert len(node) >= 2 + + node_expand_list = [] + for node in tree.nodes: + node_info = tree.nodes[node] + if len(node) == 2 and node_info['n_gripper'] is not None: + node_expand_list.append(node) + + G0 = self.parts.copy() + + for node in node_expand_list: + part_a, part_b = node + mass_a, mass_b = self.part_mass[part_a], self.part_mass[part_b] + part_fix, part_move = (part_a, part_b) if mass_a > mass_b else (part_b, part_a) + if part_move == self.base_part: part_fix, part_move = part_move, part_fix + parts_removed = [part for part in G0 if part != part_a and part != part_b] + poses = tree.nodes[tuple(node)]['poses'][:pose_reuse] + poses.extend(get_stable_poses(get_combined_mesh(self.assembly_dir, node), max_num=max_poses - pose_reuse)) + if len(poses) == 0 or self.base_part is not None: poses = [None] + for pose in poses: + sim_info = self._simulate(part_move, [part_fix], parts_removed, pose=pose, max_grippers=2, grasp_planner=grasp_planner, optimizer=optimizer, debug=debug - 1, render=render) + if sim_info['feasible']: + node_info = tree.nodes[node] + SequencePlanner._update_tree(self, tree, list(node), [part_fix], node_info['n_eval'], sim_info) + break + + @staticmethod + def plot_tree(tree, save_path=None): + from networkx.drawing.nx_agraph import graphviz_layout + node_colors = ['g' if tree.nodes[node]['n_gripper'] is not None else 'r' for node in tree.nodes] + edge_colors = ['g' if tree.edges[edge]['sim_info']['feasible'] else 'r' for edge in tree.edges] + edge_labels = {edge: ','.join([str(x) for x in set(edge[0]) - set(edge[1])]) for edge in tree.edges} + pos = graphviz_layout(tree, prog='dot') + nx.draw(tree, pos, node_color=node_colors, edge_color=edge_colors, with_labels=True) + nx.draw_networkx_edge_labels(tree, pos, edge_labels=edge_labels) + if save_path is None: + plt.show() + else: + plt.savefig(save_path) + + @staticmethod + def plot_tree_with_budget(tree, budget, save_path=None): + if budget is None: return SequencePlanner.plot_tree(tree, save_path=save_path) + + from networkx.drawing.nx_agraph import graphviz_layout + budget_tree = nx.DiGraph() + # for node in tree.nodes: + # node_info = tree.nodes[node] + # if node_info['n_eval'] <= budget: + # budget_tree.add_node(node) + for edge in tree.edges: + edge_info = tree.edges[edge] + if edge_info['n_eval'] <= budget: + budget_tree.add_edge(*edge, feasible=edge_info['sim_info']['feasible']) + + # node_colors = ['g' if budget_tree.nodes[node]['feasible'] else 'r' for node in budget_tree.nodes] + edge_colors = ['g' if budget_tree.edges[edge]['feasible'] else 'r' for edge in budget_tree.edges] + edge_labels = {edge: ','.join([str(x) for x in set(edge[0]) - set(edge[1])]) for edge in budget_tree.edges} + pos = graphviz_layout(budget_tree, prog='dot') + nx.draw(budget_tree, pos, edge_color=edge_colors, with_labels=True) + nx.draw_networkx_edge_labels(budget_tree, pos, edge_labels=edge_labels) + if save_path is None: + plt.show() + else: + plt.savefig(save_path) + + @staticmethod + def find_sequence(tree): + + # find leaf node + leaf_node = None + for node in tree.nodes: + node_info = tree.nodes[node] + if len(node) == 1 and node_info['n_gripper'] is not None: + leaf_node = node + break + else: + return None + + # find sequence in tree from bottom to top + sequence = [] + node = leaf_node + while tree.in_degree(node) > 0: + node_info = tree.nodes[node] + for parent_node in tree.predecessors(node): + parent_node_info = tree.nodes[parent_node] + if parent_node_info['n_gripper'] <= node_info['n_gripper']: + part_move = tree.edges[parent_node, node]['sim_info']['part_move'] + sequence.insert(0, part_move) + node = parent_node + break + return sequence + + @staticmethod + def check_success(tree): + + success = False + n_eval = None # min n_eval + n_gripper = None # min n_gripper + + for node in tree.nodes: + node_info = tree.nodes[node] + if len(node) == 1 and node_info['n_gripper'] is not None: + success = True + + if n_eval is None: + n_eval = node_info['n_eval'] + else: + n_eval = min(n_eval, node_info['n_eval']) + + if n_gripper is None: + n_gripper = node_info['n_gripper'] + else: + n_gripper = min(n_gripper, node_info['n_gripper']) + + return success, n_eval, n_gripper + + @staticmethod + def get_stats(tree): + success, n_eval, n_gripper = SequencePlanner.check_success(tree) + if success: + sequence = SequencePlanner.find_sequence(tree) + else: + sequence = None + return { + 'success': success, + 'n_eval': n_eval, + 'n_gripper': n_gripper, + 'sequence': [x for x in sequence] if sequence is not None else None, + } + + def log(self, tree, stats, log_dir, plot=False): + ''' + Log planned disassembly sequence and gripper statistics + ''' + t_plan = time() - self.t_start # NOTE: a bit hacky + stats['time'] = round(t_plan, 2) + stats['total_n_eval'] = self.n_eval + stats['stop_msg'] = self.stop_msg + + os.makedirs(log_dir, exist_ok=True) + with open(os.path.join(log_dir, 'tree.pkl'), 'wb') as fp: + pickle.dump(tree, fp) + with open(os.path.join(log_dir, 'stats.json'), 'w') as fp: + json.dump(stats, fp, cls=NumpyEncoder) + if plot: + self.plot_tree(tree, save_path=os.path.join(log_dir, 'tree.png')) + + def render(self, sequence, tree, record_dir=None): + ''' + Render planned disassembly sequence + ''' + parts_assembled = self.parts.copy() + parts_removed = [] + + if record_dir is not None: + os.makedirs(record_dir, exist_ok=True) + + for i, part_move in enumerate(sequence): + parts_rest = parts_assembled.copy() + parts_rest.remove(part_move) + + sim_info = tree.edges[tuple(parts_assembled), tuple(parts_rest)]['sim_info'] + assert part_move == sim_info['part_move'] + parts_fix = sim_info['parts_fix'] + parts_free = [part_i for part_i in parts_rest if part_i not in parts_fix] + [part_move] + action = np.array(sim_info['action']) + pose = np.array(sim_info['pose']) if sim_info['pose'] is not None else None + + if record_dir is not None: + record_path = os.path.join(record_dir, f'{i}_{part_move}.gif') + else: + record_path = None + + path_planner = MultiPartPathPlanner(self.asset_folder, self.assembly_dir, parts_rest, part_move, parts_removed=parts_removed, pose=pose, save_sdf=self.save_sdf) + # path_planner.check_success(action) + success, path = path_planner.plan_path(action, rotation=True) + + body_color_dict = get_body_color_dict(parts_fix, parts_free) # visualize fixes + path_planner.sim.set_body_color_map(body_color_dict) + path_planner.render(path=path, record_path=record_path) + + parts_assembled = parts_rest + parts_removed.append(part_move) diff --git a/plan_sequence/planner/beam.py b/plan_sequence/planner/beam.py new file mode 100644 index 0000000..5afcdec --- /dev/null +++ b/plan_sequence/planner/beam.py @@ -0,0 +1,71 @@ +import numpy as np + +from .base import SequencePlanner + + +class BeamSearchSequencePlanner(SequencePlanner): + + beams = None + beam_width = None + n_candidates = None + curr_beam_idx = None + + beam_width_init = 1 + n_candidate_init = 1 + + def _reset(self): + self.beams = [[] for _ in range(len(self.parts) - 1)] + self.beam_width = self.beam_width_init + self.n_candidates = [self.n_candidate_init for _ in range(len(self.parts) - 1)] + self.curr_beam_idx = 0 + + G0 = self.parts.copy() + self.beams[0].append(G0) + + def _select_node(self, tree): + + # explore the current beam + if len(self.beams[self.curr_beam_idx + 1]) < self.beam_width: + + for G in self.beams[self.curr_beam_idx]: + n_child = tree.out_degree(tuple(G)) + if n_child < min(self.n_candidates[self.curr_beam_idx], len(G)): + return G + + # too few candidates, increase n_candidate + curr_n_parts = len(self.parts) - self.curr_beam_idx + if self.n_candidates[self.curr_beam_idx] < curr_n_parts: + self.n_candidates[self.curr_beam_idx] += 1 + return self._select_node(tree) + else: # NOTE: failed in all children + self.beam_width += 1 + self.curr_beam_idx = 0 + return self._select_node(tree) + + # move to the next beam + self.curr_beam_idx += 1 + + def _score_function(parts): # for selecting top-k candidates for moving beam + n_gripper = tree.nodes[tuple(parts)]['n_gripper'] + if n_gripper is None: + return len(self.parts) + 1 + else: + return n_gripper + + # print(f'[DEBUG] next_beam {self.beams[self.curr_beam_idx]}, beam_width: {self.beam_width}, n_candidate: {self.n_candidates[self.curr_beam_idx - 1]}') + + self.beams[self.curr_beam_idx] = sorted(np.random.permutation(self.beams[self.curr_beam_idx]).tolist(), key=_score_function)[:min(self.beam_width, len(self.beams[self.curr_beam_idx]))] + + if self.curr_beam_idx == len(self.parts) - 2: # fully explored to the last beam, enlarge beam and reset + self.beam_width += 1 + self.curr_beam_idx = 0 + + return self._select_node(tree) + + def _update_tree(self, tree, parts_parent, parts_child, n_eval, sim_info): + super()._update_tree(tree, parts_parent, parts_child, n_eval, sim_info) + + if sim_info['feasible'] and \ + (not self._check_fully_explored(tree, parts_child) or len(parts_child) == 2) and \ + parts_child not in self.beams[self.curr_beam_idx + 1]: # add feasible child to the next beam + self.beams[self.curr_beam_idx + 1].append(parts_child) diff --git a/plan_sequence/planner/dfs.py b/plan_sequence/planner/dfs.py new file mode 100644 index 0000000..3ac0a46 --- /dev/null +++ b/plan_sequence/planner/dfs.py @@ -0,0 +1,27 @@ +import numpy as np + +from .base import SequencePlanner + + +class DFSSequencePlanner(SequencePlanner): + + G_path = None + + def _reset(self): + G0 = self.parts.copy() + self.G_path = [G0] + + def _select_node(self, tree): + G = self.G_path[-1] + if tree.out_degree(tuple(G)) < len(G): # current node has unexplored child + return G + else: + self.G_path.pop() + return self._select_node(tree) + + def _update_tree(self, tree, parts_parent, parts_child, n_eval, sim_info): + super()._update_tree(tree, parts_parent, parts_child, n_eval, sim_info) + if sim_info['feasible'] and len(parts_child) > 2: + self.G_path.append(parts_child) # expand tree vertically + else: + self.G_path[-1] = parts_parent # expand tree horizontally diff --git a/plan_sequence/planner/random.py b/plan_sequence/planner/random.py new file mode 100644 index 0000000..c072d17 --- /dev/null +++ b/plan_sequence/planner/random.py @@ -0,0 +1,257 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', '..')) +sys.path.append(project_base_dir) + +import numpy as np +import random +import networkx as nx +from time import time +import traceback + +from plan_sequence.planner.base import SequencePlanner +from plan_sequence.stable_pose import get_combined_mesh, get_stable_poses + + +class RandomSequencePlanner(SequencePlanner): + + def _update_tree_recursive(self, tree, parts_parent): # update n_gripper accordingly + for parts_child in tree.successors(tuple(parts_parent)): + edge_info = tree.edges[tuple(parts_parent), tuple(parts_child)]['sim_info'] + if edge_info['feasible']: + child_n_gripper, parent_n_gripper = tree.nodes[tuple(parts_child)]['n_gripper'], tree.nodes[tuple(parts_parent)]['n_gripper'] + child_n_gripper_new = max(parent_n_gripper, len(edge_info['parts_fix']) + 1) + if child_n_gripper is None or child_n_gripper_new < child_n_gripper: + tree.nodes[tuple(parts_child)]['n_gripper'] = child_n_gripper_new + self._update_tree_recursive(tree, parts_child) # recursively update children + + def _update_tree(self, tree, parts_parent, parts_child, n_eval, sim_info): + if tree.has_node(tuple(parts_child)): + assert tree.nodes[tuple(parts_child)]['n_eval'] < n_eval, f'[error] child {parts_child} incorrectly updated' + if sim_info['feasible']: + child_n_gripper, parent_n_gripper = tree.nodes[tuple(parts_child)]['n_gripper'], tree.nodes[tuple(parts_parent)]['n_gripper'] + if parent_n_gripper is not None: + child_n_gripper_new = max(parent_n_gripper, len(sim_info['parts_fix']) + 1) + if child_n_gripper is None or child_n_gripper_new < child_n_gripper: # found better plan + tree.nodes[tuple(parts_child)]['n_gripper'] = child_n_gripper_new + self._update_tree_recursive(tree, parts_child) # recursively update children + for pose in tree.nodes[tuple(parts_child)]['poses']: # check if pose is already in node attr + if sim_info['pose'] is None: + if pose is None: + break # both None -> in node attr + else: + if pose is not None and np.allclose(pose, sim_info['pose']): + break # both not None and allclose -> in node attr + else: + tree.nodes[tuple(parts_child)]['poses'].insert(0, sim_info['pose']) # not in node attr, prioritize later poses + else: + parent_n_gripper = tree.nodes[tuple(parts_parent)]['n_gripper'] + child_n_gripper = max(parent_n_gripper, len(sim_info['parts_fix']) + 1) if parent_n_gripper is not None and sim_info['feasible'] else None + tree.add_node(tuple(parts_child), n_eval=n_eval, n_gripper=child_n_gripper, poses=[sim_info['pose']] if sim_info['feasible'] else []) + tree.add_edge(tuple(parts_parent), tuple(parts_child), n_eval=n_eval, sim_info=sim_info) + + def eval_seq_fitness(self, tree, sequence, budget, max_grippers, max_poses, pose_reuse, early_term, timeout, debug=0, render=False): + + solution_found = False + fitness = 0 + + G0 = self.parts.copy() + G = self.parts.copy() + + for p in sequence: + G_prime = G.copy() + G_prime.remove(p) + if len(G_prime) <= 1: break + + parts_removed = [part for part in G0 if part not in G] + + if early_term and solution_found: + self.stop_msg = 'solution found' + break + + if budget is not None and self.n_eval >= budget: + self.stop_msg = 'budget reached' + break + + if self._check_fully_explored(tree, G0): + self.stop_msg = 'tree fully explored' + break + + if timeout is not None and (time() - self.t_start) > timeout: + self.stop_msg = 'timeout' + break + + poses = tree.nodes[tuple(G)]['poses'][:pose_reuse] + G_mesh = get_combined_mesh(self.assembly_dir, G) + poses.extend(get_stable_poses(G_mesh, max_num=max_poses - pose_reuse)) + if len(poses) == 0: + poses = [None] + # poses = [None] + + if not tree.has_edge(tuple(G), tuple(G_prime)): + for pose in poses: + + sim_timeout = None if timeout is None else timeout - (time() - self.t_start) # allocate for this step of simulation + if sim_timeout is not None and sim_timeout < 0: + break + + sim_info = self._simulate(p, G_prime, parts_removed, pose, max_grippers=max_grippers, timeout=sim_timeout, debug=debug - 1, render=render) + self.n_eval += 1 + self._update_tree(tree, G, G_prime, self.n_eval, sim_info) + + if self.find_sequence(tree, leaf_size=2) is not None: + solution_found = True + + if sim_info['feasible']: # NOTE: edge color issue (feasble child link but infeasible parent link -> red) + fitness += 1 + break + + if debug > 0: + print(f'[planner.random.plan] add edge: ({G}, {G_prime}), feasible: {sim_info["feasible"]}') + print(f'[planner.random.plan] progress: {self.n_eval}/{budget} evaluations') + else: + if tree.edges[tuple(G), tuple(G_prime)]['sim_info']['feasible']: + fitness += 1 + + G = G_prime.copy() + + # self.plot_tree(tree) + + return fitness + + def plan(self, budget, max_grippers, max_poses=3, pose_reuse=0, early_term=False, timeout=None, debug=0, render=False): + ''' + Main planning function + Input: + budget: max # simulations allowed + max_grippers: max # grippers allowed to use + Output: + tree: disassembly tree including all disassembly attempts + ''' + self.t_start = time() + self.stop_msg = None + assert budget is not None or timeout is not None + + self._reset() + + self.n_eval = 0 + G0 = self.parts.copy() + tree = nx.DiGraph() + tree.add_node(tuple(G0), n_eval=0, n_gripper=1, poses=[]) + + sequences = [] + + try: + + while self.stop_msg is None: + + if self._check_fully_explored(tree, G0): + self.stop_msg = 'tree fully explored' + break + + sequence = None + max_attempt = 1e4 + attempt_count = 0 + while sequence is None: # generate a new random sequence + rand_seq = np.random.permutation(self.parts) + for exist_seq in sequences: + if (rand_seq == exist_seq).all(): + break + else: + sequence = rand_seq + attempt_count += 1 + if attempt_count > max_attempt: + self.stop_msg = 'tree fully explored' + break + + if self.stop_msg is not None: + break + + self.eval_seq_fitness(tree, sequence, budget, max_grippers, max_poses, pose_reuse, early_term, timeout, debug, render) + + self._expand_leaf(tree, max_poses, pose_reuse, debug, render) + # self.plot_tree(tree) + + except (Exception, KeyboardInterrupt) as e: + if type(e) == KeyboardInterrupt: + self.stop_msg = 'interrupt' + else: + self.stop_msg = 'exception' + print(e, f'from {self.assembly_dir}') + print(traceback.format_exc()) + + assert self.stop_msg is not None, '[planner.base.plan] bug: unexpectedly stopped' + if debug > 0: + print(f'[planner.base.plan] stopped: {self.stop_msg}') + + return tree + + def _expand_leaf(self, tree, max_poses, pose_reuse, debug, render): + for node in tree.nodes: + assert len(node) >= 2 + + node_expand_list = [] + for node in tree.nodes: + node_info = tree.nodes[node] + if len(node) == 2 and node_info['n_gripper'] is not None: + node_expand_list.append(node) + + G0 = self.parts.copy() + + for node in node_expand_list: + part_a, part_b = node + mass_a, mass_b = self.part_mass[part_a], self.part_mass[part_b] + part_fix, part_move = (part_a, part_b) if mass_a > mass_b else (part_b, part_a) + if part_move == self.base_part: part_fix, part_move = part_move, part_fix + parts_removed = [part for part in G0 if part != part_a and part != part_b] + poses = tree.nodes[tuple(node)]['poses'][:pose_reuse] + poses.extend(get_stable_poses(get_combined_mesh(self.assembly_dir, node), max_num=max_poses - pose_reuse)) + if len(poses) == 0 or self.base_part is not None: poses = [None] + for pose in poses: + sim_info = self._simulate(part_move, [part_fix], parts_removed, pose=pose, max_grippers=2, debug=debug - 1, render=render) + if sim_info['feasible']: + node_info = tree.nodes[node] + self._update_tree(tree, list(node), [part_fix], node_info['n_eval'], sim_info) + break + + @staticmethod + def find_sequence(tree, leaf_size=1): + + # find leaf node + leaf_node = None + for node in tree.nodes: + node_info = tree.nodes[node] + if len(node) == leaf_size and node_info['n_gripper'] is not None: + leaf_node = node + break + else: + return None + + # find sequence in tree from bottom to top + sequence = [] + node = leaf_node + while tree.in_degree(node) > 0: + node_info = tree.nodes[node] + for parent_node in tree.predecessors(node): + parent_node_info = tree.nodes[parent_node] + if parent_node_info['n_gripper'] is not None and parent_node_info['n_gripper'] <= node_info['n_gripper']: + part_move = tree.edges[parent_node, node]['sim_info']['part_move'] + sequence.insert(0, part_move) + node = parent_node + break + return sequence + + @staticmethod + def get_stats(tree): + success, n_eval, n_gripper = RandomSequencePlanner.check_success(tree) + if success: + sequence = RandomSequencePlanner.find_sequence(tree) + else: + sequence = None + return { + 'success': success, + 'n_eval': n_eval, + 'n_gripper': n_gripper, + 'sequence': sequence, + } diff --git a/plan_sequence/play_logged_plan.py b/plan_sequence/play_logged_plan.py new file mode 100644 index 0000000..1d9ed66 --- /dev/null +++ b/plan_sequence/play_logged_plan.py @@ -0,0 +1,252 @@ +import os +os.environ['OMP_NUM_THREADS'] = '1' +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np +import random +import json +import pickle +from tqdm import tqdm +import traceback +import shutil +from scipy.spatial.transform import Rotation as R +from scipy.spatial.transform import Slerp + +from plan_sequence.sim_string import get_body_color_dict +from plan_sequence.physics_planner import MultiPartPathPlanner, MultiPartStabilityPlanner +from plan_sequence.planner.base import SequencePlanner +from plan_robot.render_grasp import render_path_with_grasp +from plan_robot.render_grasp_arm import render_path_with_grasp_and_arm +from plan_robot.geometry import load_part_meshes, load_gripper_meshes, load_arm_meshes, save_meshes +from assets.save import clear_saved_sdfs, save_path_all_objects +from assets.load import load_part_ids + + +def interpolate_path(states): + interpolated_path = [] + + for i in range(len(states) - 1): + current_state = states[i] + next_state = states[i + 1] + interpolated_path.append(current_state) + + if len(current_state) == 3: + average_state = (current_state + next_state) / 2 + interpolated_path.append(average_state) + elif len(current_state) == 6: + current_pos, current_euler = current_state[:3], current_state[3:] + next_pos, next_euler = next_state[:3], next_state[3:] + average_pos = (current_pos + next_pos) / 2 + rotations = R.from_euler('xyz', [current_euler, next_euler]) + slerp = Slerp([0, 1], rotations) + average_euler = slerp([0.5]).as_euler('xyz')[0] + average_state = np.concatenate([average_pos, average_euler]) + interpolated_path.append(average_state) + else: + raise NotImplementedError + + interpolated_path.append(states[-1]) + + return interpolated_path + + +def play_logged_plan(asset_folder, assembly_dir, sequence, tree, result_dir, save_mesh, save_pose, save_part, save_path, save_record, save_all, + reverse=False, show_fix=False, show_grasp=False, show_arm=False, gripper_type=None, gripper_scale=None, optimizer='L-BFGS-B', save_sdf=False, clear_sdf=False, make_video=False, budget=None, camera_pos=None, camera_lookat=None): + + parts_assembled = sorted(load_part_ids(assembly_dir)) + + if result_dir is not None: + os.makedirs(result_dir, exist_ok=True) + + if save_mesh or save_all: # save object centric mesh + mesh_dir = os.path.join(result_dir, 'mesh') + os.makedirs(mesh_dir, exist_ok=True) + all_meshes = load_part_meshes(assembly_dir, transform='none') + # shutil.copyfile(os.path.join(assembly_dir, 'config.json'), os.path.join(mesh_dir, 'config.json')) + if show_grasp: + gripper_meshes = load_gripper_meshes(gripper_type, asset_folder, visual=True) + all_meshes.update(gripper_meshes) + if show_arm: + arm_meshes = load_arm_meshes(asset_folder, visual=True, convex=False) + all_meshes.update(arm_meshes) + save_meshes(all_meshes, mesh_dir) + else: + mesh_dir = None + + if save_pose or save_all: + pose_dir = os.path.join(result_dir, 'pose') + os.makedirs(pose_dir, exist_ok=True) + else: + pose_dir = None + + if save_part or save_all: + part_dir = os.path.join(result_dir, 'part_fix') + os.makedirs(part_dir, exist_ok=True) + else: + part_dir = None + + if save_path or save_all: + path_dir = os.path.join(result_dir, 'path') + os.makedirs(path_dir, exist_ok=True) + else: + path_dir = None + + if save_record or save_all: + record_dir = os.path.join(result_dir, 'record') + os.makedirs(record_dir, exist_ok=True) + record_dir_grasp = None + if show_grasp: + record_dir_grasp = os.path.join(result_dir, 'record_grasp') + os.makedirs(record_dir_grasp, exist_ok=True) + else: + record_dir = None + record_dir_grasp = None + + try: + parts_removed = [] + + for i, part_move in enumerate(tqdm(sequence)): + parts_rest = parts_assembled.copy() + parts_rest.remove(part_move) + + sim_info = tree.edges[tuple(parts_assembled), tuple(parts_rest)]['sim_info'] + assert part_move == sim_info['part_move'] + action = np.array(sim_info['action']) + pose = np.array(sim_info['pose']) if sim_info['pose'] is not None else None + if show_grasp: + grasps = sim_info['grasp'] + else: + grasps = None + + parts_fix = sim_info['parts_fix'] + parts_free = [part_i for part_i in parts_rest if part_i not in parts_fix] + [part_move] + + if show_fix: + body_color_dict = get_body_color_dict(parts_fix, parts_free) # visualize fixes + else: + body_color_dict = get_body_color_dict([], parts_assembled) + + if record_dir is not None: + record_path = os.path.join(record_dir, f'{i}_{part_move}.mp4' if make_video else f'{i}_{part_move}.gif') + else: + record_path = None + + # print(f'[play_logged_plan] {i}-th step, part_move: {part_move}') + + if save_path or save_record or save_all: + path_planner = MultiPartPathPlanner(asset_folder, assembly_dir, parts_rest, part_move, parts_removed=parts_removed, pose=pose, save_sdf=save_sdf, + camera_pos=camera_pos, camera_lookat=camera_lookat) + # success, path = path_planner.check_success(action, return_path=True) + success, path = path_planner.plan_path(action, rotation=True) + assert success, f'[play_logged_plan] path planner: part_move {part_move} with action {action} is not successful' + + min_path_len = 300 + while len(path) < min_path_len: + path = interpolate_path(path) + + if (show_grasp or show_arm) and grasps is not None: + n_render = min(3, len(grasps)) + random_indices = np.random.choice(len(grasps), n_render, replace=False) + for idx in random_indices: + grasp = grasps[idx] + if record_dir_grasp is not None: + record_path_grasp = os.path.join(record_dir_grasp, f'{i}_{part_move}_g{idx}.mp4' if make_video else f'{i}_{part_move}_g{idx}.gif') + else: + record_path_grasp = None + if show_arm: + body_matrices = render_path_with_grasp_and_arm(asset_folder, assembly_dir, part_move, parts_rest, parts_removed, pose, path, gripper_type, gripper_scale, grasp, optimizer, camera_lookat, camera_pos, + body_color_dict, reverse, save_record or save_all, record_path_grasp, make_video) + else: + body_matrices = render_path_with_grasp(asset_folder, assembly_dir, part_move, parts_rest, parts_removed, pose, path, gripper_type, gripper_scale, grasp, camera_lookat, camera_pos, + body_color_dict, reverse, save_record or save_all, record_path_grasp, make_video) + + if path_dir is not None: + path_i_dir = os.path.join(path_dir, f'{i}_{part_move}_g{idx}') + save_path_all_objects(path_i_dir, body_matrices, n_frame=300) + + path_planner.sim.set_body_color_map(body_color_dict) + if record_path is not None: + body_matrices = path_planner.render(path=path, reverse=reverse, record_path=record_path, make_video=make_video) + + if path_dir is not None: + path_i_dir = os.path.join(path_dir, f'{i}_{part_move}') + save_path_all_objects(path_i_dir, body_matrices, n_frame=300) + + if pose_dir is not None: + pose_path = os.path.join(pose_dir, f'{i}_{part_move}.npy') + np.save(pose_path, pose, allow_pickle=True) + + if part_dir is not None: + part_path = os.path.join(part_dir, f'{i}_{part_move}.json') + with open(part_path, 'w') as fp: + json.dump(parts_fix, fp) + + parts_assembled = parts_rest + parts_removed.append(part_move) + + except (Exception, KeyboardInterrupt) as e: + if type(e) == KeyboardInterrupt: + print('[play_logged_plan] interrupt') + else: + print('[play_logged_plan] exception:', e, f'from {assembly_dir}') + print(traceback.format_exc()) + + if clear_sdf: + clear_saved_sdfs(assembly_dir) + raise e + + if clear_sdf: + clear_saved_sdfs(assembly_dir) + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--log-dir', type=str, required=True) + parser.add_argument('--assembly-dir', type=str, required=True) + parser.add_argument('--result-dir', type=str, required=True) + parser.add_argument('--save-mesh', default=False, action='store_true') + parser.add_argument('--save-pose', default=False, action='store_true') + parser.add_argument('--save-part', default=False, action='store_true') + parser.add_argument('--save-path', default=False, action='store_true') + parser.add_argument('--save-record', default=False, action='store_true') + parser.add_argument('--save-all', default=False, action='store_true') + parser.add_argument('--reverse', default=False, action='store_true') + parser.add_argument('--show-fix', default=False, action='store_true') + parser.add_argument('--show-grasp', default=False, action='store_true') + parser.add_argument('--show-arm', default=False, action='store_true') + parser.add_argument('--gripper', type=str, default='robotiq-140', choices=['panda', 'robotiq-85', 'robotiq-140']) + parser.add_argument('--scale', type=float, default=0.4) + parser.add_argument('--optimizer', type=str, default='L-BFGS-B') + parser.add_argument('--disable-save-sdf', default=False, action='store_true') + parser.add_argument('--clear-sdf', default=False, action='store_true') + parser.add_argument('--plot-tree', default=False, action='store_true') + parser.add_argument('--make-video', default=False, action='store_true') + parser.add_argument('--budget', type=int, default=None) + parser.add_argument('--seed', type=int, default=0) + parser.add_argument('--camera-lookat', type=float, nargs=3, default=[-1, 1, 0], help='camera lookat') + parser.add_argument('--camera-pos', type=float, nargs=3, default=[1.25, -1.5, 1.5], help='camera position') + args = parser.parse_args() + + random.seed(args.seed) + np.random.seed(args.seed) + + with open(os.path.join(args.log_dir, 'tree.pkl'), 'rb') as fp: + tree = pickle.load(fp) + with open(os.path.join(args.log_dir, 'stats.json'), 'r') as fp: + stats = json.load(fp) + sequence = stats['sequence'] + + if args.plot_tree: + SequencePlanner.plot_tree_with_budget(tree, budget=args.budget) + + if sequence is None: + print('[play_logged_plan] failed plan') + else: + asset_folder = os.path.join(project_base_dir, './assets') + play_logged_plan(asset_folder, args.assembly_dir, sequence, tree, args.result_dir, args.save_mesh, args.save_pose, args.save_part, args.save_path, args.save_record, args.save_all, + args.reverse, args.show_fix, args.show_grasp, args.show_arm, args.gripper, args.scale, args.optimizer, not args.disable_save_sdf, args.clear_sdf, args.make_video, args.budget, args.camera_pos, args.camera_lookat) diff --git a/plan_sequence/play_logged_plan_batch.py b/plan_sequence/play_logged_plan_batch.py new file mode 100644 index 0000000..bb6bc85 --- /dev/null +++ b/plan_sequence/play_logged_plan_batch.py @@ -0,0 +1,87 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import pickle +import json + +from plan_sequence.play_logged_plan import play_logged_plan +from utils.parallel import parallel_execute + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--log-dir', type=str, required=True) + parser.add_argument('--assembly-dir', type=str, required=True) + parser.add_argument('--id-path', type=str, default=None) + parser.add_argument('--result-dir', type=str, required=True) + parser.add_argument('--save-mesh', default=False, action='store_true') + parser.add_argument('--save-pose', default=False, action='store_true') + parser.add_argument('--save-part', default=False, action='store_true') + parser.add_argument('--save-path', default=False, action='store_true') + parser.add_argument('--save-record', default=False, action='store_true') + parser.add_argument('--save-all', default=False, action='store_true') + parser.add_argument('--reverse', default=False, action='store_true') + parser.add_argument('--show-fix', default=False, action='store_true') + parser.add_argument('--show-grasp', default=False, action='store_true') + parser.add_argument('--show-arm', default=False, action='store_true') + parser.add_argument('--gripper', type=str, default='robotiq-140', choices=['panda', 'robotiq-85', 'robotiq-140']) + parser.add_argument('--scale', type=float, default=0.4) + parser.add_argument('--optimizer', type=str, default='L-BFGS-B') + parser.add_argument('--disable-save-sdf', default=False, action='store_true') + parser.add_argument('--clear-sdf', default=False, action='store_true') + parser.add_argument('--make-video', default=False, action='store_true') + parser.add_argument('--num-proc', type=int, default=8) + parser.add_argument('--budget', type=int, default=None) + parser.add_argument('--seed', type=int, default=0) + parser.add_argument('--camera-lookat', type=float, nargs=3, default=[-1, 1, 0], help='camera lookat') + parser.add_argument('--camera-pos', type=float, nargs=3, default=[1.25, -1.5, 1.5], help='camera position') + args = parser.parse_args() + + asset_folder = os.path.join(project_base_dir, './assets') + + if args.id_path is not None: + with open(args.id_path, 'r') as fp: + if args.id_path.endswith('.txt'): + target_ids = [x.replace('\n', '') for x in fp.readlines()] + elif args.id_path.endswith('.json'): + target_ids = json.load(fp) + else: + raise Exception + else: + target_ids = None + + worker_args = [] + + for assembly_id in os.listdir(args.log_dir): + if target_ids is not None and assembly_id not in target_ids: continue + + log_dir = os.path.join(args.log_dir, assembly_id) + if not os.path.isdir(log_dir): continue + + assembly_dir = os.path.join(args.assembly_dir, assembly_id) + assert os.path.isdir(assembly_dir), f'{assembly_dir} does not exist' + + result_i_dir = os.path.join(args.result_dir, assembly_id) + + with open(os.path.join(log_dir, 'tree.pkl'), 'rb') as fp: + tree = pickle.load(fp) + with open(os.path.join(log_dir, 'stats.json'), 'r') as fp: + stats = json.load(fp) + sequence = stats['sequence'] + + if sequence is not None: + worker_args.append([ + asset_folder, assembly_dir, sequence, tree, result_i_dir, args.save_mesh, args.save_pose, args.save_part, args.save_path, args.save_record, args.save_all, + args.reverse, args.show_fix, args.show_grasp, args.show_arm, args.gripper, args.scale, args.optimizer, not args.disable_save_sdf, args.clear_sdf, args.make_video, args.budget, args.camera_pos, args.camera_lookat + ]) + + try: + for _ in parallel_execute(play_logged_plan, worker_args, args.num_proc): + pass + except KeyboardInterrupt: + exit() diff --git a/plan_sequence/plot_logged_tree.py b/plan_sequence/plot_logged_tree.py new file mode 100644 index 0000000..bbe2f4e --- /dev/null +++ b/plan_sequence/plot_logged_tree.py @@ -0,0 +1,32 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import pickle +import json + +from plan_sequence.planner.base import SequencePlanner + + +def plot_logged_tree(log_dir, save, verbose=False): + with open(os.path.join(log_dir, 'tree.pkl'), 'rb') as fp: + tree = pickle.load(fp) + if verbose: + with open(os.path.join(log_dir, 'stats.json'), 'r') as fp: + stats = json.load(fp) + print(stats) + + SequencePlanner.plot_tree(tree, save_path=os.path.join(log_dir, 'tree.png') if save else None) + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--log-dir', type=str, required=True) + parser.add_argument('--save', default=False, action='store_true') + args = parser.parse_args() + + plot_logged_tree(args.log_dir, args.save, True) diff --git a/plan_sequence/run_seq_plan.py b/plan_sequence/run_seq_plan.py new file mode 100644 index 0000000..081312a --- /dev/null +++ b/plan_sequence/run_seq_plan.py @@ -0,0 +1,108 @@ +import os +os.environ['OMP_NUM_THREADS'] = '1' +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np +import json +import traceback +import warnings +warnings.filterwarnings('ignore', category=RuntimeWarning) # for trimesh stable pose computation + +from plan_sequence.generator import generators +from plan_sequence.planner import planners +from assets.save import clear_saved_sdfs + + +def seq_plan(asset_folder, assembly_dir, generator_name, planner_name, num_proc, seed, budget, max_gripper, max_pose, pose_reuse, early_term, timeout, base_part, + save_sdf, clear_sdf, plan_grasp, plan_arm, gripper_type, gripper_scale, optimizer, debug, render, record_dir, log_dir): + + try: + generator_cls = generators[generator_name] + generator = generator_cls(asset_folder, assembly_dir, base_part=base_part, save_sdf=save_sdf) + planner_cls = planners[planner_name] + planner = planner_cls(generator, num_proc, save_sdf=save_sdf) + planner.seed(seed) + + setup = { + 'budget': budget, 'max_grippers': max_gripper, 'max_poses': max_pose, 'pose_reuse': pose_reuse, 'early_term': early_term, 'timeout': timeout, + 'plan_grasp': plan_grasp, 'plan_arm': plan_arm, 'gripper_type': gripper_type, 'gripper_scale': gripper_scale, 'optimizer': optimizer, + } + tree = planner.plan(**setup, debug=debug - 1, render=False) + + stats = planner.get_stats(tree) + + if log_dir is not None: + planner.log(tree, stats, log_dir) + with open(os.path.join(log_dir, 'setup.json'), 'w') as fp: + json.dump(setup, fp) + + if debug: + print(f'[seq_plan] stats: {stats}') + + if render and stats['success']: + planner.render(stats['sequence'], tree, record_dir) + + except (Exception, KeyboardInterrupt) as e: + if type(e) == KeyboardInterrupt: + print('[seq_plan] interrupt') + else: + print('[seq_plan] exception:', e, f'from {assembly_dir}') + print(traceback.format_exc()) + if clear_sdf: + clear_saved_sdfs(assembly_dir) + raise e + + if clear_sdf: + clear_saved_sdfs(assembly_dir) + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--dir', type=str, default='multi_assembly', help='directory storing all assemblies') + parser.add_argument('--id', type=str, required=True, help='assembly id (e.g. 00000)') + parser.add_argument('--planner', type=str, required=True, choices=list(planners.keys()), help='name of planner (node selection algorithm)') + parser.add_argument('--generator', type=str, required=True, choices=list(generators.keys()), help='name of part generator (part selection algorithm)') + parser.add_argument('--num-proc', type=int, default=1, help='number of processes for parallel planning') + parser.add_argument('--seed', type=int, default=0) + parser.add_argument('--budget', type=int, default=400, help='maximum evaluation (feasibility check) budget') + parser.add_argument('--max-gripper', type=int, default=3) + parser.add_argument('--max-pose', type=int, default=3) + parser.add_argument('--pose-reuse', type=int, default=0) + parser.add_argument('--early-term', default=False, action='store_true') + parser.add_argument('--timeout', type=int, default=None) + parser.add_argument('--base-part', type=str, default=None) + parser.add_argument('--debug', type=int, default=3, help='depth of debug message') + parser.add_argument('--render', default=False, action='store_true') + parser.add_argument('--record-dir', type=str, default=None) + parser.add_argument('--log-dir', type=str, default=None) + parser.add_argument('--disable-save-sdf', default=False, action='store_true') + parser.add_argument('--clear-sdf', default=False, action='store_true') + parser.add_argument('--plan-grasp', default=False, action='store_true') + parser.add_argument('--plan-arm', default=False, action='store_true') + parser.add_argument('--gripper', type=str, default='robotiq-140', choices=['panda', 'robotiq-85', 'robotiq-140']) + parser.add_argument('--scale', type=float, default=0.4) + parser.add_argument('--optimizer', type=str, default='L-BFGS-B') + + args = parser.parse_args() + + asset_folder = os.path.join(project_base_dir, './assets') + assembly_dir = os.path.join(asset_folder, args.dir, args.id) + exp_name = f'{args.planner}-{args.generator}' + + if args.record_dir is None: + record_dir = None + else: + record_dir = os.path.join(args.record_dir, exp_name, f's{args.seed}', args.id) + + if args.log_dir is None: + log_dir = None + else: + log_dir = os.path.join(args.log_dir, exp_name, f's{args.seed}', f'{args.id}') + + seq_plan(asset_folder, assembly_dir, args.generator, args.planner, args.num_proc, args.seed, args.budget, args.max_gripper, args.max_pose, args.pose_reuse, args.early_term, args.timeout, args.base_part, + not args.disable_save_sdf, args.clear_sdf, args.plan_grasp, args.plan_arm, args.gripper, args.scale, args.optimizer, args.debug, args.render, record_dir, log_dir) diff --git a/plan_sequence/run_seq_plan_batch.py b/plan_sequence/run_seq_plan_batch.py new file mode 100644 index 0000000..2f27a0f --- /dev/null +++ b/plan_sequence/run_seq_plan_batch.py @@ -0,0 +1,87 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +from plan_sequence.run_seq_plan import seq_plan +from utils.parallel import parallel_execute + + +if __name__ == '__main__': + from argparse import ArgumentParser + + parser = ArgumentParser() + parser.add_argument('--dir', type=str, default='multi_assembly', help='directory storing all assemblies') + parser.add_argument('--id-path', type=str, default=None) + parser.add_argument('--planner', type=str, nargs='+', required=True) + parser.add_argument('--generator', type=str, nargs='+', required=True) + parser.add_argument('--num-proc', type=int, default=1) + parser.add_argument('--inner-num-proc', type=int, default=1) + parser.add_argument('--n-seed', type=int, default=1) + parser.add_argument('--budget', type=int, default=400) + parser.add_argument('--max-gripper', type=int, nargs='+', default=(2,)) + parser.add_argument('--max-pose', type=int, default=3) + parser.add_argument('--pose-reuse', type=int, default=0) + parser.add_argument('--early-term', default=False, action='store_true') + parser.add_argument('--timeout', type=int, default=None) + parser.add_argument('--render', default=False, action='store_true') + parser.add_argument('--record-dir', type=str, default=None) + parser.add_argument('--log-dir', type=str, default=None) + parser.add_argument('--disable-save-sdf', default=False, action='store_true') + parser.add_argument('--clear-sdf', default=False, action='store_true') + parser.add_argument('--plan-grasp', default=False, action='store_true') + parser.add_argument('--plan-arm', default=False, action='store_true') + parser.add_argument('--gripper', type=str, default='robotiq-140', choices=['panda', 'robotiq-85', 'robotiq-140']) + parser.add_argument('--scale', type=float, default=0.4) + parser.add_argument('--optimizer', type=str, default='L-BFGS-B') + + args = parser.parse_args() + + asset_folder = os.path.join(project_base_dir, './assets') + assemblies_dir = os.path.join(asset_folder, args.dir) + assembly_ids = [] + if args.id_path is None: + for assembly_id in os.listdir(assemblies_dir): + assembly_dir = os.path.join(assemblies_dir, assembly_id) + if os.path.isdir(assembly_dir): + assembly_ids.append(assembly_id) + else: + with open(args.id_path, 'r') as fp: + assembly_ids = [x.replace('\n', '') for x in fp.readlines()] + real_assembly_ids = [] + for assembly_id in assembly_ids: + assembly_dir = os.path.join(assemblies_dir, assembly_id) + if os.path.isdir(assembly_dir): + real_assembly_ids.append(assembly_id) + assembly_ids = real_assembly_ids + assembly_ids.sort() + + worker_args = [] + + for max_gripper in args.max_gripper: + for assembly_id in assembly_ids: + assembly_dir = os.path.join(assemblies_dir, assembly_id) + for generator_name in args.generator: + for planner_name in args.planner: + for seed in range(args.n_seed): + exp_name = f'{planner_name}-{generator_name}' + + if args.record_dir is None: + record_dir = None + else: + record_dir = os.path.join(args.record_dir, f'g{max_gripper}', exp_name, f's{seed}', assembly_id) + + if args.log_dir is None: + log_dir = None + else: + log_dir = os.path.join(args.log_dir, f'g{max_gripper}', exp_name, f's{seed}', f'{assembly_id}') + + worker_args.append([asset_folder, assembly_dir, generator_name, planner_name, args.inner_num_proc, seed, args.budget, max_gripper, args.max_pose, args.pose_reuse, args.early_term, args.timeout, None, + not args.disable_save_sdf, args.clear_sdf, args.plan_grasp, args.plan_arm, args.gripper, args.scale, args.optimizer, 0, args.render, record_dir, log_dir]) + + try: + for _ in parallel_execute(seq_plan, worker_args, args.num_proc): + pass + except KeyboardInterrupt: + exit() diff --git a/plan_sequence/sim_string.py b/plan_sequence/sim_string.py new file mode 100644 index 0000000..f4e9737 --- /dev/null +++ b/plan_sequence/sim_string.py @@ -0,0 +1,249 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import json +import numpy as np +from scipy.spatial.transform import Rotation + +from assets.load import load_config, load_pos_quat_dict, load_part_ids +from assets.transform import mat_dict_to_pos_quat_dict, pos_quat_to_mat + + +GROUND_Z = 0 + +KN = 1e3 +KT = 1e3 +MU = 0.5 +DAMPING = 1e3 + + +def _get_color(index, alpha=1.0): + colors = [ + [210, 87, 89, 255 * alpha], + [237, 204, 73, 255 * alpha], + [60, 167, 221, 255 * alpha], + [190, 126, 208, 255 * alpha], + [108, 192, 90, 255 * alpha], + ] + colors = np.array(colors) / 255.0 + return colors[int(index) % 5] + + +def _get_fixed_color(): + return np.array([120, 120, 120, 255]) / 255.0 + + +def get_body_color_dict(parts_fix, parts_free): # parts_free = parts_rest - parts_fix + [part_move] + body_color_dict = {} + for part_id in [*parts_fix, *parts_free]: + if part_id in parts_free: + color = _get_color(part_id)[:3] + else: + color = _get_fixed_color()[:3] + body_color_dict[f'part{part_id}'] = color + return body_color_dict + + +def _arr_to_str(arr): + return ' '.join([str(x) for x in arr]) + + +def _get_basic_sim_substring(gravity=False): + substring = f''' + + +''' + return string + + +def get_path_sim_string(assembly_dir, parts_fix, part_move, parts_removed=[], save_sdf=False, pose=None, mat_dict=None, col_th=0.01, arm_string=None): + ''' + Simulation string for checking path assemblability + ''' + if pose is None: pose = np.eye(4) + + if mat_dict is None: + pos_dict, quat_dict = load_pos_quat_dict(assembly_dir) + else: + pos_dict, quat_dict = mat_dict_to_pos_quat_dict(mat_dict) + + if len(parts_removed) > 0: # set removed parts to initial states + pos_init_dict, quat_init_dict = load_pos_quat_dict(assembly_dir, transform='initial') + for part_id in parts_removed: + pos_dict[part_id] = pos_init_dict[part_id] + quat_dict[part_id] = quat_init_dict[part_id] + + sdf_args = 'load_sdf="true" save_sdf="true"' if save_sdf else '' + string = _get_path_sim_substring() + for part_id in [part_move, *parts_fix, *parts_removed]: + + if part_id in parts_removed: + if pos_dict[part_id] is None or quat_dict[part_id] is None: + continue + + if part_id == part_move: + joint_type = 'free3d-exp' + color = _get_color(part_id) + else: + joint_type = 'fixed' + # color = _get_fixed_color() + color = _get_color(part_id) + + matrix = pos_quat_to_mat(pos_dict[part_id], quat_dict[part_id]) + matrix = pose @ matrix + pos = matrix[:3, 3] + np.array([0, 0, GROUND_Z]) # NOTE: pay attention when combining mat_dict and pose + quat = Rotation.from_matrix(matrix[:3, :3]).as_quat()[[3, 0, 1, 2]] + + if pos is None or quat is None: + continue + + if type(col_th) == dict: + col_th_i = col_th[part_id] + else: + col_th_i = col_th + + string += f''' + + + + + + +''' + if arm_string is not None: + string += arm_string + string += f''' + +''' + string += f''' + +''' + for part_id in parts_fix: + string += f''' + + +''' + string += f''' + + +''' + return string + + +def get_stability_sim_string(assembly_dir, parts_fix, parts_move, gravity=True, save_sdf=False, pose=None, mat_dict=None, col_th=0.01): + ''' + Simulation string for checking stability + ''' + if pose is None: pose = np.eye(4) + + if mat_dict is None: + pos_dict, quat_dict = load_pos_quat_dict(assembly_dir) + else: + pos_dict, quat_dict = mat_dict_to_pos_quat_dict(mat_dict) + + sdf_args = 'load_sdf="true" save_sdf="true"' if save_sdf else '' + string = _get_stablility_sim_substring(gravity=gravity) + + for part_id in [*parts_fix, *parts_move]: + if part_id in parts_fix: + joint_type = 'fixed' + color = _get_fixed_color() + else: + joint_type = 'free3d-exp' + color = _get_color(part_id) + + if mat_dict is None: # ground init + matrix = pos_quat_to_mat(pos_dict[part_id], quat_dict[part_id]) + matrix = pose @ matrix + pos = matrix[:3, 3] + np.array([0, 0, GROUND_Z]) # NOTE: pay attention when combining mat_dict and pose + quat = Rotation.from_matrix(matrix[:3, :3]).as_quat()[[3, 0, 1, 2]] + else: # ground cont + pos = pos_dict[part_id] + quat = quat_dict[part_id] + + string += f''' + + + + + + +''' + string += f''' + +''' + part_pairs_in_contact = [] + for i, part_move in enumerate(parts_move): + for part_fix in parts_fix: + part_pairs_in_contact.append((part_move, part_fix)) + for j in range(i + 1, len(parts_move)): + part_pairs_in_contact.append((part_move, parts_move[j])) + string += f''' + +''' + for part_pair in part_pairs_in_contact: + string += f''' + + +''' + string += f''' + + +''' + return string diff --git a/plan_sequence/stable_pose.py b/plan_sequence/stable_pose.py new file mode 100644 index 0000000..e9ecc8f --- /dev/null +++ b/plan_sequence/stable_pose.py @@ -0,0 +1,118 @@ +import os +import sys + +project_base_dir = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..')) +sys.path.append(project_base_dir) + +import numpy as np +import trimesh +from assets.load import load_assembly, load_part_ids +from assets.transform import transform_pt_by_matrix + + +def get_ground_mesh(z=0, s=10): + v = np.array([ + [-s, -s, z], + [-s, s, z], + [s, -s, z], + [s, s, z] + ]) + f = np.array([ + [0, 2, 1], + [2, 3, 1], + [1, 3, 2], + [0, 1, 2], + ], dtype=int) + return trimesh.Trimesh(v, f) + + +def get_combined_mesh(assembly_dir, parts=None): + if parts is None: parts = load_part_ids(assembly_dir) + + assembly = load_assembly(assembly_dir) + + target_meshes = [] + for part_id, part_data in assembly.items(): + if part_id in parts: + target_meshes.append(part_data['mesh']) + + mesh = trimesh.util.concatenate(target_meshes) + return mesh + + +def get_stable_poses(mesh, prob_th=0.9, max_num=3, return_prob=False, shift_center=True): + + assert max_num >= 0 + if max_num == 0: return [] + + poses, probs = trimesh.poses.compute_stable_poses(mesh, n_samples=1) + + top_poses = [] + top_probs = [] + prob_cum = 0 + for pose, prob in zip(poses, probs): + top_poses.append(pose) + top_probs.append(prob) + prob_cum += prob + if prob_cum > prob_th: + break + if len(top_poses) >= max_num: + break + + if shift_center: + for pose in top_poses: + pose[:2, 3] -= transform_pt_by_matrix(mesh.centroid, pose)[:2] + + if return_prob: + return top_poses, top_probs + else: + return top_poses + + +def visualize_stable_poses(mesh, poses): + + print('original pose') + ground_mesh = get_ground_mesh(z=mesh.vertices.min(axis=0)[2]) + trimesh.Scene([mesh, ground_mesh]).show() + + for i, pose in enumerate(poses): + print(f'{i+1}/{len(poses)} stable pose') + mesh_new = mesh.copy() + mesh_new.apply_transform(pose) + ground_mesh = get_ground_mesh() + trimesh.Scene([mesh_new, ground_mesh]).show() + + +if __name__ == '__main__': + + from argparse import ArgumentParser + parser = ArgumentParser() + parser.add_argument('--dir', type=str, required=True) + parser.add_argument('--part-ids', type=str, nargs='+', default=None) + parser.add_argument('--suffix', type=str, default='') + args = parser.parse_args() + + mesh = get_combined_mesh(args.dir, args.part_ids) + poses, probs = get_stable_poses(mesh, prob_th=1.0, max_num=10, return_prob=True) + # visualize_stable_poses(mesh, poses) + # exit() + + from assets.save import save_posed_mesh + + assembly_id = os.path.basename(args.dir) + for i, (pose, prob) in enumerate(zip(poses, probs)): + parts = load_part_ids(args.dir) if args.part_ids is None else args.part_ids + save_posed_mesh(f'pose_{assembly_id}{args.suffix}/{i}', args.dir, parts, pose) + print(prob) + + # import redmax_py as redmax + # from utils.renderer import SimRenderer + # from seq_optim.sim_string import get_stability_sim_string + # part_ids = [x.replace('.obj', '') for x in load_part_ids(args.dir)] + # asset_folder = os.path.join(project_base_dir, 'assets') + # sim_string = get_stability_sim_string(args.dir, parts_fix=[], parts_move=part_ids, pose=poses[0]) + # sim = redmax.Simulation(sim_string, asset_folder) + # sim.reset() + # for _ in range(1000): + # sim.forward(1) + # SimRenderer.replay(sim, record=False) diff --git a/plan_sequence/visualize_logged_path.py b/plan_sequence/visualize_logged_path.py new file mode 100644 index 0000000..e941109 --- /dev/null +++ b/plan_sequence/visualize_logged_path.py @@ -0,0 +1,28 @@ +import os +import trimesh +import numpy as np +from argparse import ArgumentParser + + +def visualize_meshes(mesh_dir, path_dir): + times = sorted([int(time) for time in os.listdir(path_dir) if time.isnumeric()]) + for time in times: + mat_dir = os.path.join(path_dir, str(time)) + meshes = {} + for name in os.listdir(mat_dir): + if name.endswith('.npy'): + mat = np.load(os.path.join(mat_dir, name)) + mesh = trimesh.load(os.path.join(mesh_dir, name[:-4] + '.obj')) + mesh.apply_transform(mat) + meshes[name] = mesh + trimesh.Scene(list(meshes.values())).show() + return meshes + + +if __name__ == '__main__': + parser = ArgumentParser() + parser.add_argument('--mesh-dir', type=str, required=True) + parser.add_argument('--path-dir', type=str, required=True) + args = parser.parse_args() + + visualize_meshes(args.mesh_dir, args.path_dir) diff --git a/simulation/CMakeLists.txt b/simulation/CMakeLists.txt new file mode 100644 index 0000000..e9d454f --- /dev/null +++ b/simulation/CMakeLists.txt @@ -0,0 +1,50 @@ +cmake_minimum_required(VERSION 3.16.0) + +set(CMAKE_SUPPRESS_REGENERATION true) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +project(RedMax) + +# Enable C++ 11 +set(CMAKE_CXX_STANDARD 11) + +# Suppress warnings. +add_definitions( + -D_CRT_SECURE_NO_WARNINGS +) +if(UNIX) + set(GCC_COVERAGE_COMPILE_FLAGS "-Wno-format") + add_definitions(${GCC_COVERAGE_COMPILE_FLAGS}) +endif() + +find_package(OpenGL REQUIRED) + +set(EXTERNAL_ROOT ${PROJECT_SOURCE_DIR}/externals) +add_subdirectory(${EXTERNAL_ROOT}) +get_directory_property(EXTERNAL_HEADER + DIRECTORY ${EXTERNAL_ROOT} + DEFINITION EXTERNAL_HEADER) +set(OPENGL_VIEWER_HEADER ${PROJECT_SOURCE_DIR}/opengl_viewer/include/) + +# Expose PROJECT_DIR to the source code. +add_definitions(-DPROJECT_DIR="${PROJECT_SOURCE_DIR}") +add_definitions(-DGRAPHICS_CODEBASE_SOURCE_DIR="${CMAKE_CURRENT_LIST_DIR}") + +include_directories(${OPENGL_VIEWER_HEADER}) +include_directories(${EXTERNAL_HEADER}) + +add_definitions( + -DTW_STATIC + -DTW_NO_LIB_PRAGMA + -DTW_NO_DIRECT3D + -DGLEW_STATIC + -D_CRT_SECURE_NO_WARNINGS +) + +# Include separate projects. +add_subdirectory(opengl_viewer/) +add_subdirectory(redmax/) + +set(CMAKE_CXX_STANDARD_LIBRARIES -ldl) +# set(CMAKE_VERBOSE_MAKEFILE ON) + diff --git a/simulation/externals/CMakeLists.txt b/simulation/externals/CMakeLists.txt new file mode 100644 index 0000000..e2bf2b2 --- /dev/null +++ b/simulation/externals/CMakeLists.txt @@ -0,0 +1,128 @@ +# CMake entry point. +cmake_minimum_required(VERSION 3.1) + +# Do not want to generate zeor_check because they cause messy folders in +# visual studio 2017. +set(CMAKE_SUPPRESS_REGENERATION true) + +set(CMAKE_CXX_STANDARD 11) + +set(EXTERNAL_HEADER + "${CMAKE_CURRENT_LIST_DIR}/eigen/" + "${CMAKE_CURRENT_LIST_DIR}/glew/include" + "${CMAKE_CURRENT_LIST_DIR}/glfw/include/GLFW" + "${CMAKE_CURRENT_LIST_DIR}/imgui" + "${CMAKE_CURRENT_LIST_DIR}/libigl/include" + "${CMAKE_CURRENT_LIST_DIR}/stb" + "${CMAKE_CURRENT_LIST_DIR}/pugixml/src" + "${CMAKE_CURRENT_LIST_DIR}/tiny_obj_loader" + "${CMAKE_CURRENT_LIST_DIR}/sdfgen" +) + +include_directories(${EXTERNAL_HEADER}) + +# libigl +add_subdirectory(libigl) + +# tiny obj loader +add_subdirectory(tiny_obj_loader) + +# pugixml +add_subdirectory(pugixml) + +# pybind11 +add_subdirectory(pybind11) + +# sdfgen +add_subdirectory(sdfgen) + +# viewer related +if(MSVC AND NOT "${MSVC_VERSION}" LESS 1400) + add_definitions( "/MP" ) +endif() + +add_definitions( + -DTW_STATIC + -DTW_NO_LIB_PRAGMA + -DTW_NO_DIRECT3D + -DGLEW_STATIC + -D_CRT_SECURE_NO_WARNINGS +) + +### GLFW ### +add_subdirectory(glfw) + +include_directories( + glfw/include/GLFW/ + glew/include/ +) + +### GLEW ### +set(GLEW_SOURCE + glew/src/glew.c +) +set(GLEW_HEADERS +) +add_library(glew STATIC + ${GLEW_SOURCE} + ${GLEW_INCLUDE} +) +target_link_libraries(glew + ${OPENGL_LIBRARY} +) + +### IMGUI ### +set(IMGUI_HEADER + imgui/imgui.h + imgui/imgui_internal.h + imgui/imconfig.h + imgui/stb_rect_pack.h + imgui/stb_textedit.h + imgui/stb_truetype.h +) +set(IMGUI_SOURCE + imgui/imgui.cpp + imgui/imgui_demo.cpp + imgui/imgui_draw.cpp +) +add_library(imgui STATIC + ${IMGUI_HEADER} + ${IMGUI_SOURCE} +) +# Treat windows and ubuntu differently. +if(MSVC) + target_link_libraries(imgui + glew + glfw + ) +endif(MSVC) +if(UNIX AND NOT APPLE) + target_link_libraries(imgui + glew + glfw + X11 + Xi + Xrandr + Xxf86vm + Xinerama + Xcursor + rt + m + pthread + dl + ) +endif(UNIX AND NOT APPLE) +if(APPLE) + include_directories(/System/Library/Frameworks) + find_library(COCOA_LIBRARY Cocoa) + find_library(IOKIT_LIBRARY IOKit) + find_library(COREVIDEO_LIBRARY CoreVideo) + target_link_libraries(imgui + glew + glfw + ${COCOA_LIBRARY} + ${IOKIT_LIBRARY} + ${COREVIDEO_LIBRARY} + ) +endif(APPLE) + diff --git a/simulation/externals/bfgs/ap.cpp b/simulation/externals/bfgs/ap.cpp new file mode 100644 index 0000000..2ff4c6a --- /dev/null +++ b/simulation/externals/bfgs/ap.cpp @@ -0,0 +1,460 @@ +/******************************************************************** +AP Library version 1.2 +Copyright (c) 2003-2007, Sergey Bochkanov (ALGLIB project). +See www.alglib.net or alglib.sources.ru for details. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer listed + in this license in the documentation and/or other materials + provided with the distribution. + +- Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +********************************************************************/ + +//#include "stdafx.h" +#include +#include "ap.h" + + +/******************************************************************** +Optimized ABLAS interface +********************************************************************/ +#ifdef AP_WIN32 +#include +extern "C" +{ +typedef double (*_ddot1)(const double*, const double*, long); +typedef void (*_dmove1)(const double*, const double*, long); +typedef void (*_dmoves1)(const double*, const double*, long, double); +typedef void (*_dmoveneg1)(const double*, const double*, long); +typedef void (*_dadd1)(const double*, const double*, long); +typedef void (*_dadds1)(const double*, const double*, long, double); +typedef void (*_dsub1)(const double*, const double*, long); +typedef void (*_dmuls1)(const double*, long, double); +} +HINSTANCE ABLAS = LoadLibrary("ablas.dll"); + +static _ddot1 ddot1 = ABLAS==NULL ? NULL : (_ddot1) GetProcAddress(ABLAS, "ASMDotProduct1"); +static _dmove1 dmove1 = ABLAS==NULL ? NULL : (_dmove1) GetProcAddress(ABLAS, "ASMMove1"); +static _dmoves1 dmoves1 = ABLAS==NULL ? NULL : (_dmoves1) GetProcAddress(ABLAS, "ASMMoveS1"); +static _dmoveneg1 dmoveneg1 = ABLAS==NULL ? NULL : (_dmoveneg1) GetProcAddress(ABLAS, "ASMMoveNeg1"); +static _dadd1 dadd1 = ABLAS==NULL ? NULL : (_dadd1) GetProcAddress(ABLAS, "ASMAdd1"); +static _dadds1 dadds1 = ABLAS==NULL ? NULL : (_dadds1) GetProcAddress(ABLAS, "ASMAddS1"); +static _dsub1 dsub1 = ABLAS==NULL ? NULL : (_dsub1) GetProcAddress(ABLAS, "ASMSub1"); +static _dmuls1 dmuls1 = ABLAS==NULL ? NULL : (_dmuls1) GetProcAddress(ABLAS, "ASMMulS1"); +#endif + +const double ap::machineepsilon = 5E-16; +const double ap::maxrealnumber = 1E300; +const double ap::minrealnumber = 1E-300; + +/******************************************************************** +ap::complex operations +********************************************************************/ +const bool ap::operator==(const ap::complex& lhs, const ap::complex& rhs) +{ return lhs.x==rhs.x && lhs.y==rhs.y; } + +const bool ap::operator!=(const ap::complex& lhs, const ap::complex& rhs) +{ return lhs.x!=rhs.x || lhs.y!=rhs.y; } + +const ap::complex ap::operator+(const ap::complex& lhs) +{ return lhs; } + +const ap::complex ap::operator-(const ap::complex& lhs) +{ return ap::complex(-lhs.x, -lhs.y); } + +const ap::complex ap::operator+(const ap::complex& lhs, const ap::complex& rhs) +{ ap::complex r = lhs; r += rhs; return r; } + +const ap::complex ap::operator+(const ap::complex& lhs, const double& rhs) +{ ap::complex r = lhs; r += rhs; return r; } + +const ap::complex ap::operator+(const double& lhs, const ap::complex& rhs) +{ ap::complex r = rhs; r += lhs; return r; } + +const ap::complex ap::operator-(const ap::complex& lhs, const ap::complex& rhs) +{ ap::complex r = lhs; r -= rhs; return r; } + +const ap::complex ap::operator-(const ap::complex& lhs, const double& rhs) +{ ap::complex r = lhs; r -= rhs; return r; } + +const ap::complex ap::operator-(const double& lhs, const ap::complex& rhs) +{ ap::complex r = lhs; r -= rhs; return r; } + +const ap::complex ap::operator*(const ap::complex& lhs, const ap::complex& rhs) +{ return ap::complex(lhs.x*rhs.x - lhs.y*rhs.y, lhs.x*rhs.y + lhs.y*rhs.x); } + +const ap::complex ap::operator*(const ap::complex& lhs, const double& rhs) +{ return ap::complex(lhs.x*rhs, lhs.y*rhs); } + +const ap::complex ap::operator*(const double& lhs, const ap::complex& rhs) +{ return ap::complex(lhs*rhs.x, lhs*rhs.y); } + +const ap::complex ap::operator/(const ap::complex& lhs, const ap::complex& rhs) +{ + ap::complex result; + double e; + double f; + if( fabs(rhs.y)yabs ? xabs : yabs; + v = xabs(v1, v2, N); +} + +ap::complex ap::vdotproduct(const ap::complex *v1, const ap::complex *v2, int N) +{ + return ap::_vdotproduct(v1, v2, N); +} + +void ap::vmove(double *vdst, const double* vsrc, int N) +{ +#ifdef AP_WIN32 + if( dmove1!=NULL ) + { + dmove1(vdst, vsrc, N); + return; + } +#endif + ap::_vmove(vdst, vsrc, N); +} + +void ap::vmove(ap::complex *vdst, const ap::complex* vsrc, int N) +{ + ap::_vmove(vdst, vsrc, N); +} + +void ap::vmoveneg(double *vdst, const double *vsrc, int N) +{ +#ifdef AP_WIN32 + if( dmoveneg1!=NULL ) + { + dmoveneg1(vdst, vsrc, N); + return; + } +#endif + ap::_vmoveneg(vdst, vsrc, N); +} + +void ap::vmoveneg(ap::complex *vdst, const ap::complex *vsrc, int N) +{ + ap::_vmoveneg(vdst, vsrc, N); +} + +void ap::vmove(double *vdst, const double *vsrc, int N, double alpha) +{ +#ifdef AP_WIN32 + if( dmoves1!=NULL ) + { + dmoves1(vdst, vsrc, N, alpha); + return; + } +#endif + ap::_vmove(vdst, vsrc, N, alpha); +} + +void ap::vmove(ap::complex *vdst, const ap::complex *vsrc, int N, double alpha) +{ + ap::_vmove(vdst, vsrc, N, alpha); +} + +void ap::vmove(ap::complex *vdst, const ap::complex *vsrc, int N, ap::complex alpha) +{ + ap::_vmove(vdst, vsrc, N, alpha); +} + +void ap::vadd(double *vdst, const double *vsrc, int N) +{ +#ifdef AP_WIN32 + if( dadd1!=NULL ) + { + dadd1(vdst, vsrc, N); + return; + } +#endif + ap::_vadd(vdst, vsrc, N); +} + +void ap::vadd(ap::complex *vdst, const ap::complex *vsrc, int N) +{ + ap::_vadd(vdst, vsrc, N); +} + +void ap::vadd(double *vdst, const double *vsrc, int N, double alpha) +{ +#ifdef AP_WIN32 + if( dadds1!=NULL ) + { + dadds1(vdst, vsrc, N, alpha); + return; + } +#endif + ap::_vadd(vdst, vsrc, N, alpha); +} + +void ap::vadd(ap::complex *vdst, const ap::complex *vsrc, int N, double alpha) +{ + ap::_vadd(vdst, vsrc, N, alpha); +} + +void ap::vadd(ap::complex *vdst, const ap::complex *vsrc, int N, ap::complex alpha) +{ + ap::_vadd(vdst, vsrc, N, alpha); +} + +void ap::vsub(double *vdst, const double *vsrc, int N) +{ +#ifdef AP_WIN32 + if( dsub1!=NULL ) + { + dsub1(vdst, vsrc, N); + return; + } +#endif + ap::_vsub(vdst, vsrc, N); +} + +void ap::vsub(ap::complex *vdst, const ap::complex *vsrc, int N) +{ + ap::_vsub(vdst, vsrc, N); +} + +void ap::vsub(double *vdst, const double *vsrc, int N, double alpha) +{ +#ifdef AP_WIN32 + if( dadds1!=NULL ) + { + dadds1(vdst, vsrc, N, -alpha); + return; + } +#endif + ap::_vsub(vdst, vsrc, N, alpha); +} + +void ap::vsub(ap::complex *vdst, const ap::complex *vsrc, int N, double alpha) +{ + ap::_vsub(vdst, vsrc, N, alpha); +} + +void ap::vsub(ap::complex *vdst, const ap::complex *vsrc, int N, ap::complex alpha) +{ + ap::_vsub(vdst, vsrc, N, alpha); +} + +void ap::vmul(double *vdst, int N, double alpha) +{ +#ifdef AP_WIN32 + if( dmuls1!=NULL ) + { + dmuls1(vdst, N, alpha); + return; + } +#endif + ap::_vmul(vdst, N, alpha); +} + +void ap::vmul(ap::complex *vdst, int N, double alpha) +{ + ap::_vmul(vdst, N, alpha); +} + +void ap::vmul(ap::complex *vdst, int N, ap::complex alpha) +{ + ap::_vmul(vdst, N, alpha); +} + +/******************************************************************** +standard functions +********************************************************************/ +int ap::sign(double x) +{ + if( x>0 ) return 1; + if( x<0 ) return -1; + return 0; +} + +double ap::randomreal() +{ + int i = rand(); + while(i==RAND_MAX) + i =rand(); + return double(i)/double(RAND_MAX); +} + +int ap::randominteger(int maxv) +{ return rand()%maxv; } + +int ap::round(double x) +{ return int(floor(x+0.5)); } + +int ap::trunc(double x) +{ return int(x>0 ? floor(x) : ceil(x)); } + +int ap::ifloor(double x) +{ return int(floor(x)); } + +int ap::iceil(double x) +{ return int(ceil(x)); } + +double ap::pi() +{ return 3.14159265358979323846; } + +double ap::sqr(double x) +{ return x*x; } + +int ap::maxint(int m1, int m2) +{ + return m1>m2 ? m1 : m2; +} + +int ap::minint(int m1, int m2) +{ + return m1>m2 ? m2 : m1; +} + +double ap::maxreal(double m1, double m2) +{ + return m1>m2 ? m1 : m2; +} + +double ap::minreal(double m1, double m2) +{ + return m1>m2 ? m2 : m1; +} + +/******************************************************************** +Service routines: +********************************************************************/ +void* ap::amalloc(size_t size, size_t alignment) +{ + if( alignment<=1 ) + { + // + // no alignment, just call malloc + // + void *block = malloc(sizeof(void*)+size); + void **p = (void**)block; + *p = block; + return (void*)((char*)block+sizeof(void*)); + } + else + { + // + // align. + // + void *block = malloc(alignment-1+sizeof(void*)+size); + char *result = (char*)block+sizeof(void*); + //if( ((unsigned int)(result))%alignment!=0 ) + // result += alignment - ((unsigned int)(result))%alignment; + if( (result-(char*)0)%alignment!=0 ) + result += alignment - (result-(char*)0)%alignment; + *((void**)(result-sizeof(void*))) = block; + return result; + } +} + +void ap::afree(void *block) +{ + void *p = *((void**)((char*)block-sizeof(void*))); + free(p); +} + +int ap::vlen(int n1, int n2) +{ + return n2-n1+1; +} + diff --git a/simulation/externals/bfgs/ap.h b/simulation/externals/bfgs/ap.h new file mode 100644 index 0000000..98d5893 --- /dev/null +++ b/simulation/externals/bfgs/ap.h @@ -0,0 +1,582 @@ +/******************************************************************** +AP Library version 1.2.1 + +Copyright (c) 2003-2007, Sergey Bochkanov (ALGLIB project). +See www.alglib.net or alglib.sources.ru for details. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer listed + in this license in the documentation and/or other materials + provided with the distribution. + +- Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +********************************************************************/ + +#ifndef AP_H +#define AP_H + +#include +#include +#include + +/******************************************************************** +Array bounds check +********************************************************************/ +#define AP_ASSERT + +#ifndef AP_ASSERT // +#define NO_AP_ASSERT // This code avoids definition of the +#endif // both AP_ASSERT and NO_AP_ASSERT symbols +#ifdef NO_AP_ASSERT // +#ifdef AP_ASSERT // +#undef NO_AP_ASSERT // +#endif // +#endif // + + +/******************************************************************** +Current environment. +********************************************************************/ +#ifndef AP_WIN32 +#ifndef AP_UNKNOWN +#define AP_UNKNOWN +#endif +#endif +#ifdef AP_WIN32 +#ifdef AP_UNKNOWN +#error Multiple environments are declared! +#endif +#endif + +/******************************************************************** +This symbol is used for debugging. Do not define it and do not remove +comments. +********************************************************************/ +//#define UNSAFE_MEM_COPY + + +/******************************************************************** +Namespace of a standard library AlgoPascal. +********************************************************************/ +namespace ap +{ + +/******************************************************************** +Service routines: + amalloc - allocates an aligned block of size bytes + afree - frees block allocated by amalloc + vlen - just alias for n2-n1+1 +********************************************************************/ +void* amalloc(size_t size, size_t alignment); +void afree(void *block); +int vlen(int n1, int n2); + +/******************************************************************** +Exception class. +********************************************************************/ +class ap_error +{ +public: + ap_error(){}; + ap_error(const char *s){ msg = s; }; + + std::string msg; + + static void make_assertion(bool bClause) + { if(!bClause) throw ap_error(); }; + static void make_assertion(bool bClause, const char *msg) + { if(!bClause) throw ap_error(msg); }; +private: +}; + +/******************************************************************** +Class defining a complex number with double precision. +********************************************************************/ +class complex; + +class complex +{ +public: + complex():x(0.0),y(0.0){}; + complex(const double &_x):x(_x),y(0.0){}; + complex(const double &_x, const double &_y):x(_x),y(_y){}; + complex(const complex &z):x(z.x),y(z.y){}; + + complex& operator= (const double& v){ x = v; y = 0.0; return *this; }; + complex& operator+=(const double& v){ x += v; return *this; }; + complex& operator-=(const double& v){ x -= v; return *this; }; + complex& operator*=(const double& v){ x *= v; y *= v; return *this; }; + complex& operator/=(const double& v){ x /= v; y /= v; return *this; }; + + complex& operator= (const complex& z){ x = z.x; y = z.y; return *this; }; + complex& operator+=(const complex& z){ x += z.x; y += z.y; return *this; }; + complex& operator-=(const complex& z){ x -= z.x; y -= z.y; return *this; }; + complex& operator*=(const complex& z){ double t = x*z.x-y*z.y; y = x*z.y+y*z.x; x = t; return *this; }; + complex& operator/=(const complex& z) + { + ap::complex result; + double e; + double f; + if( fabs(z.y) +class template_1d_array +{ +public: + template_1d_array() + { + m_Vec=0; + m_iVecSize = 0; + m_iLow = 0; + m_iHigh = -1; + }; + + ~template_1d_array() + { + if(m_Vec) + { + if( Aligned ) + ap::afree(m_Vec); + else + delete[] m_Vec; + } + }; + + template_1d_array(const template_1d_array &rhs) + { + m_Vec=0; + m_iVecSize = 0; + m_iLow = 0; + m_iHigh = -1; + if( rhs.m_iVecSize!=0 ) + setcontent(rhs.m_iLow, rhs.m_iHigh, rhs.getcontent()); + }; + + + const template_1d_array& operator=(const template_1d_array &rhs) + { + if( this==&rhs ) + return *this; + + if( rhs.m_iVecSize!=0 ) + setcontent(rhs.m_iLow, rhs.m_iHigh, rhs.getcontent()); + else + { + m_Vec=0; + m_iVecSize = 0; + m_iLow = 0; + m_iHigh = -1; + } + return *this; + }; + + + const T& operator()(int i) const + { + #ifndef NO_AP_ASSERT + ap_error::make_assertion(i>=m_iLow && i<=m_iHigh); + #endif + return m_Vec[ i-m_iLow ]; + }; + + + T& operator()(int i) + { + #ifndef NO_AP_ASSERT + ap_error::make_assertion(i>=m_iLow && i<=m_iHigh); + #endif + return m_Vec[ i-m_iLow ]; + }; + + + void setbounds( int iLow, int iHigh ) + { + if(m_Vec) + { + if( Aligned ) + ap::afree(m_Vec); + else + delete[] m_Vec; + } + m_iLow = iLow; + m_iHigh = iHigh; + m_iVecSize = iHigh-iLow+1; + if( Aligned ) + m_Vec = (T*)ap::amalloc(m_iVecSize*sizeof(T), 16); + else + m_Vec = new T[m_iVecSize]; + }; + + + void setcontent( int iLow, int iHigh, const T *pContent ) + { + setbounds(iLow, iHigh); + for(int i=0; i getvector(int iStart, int iEnd) + { + if( iStart>iEnd || wrongIdx(iStart) || wrongIdx(iEnd) ) + return raw_vector(0, 0, 1); + else + return raw_vector(m_Vec+iStart-m_iLow, iEnd-iStart+1, 1); + }; + + + const_raw_vector getvector(int iStart, int iEnd) const + { + if( iStart>iEnd || wrongIdx(iStart) || wrongIdx(iEnd) ) + return const_raw_vector(0, 0, 1); + else + return const_raw_vector(m_Vec+iStart-m_iLow, iEnd-iStart+1, 1); + }; +private: + bool wrongIdx(int i) const { return im_iHigh; }; + + T *m_Vec; + long m_iVecSize; + long m_iLow, m_iHigh; +}; + + + +/******************************************************************** +Template of a dynamical two-dimensional array +********************************************************************/ +template +class template_2d_array +{ +public: + template_2d_array() + { + m_Vec=0; + m_iVecSize=0; + m_iLow1 = 0; + m_iHigh1 = -1; + m_iLow2 = 0; + m_iHigh2 = -1; + }; + + ~template_2d_array() + { + if(m_Vec) + { + if( Aligned ) + ap::afree(m_Vec); + else + delete[] m_Vec; + } + }; + + template_2d_array(const template_2d_array &rhs) + { + m_Vec=0; + m_iVecSize=0; + m_iLow1 = 0; + m_iHigh1 = -1; + m_iLow2 = 0; + m_iHigh2 = -1; + if( rhs.m_iVecSize!=0 ) + { + setbounds(rhs.m_iLow1, rhs.m_iHigh1, rhs.m_iLow2, rhs.m_iHigh2); + for(int i=m_iLow1; i<=m_iHigh1; i++) + vmove(&(operator()(i,m_iLow2)), &(rhs(i,m_iLow2)), m_iHigh2-m_iLow2+1); + } + }; + const template_2d_array& operator=(const template_2d_array &rhs) + { + if( this==&rhs ) + return *this; + + if( rhs.m_iVecSize!=0 ) + { + setbounds(rhs.m_iLow1, rhs.m_iHigh1, rhs.m_iLow2, rhs.m_iHigh2); + for(int i=m_iLow1; i<=m_iHigh1; i++) + vmove(&(operator()(i,m_iLow2)), &(rhs(i,m_iLow2)), m_iHigh2-m_iLow2+1); + } + else + { + m_Vec=0; + m_iVecSize=0; + m_iLow1 = 0; + m_iHigh1 = -1; + m_iLow2 = 0; + m_iHigh2 = -1; + } + return *this; + }; + + const T& operator()(int i1, int i2) const + { + #ifndef NO_AP_ASSERT + ap_error::make_assertion(i1>=m_iLow1 && i1<=m_iHigh1); + ap_error::make_assertion(i2>=m_iLow2 && i2<=m_iHigh2); + #endif + return m_Vec[ m_iConstOffset + i2 +i1*m_iLinearMember]; + }; + + T& operator()(int i1, int i2) + { + #ifndef NO_AP_ASSERT + ap_error::make_assertion(i1>=m_iLow1 && i1<=m_iHigh1); + ap_error::make_assertion(i2>=m_iLow2 && i2<=m_iHigh2); + #endif + return m_Vec[ m_iConstOffset + i2 +i1*m_iLinearMember]; + }; + + void setbounds( int iLow1, int iHigh1, int iLow2, int iHigh2 ) + { + if(m_Vec) + { + if( Aligned ) + ap::afree(m_Vec); + else + delete[] m_Vec; + } + int n1 = iHigh1-iLow1+1; + int n2 = iHigh2-iLow2+1; + m_iVecSize = n1*n2; + if( Aligned ) + { + //if( n2%2!=0 ) + while( (n2*sizeof(T))%16!=0 ) + { + n2++; + m_iVecSize += n1; + } + m_Vec = (T*)ap::amalloc(m_iVecSize*sizeof(T), 16); + } + else + m_Vec = new T[m_iVecSize]; + m_iLow1 = iLow1; + m_iHigh1 = iHigh1; + m_iLow2 = iLow2; + m_iHigh2 = iHigh2; + m_iConstOffset = -m_iLow2-m_iLow1*n2; + m_iLinearMember = n2; + }; + + void setcontent( int iLow1, int iHigh1, int iLow2, int iHigh2, const T *pContent ) + { + setbounds(iLow1, iHigh1, iLow2, iHigh2); + for(int i=m_iLow1; i<=m_iHigh1; i++, pContent += m_iHigh2-m_iLow2+1) + vmove(&(operator()(i,m_iLow2)), pContent, m_iHigh2-m_iLow2+1); + }; + + int getlowbound(int iBoundNum) const + { + return iBoundNum==1 ? m_iLow1 : m_iLow2; + }; + + int gethighbound(int iBoundNum) const + { + return iBoundNum==1 ? m_iHigh1 : m_iHigh2; + }; + + raw_vector getcolumn(int iColumn, int iRowStart, int iRowEnd) + { + if( (iRowStart>iRowEnd) || wrongColumn(iColumn) || wrongRow(iRowStart) ||wrongRow(iRowEnd) ) + return raw_vector(0, 0, 1); + else + return raw_vector(&((*this)(iRowStart, iColumn)), iRowEnd-iRowStart+1, m_iLinearMember); + }; + + raw_vector getrow(int iRow, int iColumnStart, int iColumnEnd) + { + if( (iColumnStart>iColumnEnd) || wrongRow(iRow) || wrongColumn(iColumnStart) || wrongColumn(iColumnEnd)) + return raw_vector(0, 0, 1); + else + return raw_vector(&((*this)(iRow, iColumnStart)), iColumnEnd-iColumnStart+1, 1); + }; + + const_raw_vector getcolumn(int iColumn, int iRowStart, int iRowEnd) const + { + if( (iRowStart>iRowEnd) || wrongColumn(iColumn) || wrongRow(iRowStart) ||wrongRow(iRowEnd) ) + return const_raw_vector(0, 0, 1); + else + return const_raw_vector(&((*this)(iRowStart, iColumn)), iRowEnd-iRowStart+1, m_iLinearMember); + }; + + const_raw_vector getrow(int iRow, int iColumnStart, int iColumnEnd) const + { + if( (iColumnStart>iColumnEnd) || wrongRow(iRow) || wrongColumn(iColumnStart) || wrongColumn(iColumnEnd)) + return const_raw_vector(0, 0, 1); + else + return const_raw_vector(&((*this)(iRow, iColumnStart)), iColumnEnd-iColumnStart+1, 1); + }; +private: + bool wrongRow(int i) const { return im_iHigh1; }; + bool wrongColumn(int j) const { return jm_iHigh2; }; + + T *m_Vec; + long m_iVecSize; + long m_iLow1, m_iLow2, m_iHigh1, m_iHigh2; + long m_iConstOffset, m_iLinearMember; +}; + + +typedef template_1d_array integer_1d_array; +typedef template_1d_array real_1d_array; +typedef template_1d_array complex_1d_array; +typedef template_1d_array boolean_1d_array; + +typedef template_2d_array integer_2d_array; +typedef template_2d_array real_2d_array; +typedef template_2d_array complex_2d_array; +typedef template_2d_array boolean_2d_array; + + +/******************************************************************** +Constants and functions introduced for compatibility with AlgoPascal +********************************************************************/ +extern const double machineepsilon; +extern const double maxrealnumber; +extern const double minrealnumber; + +int sign(double x); +double randomreal(); +int randominteger(int maxv); +int round(double x); +int trunc(double x); +int ifloor(double x); +int iceil(double x); +double pi(); +double sqr(double x); +int maxint(int m1, int m2); +int minint(int m1, int m2); +double maxreal(double m1, double m2); +double minreal(double m1, double m2); + +};//namespace ap + + +#endif diff --git a/simulation/externals/bfgs/apvt.h b/simulation/externals/bfgs/apvt.h new file mode 100644 index 0000000..e98ec60 --- /dev/null +++ b/simulation/externals/bfgs/apvt.h @@ -0,0 +1,754 @@ +/******************************************************************** +Templates for AP Library +Copyright (c) 2003-2008, Sergey Bochkanov (ALGLIB project). +See www.alglib.net or alglib.sources.ru for details. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +- Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +- Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer listed + in this license in the documentation and/or other materials + provided with the distribution. + +- Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +********************************************************************/ +#ifndef APVT_H +#define APVT_H + +/******************************************************************** +Template defining vector in memory. It is used by the basic +subroutines of linear algebra. + +Vector consists of Length elements of type T, starting from an element, +which Data is pointed to. Interval between adjacent elements equals +the value of Step. + +The class provides an access for reading only. +********************************************************************/ +template +class const_raw_vector +{ +public: + const_raw_vector(const T *Data, int Length, int Step): + pData(const_cast(Data)),iLength(Length),iStep(Step){}; + + const T* GetData() const + { return pData; }; + + int GetLength() const + { return iLength; }; + + int GetStep() const + { return iStep; }; +protected: + T *pData; + int iLength, iStep; +}; + + +/******************************************************************** +Template defining vector in memory, derived from const_raw_vector. +It is used by the basic subroutines of linear algebra. + +Vector consists of Length elements of type T, starting from an element, +which Data is pointed to. Interval between adjacent elements equals +the value of Step. + +The class provides an access both for reading and writing. +********************************************************************/ +template +class raw_vector : public const_raw_vector +{ +public: + raw_vector(T *Data, int Length, int Step):const_raw_vector(Data, Length, Step){}; + + T* GetData() + { return const_raw_vector::pData; }; +}; + + +/******************************************************************** +Dot product +********************************************************************/ +template +T vdotproduct(const_raw_vector v1, const_raw_vector v2) +{ + ap_error::make_assertion(v1.GetLength()==v2.GetLength()); + if( v1.GetStep()==1 && v2.GetStep()==1 ) + { + // + // fast + // + T r = 0; + const T *p1 = v1.GetData(); + const T *p2 = v2.GetData(); + int imax = v1.GetLength()/4; + int i; + for(i=imax; i!=0; i--) + { + r += (*p1)*(*p2) + p1[1]*p2[1] + p1[2]*p2[2] + p1[3]*p2[3]; + p1+=4; + p2+=4; + } + for(i=0; i +T _vdotproduct(const T *v1, const T *v2, int N) +{ + T r = 0; + int imax = N/4; + int i; + for(i=imax; i!=0; i--) + { + r += (*v1)*(*v2) + v1[1]*v2[1] + v1[2]*v2[2] + v1[3]*v2[3]; + v1+=4; + v2+=4; + } + for(i=0; i +void vmove(raw_vector vdst, const_raw_vector vsrc) +{ + ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength()); + if( vdst.GetStep()==1 && vsrc.GetStep()==1 ) + { + // + // fast + // + T *p1 = vdst.GetData(); + const T *p2 = vsrc.GetData(); + int imax = vdst.GetLength()/2; + int i; + for(i=imax; i!=0; i--) + { + *p1 = *p2; + p1[1] = p2[1]; + p1 += 2; + p2 += 2; + } + if(vdst.GetLength()%2 != 0) + *p1 = *p2; + return; + } + else + { + // + // general + // + int offset11 = vdst.GetStep(), offset12 = 2*offset11, offset13 = 3*offset11, offset14 = 4*offset11; + int offset21 = vsrc.GetStep(), offset22 = 2*offset21, offset23 = 3*offset21, offset24 = 4*offset21; + T *p1 = vdst.GetData(); + const T *p2 = vsrc.GetData(); + int imax = vdst.GetLength()/4; + int i; + for(i=0; i +void _vmove(T *vdst, const T* vsrc, int N) +{ + int imax = N/2; + int i; + for(i=imax; i!=0; i--) + { + *vdst = *vsrc; + vdst[1] = vsrc[1]; + vdst += 2; + vsrc += 2; + } + if(N%2!=0) + *vdst = *vsrc; +} + + +/******************************************************************** +Copy one vector multiplied by -1 into another. +********************************************************************/ +template +void vmoveneg(raw_vector vdst, const_raw_vector vsrc) +{ + ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength()); + if( vdst.GetStep()==1 && vsrc.GetStep()==1 ) + { + // + // fast + // + T *p1 = vdst.GetData(); + const T *p2 = vsrc.GetData(); + int imax = vdst.GetLength()/2; + int i; + for(i=0; i +void _vmoveneg(T *vdst, const T *vsrc, int N) +{ + T *p1 = vdst; + const T *p2 = vsrc; + int imax = N/2; + int i; + for(i=0; i +void vmove(raw_vector vdst, const_raw_vector vsrc, T2 alpha) +{ + ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength()); + if( vdst.GetStep()==1 && vsrc.GetStep()==1 ) + { + // + // fast + // + T *p1 = vdst.GetData(); + const T *p2 = vsrc.GetData(); + int imax = vdst.GetLength()/4; + int i; + for(i=imax; i!=0; i--) + { + *p1 = alpha*(*p2); + p1[1] = alpha*p2[1]; + p1[2] = alpha*p2[2]; + p1[3] = alpha*p2[3]; + p1 += 4; + p2 += 4; + } + for(i=0; i +void _vmove(T *vdst, const T *vsrc, int N, T2 alpha) +{ + T *p1 = vdst; + const T *p2 = vsrc; + int imax = N/4; + int i; + for(i=imax; i!=0; i--) + { + *p1 = alpha*(*p2); + p1[1] = alpha*p2[1]; + p1[2] = alpha*p2[2]; + p1[3] = alpha*p2[3]; + p1 += 4; + p2 += 4; + } + for(i=0; i +void vadd(raw_vector vdst, const_raw_vector vsrc) +{ + ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength()); + if( vdst.GetStep()==1 && vsrc.GetStep()==1 ) + { + // + // fast + // + T *p1 = vdst.GetData(); + const T *p2 = vsrc.GetData(); + int imax = vdst.GetLength()/4; + int i; + for(i=imax; i!=0; i--) + { + *p1 += *p2; + p1[1] += p2[1]; + p1[2] += p2[2]; + p1[3] += p2[3]; + p1 += 4; + p2 += 4; + } + for(i=0; i +void _vadd(T *vdst, const T *vsrc, int N) +{ + T *p1 = vdst; + const T *p2 = vsrc; + int imax = N/4; + int i; + for(i=imax; i!=0; i--) + { + *p1 += *p2; + p1[1] += p2[1]; + p1[2] += p2[2]; + p1[3] += p2[3]; + p1 += 4; + p2 += 4; + } + for(i=0; i +void vadd(raw_vector vdst, const_raw_vector vsrc, T2 alpha) +{ + ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength()); + if( vdst.GetStep()==1 && vsrc.GetStep()==1 ) + { + // + // fast + // + T *p1 = vdst.GetData(); + const T *p2 = vsrc.GetData(); + int imax = vdst.GetLength()/4; + int i; + for(i=imax; i!=0; i--) + { + *p1 += alpha*(*p2); + p1[1] += alpha*p2[1]; + p1[2] += alpha*p2[2]; + p1[3] += alpha*p2[3]; + p1 += 4; + p2 += 4; + } + for(i=0; i +void _vadd(T *vdst, const T *vsrc, int N, T2 alpha) +{ + T *p1 = vdst; + const T *p2 = vsrc; + int imax = N/4; + int i; + for(i=imax; i!=0; i--) + { + *p1 += alpha*(*p2); + p1[1] += alpha*p2[1]; + p1[2] += alpha*p2[2]; + p1[3] += alpha*p2[3]; + p1 += 4; + p2 += 4; + } + for(i=0; i +void vsub(raw_vector vdst, const_raw_vector vsrc) +{ + ap_error::make_assertion(vdst.GetLength()==vsrc.GetLength()); + if( vdst.GetStep()==1 && vsrc.GetStep()==1 ) + { + // + // fast + // + T *p1 = vdst.GetData(); + const T *p2 = vsrc.GetData(); + int imax = vdst.GetLength()/4; + int i; + for(i=imax; i!=0; i--) + { + *p1 -= *p2; + p1[1] -= p2[1]; + p1[2] -= p2[2]; + p1[3] -= p2[3]; + p1 += 4; + p2 += 4; + } + for(i=0; i +void _vsub(T *vdst, const T *vsrc, int N) +{ + T *p1 = vdst; + const T *p2 = vsrc; + int imax = N/4; + int i; + for(i=imax; i!=0; i--) + { + *p1 -= *p2; + p1[1] -= p2[1]; + p1[2] -= p2[2]; + p1[3] -= p2[3]; + p1 += 4; + p2 += 4; + } + for(i=0; i +void vsub(raw_vector vdst, const_raw_vector vsrc, T2 alpha) +{ + vadd(vdst, vsrc, -alpha); +} + + +/******************************************************************** +vsub, another form +********************************************************************/ +template +void _vsub(T *vdst, const T *vsrc, int N, T2 alpha) +{ + _vadd(vdst, vsrc, N, -alpha); +} + + +/******************************************************************** +In-place vector multiplication +********************************************************************/ +template +void vmul(raw_vector vdst, T2 alpha) +{ + if( vdst.GetStep()==1 ) + { + // + // fast + // + T *p1 = vdst.GetData(); + int imax = vdst.GetLength()/4; + int i; + for(i=imax; i!=0; i--) + { + *p1 *= alpha; + p1[1] *= alpha; + p1[2] *= alpha; + p1[3] *= alpha; + p1 += 4; + } + for(i=0; i +void _vmul(T *vdst, int N, T2 alpha) +{ + T *p1 = vdst; + int imax = N/4; + int i; + for(i=imax; i!=0; i--) + { + *p1 *= alpha; + p1[1] *= alpha; + p1[2] *= alpha; + p1[3] *= alpha; + p1 += 4; + } + for(i=0; i +#include "lbfgsb.h" + +void lbfgsbactive(const int& n, + const ap::real_1d_array& l, + const ap::real_1d_array& u, + const ap::integer_1d_array& nbd, + ap::real_1d_array& x, + ap::integer_1d_array& iwhere, + bool& prjctd, + bool& cnstnd, + bool& boxed); +void lbfgsbbmv(const int& m, + const ap::real_2d_array& sy, + ap::real_2d_array& wt, + const int& col, + const ap::real_1d_array& v, + ap::real_1d_array& p, + int& info, + ap::real_1d_array& workvec); +void lbfgsbcauchy(const int& n, + const ap::real_1d_array& x, + const ap::real_1d_array& l, + const ap::real_1d_array& u, + const ap::integer_1d_array& nbd, + const ap::real_1d_array& g, + ap::integer_1d_array& iorder, + ap::integer_1d_array& iwhere, + ap::real_1d_array& t, + ap::real_1d_array& d, + ap::real_1d_array& xcp, + const int& m, + const ap::real_2d_array& wy, + const ap::real_2d_array& ws, + const ap::real_2d_array& sy, + ap::real_2d_array& wt, + const double& theta, + const int& col, + const int& head, + ap::real_1d_array& p, + ap::real_1d_array& c, + ap::real_1d_array& wbp, + ap::real_1d_array& v, + int& nint, + const ap::real_1d_array& sg, + const ap::real_1d_array& yg, + const double& sbgnrm, + int& info, + ap::real_1d_array& workvec); +void lbfgsbcmprlb(const int& n, + const int& m, + const ap::real_1d_array& x, + const ap::real_1d_array& g, + const ap::real_2d_array& ws, + const ap::real_2d_array& wy, + const ap::real_2d_array& sy, + ap::real_2d_array& wt, + const ap::real_1d_array& z, + ap::real_1d_array& r, + ap::real_1d_array& wa, + const ap::integer_1d_array& index, + const double& theta, + const int& col, + const int& head, + const int& nfree, + const bool& cnstnd, + int& info, + ap::real_1d_array& workvec, + ap::real_1d_array& workvec2); +void lbfgsberrclb(const int& n, + const int& m, + const double& factr, + const ap::real_1d_array& l, + const ap::real_1d_array& u, + const ap::integer_1d_array& nbd, + int& task, + int& info, + int& k); +void lbfgsbformk(const int& n, + const int& nsub, + const ap::integer_1d_array& ind, + const int& nenter, + const int& ileave, + const ap::integer_1d_array& indx2, + const int& iupdat, + const bool& updatd, + ap::real_2d_array& wn, + ap::real_2d_array& wn1, + const int& m, + const ap::real_2d_array& ws, + const ap::real_2d_array& wy, + const ap::real_2d_array& sy, + const double& theta, + const int& col, + const int& head, + int& info, + ap::real_1d_array& workvec, + ap::real_2d_array& workmat); +void lbfgsbformt(const int& m, + ap::real_2d_array& wt, + const ap::real_2d_array& sy, + const ap::real_2d_array& ss, + const int& col, + const double& theta, + int& info); +void lbfgsbfreev(const int& n, + int& nfree, + ap::integer_1d_array& index, + int& nenter, + int& ileave, + ap::integer_1d_array& indx2, + const ap::integer_1d_array& iwhere, + bool& wrk, + const bool& updatd, + const bool& cnstnd, + const int& iter); +void lbfgsbhpsolb(const int& n, + ap::real_1d_array& t, + ap::integer_1d_array& iorder, + const int& iheap); +void lbfgsblnsrlb(const int& n, + const ap::real_1d_array& l, + const ap::real_1d_array& u, + const ap::integer_1d_array& nbd, + ap::real_1d_array& x, + const double& f, + double& fold, + double& gd, + double& gdold, + const ap::real_1d_array& g, + const ap::real_1d_array& d, + ap::real_1d_array& r, + ap::real_1d_array& t, + const ap::real_1d_array& z, + double& stp, + double& dnrm, + double& dtd, + double& xstep, + double& stpmx, + const int& iter, + int& ifun, + int& iback, + int& nfgv, + int& info, + int& task, + const bool& boxed, + const bool& cnstnd, + int& csave, + ap::integer_1d_array& isave, + ap::real_1d_array& dsave); +void lbfgsbmatupd(const int& n, + const int& m, + ap::real_2d_array& ws, + ap::real_2d_array& wy, + ap::real_2d_array& sy, + ap::real_2d_array& ss, + const ap::real_1d_array& d, + const ap::real_1d_array& r, + int& itail, + const int& iupdat, + int& col, + int& head, + double& theta, + const double& rr, + const double& dr, + const double& stp, + const double& dtd); +void lbfgsbprojgr(const int& n, + const ap::real_1d_array& l, + const ap::real_1d_array& u, + const ap::integer_1d_array& nbd, + const ap::real_1d_array& x, + const ap::real_1d_array& g, + double& sbgnrm); +void lbfgsbsubsm(const int& n, + const int& m, + const int& nsub, + const ap::integer_1d_array& ind, + const ap::real_1d_array& l, + const ap::real_1d_array& u, + const ap::integer_1d_array& nbd, + ap::real_1d_array& x, + ap::real_1d_array& d, + const ap::real_2d_array& ws, + const ap::real_2d_array& wy, + const double& theta, + const int& col, + const int& head, + int& iword, + ap::real_1d_array& wv, + ap::real_2d_array& wn, + int& info); +void lbfgsbdcsrch(const double& f, + const double& g, + double& stp, + const double& ftol, + const double& gtol, + const double& xtol, + const double& stpmin, + const double& stpmax, + int& task, + ap::integer_1d_array& isave, + ap::real_1d_array& dsave, + int& addinfo); +void lbfgsbdcstep(double& stx, + double& fx, + double& dx, + double& sty, + double& fy, + double& dy, + double& stp, + const double& fp, + const double& dp, + bool& brackt, + const double& stpmin, + const double& stpmax); +bool additionallbfgsbstoppingcriterion(int iter, + const ap::real_1d_array& x, + double f, + const ap::real_1d_array& g); +bool lbfgsbdpofa(ap::real_2d_array& a, const int& n); +void lbfgsbdtrsl(ap::real_2d_array& t, + const int& n, + ap::real_1d_array& b, + const int& job, + int& info); +void lbfgsbnewiteration(const ap::real_1d_array& x, + double f, + const ap::real_1d_array& g); + +/************************************************************************* +The subroutine minimizes the function F(x) of N arguments with simple +constraints using a quasi-Newton method (LBFGS scheme) which is optimized +to use a minimum amount of memory. + +The subroutine generates the approximation of an inverse Hessian matrix by +using information about the last M steps of the algorithm (instead of N). +It lessens a required amount of memory from a value of order N^2 to a +value of order 2*N*M. + +This subroutine uses the FuncGrad subroutine which calculates the value of +the function F and gradient G in point X. The programmer should define the +FuncGrad subroutine by himself. It should be noted that the subroutine +doesn't need to waste time for memory allocation of array G, because the +memory is allocated in calling the subroutine. Setting a dimension of +array G each time when calling a subroutine will excessively slow down an +algorithm. + +The programmer could also redefine the LBFGSNewIteration subroutine which +is called on each new step. The current point X, the function value F and +the gradient G are passed into this subroutine. It is reasonable to +redefine the subroutine for better debugging, for example, to visualize +the solution process. + +Input parameters: + N - problem dimension. N>0 + M - number of corrections in the BFGS scheme of Hessian + approximation update. Recommended value: 3<=M<=7. The + smaller value causes worse convergence, the bigger will + not cause a considerably better convergence, but will + cause a fall in the performance. M<=N. + X - initial solution approximation. + Array whose index ranges from 1 to N. + EpsG - positive number which defines a precision of search. The + subroutine finishes its work if the condition ||G|| < EpsG + is satisfied, where ||.|| means Euclidian norm, G - gradient + projection onto a feasible set, X - current approximation. + EpsF - positive number which defines a precision of search. The + subroutine finishes its work if on iteration number k+1 + the condition |F(k+1)-F(k)| <= EpsF*max{|F(k)|, |F(k+1)|, 1} + is satisfied. + EpsX - positive number which defines a precision of search. The + subroutine finishes its work if on iteration number k+1 + the condition |X(k+1)-X(k)| <= EpsX is satisfied. + MaxIts - maximum number of iterations. + If MaxIts=0, the number of iterations is unlimited. + NBD - constraint type. If NBD(i) is equal to: + * 0, X(i) has no constraints, + * 1, X(i) has only lower boundary, + * 2, X(i) has both lower and upper boundaries, + * 3, X(i) has only upper boundary, + Array whose index ranges from 1 to N. + L - lower boundaries of X(i) variables. + Array whose index ranges from 1 to N. + U - upper boundaries of X(i) variables. + Array whose index ranges from 1 to N. + +Output parameters: + X - solution approximation. +Array whose index ranges from 1 to N. + Info - a return code: + * -2 unknown internal error, + * -1 wrong parameters were specified, + * 0 interrupted by user, + * 1 relative function decreasing is less or equal to EpsF, + * 2 step is less or equal to EpsX, + * 4 gradient norm is less or equal to EpsG, + * 5 number of iterations exceeds MaxIts. + +FuncGrad routine description. User-defined. +Input parameters: + X - array whose index ranges from 1 to N. +Output parameters: + F - function value at X. + G - function gradient. + Array whose index ranges from 1 to N. +The memory for array G has already been allocated in the calling subroutine, +and it isn't necessary to allocate it in the FuncGrad subroutine. + + NEOS, November 1994. (Latest revision June 1996.) + Optimization Technology Center. + Argonne National Laboratory and Northwestern University. + + Written by Ciyou Zhu in collaboration with + R.H. Byrd, P. Lu-Chen and J. Nocedal. +*************************************************************************/ +void lbfgsbminimize(const int& n, + const int& m, + ap::real_1d_array& x, + const double& epsg, + const double& epsf, + const double& epsx, + const int& maxits, + const ap::integer_1d_array& nbd, + const ap::real_1d_array& l, + const ap::real_1d_array& u, + int& info) +{ + double f; + ap::real_1d_array g; + ap::real_1d_array xold; + ap::real_1d_array xdiff; + ap::real_2d_array ws; + ap::real_2d_array wy; + ap::real_2d_array sy; + ap::real_2d_array ss; + ap::real_2d_array yy; + ap::real_2d_array wt; + ap::real_2d_array wn; + ap::real_2d_array snd; + ap::real_1d_array z; + ap::real_1d_array r; + ap::real_1d_array d; + ap::real_1d_array t; + ap::real_1d_array wa; + ap::real_1d_array sg; + ap::real_1d_array sgo; + ap::real_1d_array yg; + ap::real_1d_array ygo; + ap::integer_1d_array index; + ap::integer_1d_array iwhere; + ap::integer_1d_array indx2; + int csave; + ap::boolean_1d_array lsave; + ap::integer_1d_array isave; + ap::real_1d_array dsave; + int task; + bool prjctd; + bool cnstnd; + bool boxed; + bool updatd; + bool wrk; + int i; + int k; + int nintol; + int iback; + int nskip; + int head; + int col; + int iter; + int itail; + int iupdat; + int nint; + int nfgv; + int internalinfo; + int ifun; + int iword; + int nfree; + int nact; + int ileave; + int nenter; + double theta; + double fold; + double dr; + double rr; + double dnrm; + double xstep; + double sbgnrm; + double ddum; + double dtd; + double gd; + double gdold; + double stp; + double stpmx; + double tf; + ap::real_1d_array workvec; + ap::real_1d_array workvec2; + ap::real_1d_array dsave13; + ap::real_1d_array wa0; + ap::real_1d_array wa1; + ap::real_1d_array wa2; + ap::real_1d_array wa3; + ap::real_2d_array workmat; + ap::integer_1d_array isave2; + + workvec.setbounds(1, m); + workvec2.setbounds(1, 2*m); + workmat.setbounds(1, m, 1, m); + isave2.setbounds(1, 2); + dsave13.setbounds(1, 13); + wa0.setbounds(1, 2*m); + wa1.setbounds(1, 2*m); + wa2.setbounds(1, 2*m); + wa3.setbounds(1, 2*m); + g.setbounds(1, n); + xold.setbounds(1, n); + xdiff.setbounds(1, n); + ws.setbounds(1, n, 1, m); + wy.setbounds(1, n, 1, m); + sy.setbounds(1, m, 1, m); + ss.setbounds(1, m, 1, m); + yy.setbounds(1, m, 1, m); + wt.setbounds(1, m, 1, m); + wn.setbounds(1, 2*m, 1, 2*m); + snd.setbounds(1, 2*m, 1, 2*m); + z.setbounds(1, n); + r.setbounds(1, n); + d.setbounds(1, n); + t.setbounds(1, n); + wa.setbounds(1, 8*m); + sg.setbounds(1, m); + sgo.setbounds(1, m); + yg.setbounds(1, m); + ygo.setbounds(1, m); + index.setbounds(1, n); + iwhere.setbounds(1, n); + indx2.setbounds(1, n); + lsave.setbounds(1, 4); + isave.setbounds(1, 23); + dsave.setbounds(1, 29); + col = 0; + head = 1; + theta = 1; + iupdat = 0; + updatd = false; + iter = 0; + nfgv = 0; + nint = 0; + nintol = 0; + nskip = 0; + nfree = n; + internalinfo = 0; + lbfgsberrclb(n, m, epsf, l, u, nbd, task, internalinfo, k); + if( task==2||maxits<0||epsg<0||epsx<0 ) + { + info = -1; + return; + } + lbfgsbactive(n, l, u, nbd, x, iwhere, prjctd, cnstnd, boxed); + ap::vmove(&xold(1), &x(1), ap::vlen(1,n)); + funcgrad(x, f, g); + // added for debug + if (bShowTestResults) + { + printf("FucnCall: %d\tEnergy: %.16e\n", nFuncCall, f); + fprintf(f_result, "%d %d %.16e\n", numIter, nFuncCall, f); + } + // finish debug + nfgv = 1; + lbfgsbprojgr(n, l, u, nbd, x, g, sbgnrm); + if( sbgnrm<=epsg ) + { + info = 4; + return; + } + while(true) + { + printf("-------------------------------------Iter %2d------------------------------------\n", iter + 1); + iword = -1; + if( !cnstnd&&col>0 ) + { + ap::vmove(&z(1), &x(1), ap::vlen(1,n)); + wrk = updatd; + nint = 0; + } + else + { + ap::vmove(&wa0(1), &wa(1), ap::vlen(1,2*m)); + ap::vmove(&wa1(1), &wa(2*m+1), ap::vlen(1,2*m)); + ap::vmove(&wa2(1), &wa(4*m+1), ap::vlen(1,2*m)); + ap::vmove(&wa3(1), &wa(6*m+1), ap::vlen(1,2*m)); + lbfgsbcauchy(n, x, l, u, nbd, g, indx2, iwhere, t, d, z, m, wy, ws, sy, wt, theta, col, head, wa0, wa1, wa2, wa3, nint, sg, yg, sbgnrm, internalinfo, workvec); + ap::vmove(&wa(1), &wa0(1), ap::vlen(1,2*m)); + ap::vmove(&wa(2*m+1), &wa1(1), ap::vlen(2*m+1,4*m)); + ap::vmove(&wa(4*m+1), &wa2(1), ap::vlen(4*m+1,6*m)); + ap::vmove(&wa(6*m+1), &wa3(1), ap::vlen(6*m+1,8*m)); + if( internalinfo!=0 ) + { + internalinfo = 0; + col = 0; + head = 1; + theta = 1; + iupdat = 0; + updatd = false; + continue; + } + nintol = nintol+nint; + lbfgsbfreev(n, nfree, index, nenter, ileave, indx2, iwhere, wrk, updatd, cnstnd, iter); + nact = n-nfree; + } + if( nfree!=0&&col!=0 ) + { + if( wrk ) + { + lbfgsbformk(n, nfree, index, nenter, ileave, indx2, iupdat, updatd, wn, snd, m, ws, wy, sy, theta, col, head, internalinfo, workvec, workmat); + } + if( internalinfo!=0 ) + { + internalinfo = 0; + col = 0; + head = 1; + theta = 1; + iupdat = 0; + updatd = false; + continue; + } + lbfgsbcmprlb(n, m, x, g, ws, wy, sy, wt, z, r, wa, index, theta, col, head, nfree, cnstnd, internalinfo, workvec, workvec2); + if( internalinfo==0 ) + { + lbfgsbsubsm(n, m, nfree, index, l, u, nbd, z, r, ws, wy, theta, col, head, iword, wa, wn, internalinfo); + } + if( internalinfo!=0 ) + { + internalinfo = 0; + col = 0; + head = 1; + theta = 1; + iupdat = 0; + updatd = false; + continue; + } + } + for(i = 1; i <= n; i++) + { + d(i) = z(i)-x(i); + } + task = 0; + while(true) + { + lbfgsblnsrlb(n, l, u, nbd, x, f, fold, gd, gdold, g, d, r, t, z, stp, dnrm, dtd, xstep, stpmx, iter, ifun, iback, nfgv, internalinfo, task, boxed, cnstnd, csave, isave2, dsave13); + if( internalinfo!=0||iback>=20||task!=1 ) + { + break; + } + funcgrad(x, f, g); + } + if( internalinfo!=0 ) + { + ap::vmove(&x(1), &t(1), ap::vlen(1,n)); + ap::vmove(&g(1), &r(1), ap::vlen(1,n)); + f = fold; + if( col==0 ) + { + if( internalinfo==0 ) + { + internalinfo = -9; + nfgv = nfgv-1; + ifun = ifun-1; + iback = iback-1; + } + task = 2; + iter = iter+1; + info = -2; + return; + } + else + { + if( internalinfo==0 ) + { + nfgv = nfgv-1; + } + internalinfo = 0; + col = 0; + head = 1; + theta = 1; + iupdat = 0; + updatd = false; + continue; + } + } + iter = iter+1; + // added for debug + if (bShowTestResults) + { + numIter = iter; + bNewIteration = true; + printf("Iter %2d.\t", iter); + } + // finish debug + lbfgsbnewiteration(x, f, g); + lbfgsbprojgr(n, l, u, nbd, x, g, sbgnrm); + if( sbgnrm<=epsg ) + { + info = 4; + return; + } + ap::vmove(&xdiff(1), &xold(1), ap::vlen(1,n)); + ap::vsub(&xdiff(1), &x(1), ap::vlen(1,n)); + tf = ap::vdotproduct(&xdiff(1), &xdiff(1), ap::vlen(1,n)); + tf = sqrt(tf); + if( tf<=epsx ) + { + info = 2; + return; + } + ddum = ap::maxreal(fabs(fold), ap::maxreal(fabs(f), double(1))); + // added for debug + if (bShowTestResults) + { + printf("FucnCall: %d\tEnergy: %.16e\n", nFuncCall, f); + fprintf(f_result, "%d %d %.16e\n", numIter, nFuncCall, f); + } + // finish debug + if( fold-f<=epsf*ddum ) + { + info = 1; + return; + } + if( iter>maxits&&maxits>0 ) + { + info = 5; + return; + } + if( additionallbfgsbstoppingcriterion(iter, x, f, g) ) + { + info = 0; + return; + } + ap::vmove(&xold(1), &x(1), ap::vlen(1,n)); + for(i = 1; i <= n; i++) + { + r(i) = g(i)-r(i); + } + rr = ap::vdotproduct(&r(1), &r(1), ap::vlen(1,n)); + if( stp==1 ) + { + dr = gd-gdold; + ddum = -gdold; + } + else + { + dr = (gd-gdold)*stp; + ap::vmul(&d(1), ap::vlen(1,n), stp); + ddum = -gdold*stp; + } + if( dr<=ap::machineepsilon*ddum ) + { + nskip = nskip+1; + updatd = false; + } + else + { + updatd = true; + iupdat = iupdat+1; + lbfgsbmatupd(n, m, ws, wy, sy, ss, d, r, itail, iupdat, col, head, theta, rr, dr, stp, dtd); + lbfgsbformt(m, wt, sy, ss, col, theta, internalinfo); + if( internalinfo!=0 ) + { + internalinfo = 0; + col = 0; + head = 1; + theta = 1; + iupdat = 0; + updatd = false; + continue; + } + } + } +} + + +void lbfgsbactive(const int& n, + const ap::real_1d_array& l, + const ap::real_1d_array& u, + const ap::integer_1d_array& nbd, + ap::real_1d_array& x, + ap::integer_1d_array& iwhere, + bool& prjctd, + bool& cnstnd, + bool& boxed) +{ + int nbdd; + int i; + + nbdd = 0; + prjctd = false; + cnstnd = false; + boxed = true; + for(i = 1; i <= n; i++) + { + if( nbd(i)>0 ) + { + if( nbd(i)<=2&&x(i)<=l(i) ) + { + if( x(i)=2&&x(i)>=u(i) ) + { + if( x(i)>u(i) ) + { + prjctd = true; + x(i) = u(i); + } + nbdd = nbdd+1; + } + } + } + } + for(i = 1; i <= n; i++) + { + if( nbd(i)!=2 ) + { + boxed = false; + } + if( nbd(i)==0 ) + { + iwhere(i) = -1; + } + else + { + cnstnd = true; + if( nbd(i)==2&&u(i)-l(i)<=0 ) + { + iwhere(i) = 3; + } + else + { + iwhere(i) = 0; + } + } + } +} + + +void lbfgsbbmv(const int& m, + const ap::real_2d_array& sy, + ap::real_2d_array& wt, + const int& col, + const ap::real_1d_array& v, + ap::real_1d_array& p, + int& info, + ap::real_1d_array& workvec) +{ + int i; + int k; + int i2; + double s; + + if( col==0 ) + { + return; + } + p(col+1) = v(col+1); + for(i = 2; i <= col; i++) + { + i2 = col+i; + s = 0.0; + for(k = 1; k <= i-1; k++) + { + s = s+sy(i,k)*v(k)/sy(k,k); + } + p(i2) = v(i2)+s; + } + ap::vmove(&workvec(1), &p(col+1), ap::vlen(1,col)); + lbfgsbdtrsl(wt, col, workvec, 11, info); + ap::vmove(&p(col+1), &workvec(1), ap::vlen(col+1,col+col)); + if( info!=0 ) + { + return; + } + for(i = 1; i <= col; i++) + { + p(i) = v(i)/sqrt(sy(i,i)); + } + ap::vmove(&workvec(1), &p(col+1), ap::vlen(1,col)); + lbfgsbdtrsl(wt, col, workvec, 1, info); + ap::vmove(&p(col+1), &workvec(1), ap::vlen(col+1,col+col)); + if( info!=0 ) + { + return; + } + for(i = 1; i <= col; i++) + { + p(i) = -p(i)/sqrt(sy(i,i)); + } + for(i = 1; i <= col; i++) + { + s = 0; + for(k = i+1; k <= col; k++) + { + s = s+sy(k,i)*p(col+k)/sy(i,i); + } + p(i) = p(i)+s; + } +} + + +void lbfgsbcauchy(const int& n, + const ap::real_1d_array& x, + const ap::real_1d_array& l, + const ap::real_1d_array& u, + const ap::integer_1d_array& nbd, + const ap::real_1d_array& g, + ap::integer_1d_array& iorder, + ap::integer_1d_array& iwhere, + ap::real_1d_array& t, + ap::real_1d_array& d, + ap::real_1d_array& xcp, + const int& m, + const ap::real_2d_array& wy, + const ap::real_2d_array& ws, + const ap::real_2d_array& sy, + ap::real_2d_array& wt, + const double& theta, + const int& col, + const int& head, + ap::real_1d_array& p, + ap::real_1d_array& c, + ap::real_1d_array& wbp, + ap::real_1d_array& v, + int& nint, + const ap::real_1d_array& sg, + const ap::real_1d_array& yg, + const double& sbgnrm, + int& info, + ap::real_1d_array& workvec) +{ + bool xlower; + bool xupper; + bool bnded; + int i; + int j; + int col2; + int nfree; + int nbreak; + int pointr; + int ibp; + int nleft; + int ibkmin; + int iter; + double f1; + double f2; + double dt; + double dtm; + double tsum; + double dibp; + double zibp; + double dibp2; + double bkmin; + double tu; + double tl; + double wmc; + double wmp; + double wmw; + double tj; + double tj0; + double neggi; + double f2org; + double tmpv; + + if( sbgnrm<=0 ) + { + ap::vmove(&xcp(1), &x(1), ap::vlen(1,n)); + return; + } + bnded = true; + nfree = n+1; + nbreak = 0; + ibkmin = 0; + bkmin = 0; + col2 = 2*col; + f1 = 0; + for(i = 1; i <= col2; i++) + { + p(i) = 0; + } + for(i = 1; i <= n; i++) + { + neggi = -g(i); + if( iwhere(i)!=3&&iwhere(i)!=-1 ) + { + tl = 0; + tu = 0; + if( nbd(i)<=2 ) + { + tl = x(i)-l(i); + } + if( nbd(i)>=2 ) + { + tu = u(i)-x(i); + } + xlower = nbd(i)<=2&&tl<=0; + xupper = nbd(i)>=2&&tu<=0; + iwhere(i) = 0; + if( xlower ) + { + if( neggi<=0 ) + { + iwhere(i) = 1; + } + } + else + { + if( xupper ) + { + if( neggi>=0 ) + { + iwhere(i) = 2; + } + } + else + { + if( fabs(neggi)<=0 ) + { + iwhere(i) = -3; + } + } + } + } + pointr = head; + if( iwhere(i)!=0&&iwhere(i)!=-1 ) + { + d(i) = 0; + } + else + { + d(i) = neggi; + f1 = f1-neggi*neggi; + for(j = 1; j <= col; j++) + { + p(j) = p(j)+wy(i,pointr)*neggi; + p(col+j) = p(col+j)+ws(i,pointr)*neggi; + pointr = pointr%m+1; + } + if( nbd(i)<=2&&nbd(i)!=0&&neggi<0 ) + { + nbreak = nbreak+1; + iorder(nbreak) = i; + t(nbreak) = tl/(-neggi); + if( nbreak==1||t(nbreak)=2&&neggi>0 ) + { + nbreak = nbreak+1; + iorder(nbreak) = i; + t(nbreak) = tu/neggi; + if( nbreak==1||t(nbreak)0 ) + { + bnded = false; + } + } + } + } + } + if( theta!=1 ) + { + ap::vmul(&p(col+1), ap::vlen(col+1,col+col), theta); + } + ap::vmove(&xcp(1), &x(1), ap::vlen(1,n)); + if( nbreak==0&&nfree==n+1 ) + { + return; + } + for(j = 1; j <= col2; j++) + { + c(j) = 0; + } + f2 = -theta*f1; + f2org = f2; + if( col>0 ) + { + lbfgsbbmv(m, sy, wt, col, p, v, info, workvec); + if( info!=0 ) + { + return; + } + tmpv = ap::vdotproduct(&v(1), &p(1), ap::vlen(1,col2)); + f2 = f2-tmpv; + } + dtm = -f1/f2; + tsum = 0; + nint = 1; + if( nbreak!=0 ) + { + nleft = nbreak; + iter = 1; + tj = 0; + while(true) + { + tj0 = tj; + if( iter==1 ) + { + tj = bkmin; + ibp = iorder(ibkmin); + } + else + { + if( iter==2 ) + { + if( ibkmin!=nbreak ) + { + t(ibkmin) = t(nbreak); + iorder(ibkmin) = iorder(nbreak); + } + } + lbfgsbhpsolb(nleft, t, iorder, iter-2); + tj = t(nleft); + ibp = iorder(nleft); + } + dt = tj-tj0; + if( dtm
0 ) + { + zibp = u(ibp)-x(ibp); + xcp(ibp) = u(ibp); + iwhere(ibp) = 2; + } + else + { + zibp = l(ibp)-x(ibp); + xcp(ibp) = l(ibp); + iwhere(ibp) = 1; + } + if( nleft==0&&nbreak==n ) + { + dtm = dt; + if( col>0 ) + { + ap::vadd(&c(1), &p(1), ap::vlen(1,col2), dtm); + } + return; + } + nint = nint+1; + dibp2 = ap::sqr(dibp); + f1 = f1+dt*f2+dibp2-theta*dibp*zibp; + f2 = f2-theta*dibp2; + if( col>0 ) + { + ap::vadd(&c(1), &p(1), ap::vlen(1,col2), dt); + pointr = head; + for(j = 1; j <= col; j++) + { + wbp(j) = wy(ibp,pointr); + wbp(col+j) = theta*ws(ibp,pointr); + pointr = pointr%m+1; + } + lbfgsbbmv(m, sy, wt, col, wbp, v, info, workvec); + if( info!=0 ) + { + return; + } + wmc = ap::vdotproduct(&c(1), &v(1), ap::vlen(1,col2)); + wmp = ap::vdotproduct(&p(1), &v(1), ap::vlen(1,col2)); + wmw = ap::vdotproduct(&wbp(1), &v(1), ap::vlen(1,col2)); + ap::vsub(&p(1), &wbp(1), ap::vlen(1,col2), dibp); + f1 = f1+dibp*wmc; + f2 = f2+2.0*dibp*wmp-dibp2*wmw; + } + f2 = ap::maxreal(ap::machineepsilon*f2org, f2); + if( nleft>0 ) + { + dtm = -f1/f2; + continue; + } + else + { + if( bnded ) + { + f1 = 0; + f2 = 0; + dtm = 0; + } + else + { + dtm = -f1/f2; + } + } + break; + } + } + if( dtm<=0 ) + { + dtm = 0; + } + tsum = tsum+dtm; + ap::vadd(&xcp(1), &d(1), ap::vlen(1,n), tsum); + if( col>0 ) + { + ap::vadd(&c(1), &p(1), ap::vlen(1,col2), dtm); + } +} + + +void lbfgsbcmprlb(const int& n, + const int& m, + const ap::real_1d_array& x, + const ap::real_1d_array& g, + const ap::real_2d_array& ws, + const ap::real_2d_array& wy, + const ap::real_2d_array& sy, + ap::real_2d_array& wt, + const ap::real_1d_array& z, + ap::real_1d_array& r, + ap::real_1d_array& wa, + const ap::integer_1d_array& index, + const double& theta, + const int& col, + const int& head, + const int& nfree, + const bool& cnstnd, + int& info, + ap::real_1d_array& workvec, + ap::real_1d_array& workvec2) +{ + int i; + int j; + int k; + int pointr; + double a1; + double a2; + + if( !cnstnd&&col>0 ) + { + for(i = 1; i <= n; i++) + { + r(i) = -g(i); + } + } + else + { + for(i = 1; i <= nfree; i++) + { + k = index(i); + r(i) = -theta*(z(k)-x(k))-g(k); + } + ap::vmove(&workvec2(1), &wa(2*m+1), ap::vlen(1,2*m)); + lbfgsbbmv(m, sy, wt, col, workvec2, wa, info, workvec); + ap::vmove(&wa(2*m+1), &workvec2(1), ap::vlen(2*m+1,4*m)); + if( info!=0 ) + { + info = -8; + return; + } + pointr = head; + for(j = 1; j <= col; j++) + { + a1 = wa(j); + a2 = theta*wa(col+j); + for(i = 1; i <= nfree; i++) + { + k = index(i); + r(i) = r(i)+wy(k,pointr)*a1+ws(k,pointr)*a2; + } + pointr = pointr%m+1; + } + } +} + + +void lbfgsberrclb(const int& n, + const int& m, + const double& factr, + const ap::real_1d_array& l, + const ap::real_1d_array& u, + const ap::integer_1d_array& nbd, + int& task, + int& info, + int& k) +{ + int i; + + if( n<=0 ) + { + task = 2; + } + if( m<=0 ) + { + task = 2; + } + if( m>n ) + { + task = 2; + } + if( factr<0 ) + { + task = 2; + } + for(i = 1; i <= n; i++) + { + if( nbd(i)<0||nbd(i)>3 ) + { + task = 2; + info = -6; + k = i; + } + if( nbd(i)==2 ) + { + if( l(i)>u(i) ) + { + task = 2; + info = -7; + k = i; + } + } + } +} + + +void lbfgsbformk(const int& n, + const int& nsub, + const ap::integer_1d_array& ind, + const int& nenter, + const int& ileave, + const ap::integer_1d_array& indx2, + const int& iupdat, + const bool& updatd, + ap::real_2d_array& wn, + ap::real_2d_array& wn1, + const int& m, + const ap::real_2d_array& ws, + const ap::real_2d_array& wy, + const ap::real_2d_array& sy, + const double& theta, + const int& col, + const int& head, + int& info, + ap::real_1d_array& workvec, + ap::real_2d_array& workmat) +{ + int m2; + int ipntr; + int jpntr; + int iy; + int iis; + int jy; + int js; + int is1; + int js1; + int k1; + int i; + int k; + int col2; + int pbegin; + int pend; + int dbegin; + int dend; + int upcl; + double temp1; + double temp2; + double temp3; + double temp4; + double v; + int j; + + if( updatd ) + { + if( iupdat>m ) + { + for(jy = 1; jy <= m-1; jy++) + { + js = m+jy; + ap::vmove(wn1.getcolumn(jy, jy, m-1), wn1.getcolumn(jy+1, jy+1, m)); + ap::vmove(wn1.getcolumn(js, js, js+m-jy-1), wn1.getcolumn(js+1, js+1, js+m-jy)); + ap::vmove(wn1.getcolumn(jy, m+1, m+m-1), wn1.getcolumn(jy+1, m+2, m+m)); + } + } + pbegin = 1; + pend = nsub; + dbegin = nsub+1; + dend = n; + iy = col; + iis = m+col; + ipntr = head+col-1; + if( ipntr>m ) + { + ipntr = ipntr-m; + } + jpntr = head; + for(jy = 1; jy <= col; jy++) + { + js = m+jy; + temp1 = 0; + temp2 = 0; + temp3 = 0; + for(k = pbegin; k <= pend; k++) + { + k1 = ind(k); + temp1 = temp1+wy(k1,ipntr)*wy(k1,jpntr); + } + for(k = dbegin; k <= dend; k++) + { + k1 = ind(k); + temp2 = temp2+ws(k1,ipntr)*ws(k1,jpntr); + temp3 = temp3+ws(k1,ipntr)*wy(k1,jpntr); + } + wn1(iy,jy) = temp1; + wn1(iis,js) = temp2; + wn1(iis,jy) = temp3; + jpntr = jpntr%m+1; + } + jy = col; + jpntr = head+col-1; + if( jpntr>m ) + { + jpntr = jpntr-m; + } + ipntr = head; + for(i = 1; i <= col; i++) + { + iis = m+i; + temp3 = 0; + for(k = pbegin; k <= pend; k++) + { + k1 = ind(k); + temp3 = temp3+ws(k1,ipntr)*wy(k1,jpntr); + } + ipntr = ipntr%m+1; + wn1(iis,jy) = temp3; + } + upcl = col-1; + } + else + { + upcl = col; + } + ipntr = head; + for(iy = 1; iy <= upcl; iy++) + { + iis = m+iy; + jpntr = head; + for(jy = 1; jy <= iy; jy++) + { + js = m+jy; + temp1 = 0; + temp2 = 0; + temp3 = 0; + temp4 = 0; + for(k = 1; k <= nenter; k++) + { + k1 = indx2(k); + temp1 = temp1+wy(k1,ipntr)*wy(k1,jpntr); + temp2 = temp2+ws(k1,ipntr)*ws(k1,jpntr); + } + for(k = ileave; k <= n; k++) + { + k1 = indx2(k); + temp3 = temp3+wy(k1,ipntr)*wy(k1,jpntr); + temp4 = temp4+ws(k1,ipntr)*ws(k1,jpntr); + } + wn1(iy,jy) = wn1(iy,jy)+temp1-temp3; + wn1(iis,js) = wn1(iis,js)-temp2+temp4; + jpntr = jpntr%m+1; + } + ipntr = ipntr%m+1; + } + ipntr = head; + for(iis = m+1; iis <= m+upcl; iis++) + { + jpntr = head; + for(jy = 1; jy <= upcl; jy++) + { + temp1 = 0; + temp3 = 0; + for(k = 1; k <= nenter; k++) + { + k1 = indx2(k); + temp1 = temp1+ws(k1,ipntr)*wy(k1,jpntr); + } + for(k = ileave; k <= n; k++) + { + k1 = indx2(k); + temp3 = temp3+ws(k1,ipntr)*wy(k1,jpntr); + } + if( iis<=jy+m ) + { + wn1(iis,jy) = wn1(iis,jy)+temp1-temp3; + } + else + { + wn1(iis,jy) = wn1(iis,jy)-temp1+temp3; + } + jpntr = jpntr%m+1; + } + ipntr = ipntr%m+1; + } + m2 = 2*m; + for(iy = 1; iy <= col; iy++) + { + iis = col+iy; + is1 = m+iy; + for(jy = 1; jy <= iy; jy++) + { + js = col+jy; + js1 = m+jy; + wn(jy,iy) = wn1(iy,jy)/theta; + wn(js,iis) = wn1(is1,js1)*theta; + } + for(jy = 1; jy <= iy-1; jy++) + { + wn(jy,iis) = -wn1(is1,jy); + } + for(jy = iy; jy <= col; jy++) + { + wn(jy,iis) = wn1(is1,jy); + } + wn(iy,iy) = wn(iy,iy)+sy(iy,iy); + } + info = 0; + if( !lbfgsbdpofa(wn, col) ) + { + info = -1; + return; + } + col2 = 2*col; + for(js = col+1; js <= col2; js++) + { + ap::vmove(workvec.getvector(1, col), wn.getcolumn(js, 1, col)); + lbfgsbdtrsl(wn, col, workvec, 11, info); + ap::vmove(wn.getcolumn(js, 1, col), workvec.getvector(1, col)); + } + for(iis = col+1; iis <= col2; iis++) + { + for(js = iis; js <= col2; js++) + { + v = ap::vdotproduct(wn.getcolumn(iis, 1, col), wn.getcolumn(js, 1, col)); + wn(iis,js) = wn(iis,js)+v; + } + } + for(j = 1; j <= col; j++) + { + ap::vmove(&workmat(j, 1), &wn(col+j, col+1), ap::vlen(1,col)); + } + info = 0; + if( !lbfgsbdpofa(workmat, col) ) + { + info = -2; + return; + } + for(j = 1; j <= col; j++) + { + ap::vmove(&wn(col+j, col+1), &workmat(j, 1), ap::vlen(col+1,col+col)); + } +} + + +void lbfgsbformt(const int& m, + ap::real_2d_array& wt, + const ap::real_2d_array& sy, + const ap::real_2d_array& ss, + const int& col, + const double& theta, + int& info) +{ + int i; + int j; + int k; + int k1; + double ddum; + + for(j = 1; j <= col; j++) + { + wt(1,j) = theta*ss(1,j); + } + for(i = 2; i <= col; i++) + { + for(j = i; j <= col; j++) + { + k1 = ap::minint(i, j)-1; + ddum = 0; + for(k = 1; k <= k1; k++) + { + ddum = ddum+sy(i,k)*sy(j,k)/sy(k,k); + } + wt(i,j) = ddum+theta*ss(i,j); + } + } + info = 0; + if( !lbfgsbdpofa(wt, col) ) + { + info = -3; + } +} + + +void lbfgsbfreev(const int& n, + int& nfree, + ap::integer_1d_array& index, + int& nenter, + int& ileave, + ap::integer_1d_array& indx2, + const ap::integer_1d_array& iwhere, + bool& wrk, + const bool& updatd, + const bool& cnstnd, + const int& iter) +{ + int iact; + int i; + int k; + + nenter = 0; + ileave = n+1; + if( iter>0&&cnstnd ) + { + for(i = 1; i <= nfree; i++) + { + k = index(i); + if( iwhere(k)>0 ) + { + ileave = ileave-1; + indx2(ileave) = k; + } + } + for(i = 1+nfree; i <= n; i++) + { + k = index(i); + if( iwhere(k)<=0 ) + { + nenter = nenter+1; + indx2(nenter) = k; + } + } + } + wrk = ileave0||updatd; + nfree = 0; + iact = n+1; + for(i = 1; i <= n; i++) + { + if( iwhere(i)<=0 ) + { + nfree = nfree+1; + index(nfree) = i; + } + else + { + iact = iact-1; + index(iact) = i; + } + } +} + + +void lbfgsbhpsolb(const int& n, + ap::real_1d_array& t, + ap::integer_1d_array& iorder, + const int& iheap) +{ + int i; + int j; + int k; + int indxin; + int indxou; + double ddum; + double dout; + + if( iheap==0 ) + { + for(k = 2; k <= n; k++) + { + ddum = t(k); + indxin = iorder(k); + i = k; + while(true) + { + if( i>1 ) + { + j = i/2; + if( ddum1 ) + { + i = 1; + dout = t(1); + indxou = iorder(1); + ddum = t(n); + indxin = iorder(n); + while(true) + { + j = i+i; + if( j<=n-1 ) + { + if( t(j+1)=0 ) + { + stpmx = 0; + } + else + { + if( a1*stpmx0&&nbd(i)>=2 ) + { + a2 = u(i)-x(i); + if( a2<=0 ) + { + stpmx = 0; + } + else + { + if( a1*stpmx>a2 ) + { + stpmx = a2/a1; + } + } + } + } + } + } + } + } + if( iter==0&&!boxed ) + { + stp = ap::minreal(1/dnrm, stpmx); + } + else + { + stp = 1; + } + ap::vmove(&t(1), &x(1), ap::vlen(1,n)); + ap::vmove(&r(1), &g(1), ap::vlen(1,n)); + fold = f; + ifun = 0; + iback = 0; + csave = 0; + } + v = ap::vdotproduct(&g(1), &d(1), ap::vlen(1,n)); + gd = v; + if( ifun==0 ) + { + gdold = gd; + if( gd>=0 ) + { + info = -4; + return; + } + } + lbfgsbdcsrch(f, gd, stp, ftol, gtol, xtol, double(0), stpmx, csave, isave, dsave, addinfo); + xstep = stp*dnrm; + if( csave!=4&&csave!=3 ) + { + task = 1; + ifun = ifun+1; + nfgv = nfgv+1; + iback = ifun-1; + if( stp==1 ) + { + ap::vmove(&x(1), &z(1), ap::vlen(1,n)); + } + else + { + for(i = 1; i <= n; i++) + { + x(i) = stp*d(i)+t(i); + } + } + } + else + { + task = 5; + } +} + + +void lbfgsbmatupd(const int& n, + const int& m, + ap::real_2d_array& ws, + ap::real_2d_array& wy, + ap::real_2d_array& sy, + ap::real_2d_array& ss, + const ap::real_1d_array& d, + const ap::real_1d_array& r, + int& itail, + const int& iupdat, + int& col, + int& head, + double& theta, + const double& rr, + const double& dr, + const double& stp, + const double& dtd) +{ + int j; + int pointr; + double v; + + if( iupdat<=m ) + { + col = iupdat; + itail = (head+iupdat-2)%m+1; + } + else + { + itail = itail%m+1; + head = head%m+1; + } + ap::vmove(ws.getcolumn(itail, 1, n), d.getvector(1, n)); + ap::vmove(wy.getcolumn(itail, 1, n), r.getvector(1, n)); + theta = rr/dr; + if( iupdat>m ) + { + for(j = 1; j <= col-1; j++) + { + ap::vmove(ss.getcolumn(j, 1, j), ss.getcolumn(j+1, 2, j+1)); + ap::vmove(sy.getcolumn(j, j, col-1), sy.getcolumn(j+1, j+1, col)); + } + } + pointr = head; + for(j = 1; j <= col-1; j++) + { + v = ap::vdotproduct(d.getvector(1, n), wy.getcolumn(pointr, 1, n)); + sy(col,j) = v; + v = ap::vdotproduct(ws.getcolumn(pointr, 1, n), d.getvector(1, n)); + ss(j,col) = v; + pointr = pointr%m+1; + } + if( stp==1 ) + { + ss(col,col) = dtd; + } + else + { + ss(col,col) = stp*stp*dtd; + } + sy(col,col) = dr; +} + + +void lbfgsbprojgr(const int& n, + const ap::real_1d_array& l, + const ap::real_1d_array& u, + const ap::integer_1d_array& nbd, + const ap::real_1d_array& x, + const ap::real_1d_array& g, + double& sbgnrm) +{ + int i; + double gi; + + sbgnrm = 0; + for(i = 1; i <= n; i++) + { + gi = g(i); + if( nbd(i)!=0 ) + { + if( gi<0 ) + { + if( nbd(i)>=2 ) + { + gi = ap::maxreal(x(i)-u(i), gi); + } + } + else + { + if( nbd(i)<=2 ) + { + gi = ap::minreal(x(i)-l(i), gi); + } + } + } + sbgnrm = ap::maxreal(sbgnrm, fabs(gi)); + } +} + + +void lbfgsbsubsm(const int& n, + const int& m, + const int& nsub, + const ap::integer_1d_array& ind, + const ap::real_1d_array& l, + const ap::real_1d_array& u, + const ap::integer_1d_array& nbd, + ap::real_1d_array& x, + ap::real_1d_array& d, + const ap::real_2d_array& ws, + const ap::real_2d_array& wy, + const double& theta, + const int& col, + const int& head, + int& iword, + ap::real_1d_array& wv, + ap::real_2d_array& wn, + int& info) +{ + int pointr; + int m2; + int col2; + int ibd; + int jy; + int js; + int i; + int j; + int k; + double alpha; + double dk; + double temp1; + double temp2; + + if( nsub<=0 ) + { + return; + } + pointr = head; + for(i = 1; i <= col; i++) + { + temp1 = 0; + temp2 = 0; + for(j = 1; j <= nsub; j++) + { + k = ind(j); + temp1 = temp1+wy(k,pointr)*d(j); + temp2 = temp2+ws(k,pointr)*d(j); + } + wv(i) = temp1; + wv(col+i) = theta*temp2; + pointr = pointr%m+1; + } + m2 = 2*m; + col2 = 2*col; + lbfgsbdtrsl(wn, col2, wv, 11, info); + if( info!=0 ) + { + return; + } + for(i = 1; i <= col; i++) + { + wv(i) = -wv(i); + } + lbfgsbdtrsl(wn, col2, wv, 1, info); + if( info!=0 ) + { + return; + } + pointr = head; + for(jy = 1; jy <= col; jy++) + { + js = col+jy; + for(i = 1; i <= nsub; i++) + { + k = ind(i); + d(i) = d(i)+wy(k,pointr)*wv(jy)/theta+ws(k,pointr)*wv(js); + } + pointr = pointr%m+1; + } + for(i = 1; i <= nsub; i++) + { + d(i) = d(i)/theta; + } + alpha = 1; + temp1 = alpha; + for(i = 1; i <= nsub; i++) + { + k = ind(i); + dk = d(i); + if( nbd(k)!=0 ) + { + if( dk<0&&nbd(k)<=2 ) + { + temp2 = l(k)-x(k); + if( temp2>=0 ) + { + temp1 = 0; + } + else + { + if( dk*alpha0&&nbd(k)>=2 ) + { + temp2 = u(k)-x(k); + if( temp2<=0 ) + { + temp1 = 0; + } + else + { + if( dk*alpha>temp2 ) + { + temp1 = temp2/dk; + } + } + } + } + if( temp10 ) + { + x(k) = u(k); + d(ibd) = 0; + } + else + { + if( dk<0 ) + { + x(k) = l(k); + d(ibd) = 0; + } + } + } + for(i = 1; i <= nsub; i++) + { + k = ind(i); + x(k) = x(k)+alpha*d(i); + } + if( alpha<1 ) + { + iword = 1; + } + else + { + iword = 0; + } +} + + +void lbfgsbdcsrch(const double& f, + const double& g, + double& stp, + const double& ftol, + const double& gtol, + const double& xtol, + const double& stpmin, + const double& stpmax, + int& task, + ap::integer_1d_array& isave, + ap::real_1d_array& dsave, + int& addinfo) +{ + bool brackt; + int stage; + double finit; + double ftest; + double fm; + double fx; + double fxm; + double fy; + double fym; + double ginit; + double gtest; + double gm; + double gx; + double gxm; + double gy; + double gym; + double stx; + double sty; + double stmin; + double stmax; + double width; + double width1; + double xtrapl; + double xtrapu; + + xtrapl = 1.1E0; + xtrapu = 4.0E0; + while(true) + { + if( task==0 ) + { + if( stpstpmax ) + { + task = 2; + addinfo = 0; + } + if( g>=0 ) + { + task = 2; + addinfo = 0; + } + if( ftol<0 ) + { + task = 2; + addinfo = 0; + } + if( gtol<0 ) + { + task = 2; + addinfo = 0; + } + if( xtol<0 ) + { + task = 2; + addinfo = 0; + } + if( stpmin<0 ) + { + task = 2; + addinfo = 0; + } + if( stpmax=0 ) + { + stage = 2; + } + if( brackt&&(stp<=stmin||stp>=stmax) ) + { + task = 3; + addinfo = 1; + } + if( brackt&&stmax-stmin<=xtol*stmax ) + { + task = 3; + addinfo = 2; + } + if( stp==stpmax&&f<=ftest&&g<=gtest ) + { + task = 3; + addinfo = 3; + } + if( stp==stpmin&&(f>ftest||g>=gtest) ) + { + task = 3; + addinfo = 4; + } + if( f<=ftest&&fabs(g)<=gtol*(-ginit) ) + { + task = 4; + addinfo = -1; + } + if( task==3||task==4 ) + { + break; + } + if( stage==1&&f<=fx&&f>ftest ) + { + fm = f-stp*gtest; + fxm = fx-stx*gtest; + fym = fy-sty*gtest; + gm = g-gtest; + gxm = gx-gtest; + gym = gy-gtest; + lbfgsbdcstep(stx, fxm, gxm, sty, fym, gym, stp, fm, gm, brackt, stmin, stmax); + fx = fxm+stx*gtest; + fy = fym+sty*gtest; + gx = gxm+gtest; + gy = gym+gtest; + } + else + { + lbfgsbdcstep(stx, fx, gx, sty, fy, gy, stp, f, g, brackt, stmin, stmax); + } + if( brackt ) + { + if( fabs(sty-stx)>=0.66*width1 ) + { + stp = stx+0.5*(sty-stx); + } + width1 = width; + width = fabs(sty-stx); + } + if( brackt ) + { + stmin = ap::minreal(stx, sty); + stmax = ap::maxreal(stx, sty); + } + else + { + stmin = stp+xtrapl*(stp-stx); + stmax = stp+xtrapu*(stp-stx); + } + stp = ap::maxreal(stp, stpmin); + stp = ap::minreal(stp, stpmax); + if( brackt&&(stp<=stmin||stp>=stmax)||brackt&&stmax-stmin<=xtol*stmax ) + { + stp = stx; + } + task = 1; + break; + } + if( brackt ) + { + isave(1) = 1; + } + else + { + isave(1) = 0; + } + isave(2) = stage; + dsave(1) = ginit; + dsave(2) = gtest; + dsave(3) = gx; + dsave(4) = gy; + dsave(5) = finit; + dsave(6) = fx; + dsave(7) = fy; + dsave(8) = stx; + dsave(9) = sty; + dsave(10) = stmin; + dsave(11) = stmax; + dsave(12) = width; + dsave(13) = width1; +} + + +void lbfgsbdcstep(double& stx, + double& fx, + double& dx, + double& sty, + double& fy, + double& dy, + double& stp, + const double& fp, + const double& dp, + bool& brackt, + const double& stpmin, + const double& stpmax) +{ + double gamma; + double p; + double q; + double r; + double s; + double sgnd; + double stpc; + double stpf; + double stpq; + double theta; + + sgnd = dp*(dx/fabs(dx)); + if( fp>fx ) + { + theta = 3*(fx-fp)/(stp-stx)+dx+dp; + s = ap::maxreal(fabs(theta), ap::maxreal(fabs(dx), fabs(dp))); + gamma = s*sqrt(ap::sqr(theta/s)-dx/s*(dp/s)); + if( stpstx ) + { + gamma = -gamma; + } + p = gamma-dp+theta; + q = gamma-dp+gamma+dx; + r = p/q; + stpc = stp+r*(stx-stp); + stpq = stp+dp/(dp-dx)*(stx-stp); + if( fabs(stpc-stp)>fabs(stpq-stp) ) + { + stpf = stpc; + } + else + { + stpf = stpq; + } + brackt = true; + } + else + { + if( fabs(dp)stx ) + { + gamma = -gamma; + } + p = gamma-dp+theta; + q = gamma+(dx-dp)+gamma; + r = p/q; + if( r<0&&gamma!=0 ) + { + stpc = stp+r*(stx-stp); + } + else + { + if( stp>stx ) + { + stpc = stpmax; + } + else + { + stpc = stpmin; + } + } + stpq = stp+dp/(dp-dx)*(stx-stp); + if( brackt ) + { + if( fabs(stpc-stp)stx ) + { + stpf = ap::minreal(stp+0.66*(sty-stp), stpf); + } + else + { + stpf = ap::maxreal(stp+0.66*(sty-stp), stpf); + } + } + else + { + if( fabs(stpc-stp)>fabs(stpq-stp) ) + { + stpf = stpc; + } + else + { + stpf = stpq; + } + stpf = ap::minreal(stpmax, stpf); + stpf = ap::maxreal(stpmin, stpf); + } + } + else + { + if( brackt ) + { + theta = 3*(fp-fy)/(sty-stp)+dy+dp; + s = ap::maxreal(fabs(theta), ap::maxreal(fabs(dy), fabs(dp))); + gamma = s*sqrt(ap::sqr(theta/s)-dy/s*(dp/s)); + if( stp>sty ) + { + gamma = -gamma; + } + p = gamma-dp+theta; + q = gamma-dp+gamma+dy; + r = p/q; + stpc = stp+r*(sty-stp); + stpf = stpc; + } + else + { + if( stp>stx ) + { + stpf = stpmax; + } + else + { + stpf = stpmin; + } + } + } + } + } + if( fp>fx ) + { + sty = stp; + fy = fp; + dy = dp; + } + else + { + if( sgnd<0 ) + { + sty = stx; + fy = fx; + dy = dx; + } + stx = stp; + fx = fp; + dx = dp; + } + stp = stpf; +} + + +bool additionallbfgsbstoppingcriterion(int iter, + const ap::real_1d_array& x, + double f, + const ap::real_1d_array& g) +{ + bool result; + + result = false; + return result; +} + + +bool lbfgsbdpofa(ap::real_2d_array& a, const int& n) +{ + bool result; + double t; + double s; + double v; + int j; + int jm1; + int k; + + for(j = 1; j <= n; j++) + { + s = 0.0; + jm1 = j-1; + if( jm1>=1 ) + { + for(k = 1; k <= jm1; k++) + { + v = ap::vdotproduct(a.getcolumn(k, 1, k-1), a.getcolumn(j, 1, k-1)); + t = a(k,j)-v; + t = t/a(k,k); + a(k,j) = t; + s = s+t*t; + } + } + s = a(j,j)-s; + if( s<=0.0 ) + { + result = false; + return result; + } + a(j,j) = sqrt(s); + } + result = true; + return result; +} + + +void lbfgsbdtrsl(ap::real_2d_array& t, + const int& n, + ap::real_1d_array& b, + const int& job, + int& info) +{ + double temp; + double v; + int cse; + int j; + int jj; + + for(j = 1; j <= n; j++) + { + if( t(j,j)==0.0 ) + { + info = j; + return; + } + } + info = 0; + cse = 1; + if( job%10!=0 ) + { + cse = 2; + } + if( job%100/10!=0 ) + { + cse = cse+2; + } + if( cse==1 ) + { + b(1) = b(1)/t(1,1); + if( n<2 ) + { + return; + } + for(j = 2; j <= n; j++) + { + temp = -b(j-1); + ap::vadd(b.getvector(j, n), t.getcolumn(j-1, j, n), temp); + b(j) = b(j)/t(j,j); + } + return; + } + if( cse==2 ) + { + b(n) = b(n)/t(n,n); + if( n<2 ) + { + return; + } + for(jj = 2; jj <= n; jj++) + { + j = n-jj+1; + temp = -b(j+1); + ap::vadd(b.getvector(1, j), t.getcolumn(j+1, 1, j), temp); + b(j) = b(j)/t(j,j); + } + return; + } + if( cse==3 ) + { + b(n) = b(n)/t(n,n); + if( n<2 ) + { + return; + } + for(jj = 2; jj <= n; jj++) + { + j = n-jj+1; + v = ap::vdotproduct(t.getcolumn(j, j+1, j+1+jj-1-1), b.getvector(j+1, j+1+jj-1-1)); + b(j) = b(j)-v; + b(j) = b(j)/t(j,j); + } + return; + } + if( cse==4 ) + { + b(1) = b(1)/t(1,1); + if( n<2 ) + { + return; + } + for(j = 2; j <= n; j++) + { + v = ap::vdotproduct(t.getcolumn(j, 1, j-1), b.getvector(1, j-1)); + b(j) = b(j)-v; + b(j) = b(j)/t(j,j); + } + return; + } +} + + +void lbfgsbnewiteration(const ap::real_1d_array& x, + double f, + const ap::real_1d_array& g) +{ + +} + + + diff --git a/simulation/externals/bfgs/lbfgsb.h b/simulation/externals/bfgs/lbfgsb.h new file mode 100644 index 0000000..61f9f13 --- /dev/null +++ b/simulation/externals/bfgs/lbfgsb.h @@ -0,0 +1,137 @@ +/************************************************************************* +NEOS, November 1994. (Latest revision June 1996.) +Optimization Technology Center. +Argonne National Laboratory and Northwestern University. + +Written by Ciyou Zhu in collaboration with +R.H. Byrd, P. Lu-Chen and J. Nocedal. + +Contributors: + * Sergey Bochkanov (ALGLIB project). Translation from FORTRAN to + pseudocode. + +This software is freely available, but we expect that all publications +describing work using this software, or all commercial products using it, +quote at least one of the references given below: + * R. H. Byrd, P. Lu and J. Nocedal. A Limited Memory Algorithm for + Bound Constrained Optimization, (1995), SIAM Journal on Scientific + and Statistical Computing , 16, 5, pp. 1190-1208. + * C. Zhu, R.H. Byrd and J. Nocedal. L-BFGS-B: Algorithm 778: L-BFGS-B, + FORTRAN routines for large scale bound constrained optimization + (1997), ACM Transactions on Mathematical Software, Vol 23, Num. 4, + pp. 550 - 560. +*************************************************************************/ + +#ifndef _lbfgsb_h +#define _lbfgsb_h + +#include "ap.h" + +extern int numIter; +extern bool bNewIteration; +extern FILE* f_result; +extern int nFuncCall; +extern bool bShowTestResults; + +void funcgrad(const ap::real_1d_array& x, double& f, ap::real_1d_array& g); + +/************************************************************************* +The subroutine minimizes the function F(x) of N arguments with simple +constraints using a quasi-Newton method (LBFGS scheme) which is optimized +to use a minimum amount of memory. + +The subroutine generates the approximation of an inverse Hessian matrix by +using information about the last M steps of the algorithm (instead of N). +It lessens a required amount of memory from a value of order N^2 to a +value of order 2*N*M. + +This subroutine uses the FuncGrad subroutine which calculates the value of +the function F and gradient G in point X. The programmer should define the +FuncGrad subroutine by himself. It should be noted that the subroutine +doesn't need to waste time for memory allocation of array G, because the +memory is allocated in calling the subroutine. Setting a dimension of +array G each time when calling a subroutine will excessively slow down an +algorithm. + +The programmer could also redefine the LBFGSNewIteration subroutine which +is called on each new step. The current point X, the function value F and +the gradient G are passed into this subroutine. It is reasonable to +redefine the subroutine for better debugging, for example, to visualize +the solution process. + +Input parameters: + N - problem dimension. N>0 + M - number of corrections in the BFGS scheme of Hessian + approximation update. Recommended value: 3<=M<=7. The + smaller value causes worse convergence, the bigger will + not cause a considerably better convergence, but will + cause a fall in the performance. M<=N. + X - initial solution approximation. + Array whose index ranges from 1 to N. + EpsG - positive number which defines a precision of search. The + subroutine finishes its work if the condition ||G|| < EpsG + is satisfied, where ||.|| means Euclidian norm, G - gradient + projection onto a feasible set, X - current approximation. + EpsF - positive number which defines a precision of search. The + subroutine finishes its work if on iteration number k+1 + the condition |F(k+1)-F(k)| <= EpsF*max{|F(k)|, |F(k+1)|, 1} + is satisfied. + EpsX - positive number which defines a precision of search. The + subroutine finishes its work if on iteration number k+1 + the condition |X(k+1)-X(k)| <= EpsX is satisfied. + MaxIts - maximum number of iterations. + If MaxIts=0, the number of iterations is unlimited. + NBD - constraint type. If NBD(i) is equal to: + * 0, X(i) has no constraints, + * 1, X(i) has only lower boundary, + * 2, X(i) has both lower and upper boundaries, + * 3, X(i) has only upper boundary, + Array whose index ranges from 1 to N. + L - lower boundaries of X(i) variables. + Array whose index ranges from 1 to N. + U - upper boundaries of X(i) variables. + Array whose index ranges from 1 to N. + +Output parameters: + X - solution approximation. +Array whose index ranges from 1 to N. + Info - a return code: + * -2 unknown internal error, + * -1 wrong parameters were specified, + * 0 interrupted by user, + * 1 relative function decreasing is less or equal to EpsF, + * 2 step is less or equal to EpsX, + * 4 gradient norm is less or equal to EpsG, + * 5 number of iterations exceeds MaxIts. + +FuncGrad routine description. User-defined. +Input parameters: + X - array whose index ranges from 1 to N. +Output parameters: + F - function value at X. + G - function gradient. + Array whose index ranges from 1 to N. +The memory for array G has already been allocated in the calling subroutine, +and it isn't necessary to allocate it in the FuncGrad subroutine. + + NEOS, November 1994. (Latest revision June 1996.) + Optimization Technology Center. + Argonne National Laboratory and Northwestern University. + + Written by Ciyou Zhu in collaboration with + R.H. Byrd, P. Lu-Chen and J. Nocedal. +*************************************************************************/ +void lbfgsbminimize(const int& n, + const int& m, + ap::real_1d_array& x, + const double& epsg, + const double& epsf, + const double& epsx, + const int& maxits, + const ap::integer_1d_array& nbd, + const ap::real_1d_array& l, + const ap::real_1d_array& u, + int& info); + + +#endif diff --git a/simulation/externals/eigen/.hg_archival.txt b/simulation/externals/eigen/.hg_archival.txt new file mode 100644 index 0000000..b8b604b --- /dev/null +++ b/simulation/externals/eigen/.hg_archival.txt @@ -0,0 +1,4 @@ +repo: 8a21fd850624c931e448cbcfb38168cb2717c790 +node: 5a0156e40feb7c4136680b493c6e433d91a6f355 +branch: 3.3 +tag: 3.3.4 diff --git a/simulation/externals/eigen/.hgeol b/simulation/externals/eigen/.hgeol new file mode 100644 index 0000000..5327df1 --- /dev/null +++ b/simulation/externals/eigen/.hgeol @@ -0,0 +1,11 @@ +[patterns] +*.sh = LF +*.MINPACK = CRLF +scripts/*.in = LF +debug/msvc/*.dat = CRLF +debug/msvc/*.natvis = CRLF +unsupported/test/mpreal/*.* = CRLF +** = native + +[repository] +native = LF diff --git a/simulation/externals/eigen/.hgignore b/simulation/externals/eigen/.hgignore new file mode 100644 index 0000000..769a47f --- /dev/null +++ b/simulation/externals/eigen/.hgignore @@ -0,0 +1,34 @@ +syntax: glob +qrc_*cxx +*.orig +*.pyc +*.diff +diff +*.save +save +*.old +*.gmo +*.qm +core +core.* +*.bak +*~ +build* +*.moc.* +*.moc +ui_* +CMakeCache.txt +tags +.*.swp +activity.png +*.out +*.php* +*.log +*.orig +*.rej +log +patch +a +a.* +lapack/testing +lapack/reference diff --git a/simulation/externals/eigen/.hgtags b/simulation/externals/eigen/.hgtags new file mode 100644 index 0000000..32ec946 --- /dev/null +++ b/simulation/externals/eigen/.hgtags @@ -0,0 +1,33 @@ +2db9468678c6480c9633b6272ff0e3599d1e11a3 2.0-beta3 +375224817dce669b6fa31d920d4c895a63fabf32 2.0-beta1 +3b8120f077865e2a072e10f5be33e1d942b83a06 2.0-rc1 +19dfc0e7666bcee26f7a49eb42f39a0280a3485e 2.0-beta5 +7a7d8a9526f003ffa2430dfb0c2c535b5add3023 2.0-beta4 +7d14ad088ac23769c349518762704f0257f6a39b 2.0.1 +b9d48561579fd7d4c05b2aa42235dc9de6484bf2 2.0-beta6 +e17630a40408243cb1a51ad0fe3a99beb75b7450 before-hg-migration +eda654d4cda2210ce80719addcf854773e6dec5a 2.0.0 +ee9a7c468a9e73fab12f38f02bac24b07f29ed71 2.0-beta2 +d49097c25d8049e730c254a2fed725a240ce4858 after-hg-migration +655348878731bcb5d9bbe0854077b052e75e5237 actual-start-from-scratch +12a658962d4e6dfdc9a1c350fe7b69e36e70675c 3.0-beta1 +5c4180ad827b3f869b13b1d82f5a6ce617d6fcee 3.0-beta2 +7ae24ca6f3891d5ac58ddc7db60ad413c8d6ec35 3.0-beta3 +c40708b9088d622567fecc9208ad4a426621d364 3.0-beta4 +b6456624eae74f49ae8683d8e7b2882a2ca0342a 3.0-rc1 +a810d5dbab47acfe65b3350236efdd98f67d4d8a 3.1.0-alpha1 +304c88ca3affc16dd0b008b1104873986edd77af 3.1.0-alpha2 +920fc730b5930daae0a6dbe296d60ce2e3808215 3.1.0-beta1 +8383e883ebcc6f14695ff0b5e20bb631abab43fb 3.1.0-rc1 +bf4cb8c934fa3a79f45f1e629610f0225e93e493 3.1.0-rc2 +da195914abcc1d739027cbee7c52077aab30b336 3.2-beta1 +a8e0d153fc5e239ef8b06e3665f1f9e8cb8d49c8 before-evaluators +09a8e21866106b49c5dec1d6d543e5794e82efa0 3.3-alpha1 +ce5a455b34c0a0ac3545a1497cb4a16c38ed90e8 3.3-beta1 +69d418c0699907bcd0bf9e0b3ba0a112ed091d85 3.3-beta2 +bef509908b9da05d0d07ffc0da105e2c8c6d3996 3.3-rc1 +04ab5fa4b241754afcf631117572276444c67239 3.3-rc2 +26667be4f70baf4f0d39e96f330714c87b399090 3.3.0 +f562a193118d4f40514e2f4a0ace6e974926ef06 3.3.1 +da9b4e14c2550e0d11078a3c39e6d56eba9905df 3.3.2 +67e894c6cd8f5f1f604b27d37ed47fdf012674ff 3.3.3 diff --git a/simulation/externals/eigen/CMakeLists.txt b/simulation/externals/eigen/CMakeLists.txt new file mode 100644 index 0000000..f584002 --- /dev/null +++ b/simulation/externals/eigen/CMakeLists.txt @@ -0,0 +1,596 @@ +project(Eigen3) + +cmake_minimum_required(VERSION 2.8.5) + +# guard against in-source builds + +if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ") +endif() + +# Alias Eigen_*_DIR to Eigen3_*_DIR: + +set(Eigen_SOURCE_DIR ${Eigen3_SOURCE_DIR}) +set(Eigen_BINARY_DIR ${Eigen3_BINARY_DIR}) + +# guard against bad build-type strings + +if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release") +endif() + +string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower) +if( NOT cmake_build_type_tolower STREQUAL "debug" + AND NOT cmake_build_type_tolower STREQUAL "release" + AND NOT cmake_build_type_tolower STREQUAL "relwithdebinfo") + message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo (case-insensitive).") +endif() + + +############################################################################# +# retrieve version infomation # +############################################################################# + +# automatically parse the version number +file(READ "${PROJECT_SOURCE_DIR}/Eigen/src/Core/util/Macros.h" _eigen_version_header) +string(REGEX MATCH "define[ \t]+EIGEN_WORLD_VERSION[ \t]+([0-9]+)" _eigen_world_version_match "${_eigen_version_header}") +set(EIGEN_WORLD_VERSION "${CMAKE_MATCH_1}") +string(REGEX MATCH "define[ \t]+EIGEN_MAJOR_VERSION[ \t]+([0-9]+)" _eigen_major_version_match "${_eigen_version_header}") +set(EIGEN_MAJOR_VERSION "${CMAKE_MATCH_1}") +string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_version_match "${_eigen_version_header}") +set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}") +set(EIGEN_VERSION_NUMBER ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}) + +# if the mercurial program is absent, this will leave the EIGEN_HG_CHANGESET string empty, +# but won't stop CMake. +execute_process(COMMAND hg tip -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_HGTIP_OUTPUT) +execute_process(COMMAND hg branch -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_BRANCH_OUTPUT) + +# if this is the default (aka development) branch, extract the mercurial changeset number from the hg tip output... +if(EIGEN_BRANCH_OUTPUT MATCHES "default") +string(REGEX MATCH "^changeset: *[0-9]*:([0-9;a-f]+).*" EIGEN_HG_CHANGESET_MATCH "${EIGEN_HGTIP_OUTPUT}") +set(EIGEN_HG_CHANGESET "${CMAKE_MATCH_1}") +endif(EIGEN_BRANCH_OUTPUT MATCHES "default") +#...and show it next to the version number +if(EIGEN_HG_CHANGESET) + set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER} (mercurial changeset ${EIGEN_HG_CHANGESET})") +else(EIGEN_HG_CHANGESET) + set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER}") +endif(EIGEN_HG_CHANGESET) + + +include(CheckCXXCompilerFlag) +include(GNUInstallDirs) + +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + +############################################################################# +# find how to link to the standard libraries # +############################################################################# + +find_package(StandardMathLibrary) + + +set(EIGEN_TEST_CUSTOM_LINKER_FLAGS "" CACHE STRING "Additional linker flags when linking unit tests.") +set(EIGEN_TEST_CUSTOM_CXX_FLAGS "" CACHE STRING "Additional compiler flags when compiling unit tests.") + +set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "") + +if(NOT STANDARD_MATH_LIBRARY_FOUND) + + message(FATAL_ERROR + "Can't link to the standard math library. Please report to the Eigen developers, telling them about your platform.") + +else() + + if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) + set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO} ${STANDARD_MATH_LIBRARY}") + else() + set(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO "${STANDARD_MATH_LIBRARY}") + endif() + +endif() + +if(EIGEN_STANDARD_LIBRARIES_TO_LINK_TO) + message(STATUS "Standard libraries to link to explicitly: ${EIGEN_STANDARD_LIBRARIES_TO_LINK_TO}") +else() + message(STATUS "Standard libraries to link to explicitly: none") +endif() + +option(EIGEN_BUILD_BTL "Build benchmark suite" OFF) + +# Disable pkgconfig only for native Windows builds +if(NOT WIN32 OR NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows) + option(EIGEN_BUILD_PKGCONFIG "Build pkg-config .pc file for Eigen" ON) +endif() + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +option(EIGEN_SPLIT_LARGE_TESTS "Split large tests into smaller executables" ON) + +option(EIGEN_DEFAULT_TO_ROW_MAJOR "Use row-major as default matrix storage order" OFF) +if(EIGEN_DEFAULT_TO_ROW_MAJOR) + add_definitions("-DEIGEN_DEFAULT_TO_ROW_MAJOR") +endif() + +set(EIGEN_TEST_MAX_SIZE "320" CACHE STRING "Maximal matrix/vector size, default is 320") + +macro(ei_add_cxx_compiler_flag FLAG) + string(REGEX REPLACE "-" "" SFLAG1 ${FLAG}) + string(REGEX REPLACE "\\+" "p" SFLAG ${SFLAG1}) + check_cxx_compiler_flag(${FLAG} COMPILER_SUPPORT_${SFLAG}) + if(COMPILER_SUPPORT_${SFLAG}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}") + endif() +endmacro(ei_add_cxx_compiler_flag) + +if(NOT MSVC) + # We assume that other compilers are partly compatible with GNUCC + + # clang outputs some warnings for unknown flags that are not caught by check_cxx_compiler_flag + # adding -Werror turns such warnings into errors + check_cxx_compiler_flag("-Werror" COMPILER_SUPPORT_WERROR) + if(COMPILER_SUPPORT_WERROR) + set(CMAKE_REQUIRED_FLAGS "-Werror") + endif() + ei_add_cxx_compiler_flag("-pedantic") + ei_add_cxx_compiler_flag("-Wall") + ei_add_cxx_compiler_flag("-Wextra") + #ei_add_cxx_compiler_flag("-Weverything") # clang + + ei_add_cxx_compiler_flag("-Wundef") + ei_add_cxx_compiler_flag("-Wcast-align") + ei_add_cxx_compiler_flag("-Wchar-subscripts") + ei_add_cxx_compiler_flag("-Wnon-virtual-dtor") + ei_add_cxx_compiler_flag("-Wunused-local-typedefs") + ei_add_cxx_compiler_flag("-Wpointer-arith") + ei_add_cxx_compiler_flag("-Wwrite-strings") + ei_add_cxx_compiler_flag("-Wformat-security") + ei_add_cxx_compiler_flag("-Wshorten-64-to-32") + ei_add_cxx_compiler_flag("-Wlogical-op") + ei_add_cxx_compiler_flag("-Wenum-conversion") + ei_add_cxx_compiler_flag("-Wc++11-extensions") + ei_add_cxx_compiler_flag("-Wdouble-promotion") +# ei_add_cxx_compiler_flag("-Wconversion") + + # -Wshadow is insanely too strict with gcc, hopefully it will become usable with gcc 6 + # if(NOT CMAKE_COMPILER_IS_GNUCXX OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.0.0")) + if(NOT CMAKE_COMPILER_IS_GNUCXX) + ei_add_cxx_compiler_flag("-Wshadow") + endif() + + ei_add_cxx_compiler_flag("-Wno-psabi") + ei_add_cxx_compiler_flag("-Wno-variadic-macros") + ei_add_cxx_compiler_flag("-Wno-long-long") + + ei_add_cxx_compiler_flag("-fno-check-new") + ei_add_cxx_compiler_flag("-fno-common") + ei_add_cxx_compiler_flag("-fstrict-aliasing") + ei_add_cxx_compiler_flag("-wd981") # disable ICC's "operands are evaluated in unspecified order" remark + ei_add_cxx_compiler_flag("-wd2304") # disable ICC's "warning #2304: non-explicit constructor with single argument may cause implicit type conversion" produced by -Wnon-virtual-dtor + + + # The -ansi flag must be added last, otherwise it is also used as a linker flag by check_cxx_compiler_flag making it fails + # Moreover we should not set both -strict-ansi and -ansi + check_cxx_compiler_flag("-strict-ansi" COMPILER_SUPPORT_STRICTANSI) + ei_add_cxx_compiler_flag("-Qunused-arguments") # disable clang warning: argument unused during compilation: '-ansi' + + if(COMPILER_SUPPORT_STRICTANSI) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -strict-ansi") + else() + ei_add_cxx_compiler_flag("-ansi") + endif() + + if(ANDROID_NDK) + ei_add_cxx_compiler_flag("-pie") + ei_add_cxx_compiler_flag("-fPIE") + endif() + + set(CMAKE_REQUIRED_FLAGS "") + + option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF) + if(EIGEN_TEST_SSE2) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2") + message(STATUS "Enabling SSE2 in tests/examples") + endif() + + option(EIGEN_TEST_SSE3 "Enable/Disable SSE3 in tests/examples" OFF) + if(EIGEN_TEST_SSE3) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse3") + message(STATUS "Enabling SSE3 in tests/examples") + endif() + + option(EIGEN_TEST_SSSE3 "Enable/Disable SSSE3 in tests/examples" OFF) + if(EIGEN_TEST_SSSE3) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mssse3") + message(STATUS "Enabling SSSE3 in tests/examples") + endif() + + option(EIGEN_TEST_SSE4_1 "Enable/Disable SSE4.1 in tests/examples" OFF) + if(EIGEN_TEST_SSE4_1) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.1") + message(STATUS "Enabling SSE4.1 in tests/examples") + endif() + + option(EIGEN_TEST_SSE4_2 "Enable/Disable SSE4.2 in tests/examples" OFF) + if(EIGEN_TEST_SSE4_2) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4.2") + message(STATUS "Enabling SSE4.2 in tests/examples") + endif() + + option(EIGEN_TEST_AVX "Enable/Disable AVX in tests/examples" OFF) + if(EIGEN_TEST_AVX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx") + message(STATUS "Enabling AVX in tests/examples") + endif() + + option(EIGEN_TEST_FMA "Enable/Disable FMA in tests/examples" OFF) + if(EIGEN_TEST_FMA AND NOT EIGEN_TEST_NEON) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfma") + message(STATUS "Enabling FMA in tests/examples") + endif() + + option(EIGEN_TEST_AVX512 "Enable/Disable AVX512 in tests/examples" OFF) + if(EIGEN_TEST_AVX512) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -fabi-version=6 -DEIGEN_ENABLE_AVX512") + message(STATUS "Enabling AVX512 in tests/examples") + endif() + + option(EIGEN_TEST_F16C "Enable/Disable F16C in tests/examples" OFF) + if(EIGEN_TEST_F16C) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mf16c") + message(STATUS "Enabling F16C in tests/examples") + endif() + + option(EIGEN_TEST_ALTIVEC "Enable/Disable AltiVec in tests/examples" OFF) + if(EIGEN_TEST_ALTIVEC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec -mabi=altivec") + message(STATUS "Enabling AltiVec in tests/examples") + endif() + + option(EIGEN_TEST_VSX "Enable/Disable VSX in tests/examples" OFF) + if(EIGEN_TEST_VSX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mvsx") + message(STATUS "Enabling VSX in tests/examples") + endif() + + option(EIGEN_TEST_NEON "Enable/Disable Neon in tests/examples" OFF) + if(EIGEN_TEST_NEON) + if(EIGEN_TEST_FMA) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon-vfpv4") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon") + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=hard") + message(STATUS "Enabling NEON in tests/examples") + endif() + + option(EIGEN_TEST_NEON64 "Enable/Disable Neon in tests/examples" OFF) + if(EIGEN_TEST_NEON64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + message(STATUS "Enabling NEON in tests/examples") + endif() + + option(EIGEN_TEST_ZVECTOR "Enable/Disable S390X(zEC13) ZVECTOR in tests/examples" OFF) + if(EIGEN_TEST_ZVECTOR) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=z13 -mzvector") + message(STATUS "Enabling S390X(zEC13) ZVECTOR in tests/examples") + endif() + + check_cxx_compiler_flag("-fopenmp" COMPILER_SUPPORT_OPENMP) + if(COMPILER_SUPPORT_OPENMP) + option(EIGEN_TEST_OPENMP "Enable/Disable OpenMP in tests/examples" OFF) + if(EIGEN_TEST_OPENMP) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") + message(STATUS "Enabling OpenMP in tests/examples") + endif() + endif() + +else(NOT MSVC) + + # C4127 - conditional expression is constant + # C4714 - marked as __forceinline not inlined (I failed to deactivate it selectively) + # We can disable this warning in the unit tests since it is clear that it occurs + # because we are oftentimes returning objects that have a destructor or may + # throw exceptions - in particular in the unit tests we are throwing extra many + # exceptions to cover indexing errors. + # C4505 - unreferenced local function has been removed (impossible to deactive selectively) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /wd4127 /wd4505 /wd4714") + + # replace all /Wx by /W4 + string(REGEX REPLACE "/W[0-9]" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + + check_cxx_compiler_flag("/openmp" COMPILER_SUPPORT_OPENMP) + if(COMPILER_SUPPORT_OPENMP) + option(EIGEN_TEST_OPENMP "Enable/Disable OpenMP in tests/examples" OFF) + if(EIGEN_TEST_OPENMP) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp") + message(STATUS "Enabling OpenMP in tests/examples") + endif() + endif() + + option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF) + if(EIGEN_TEST_SSE2) + if(NOT CMAKE_CL_64) + # arch is not supported on 64 bit systems, SSE is enabled automatically. + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") + endif(NOT CMAKE_CL_64) + message(STATUS "Enabling SSE2 in tests/examples") + endif(EIGEN_TEST_SSE2) +endif(NOT MSVC) + +option(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION "Disable explicit vectorization in tests/examples" OFF) +option(EIGEN_TEST_X87 "Force using X87 instructions. Implies no vectorization." OFF) +option(EIGEN_TEST_32BIT "Force generating 32bit code." OFF) + +if(EIGEN_TEST_X87) + set(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION ON) + if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpmath=387") + message(STATUS "Forcing use of x87 instructions in tests/examples") + else() + message(STATUS "EIGEN_TEST_X87 ignored on your compiler") + endif() +endif() + +if(EIGEN_TEST_32BIT) + if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") + message(STATUS "Forcing generation of 32-bit code in tests/examples") + else() + message(STATUS "EIGEN_TEST_32BIT ignored on your compiler") + endif() +endif() + +if(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION) + add_definitions(-DEIGEN_DONT_VECTORIZE=1) + message(STATUS "Disabling vectorization in tests/examples") +endif() + +option(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT "Disable explicit alignment (hence vectorization) in tests/examples" OFF) +if(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT) + add_definitions(-DEIGEN_DONT_ALIGN=1) + message(STATUS "Disabling alignment in tests/examples") +endif() + +option(EIGEN_TEST_NO_EXCEPTIONS "Disables C++ exceptions" OFF) +if(EIGEN_TEST_NO_EXCEPTIONS) + ei_add_cxx_compiler_flag("-fno-exceptions") + message(STATUS "Disabling exceptions in tests/examples") +endif() + +option(EIGEN_TEST_CXX11 "Enable testing with C++11 and C++11 features (e.g. Tensor module)." OFF) + +set(EIGEN_CUDA_COMPUTE_ARCH 30 CACHE STRING "The CUDA compute architecture level to target when compiling CUDA code") + +include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + +# Backward compatibility support for EIGEN_INCLUDE_INSTALL_DIR +if(EIGEN_INCLUDE_INSTALL_DIR) + message(WARNING "EIGEN_INCLUDE_INSTALL_DIR is deprecated. Use INCLUDE_INSTALL_DIR instead.") +endif() + +if(EIGEN_INCLUDE_INSTALL_DIR AND NOT INCLUDE_INSTALL_DIR) + set(INCLUDE_INSTALL_DIR ${EIGEN_INCLUDE_INSTALL_DIR} + CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen header files are installed") +else() + set(INCLUDE_INSTALL_DIR + "${CMAKE_INSTALL_INCLUDEDIR}/eigen3" + CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen header files are installed" + ) +endif() +set(CMAKEPACKAGE_INSTALL_DIR + "${CMAKE_INSTALL_DATADIR}/eigen3/cmake" + CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where Eigen3Config.cmake is installed" + ) +set(PKGCONFIG_INSTALL_DIR + "${CMAKE_INSTALL_DATADIR}/pkgconfig" + CACHE PATH "The directory relative to CMAKE_PREFIX_PATH where eigen3.pc is installed" + ) + + +# similar to set_target_properties but append the property instead of overwriting it +macro(ei_add_target_property target prop value) + + get_target_property(previous ${target} ${prop}) + # if the property wasn't previously set, ${previous} is now "previous-NOTFOUND" which cmake allows catching with plain if() + if(NOT previous) + set(previous "") + endif(NOT previous) + set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}") +endmacro(ei_add_target_property) + +install(FILES + signature_of_eigen3_matrix_library + DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel + ) + +if(EIGEN_BUILD_PKGCONFIG) + configure_file(eigen3.pc.in eigen3.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc + DESTINATION ${PKGCONFIG_INSTALL_DIR} + ) +endif() + +add_subdirectory(Eigen) + +add_subdirectory(doc EXCLUDE_FROM_ALL) + +include(EigenConfigureTesting) + +# fixme, not sure this line is still needed: +enable_testing() # must be called from the root CMakeLists, see man page + + +if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) + add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest +else() + add_subdirectory(test EXCLUDE_FROM_ALL) +endif() + +if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) + add_subdirectory(blas) + add_subdirectory(lapack) +else() + add_subdirectory(blas EXCLUDE_FROM_ALL) + add_subdirectory(lapack EXCLUDE_FROM_ALL) +endif() + +# add SYCL +option(EIGEN_TEST_SYCL "Add Sycl support." OFF) +if(EIGEN_TEST_SYCL) + set (CMAKE_MODULE_PATH "${CMAKE_ROOT}/Modules" "cmake/Modules/" "${CMAKE_MODULE_PATH}") + include(FindComputeCpp) +endif() + +add_subdirectory(unsupported) + +add_subdirectory(demos EXCLUDE_FROM_ALL) + +# must be after test and unsupported, for configuring buildtests.in +add_subdirectory(scripts EXCLUDE_FROM_ALL) + +# TODO: consider also replacing EIGEN_BUILD_BTL by a custom target "make btl"? +if(EIGEN_BUILD_BTL) + add_subdirectory(bench/btl EXCLUDE_FROM_ALL) +endif(EIGEN_BUILD_BTL) + +if(NOT WIN32) + add_subdirectory(bench/spbench EXCLUDE_FROM_ALL) +endif(NOT WIN32) + +configure_file(scripts/cdashtesting.cmake.in cdashtesting.cmake @ONLY) + +ei_testing_print_summary() + +message(STATUS "") +message(STATUS "Configured Eigen ${EIGEN_VERSION_NUMBER}") +message(STATUS "") + +option(EIGEN_FAILTEST "Enable failtests." OFF) +if(EIGEN_FAILTEST) + add_subdirectory(failtest) +endif() + +string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_tolower) +if(cmake_generator_tolower MATCHES "makefile") + message(STATUS "Some things you can do now:") + message(STATUS "--------------+--------------------------------------------------------------") + message(STATUS "Command | Description") + message(STATUS "--------------+--------------------------------------------------------------") + message(STATUS "make install | Install Eigen. Headers will be installed to:") + message(STATUS " | /") + message(STATUS " | Using the following values:") + message(STATUS " | CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") + message(STATUS " | INCLUDE_INSTALL_DIR: ${INCLUDE_INSTALL_DIR}") + message(STATUS " | Change the install location of Eigen headers using:") + message(STATUS " | cmake . -DCMAKE_INSTALL_PREFIX=yourprefix") + message(STATUS " | Or:") + message(STATUS " | cmake . -DINCLUDE_INSTALL_DIR=yourdir") + message(STATUS "make doc | Generate the API documentation, requires Doxygen & LaTeX") + message(STATUS "make check | Build and run the unit-tests. Read this page:") + message(STATUS " | http://eigen.tuxfamily.org/index.php?title=Tests") + message(STATUS "make blas | Build BLAS library (not the same thing as Eigen)") + message(STATUS "make uninstall| Removes files installed by make install") + message(STATUS "--------------+--------------------------------------------------------------") +else() + message(STATUS "To build/run the unit tests, read this page:") + message(STATUS " http://eigen.tuxfamily.org/index.php?title=Tests") +endif() + +message(STATUS "") + + +set ( EIGEN_VERSION_STRING ${EIGEN_VERSION_NUMBER} ) +set ( EIGEN_VERSION_MAJOR ${EIGEN_WORLD_VERSION} ) +set ( EIGEN_VERSION_MINOR ${EIGEN_MAJOR_VERSION} ) +set ( EIGEN_VERSION_PATCH ${EIGEN_MINOR_VERSION} ) +set ( EIGEN_DEFINITIONS "") +set ( EIGEN_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}" ) +set ( EIGEN_ROOT_DIR ${CMAKE_INSTALL_PREFIX} ) + +# Interface libraries require at least CMake 3.0 +if (NOT CMAKE_VERSION VERSION_LESS 3.0) + include (CMakePackageConfigHelpers) + + # Imported target support + add_library (eigen INTERFACE) + + target_compile_definitions (eigen INTERFACE ${EIGEN_DEFINITIONS}) + target_include_directories (eigen INTERFACE + $ + $ + ) + + # Export as title case Eigen + set_target_properties (eigen PROPERTIES EXPORT_NAME Eigen) + + install (TARGETS eigen EXPORT Eigen3Targets) + + configure_package_config_file ( + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Eigen3Config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake + PATH_VARS EIGEN_INCLUDE_DIR EIGEN_ROOT_DIR + INSTALL_DESTINATION ${CMAKEPACKAGE_INSTALL_DIR} + NO_CHECK_REQUIRED_COMPONENTS_MACRO # Eigen does not provide components + ) + # Remove CMAKE_SIZEOF_VOID_P from Eigen3ConfigVersion.cmake since Eigen does + # not depend on architecture specific settings or libraries. More + # specifically, an Eigen3Config.cmake generated from a 64 bit target can be + # used for 32 bit targets as well (and vice versa). + set (_Eigen3_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) + unset (CMAKE_SIZEOF_VOID_P) + write_basic_package_version_file (Eigen3ConfigVersion.cmake + VERSION ${EIGEN_VERSION_NUMBER} + COMPATIBILITY SameMajorVersion) + set (CMAKE_SIZEOF_VOID_P ${_Eigen3_CMAKE_SIZEOF_VOID_P}) + + # The Eigen target will be located in the Eigen3 namespace. Other CMake + # targets can refer to it using Eigen3::Eigen. + export (TARGETS eigen NAMESPACE Eigen3:: FILE Eigen3Targets.cmake) + # Export Eigen3 package to CMake registry such that it can be easily found by + # CMake even if it has not been installed to a standard directory. + export (PACKAGE Eigen3) + + install (EXPORT Eigen3Targets NAMESPACE Eigen3:: DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}) + +else (NOT CMAKE_VERSION VERSION_LESS 3.0) + # Fallback to legacy Eigen3Config.cmake without the imported target + + # If CMakePackageConfigHelpers module is available (CMake >= 2.8.8) + # create a relocatable Config file, otherwise leave the hardcoded paths + include(CMakePackageConfigHelpers OPTIONAL RESULT_VARIABLE CPCH_PATH) + + if(CPCH_PATH) + configure_package_config_file ( + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Eigen3ConfigLegacy.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake + PATH_VARS EIGEN_INCLUDE_DIR EIGEN_ROOT_DIR + INSTALL_DESTINATION ${CMAKEPACKAGE_INSTALL_DIR} + NO_CHECK_REQUIRED_COMPONENTS_MACRO # Eigen does not provide components + ) + else() + # The PACKAGE_* variables are defined by the configure_package_config_file + # but without it we define them manually to the hardcoded paths + set(PACKAGE_INIT "") + set(PACKAGE_EIGEN_INCLUDE_DIR ${EIGEN_INCLUDE_DIR}) + set(PACKAGE_EIGEN_ROOT_DIR ${EIGEN_ROOT_DIR}) + configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Eigen3ConfigLegacy.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake + @ONLY ESCAPE_QUOTES ) + endif() + + write_basic_package_version_file( Eigen3ConfigVersion.cmake + VERSION ${EIGEN_VERSION_NUMBER} + COMPATIBILITY SameMajorVersion ) + +endif (NOT CMAKE_VERSION VERSION_LESS 3.0) + +install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UseEigen3.cmake + ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/Eigen3ConfigVersion.cmake + DESTINATION ${CMAKEPACKAGE_INSTALL_DIR} ) + +# Add uninstall target +add_custom_target ( uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/EigenUninstall.cmake) diff --git a/simulation/externals/eigen/COPYING.BSD b/simulation/externals/eigen/COPYING.BSD new file mode 100644 index 0000000..11971ff --- /dev/null +++ b/simulation/externals/eigen/COPYING.BSD @@ -0,0 +1,26 @@ +/* + Copyright (c) 2011, Intel Corporation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ \ No newline at end of file diff --git a/simulation/externals/eigen/COPYING.GPL b/simulation/externals/eigen/COPYING.GPL new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/simulation/externals/eigen/COPYING.GPL @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/simulation/externals/eigen/COPYING.LGPL b/simulation/externals/eigen/COPYING.LGPL new file mode 100644 index 0000000..4362b49 --- /dev/null +++ b/simulation/externals/eigen/COPYING.LGPL @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/simulation/externals/eigen/COPYING.MINPACK b/simulation/externals/eigen/COPYING.MINPACK new file mode 100644 index 0000000..11d8a9a --- /dev/null +++ b/simulation/externals/eigen/COPYING.MINPACK @@ -0,0 +1,52 @@ +Minpack Copyright Notice (1999) University of Chicago. All rights reserved + +Redistribution and use in source and binary forms, with or +without modification, are permitted provided that the +following conditions are met: + +1. Redistributions of source code must retain the above +copyright notice, this list of conditions and the following +disclaimer. + +2. Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials +provided with the distribution. + +3. The end-user documentation included with the +redistribution, if any, must include the following +acknowledgment: + + "This product includes software developed by the + University of Chicago, as Operator of Argonne National + Laboratory. + +Alternately, this acknowledgment may appear in the software +itself, if and wherever such third-party acknowledgments +normally appear. + +4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS" +WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE +UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND +THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE +OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY +OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR +USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF +THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4) +DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION +UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL +BE CORRECTED. + +5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT +HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF +ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT, +INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF +ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF +PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER +SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT +(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, +EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE +POSSIBILITY OF SUCH LOSS OR DAMAGES. + diff --git a/simulation/externals/eigen/COPYING.MPL2 b/simulation/externals/eigen/COPYING.MPL2 new file mode 100644 index 0000000..14e2f77 --- /dev/null +++ b/simulation/externals/eigen/COPYING.MPL2 @@ -0,0 +1,373 @@ +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. diff --git a/simulation/externals/eigen/COPYING.README b/simulation/externals/eigen/COPYING.README new file mode 100644 index 0000000..de5b632 --- /dev/null +++ b/simulation/externals/eigen/COPYING.README @@ -0,0 +1,18 @@ +Eigen is primarily MPL2 licensed. See COPYING.MPL2 and these links: + http://www.mozilla.org/MPL/2.0/ + http://www.mozilla.org/MPL/2.0/FAQ.html + +Some files contain third-party code under BSD or LGPL licenses, whence the other +COPYING.* files here. + +All the LGPL code is either LGPL 2.1-only, or LGPL 2.1-or-later. +For this reason, the COPYING.LGPL file contains the LGPL 2.1 text. + +If you want to guarantee that the Eigen code that you are #including is licensed +under the MPL2 and possibly more permissive licenses (like BSD), #define this +preprocessor symbol: + EIGEN_MPL2_ONLY +For example, with most compilers, you could add this to your project CXXFLAGS: + -DEIGEN_MPL2_ONLY +This will cause a compilation error to be generated if you #include any code that is +LGPL licensed. diff --git a/simulation/externals/eigen/CTestConfig.cmake b/simulation/externals/eigen/CTestConfig.cmake new file mode 100644 index 0000000..755b473 --- /dev/null +++ b/simulation/externals/eigen/CTestConfig.cmake @@ -0,0 +1,13 @@ +## This file should be placed in the root directory of your project. +## Then modify the CMakeLists.txt file in the root directory of your +## project to incorporate the testing dashboard. +## # The following are required to uses Dart and the Cdash dashboard +## ENABLE_TESTING() +## INCLUDE(CTest) +set(CTEST_PROJECT_NAME "Eigen3.3") +set(CTEST_NIGHTLY_START_TIME "00:00:00 UTC") + +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "manao.inria.fr") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=Eigen3.3") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/simulation/externals/eigen/CTestCustom.cmake.in b/simulation/externals/eigen/CTestCustom.cmake.in new file mode 100644 index 0000000..9fed9d3 --- /dev/null +++ b/simulation/externals/eigen/CTestCustom.cmake.in @@ -0,0 +1,3 @@ + +set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS "2000") +set(CTEST_CUSTOM_MAXIMUM_NUMBER_OF_ERRORS "2000") diff --git a/simulation/externals/eigen/Eigen/CMakeLists.txt b/simulation/externals/eigen/Eigen/CMakeLists.txt new file mode 100644 index 0000000..9eb502b --- /dev/null +++ b/simulation/externals/eigen/Eigen/CMakeLists.txt @@ -0,0 +1,19 @@ +include(RegexUtils) +test_escape_string_as_regex() + +file(GLOB Eigen_directory_files "*") + +escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + +foreach(f ${Eigen_directory_files}) + if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/src") + list(APPEND Eigen_directory_files_to_install ${f}) + endif() +endforeach(f ${Eigen_directory_files}) + +install(FILES + ${Eigen_directory_files_to_install} + DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel + ) + +install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel FILES_MATCHING PATTERN "*.h") diff --git a/simulation/externals/eigen/Eigen/Cholesky b/simulation/externals/eigen/Eigen/Cholesky new file mode 100644 index 0000000..369d1f5 --- /dev/null +++ b/simulation/externals/eigen/Eigen/Cholesky @@ -0,0 +1,41 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CHOLESKY_MODULE_H +#define EIGEN_CHOLESKY_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup Cholesky_Module Cholesky module + * + * + * + * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. + * Those decompositions are also accessible via the following methods: + * - MatrixBase::llt() + * - MatrixBase::ldlt() + * - SelfAdjointView::llt() + * - SelfAdjointView::ldlt() + * + * \code + * #include + * \endcode + */ + +#include "src/Cholesky/LLT.h" +#include "src/Cholesky/LDLT.h" +#ifdef EIGEN_USE_LAPACKE +#include "src/misc/lapacke.h" +#include "src/Cholesky/LLT_LAPACKE.h" +#endif + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_CHOLESKY_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/simulation/externals/eigen/Eigen/CholmodSupport b/simulation/externals/eigen/Eigen/CholmodSupport new file mode 100644 index 0000000..bed8924 --- /dev/null +++ b/simulation/externals/eigen/Eigen/CholmodSupport @@ -0,0 +1,48 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CHOLMODSUPPORT_MODULE_H +#define EIGEN_CHOLMODSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +extern "C" { + #include +} + +/** \ingroup Support_modules + * \defgroup CholmodSupport_Module CholmodSupport module + * + * This module provides an interface to the Cholmod library which is part of the suitesparse package. + * It provides the two following main factorization classes: + * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. + * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). + * + * For the sake of completeness, this module also propose the two following classes: + * - class CholmodSimplicialLLT + * - class CholmodSimplicialLDLT + * Note that these classes does not bring any particular advantage compared to the built-in + * SimplicialLLT and SimplicialLDLT factorization classes. + * + * \code + * #include + * \endcode + * + * In order to use this module, the cholmod headers must be accessible from the include paths, and your binary must be linked to the cholmod library and its dependencies. + * The dependencies depend on how cholmod has been compiled. + * For a cmake based project, you can use our FindCholmod.cmake module to help you in this task. + * + */ + +#include "src/CholmodSupport/CholmodSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_CHOLMODSUPPORT_MODULE_H + diff --git a/simulation/externals/eigen/Eigen/Core b/simulation/externals/eigen/Eigen/Core new file mode 100644 index 0000000..0f7fa63 --- /dev/null +++ b/simulation/externals/eigen/Eigen/Core @@ -0,0 +1,516 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2007-2011 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CORE_H +#define EIGEN_CORE_H + +// first thing Eigen does: stop the compiler from committing suicide +#include "src/Core/util/DisableStupidWarnings.h" + +// Handle NVCC/CUDA/SYCL +#if defined(__CUDACC__) || defined(__SYCL_DEVICE_ONLY__) + // Do not try asserts on CUDA and SYCL! + #ifndef EIGEN_NO_DEBUG + #define EIGEN_NO_DEBUG + #endif + + #ifdef EIGEN_INTERNAL_DEBUGGING + #undef EIGEN_INTERNAL_DEBUGGING + #endif + + #ifdef EIGEN_EXCEPTIONS + #undef EIGEN_EXCEPTIONS + #endif + + // All functions callable from CUDA code must be qualified with __device__ + #ifdef __CUDACC__ + // Do not try to vectorize on CUDA and SYCL! + #ifndef EIGEN_DONT_VECTORIZE + #define EIGEN_DONT_VECTORIZE + #endif + + #define EIGEN_DEVICE_FUNC __host__ __device__ + // We need math_functions.hpp to ensure that that EIGEN_USING_STD_MATH macro + // works properly on the device side + #include + #else + #define EIGEN_DEVICE_FUNC + #endif + +#else + #define EIGEN_DEVICE_FUNC + +#endif + +// When compiling CUDA device code with NVCC, pull in math functions from the +// global namespace. In host mode, and when device doee with clang, use the +// std versions. +#if defined(__CUDA_ARCH__) && defined(__NVCC__) + #define EIGEN_USING_STD_MATH(FUNC) using ::FUNC; +#else + #define EIGEN_USING_STD_MATH(FUNC) using std::FUNC; +#endif + +#if (defined(_CPPUNWIND) || defined(__EXCEPTIONS)) && !defined(__CUDA_ARCH__) && !defined(EIGEN_EXCEPTIONS) && !defined(EIGEN_USE_SYCL) + #define EIGEN_EXCEPTIONS +#endif + +#ifdef EIGEN_EXCEPTIONS + #include +#endif + +// then include this file where all our macros are defined. It's really important to do it first because +// it's where we do all the alignment settings (platform detection and honoring the user's will if he +// defined e.g. EIGEN_DONT_ALIGN) so it needs to be done before we do anything with vectorization. +#include "src/Core/util/Macros.h" + +// Disable the ipa-cp-clone optimization flag with MinGW 6.x or newer (enabled by default with -O3) +// See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556 for details. +#if EIGEN_COMP_MINGW && EIGEN_GNUC_AT_LEAST(4,6) + #pragma GCC optimize ("-fno-ipa-cp-clone") +#endif + +#include + +// this include file manages BLAS and MKL related macros +// and inclusion of their respective header files +#include "src/Core/util/MKL_support.h" + +// if alignment is disabled, then disable vectorization. Note: EIGEN_MAX_ALIGN_BYTES is the proper check, it takes into +// account both the user's will (EIGEN_MAX_ALIGN_BYTES,EIGEN_DONT_ALIGN) and our own platform checks +#if EIGEN_MAX_ALIGN_BYTES==0 + #ifndef EIGEN_DONT_VECTORIZE + #define EIGEN_DONT_VECTORIZE + #endif +#endif + +#if EIGEN_COMP_MSVC + #include // for _aligned_malloc -- need it regardless of whether vectorization is enabled + #if (EIGEN_COMP_MSVC >= 1500) // 2008 or later + // Remember that usage of defined() in a #define is undefined by the standard. + // a user reported that in 64-bit mode, MSVC doesn't care to define _M_IX86_FP. + #if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || EIGEN_ARCH_x86_64 + #define EIGEN_SSE2_ON_MSVC_2008_OR_LATER + #endif + #endif +#else + // Remember that usage of defined() in a #define is undefined by the standard + #if (defined __SSE2__) && ( (!EIGEN_COMP_GNUC) || EIGEN_COMP_ICC || EIGEN_GNUC_AT_LEAST(4,2) ) + #define EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC + #endif +#endif + +#ifndef EIGEN_DONT_VECTORIZE + + #if defined (EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC) || defined(EIGEN_SSE2_ON_MSVC_2008_OR_LATER) + + // Defines symbols for compile-time detection of which instructions are + // used. + // EIGEN_VECTORIZE_YY is defined if and only if the instruction set YY is used + #define EIGEN_VECTORIZE + #define EIGEN_VECTORIZE_SSE + #define EIGEN_VECTORIZE_SSE2 + + // Detect sse3/ssse3/sse4: + // gcc and icc defines __SSE3__, ... + // there is no way to know about this on msvc. You can define EIGEN_VECTORIZE_SSE* if you + // want to force the use of those instructions with msvc. + #ifdef __SSE3__ + #define EIGEN_VECTORIZE_SSE3 + #endif + #ifdef __SSSE3__ + #define EIGEN_VECTORIZE_SSSE3 + #endif + #ifdef __SSE4_1__ + #define EIGEN_VECTORIZE_SSE4_1 + #endif + #ifdef __SSE4_2__ + #define EIGEN_VECTORIZE_SSE4_2 + #endif + #ifdef __AVX__ + #define EIGEN_VECTORIZE_AVX + #define EIGEN_VECTORIZE_SSE3 + #define EIGEN_VECTORIZE_SSSE3 + #define EIGEN_VECTORIZE_SSE4_1 + #define EIGEN_VECTORIZE_SSE4_2 + #endif + #ifdef __AVX2__ + #define EIGEN_VECTORIZE_AVX2 + #endif + #ifdef __FMA__ + #define EIGEN_VECTORIZE_FMA + #endif + #if defined(__AVX512F__) && defined(EIGEN_ENABLE_AVX512) + #define EIGEN_VECTORIZE_AVX512 + #define EIGEN_VECTORIZE_AVX2 + #define EIGEN_VECTORIZE_AVX + #define EIGEN_VECTORIZE_FMA + #ifdef __AVX512DQ__ + #define EIGEN_VECTORIZE_AVX512DQ + #endif + #endif + + // include files + + // This extern "C" works around a MINGW-w64 compilation issue + // https://sourceforge.net/tracker/index.php?func=detail&aid=3018394&group_id=202880&atid=983354 + // In essence, intrin.h is included by windows.h and also declares intrinsics (just as emmintrin.h etc. below do). + // However, intrin.h uses an extern "C" declaration, and g++ thus complains of duplicate declarations + // with conflicting linkage. The linkage for intrinsics doesn't matter, but at that stage the compiler doesn't know; + // so, to avoid compile errors when windows.h is included after Eigen/Core, ensure intrinsics are extern "C" here too. + // notice that since these are C headers, the extern "C" is theoretically needed anyways. + extern "C" { + // In theory we should only include immintrin.h and not the other *mmintrin.h header files directly. + // Doing so triggers some issues with ICC. However old gcc versions seems to not have this file, thus: + #if EIGEN_COMP_ICC >= 1110 + #include + #else + #include + #include + #include + #ifdef EIGEN_VECTORIZE_SSE3 + #include + #endif + #ifdef EIGEN_VECTORIZE_SSSE3 + #include + #endif + #ifdef EIGEN_VECTORIZE_SSE4_1 + #include + #endif + #ifdef EIGEN_VECTORIZE_SSE4_2 + #include + #endif + #if defined(EIGEN_VECTORIZE_AVX) || defined(EIGEN_VECTORIZE_AVX512) + #include + #endif + #endif + } // end extern "C" + #elif defined __VSX__ + #define EIGEN_VECTORIZE + #define EIGEN_VECTORIZE_VSX + #include + // We need to #undef all these ugly tokens defined in + // => use __vector instead of vector + #undef bool + #undef vector + #undef pixel + #elif defined __ALTIVEC__ + #define EIGEN_VECTORIZE + #define EIGEN_VECTORIZE_ALTIVEC + #include + // We need to #undef all these ugly tokens defined in + // => use __vector instead of vector + #undef bool + #undef vector + #undef pixel + #elif (defined __ARM_NEON) || (defined __ARM_NEON__) + #define EIGEN_VECTORIZE + #define EIGEN_VECTORIZE_NEON + #include + #elif (defined __s390x__ && defined __VEC__) + #define EIGEN_VECTORIZE + #define EIGEN_VECTORIZE_ZVECTOR + #include + #endif +#endif + +#if defined(__F16C__) && !defined(EIGEN_COMP_CLANG) + // We can use the optimized fp16 to float and float to fp16 conversion routines + #define EIGEN_HAS_FP16_C +#endif + +#if defined __CUDACC__ + #define EIGEN_VECTORIZE_CUDA + #include + #if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500 + #define EIGEN_HAS_CUDA_FP16 + #endif +#endif + +#if defined EIGEN_HAS_CUDA_FP16 + #include + #include +#endif + +#if (defined _OPENMP) && (!defined EIGEN_DONT_PARALLELIZE) + #define EIGEN_HAS_OPENMP +#endif + +#ifdef EIGEN_HAS_OPENMP +#include +#endif + +// MSVC for windows mobile does not have the errno.h file +#if !(EIGEN_COMP_MSVC && EIGEN_OS_WINCE) && !EIGEN_COMP_ARM +#define EIGEN_HAS_ERRNO +#endif + +#ifdef EIGEN_HAS_ERRNO +#include +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // for CHAR_BIT +// for min/max: +#include + +// for std::is_nothrow_move_assignable +#ifdef EIGEN_INCLUDE_TYPE_TRAITS +#include +#endif + +// for outputting debug info +#ifdef EIGEN_DEBUG_ASSIGN +#include +#endif + +// required for __cpuid, needs to be included after cmath +#if EIGEN_COMP_MSVC && EIGEN_ARCH_i386_OR_x86_64 && !EIGEN_OS_WINCE + #include +#endif + +/** \brief Namespace containing all symbols from the %Eigen library. */ +namespace Eigen { + +inline static const char *SimdInstructionSetsInUse(void) { +#if defined(EIGEN_VECTORIZE_AVX512) + return "AVX512, FMA, AVX2, AVX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2"; +#elif defined(EIGEN_VECTORIZE_AVX) + return "AVX SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2"; +#elif defined(EIGEN_VECTORIZE_SSE4_2) + return "SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2"; +#elif defined(EIGEN_VECTORIZE_SSE4_1) + return "SSE, SSE2, SSE3, SSSE3, SSE4.1"; +#elif defined(EIGEN_VECTORIZE_SSSE3) + return "SSE, SSE2, SSE3, SSSE3"; +#elif defined(EIGEN_VECTORIZE_SSE3) + return "SSE, SSE2, SSE3"; +#elif defined(EIGEN_VECTORIZE_SSE2) + return "SSE, SSE2"; +#elif defined(EIGEN_VECTORIZE_ALTIVEC) + return "AltiVec"; +#elif defined(EIGEN_VECTORIZE_VSX) + return "VSX"; +#elif defined(EIGEN_VECTORIZE_NEON) + return "ARM NEON"; +#elif defined(EIGEN_VECTORIZE_ZVECTOR) + return "S390X ZVECTOR"; +#else + return "None"; +#endif +} + +} // end namespace Eigen + +#if defined EIGEN2_SUPPORT_STAGE40_FULL_EIGEN3_STRICTNESS || defined EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API || defined EIGEN2_SUPPORT_STAGE20_RESOLVE_API_CONFLICTS || defined EIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API || defined EIGEN2_SUPPORT +// This will generate an error message: +#error Eigen2-support is only available up to version 3.2. Please go to "http://eigen.tuxfamily.org/index.php?title=Eigen2" for further information +#endif + +namespace Eigen { + +// we use size_t frequently and we'll never remember to prepend it with std:: everytime just to +// ensure QNX/QCC support +using std::size_t; +// gcc 4.6.0 wants std:: for ptrdiff_t +using std::ptrdiff_t; + +} + +/** \defgroup Core_Module Core module + * This is the main module of Eigen providing dense matrix and vector support + * (both fixed and dynamic size) with all the features corresponding to a BLAS library + * and much more... + * + * \code + * #include + * \endcode + */ + +#include "src/Core/util/Constants.h" +#include "src/Core/util/Meta.h" +#include "src/Core/util/ForwardDeclarations.h" +#include "src/Core/util/StaticAssert.h" +#include "src/Core/util/XprHelper.h" +#include "src/Core/util/Memory.h" + +#include "src/Core/NumTraits.h" +#include "src/Core/MathFunctions.h" +#include "src/Core/GenericPacketMath.h" +#include "src/Core/MathFunctionsImpl.h" + +#if defined EIGEN_VECTORIZE_AVX512 + #include "src/Core/arch/SSE/PacketMath.h" + #include "src/Core/arch/AVX/PacketMath.h" + #include "src/Core/arch/AVX512/PacketMath.h" + #include "src/Core/arch/AVX512/MathFunctions.h" +#elif defined EIGEN_VECTORIZE_AVX + // Use AVX for floats and doubles, SSE for integers + #include "src/Core/arch/SSE/PacketMath.h" + #include "src/Core/arch/SSE/Complex.h" + #include "src/Core/arch/SSE/MathFunctions.h" + #include "src/Core/arch/AVX/PacketMath.h" + #include "src/Core/arch/AVX/MathFunctions.h" + #include "src/Core/arch/AVX/Complex.h" + #include "src/Core/arch/AVX/TypeCasting.h" +#elif defined EIGEN_VECTORIZE_SSE + #include "src/Core/arch/SSE/PacketMath.h" + #include "src/Core/arch/SSE/MathFunctions.h" + #include "src/Core/arch/SSE/Complex.h" + #include "src/Core/arch/SSE/TypeCasting.h" +#elif defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX) + #include "src/Core/arch/AltiVec/PacketMath.h" + #include "src/Core/arch/AltiVec/MathFunctions.h" + #include "src/Core/arch/AltiVec/Complex.h" +#elif defined EIGEN_VECTORIZE_NEON + #include "src/Core/arch/NEON/PacketMath.h" + #include "src/Core/arch/NEON/MathFunctions.h" + #include "src/Core/arch/NEON/Complex.h" +#elif defined EIGEN_VECTORIZE_ZVECTOR + #include "src/Core/arch/ZVector/PacketMath.h" + #include "src/Core/arch/ZVector/MathFunctions.h" + #include "src/Core/arch/ZVector/Complex.h" +#endif + +// Half float support +#include "src/Core/arch/CUDA/Half.h" +#include "src/Core/arch/CUDA/PacketMathHalf.h" +#include "src/Core/arch/CUDA/TypeCasting.h" + +#if defined EIGEN_VECTORIZE_CUDA + #include "src/Core/arch/CUDA/PacketMath.h" + #include "src/Core/arch/CUDA/MathFunctions.h" +#endif + +#include "src/Core/arch/Default/Settings.h" + +#include "src/Core/functors/TernaryFunctors.h" +#include "src/Core/functors/BinaryFunctors.h" +#include "src/Core/functors/UnaryFunctors.h" +#include "src/Core/functors/NullaryFunctors.h" +#include "src/Core/functors/StlFunctors.h" +#include "src/Core/functors/AssignmentFunctors.h" + +// Specialized functors to enable the processing of complex numbers +// on CUDA devices +#include "src/Core/arch/CUDA/Complex.h" + +#include "src/Core/IO.h" +#include "src/Core/DenseCoeffsBase.h" +#include "src/Core/DenseBase.h" +#include "src/Core/MatrixBase.h" +#include "src/Core/EigenBase.h" + +#include "src/Core/Product.h" +#include "src/Core/CoreEvaluators.h" +#include "src/Core/AssignEvaluator.h" + +#ifndef EIGEN_PARSED_BY_DOXYGEN // work around Doxygen bug triggered by Assign.h r814874 + // at least confirmed with Doxygen 1.5.5 and 1.5.6 + #include "src/Core/Assign.h" +#endif + +#include "src/Core/ArrayBase.h" +#include "src/Core/util/BlasUtil.h" +#include "src/Core/DenseStorage.h" +#include "src/Core/NestByValue.h" + +// #include "src/Core/ForceAlignedAccess.h" + +#include "src/Core/ReturnByValue.h" +#include "src/Core/NoAlias.h" +#include "src/Core/PlainObjectBase.h" +#include "src/Core/Matrix.h" +#include "src/Core/Array.h" +#include "src/Core/CwiseTernaryOp.h" +#include "src/Core/CwiseBinaryOp.h" +#include "src/Core/CwiseUnaryOp.h" +#include "src/Core/CwiseNullaryOp.h" +#include "src/Core/CwiseUnaryView.h" +#include "src/Core/SelfCwiseBinaryOp.h" +#include "src/Core/Dot.h" +#include "src/Core/StableNorm.h" +#include "src/Core/Stride.h" +#include "src/Core/MapBase.h" +#include "src/Core/Map.h" +#include "src/Core/Ref.h" +#include "src/Core/Block.h" +#include "src/Core/VectorBlock.h" +#include "src/Core/Transpose.h" +#include "src/Core/DiagonalMatrix.h" +#include "src/Core/Diagonal.h" +#include "src/Core/DiagonalProduct.h" +#include "src/Core/Redux.h" +#include "src/Core/Visitor.h" +#include "src/Core/Fuzzy.h" +#include "src/Core/Swap.h" +#include "src/Core/CommaInitializer.h" +#include "src/Core/GeneralProduct.h" +#include "src/Core/Solve.h" +#include "src/Core/Inverse.h" +#include "src/Core/SolverBase.h" +#include "src/Core/PermutationMatrix.h" +#include "src/Core/Transpositions.h" +#include "src/Core/TriangularMatrix.h" +#include "src/Core/SelfAdjointView.h" +#include "src/Core/products/GeneralBlockPanelKernel.h" +#include "src/Core/products/Parallelizer.h" +#include "src/Core/ProductEvaluators.h" +#include "src/Core/products/GeneralMatrixVector.h" +#include "src/Core/products/GeneralMatrixMatrix.h" +#include "src/Core/SolveTriangular.h" +#include "src/Core/products/GeneralMatrixMatrixTriangular.h" +#include "src/Core/products/SelfadjointMatrixVector.h" +#include "src/Core/products/SelfadjointMatrixMatrix.h" +#include "src/Core/products/SelfadjointProduct.h" +#include "src/Core/products/SelfadjointRank2Update.h" +#include "src/Core/products/TriangularMatrixVector.h" +#include "src/Core/products/TriangularMatrixMatrix.h" +#include "src/Core/products/TriangularSolverMatrix.h" +#include "src/Core/products/TriangularSolverVector.h" +#include "src/Core/BandMatrix.h" +#include "src/Core/CoreIterators.h" +#include "src/Core/ConditionEstimator.h" + +#include "src/Core/BooleanRedux.h" +#include "src/Core/Select.h" +#include "src/Core/VectorwiseOp.h" +#include "src/Core/Random.h" +#include "src/Core/Replicate.h" +#include "src/Core/Reverse.h" +#include "src/Core/ArrayWrapper.h" + +#ifdef EIGEN_USE_BLAS +#include "src/Core/products/GeneralMatrixMatrix_BLAS.h" +#include "src/Core/products/GeneralMatrixVector_BLAS.h" +#include "src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h" +#include "src/Core/products/SelfadjointMatrixMatrix_BLAS.h" +#include "src/Core/products/SelfadjointMatrixVector_BLAS.h" +#include "src/Core/products/TriangularMatrixMatrix_BLAS.h" +#include "src/Core/products/TriangularMatrixVector_BLAS.h" +#include "src/Core/products/TriangularSolverMatrix_BLAS.h" +#endif // EIGEN_USE_BLAS + +#ifdef EIGEN_USE_MKL_VML +#include "src/Core/Assign_MKL.h" +#endif + +#include "src/Core/GlobalFunctions.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_CORE_H diff --git a/simulation/externals/eigen/Eigen/Dense b/simulation/externals/eigen/Eigen/Dense new file mode 100644 index 0000000..5768910 --- /dev/null +++ b/simulation/externals/eigen/Eigen/Dense @@ -0,0 +1,7 @@ +#include "Core" +#include "LU" +#include "Cholesky" +#include "QR" +#include "SVD" +#include "Geometry" +#include "Eigenvalues" diff --git a/simulation/externals/eigen/Eigen/Eigen b/simulation/externals/eigen/Eigen/Eigen new file mode 100644 index 0000000..654c8dc --- /dev/null +++ b/simulation/externals/eigen/Eigen/Eigen @@ -0,0 +1,2 @@ +#include "Dense" +#include "Sparse" diff --git a/simulation/externals/eigen/Eigen/Eigenvalues b/simulation/externals/eigen/Eigen/Eigenvalues new file mode 100644 index 0000000..009e529 --- /dev/null +++ b/simulation/externals/eigen/Eigen/Eigenvalues @@ -0,0 +1,57 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_EIGENVALUES_MODULE_H +#define EIGEN_EIGENVALUES_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include "Cholesky" +#include "Jacobi" +#include "Householder" +#include "LU" +#include "Geometry" + +/** \defgroup Eigenvalues_Module Eigenvalues module + * + * + * + * This module mainly provides various eigenvalue solvers. + * This module also provides some MatrixBase methods, including: + * - MatrixBase::eigenvalues(), + * - MatrixBase::operatorNorm() + * + * \code + * #include + * \endcode + */ + +#include "src/misc/RealSvd2x2.h" +#include "src/Eigenvalues/Tridiagonalization.h" +#include "src/Eigenvalues/RealSchur.h" +#include "src/Eigenvalues/EigenSolver.h" +#include "src/Eigenvalues/SelfAdjointEigenSolver.h" +#include "src/Eigenvalues/GeneralizedSelfAdjointEigenSolver.h" +#include "src/Eigenvalues/HessenbergDecomposition.h" +#include "src/Eigenvalues/ComplexSchur.h" +#include "src/Eigenvalues/ComplexEigenSolver.h" +#include "src/Eigenvalues/RealQZ.h" +#include "src/Eigenvalues/GeneralizedEigenSolver.h" +#include "src/Eigenvalues/MatrixBaseEigenvalues.h" +#ifdef EIGEN_USE_LAPACKE +#include "src/misc/lapacke.h" +#include "src/Eigenvalues/RealSchur_LAPACKE.h" +#include "src/Eigenvalues/ComplexSchur_LAPACKE.h" +#include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h" +#endif + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_EIGENVALUES_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/simulation/externals/eigen/Eigen/Geometry b/simulation/externals/eigen/Eigen/Geometry new file mode 100644 index 0000000..716d529 --- /dev/null +++ b/simulation/externals/eigen/Eigen/Geometry @@ -0,0 +1,62 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_GEOMETRY_MODULE_H +#define EIGEN_GEOMETRY_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include "SVD" +#include "LU" +#include + +/** \defgroup Geometry_Module Geometry module + * + * This module provides support for: + * - fixed-size homogeneous transformations + * - translation, scaling, 2D and 3D rotations + * - \link Quaternion quaternions \endlink + * - cross products (\ref MatrixBase::cross, \ref MatrixBase::cross3) + * - orthognal vector generation (\ref MatrixBase::unitOrthogonal) + * - some linear components: \link ParametrizedLine parametrized-lines \endlink and \link Hyperplane hyperplanes \endlink + * - \link AlignedBox axis aligned bounding boxes \endlink + * - \link umeyama least-square transformation fitting \endlink + * + * \code + * #include + * \endcode + */ + +#include "src/Geometry/OrthoMethods.h" +#include "src/Geometry/EulerAngles.h" + +#include "src/Geometry/Homogeneous.h" +#include "src/Geometry/RotationBase.h" +#include "src/Geometry/Rotation2D.h" +#include "src/Geometry/Quaternion.h" +#include "src/Geometry/AngleAxis.h" +#include "src/Geometry/Transform.h" +#include "src/Geometry/Translation.h" +#include "src/Geometry/Scaling.h" +#include "src/Geometry/Hyperplane.h" +#include "src/Geometry/ParametrizedLine.h" +#include "src/Geometry/AlignedBox.h" +#include "src/Geometry/Umeyama.h" + +// Use the SSE optimized version whenever possible. At the moment the +// SSE version doesn't compile when AVX is enabled +#if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX +#include "src/Geometry/arch/Geometry_SSE.h" +#endif + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_GEOMETRY_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ + diff --git a/simulation/externals/eigen/Eigen/Householder b/simulation/externals/eigen/Eigen/Householder new file mode 100644 index 0000000..89cd81b --- /dev/null +++ b/simulation/externals/eigen/Eigen/Householder @@ -0,0 +1,30 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_HOUSEHOLDER_MODULE_H +#define EIGEN_HOUSEHOLDER_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup Householder_Module Householder module + * This module provides Householder transformations. + * + * \code + * #include + * \endcode + */ + +#include "src/Householder/Householder.h" +#include "src/Householder/HouseholderSequence.h" +#include "src/Householder/BlockHouseholder.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_HOUSEHOLDER_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/simulation/externals/eigen/Eigen/IterativeLinearSolvers b/simulation/externals/eigen/Eigen/IterativeLinearSolvers new file mode 100644 index 0000000..957d575 --- /dev/null +++ b/simulation/externals/eigen/Eigen/IterativeLinearSolvers @@ -0,0 +1,48 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H +#define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H + +#include "SparseCore" +#include "OrderingMethods" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** + * \defgroup IterativeLinearSolvers_Module IterativeLinearSolvers module + * + * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse. + * Those solvers are accessible via the following classes: + * - ConjugateGradient for selfadjoint (hermitian) matrices, + * - LeastSquaresConjugateGradient for rectangular least-square problems, + * - BiCGSTAB for general square matrices. + * + * These iterative solvers are associated with some preconditioners: + * - IdentityPreconditioner - not really useful + * - DiagonalPreconditioner - also called Jacobi preconditioner, work very well on diagonal dominant matrices. + * - IncompleteLUT - incomplete LU factorization with dual thresholding + * + * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. + * + \code + #include + \endcode + */ + +#include "src/IterativeLinearSolvers/SolveWithGuess.h" +#include "src/IterativeLinearSolvers/IterativeSolverBase.h" +#include "src/IterativeLinearSolvers/BasicPreconditioners.h" +#include "src/IterativeLinearSolvers/ConjugateGradient.h" +#include "src/IterativeLinearSolvers/LeastSquareConjugateGradient.h" +#include "src/IterativeLinearSolvers/BiCGSTAB.h" +#include "src/IterativeLinearSolvers/IncompleteLUT.h" +#include "src/IterativeLinearSolvers/IncompleteCholesky.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_ITERATIVELINEARSOLVERS_MODULE_H diff --git a/simulation/externals/eigen/Eigen/Jacobi b/simulation/externals/eigen/Eigen/Jacobi new file mode 100644 index 0000000..17c1d78 --- /dev/null +++ b/simulation/externals/eigen/Eigen/Jacobi @@ -0,0 +1,33 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_JACOBI_MODULE_H +#define EIGEN_JACOBI_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup Jacobi_Module Jacobi module + * This module provides Jacobi and Givens rotations. + * + * \code + * #include + * \endcode + * + * In addition to listed classes, it defines the two following MatrixBase methods to apply a Jacobi or Givens rotation: + * - MatrixBase::applyOnTheLeft() + * - MatrixBase::applyOnTheRight(). + */ + +#include "src/Jacobi/Jacobi.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_JACOBI_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ + diff --git a/simulation/externals/eigen/Eigen/LU b/simulation/externals/eigen/Eigen/LU new file mode 100644 index 0000000..6f6c556 --- /dev/null +++ b/simulation/externals/eigen/Eigen/LU @@ -0,0 +1,46 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_LU_MODULE_H +#define EIGEN_LU_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup LU_Module LU module + * This module includes %LU decomposition and related notions such as matrix inversion and determinant. + * This module defines the following MatrixBase methods: + * - MatrixBase::inverse() + * - MatrixBase::determinant() + * + * \code + * #include + * \endcode + */ + +#include "src/misc/Kernel.h" +#include "src/misc/Image.h" +#include "src/LU/FullPivLU.h" +#include "src/LU/PartialPivLU.h" +#ifdef EIGEN_USE_LAPACKE +#include "src/misc/lapacke.h" +#include "src/LU/PartialPivLU_LAPACKE.h" +#endif +#include "src/LU/Determinant.h" +#include "src/LU/InverseImpl.h" + +// Use the SSE optimized version whenever possible. At the moment the +// SSE version doesn't compile when AVX is enabled +#if defined EIGEN_VECTORIZE_SSE && !defined EIGEN_VECTORIZE_AVX + #include "src/LU/arch/Inverse_SSE.h" +#endif + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_LU_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/simulation/externals/eigen/Eigen/MetisSupport b/simulation/externals/eigen/Eigen/MetisSupport new file mode 100644 index 0000000..85c41bf --- /dev/null +++ b/simulation/externals/eigen/Eigen/MetisSupport @@ -0,0 +1,35 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_METISSUPPORT_MODULE_H +#define EIGEN_METISSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +extern "C" { +#include +} + + +/** \ingroup Support_modules + * \defgroup MetisSupport_Module MetisSupport module + * + * \code + * #include + * \endcode + * This module defines an interface to the METIS reordering package (http://glaros.dtc.umn.edu/gkhome/views/metis). + * It can be used just as any other built-in method as explained in \link OrderingMethods_Module here. \endlink + */ + + +#include "src/MetisSupport/MetisSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_METISSUPPORT_MODULE_H diff --git a/simulation/externals/eigen/Eigen/OrderingMethods b/simulation/externals/eigen/Eigen/OrderingMethods new file mode 100644 index 0000000..d8ea361 --- /dev/null +++ b/simulation/externals/eigen/Eigen/OrderingMethods @@ -0,0 +1,73 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ORDERINGMETHODS_MODULE_H +#define EIGEN_ORDERINGMETHODS_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** + * \defgroup OrderingMethods_Module OrderingMethods module + * + * This module is currently for internal use only + * + * It defines various built-in and external ordering methods for sparse matrices. + * They are typically used to reduce the number of elements during + * the sparse matrix decomposition (LLT, LU, QR). + * Precisely, in a preprocessing step, a permutation matrix P is computed using + * those ordering methods and applied to the columns of the matrix. + * Using for instance the sparse Cholesky decomposition, it is expected that + * the nonzeros elements in LLT(A*P) will be much smaller than that in LLT(A). + * + * + * Usage : + * \code + * #include + * \endcode + * + * A simple usage is as a template parameter in the sparse decomposition classes : + * + * \code + * SparseLU > solver; + * \endcode + * + * \code + * SparseQR > solver; + * \endcode + * + * It is possible as well to call directly a particular ordering method for your own purpose, + * \code + * AMDOrdering ordering; + * PermutationMatrix perm; + * SparseMatrix A; + * //Fill the matrix ... + * + * ordering(A, perm); // Call AMD + * \endcode + * + * \note Some of these methods (like AMD or METIS), need the sparsity pattern + * of the input matrix to be symmetric. When the matrix is structurally unsymmetric, + * Eigen computes internally the pattern of \f$A^T*A\f$ before calling the method. + * If your matrix is already symmetric (at leat in structure), you can avoid that + * by calling the method with a SelfAdjointView type. + * + * \code + * // Call the ordering on the pattern of the lower triangular matrix A + * ordering(A.selfadjointView(), perm); + * \endcode + */ + +#ifndef EIGEN_MPL2_ONLY +#include "src/OrderingMethods/Amd.h" +#endif + +#include "src/OrderingMethods/Ordering.h" +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_ORDERINGMETHODS_MODULE_H diff --git a/simulation/externals/eigen/Eigen/PaStiXSupport b/simulation/externals/eigen/Eigen/PaStiXSupport new file mode 100644 index 0000000..de3a63b --- /dev/null +++ b/simulation/externals/eigen/Eigen/PaStiXSupport @@ -0,0 +1,48 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_PASTIXSUPPORT_MODULE_H +#define EIGEN_PASTIXSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +extern "C" { +#include +#include +} + +#ifdef complex +#undef complex +#endif + +/** \ingroup Support_modules + * \defgroup PaStiXSupport_Module PaStiXSupport module + * + * This module provides an interface to the PaSTiX library. + * PaSTiX is a general \b supernodal, \b parallel and \b opensource sparse solver. + * It provides the two following main factorization classes: + * - class PastixLLT : a supernodal, parallel LLt Cholesky factorization. + * - class PastixLDLT: a supernodal, parallel LDLt Cholesky factorization. + * - class PastixLU : a supernodal, parallel LU factorization (optimized for a symmetric pattern). + * + * \code + * #include + * \endcode + * + * In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies. + * The dependencies depend on how PaSTiX has been compiled. + * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. + * + */ + +#include "src/PaStiXSupport/PaStiXSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_PASTIXSUPPORT_MODULE_H diff --git a/simulation/externals/eigen/Eigen/PardisoSupport b/simulation/externals/eigen/Eigen/PardisoSupport new file mode 100644 index 0000000..340edf5 --- /dev/null +++ b/simulation/externals/eigen/Eigen/PardisoSupport @@ -0,0 +1,35 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_PARDISOSUPPORT_MODULE_H +#define EIGEN_PARDISOSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include + +/** \ingroup Support_modules + * \defgroup PardisoSupport_Module PardisoSupport module + * + * This module brings support for the Intel(R) MKL PARDISO direct sparse solvers. + * + * \code + * #include + * \endcode + * + * In order to use this module, the MKL headers must be accessible from the include paths, and your binary must be linked to the MKL library and its dependencies. + * See this \ref TopicUsingIntelMKL "page" for more information on MKL-Eigen integration. + * + */ + +#include "src/PardisoSupport/PardisoSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_PARDISOSUPPORT_MODULE_H diff --git a/simulation/externals/eigen/Eigen/QR b/simulation/externals/eigen/Eigen/QR new file mode 100644 index 0000000..80838e3 --- /dev/null +++ b/simulation/externals/eigen/Eigen/QR @@ -0,0 +1,47 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_QR_MODULE_H +#define EIGEN_QR_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include "Cholesky" +#include "Jacobi" +#include "Householder" + +/** \defgroup QR_Module QR module + * + * + * + * This module provides various QR decompositions + * This module also provides some MatrixBase methods, including: + * - MatrixBase::householderQr() + * - MatrixBase::colPivHouseholderQr() + * - MatrixBase::fullPivHouseholderQr() + * + * \code + * #include + * \endcode + */ + +#include "src/QR/HouseholderQR.h" +#include "src/QR/FullPivHouseholderQR.h" +#include "src/QR/ColPivHouseholderQR.h" +#include "src/QR/CompleteOrthogonalDecomposition.h" +#ifdef EIGEN_USE_LAPACKE +#include "src/misc/lapacke.h" +#include "src/QR/HouseholderQR_LAPACKE.h" +#include "src/QR/ColPivHouseholderQR_LAPACKE.h" +#endif + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_QR_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/simulation/externals/eigen/Eigen/QtAlignedMalloc b/simulation/externals/eigen/Eigen/QtAlignedMalloc new file mode 100644 index 0000000..c6571f1 --- /dev/null +++ b/simulation/externals/eigen/Eigen/QtAlignedMalloc @@ -0,0 +1,40 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_QTMALLOC_MODULE_H +#define EIGEN_QTMALLOC_MODULE_H + +#include "Core" + +#if (!EIGEN_MALLOC_ALREADY_ALIGNED) + +#include "src/Core/util/DisableStupidWarnings.h" + +void *qMalloc(std::size_t size) +{ + return Eigen::internal::aligned_malloc(size); +} + +void qFree(void *ptr) +{ + Eigen::internal::aligned_free(ptr); +} + +void *qRealloc(void *ptr, std::size_t size) +{ + void* newPtr = Eigen::internal::aligned_malloc(size); + memcpy(newPtr, ptr, size); + Eigen::internal::aligned_free(ptr); + return newPtr; +} + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif + +#endif // EIGEN_QTMALLOC_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/simulation/externals/eigen/Eigen/SPQRSupport b/simulation/externals/eigen/Eigen/SPQRSupport new file mode 100644 index 0000000..f70390c --- /dev/null +++ b/simulation/externals/eigen/Eigen/SPQRSupport @@ -0,0 +1,34 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPQRSUPPORT_MODULE_H +#define EIGEN_SPQRSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include "SuiteSparseQR.hpp" + +/** \ingroup Support_modules + * \defgroup SPQRSupport_Module SuiteSparseQR module + * + * This module provides an interface to the SPQR library, which is part of the suitesparse package. + * + * \code + * #include + * \endcode + * + * In order to use this module, the SPQR headers must be accessible from the include paths, and your binary must be linked to the SPQR library and its dependencies (Cholmod, AMD, COLAMD,...). + * For a cmake based project, you can use our FindSPQR.cmake and FindCholmod.Cmake modules + * + */ + +#include "src/CholmodSupport/CholmodSupport.h" +#include "src/SPQRSupport/SuiteSparseQRSupport.h" + +#endif diff --git a/simulation/externals/eigen/Eigen/SVD b/simulation/externals/eigen/Eigen/SVD new file mode 100644 index 0000000..86143c2 --- /dev/null +++ b/simulation/externals/eigen/Eigen/SVD @@ -0,0 +1,47 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SVD_MODULE_H +#define EIGEN_SVD_MODULE_H + +#include "QR" +#include "Householder" +#include "Jacobi" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup SVD_Module SVD module + * + * + * + * This module provides SVD decomposition for matrices (both real and complex). + * Two decomposition algorithms are provided: + * - JacobiSVD implementing two-sided Jacobi iterations is numerically very accurate, fast for small matrices, but very slow for larger ones. + * - BDCSVD implementing a recursive divide & conquer strategy on top of an upper-bidiagonalization which remains fast for large problems. + * These decompositions are accessible via the respective classes and following MatrixBase methods: + * - MatrixBase::jacobiSvd() + * - MatrixBase::bdcSvd() + * + * \code + * #include + * \endcode + */ + +#include "src/misc/RealSvd2x2.h" +#include "src/SVD/UpperBidiagonalization.h" +#include "src/SVD/SVDBase.h" +#include "src/SVD/JacobiSVD.h" +#include "src/SVD/BDCSVD.h" +#if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) +#include "src/misc/lapacke.h" +#include "src/SVD/JacobiSVD_LAPACKE.h" +#endif + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SVD_MODULE_H +/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/simulation/externals/eigen/Eigen/Sparse b/simulation/externals/eigen/Eigen/Sparse new file mode 100644 index 0000000..136e681 --- /dev/null +++ b/simulation/externals/eigen/Eigen/Sparse @@ -0,0 +1,36 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSE_MODULE_H +#define EIGEN_SPARSE_MODULE_H + +/** \defgroup Sparse_Module Sparse meta-module + * + * Meta-module including all related modules: + * - \ref SparseCore_Module + * - \ref OrderingMethods_Module + * - \ref SparseCholesky_Module + * - \ref SparseLU_Module + * - \ref SparseQR_Module + * - \ref IterativeLinearSolvers_Module + * + \code + #include + \endcode + */ + +#include "SparseCore" +#include "OrderingMethods" +#ifndef EIGEN_MPL2_ONLY +#include "SparseCholesky" +#endif +#include "SparseLU" +#include "SparseQR" +#include "IterativeLinearSolvers" + +#endif // EIGEN_SPARSE_MODULE_H + diff --git a/simulation/externals/eigen/Eigen/SparseCholesky b/simulation/externals/eigen/Eigen/SparseCholesky new file mode 100644 index 0000000..b6a320c --- /dev/null +++ b/simulation/externals/eigen/Eigen/SparseCholesky @@ -0,0 +1,45 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2013 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSECHOLESKY_MODULE_H +#define EIGEN_SPARSECHOLESKY_MODULE_H + +#include "SparseCore" +#include "OrderingMethods" + +#include "src/Core/util/DisableStupidWarnings.h" + +/** + * \defgroup SparseCholesky_Module SparseCholesky module + * + * This module currently provides two variants of the direct sparse Cholesky decomposition for selfadjoint (hermitian) matrices. + * Those decompositions are accessible via the following classes: + * - SimplicialLLt, + * - SimplicialLDLt + * + * Such problems can also be solved using the ConjugateGradient solver from the IterativeLinearSolvers module. + * + * \code + * #include + * \endcode + */ + +#ifdef EIGEN_MPL2_ONLY +#error The SparseCholesky module has nothing to offer in MPL2 only mode +#endif + +#include "src/SparseCholesky/SimplicialCholesky.h" + +#ifndef EIGEN_MPL2_ONLY +#include "src/SparseCholesky/SimplicialCholesky_impl.h" +#endif + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SPARSECHOLESKY_MODULE_H diff --git a/simulation/externals/eigen/Eigen/SparseCore b/simulation/externals/eigen/Eigen/SparseCore new file mode 100644 index 0000000..76966c4 --- /dev/null +++ b/simulation/externals/eigen/Eigen/SparseCore @@ -0,0 +1,69 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSECORE_MODULE_H +#define EIGEN_SPARSECORE_MODULE_H + +#include "Core" + +#include "src/Core/util/DisableStupidWarnings.h" + +#include +#include +#include +#include +#include + +/** + * \defgroup SparseCore_Module SparseCore module + * + * This module provides a sparse matrix representation, and basic associated matrix manipulations + * and operations. + * + * See the \ref TutorialSparse "Sparse tutorial" + * + * \code + * #include + * \endcode + * + * This module depends on: Core. + */ + +#include "src/SparseCore/SparseUtil.h" +#include "src/SparseCore/SparseMatrixBase.h" +#include "src/SparseCore/SparseAssign.h" +#include "src/SparseCore/CompressedStorage.h" +#include "src/SparseCore/AmbiVector.h" +#include "src/SparseCore/SparseCompressedBase.h" +#include "src/SparseCore/SparseMatrix.h" +#include "src/SparseCore/SparseMap.h" +#include "src/SparseCore/MappedSparseMatrix.h" +#include "src/SparseCore/SparseVector.h" +#include "src/SparseCore/SparseRef.h" +#include "src/SparseCore/SparseCwiseUnaryOp.h" +#include "src/SparseCore/SparseCwiseBinaryOp.h" +#include "src/SparseCore/SparseTranspose.h" +#include "src/SparseCore/SparseBlock.h" +#include "src/SparseCore/SparseDot.h" +#include "src/SparseCore/SparseRedux.h" +#include "src/SparseCore/SparseView.h" +#include "src/SparseCore/SparseDiagonalProduct.h" +#include "src/SparseCore/ConservativeSparseSparseProduct.h" +#include "src/SparseCore/SparseSparseProductWithPruning.h" +#include "src/SparseCore/SparseProduct.h" +#include "src/SparseCore/SparseDenseProduct.h" +#include "src/SparseCore/SparseSelfAdjointView.h" +#include "src/SparseCore/SparseTriangularView.h" +#include "src/SparseCore/TriangularSolver.h" +#include "src/SparseCore/SparsePermutation.h" +#include "src/SparseCore/SparseFuzzy.h" +#include "src/SparseCore/SparseSolverBase.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SPARSECORE_MODULE_H + diff --git a/simulation/externals/eigen/Eigen/SparseLU b/simulation/externals/eigen/Eigen/SparseLU new file mode 100644 index 0000000..38b38b5 --- /dev/null +++ b/simulation/externals/eigen/Eigen/SparseLU @@ -0,0 +1,46 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2012 Désiré Nuentsa-Wakam +// Copyright (C) 2012 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSELU_MODULE_H +#define EIGEN_SPARSELU_MODULE_H + +#include "SparseCore" + +/** + * \defgroup SparseLU_Module SparseLU module + * This module defines a supernodal factorization of general sparse matrices. + * The code is fully optimized for supernode-panel updates with specialized kernels. + * Please, see the documentation of the SparseLU class for more details. + */ + +// Ordering interface +#include "OrderingMethods" + +#include "src/SparseLU/SparseLU_gemm_kernel.h" + +#include "src/SparseLU/SparseLU_Structs.h" +#include "src/SparseLU/SparseLU_SupernodalMatrix.h" +#include "src/SparseLU/SparseLUImpl.h" +#include "src/SparseCore/SparseColEtree.h" +#include "src/SparseLU/SparseLU_Memory.h" +#include "src/SparseLU/SparseLU_heap_relax_snode.h" +#include "src/SparseLU/SparseLU_relax_snode.h" +#include "src/SparseLU/SparseLU_pivotL.h" +#include "src/SparseLU/SparseLU_panel_dfs.h" +#include "src/SparseLU/SparseLU_kernel_bmod.h" +#include "src/SparseLU/SparseLU_panel_bmod.h" +#include "src/SparseLU/SparseLU_column_dfs.h" +#include "src/SparseLU/SparseLU_column_bmod.h" +#include "src/SparseLU/SparseLU_copy_to_ucol.h" +#include "src/SparseLU/SparseLU_pruneL.h" +#include "src/SparseLU/SparseLU_Utils.h" +#include "src/SparseLU/SparseLU.h" + +#endif // EIGEN_SPARSELU_MODULE_H diff --git a/simulation/externals/eigen/Eigen/SparseQR b/simulation/externals/eigen/Eigen/SparseQR new file mode 100644 index 0000000..a6f3b7f --- /dev/null +++ b/simulation/externals/eigen/Eigen/SparseQR @@ -0,0 +1,37 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SPARSEQR_MODULE_H +#define EIGEN_SPARSEQR_MODULE_H + +#include "SparseCore" +#include "OrderingMethods" +#include "src/Core/util/DisableStupidWarnings.h" + +/** \defgroup SparseQR_Module SparseQR module + * \brief Provides QR decomposition for sparse matrices + * + * This module provides a simplicial version of the left-looking Sparse QR decomposition. + * The columns of the input matrix should be reordered to limit the fill-in during the + * decomposition. Built-in methods (COLAMD, AMD) or external methods (METIS) can be used to this end. + * See the \link OrderingMethods_Module OrderingMethods\endlink module for the list + * of built-in and external ordering methods. + * + * \code + * #include + * \endcode + * + * + */ + +#include "OrderingMethods" +#include "src/SparseCore/SparseColEtree.h" +#include "src/SparseQR/SparseQR.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif diff --git a/simulation/externals/eigen/Eigen/StdDeque b/simulation/externals/eigen/Eigen/StdDeque new file mode 100644 index 0000000..bc68397 --- /dev/null +++ b/simulation/externals/eigen/Eigen/StdDeque @@ -0,0 +1,27 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// Copyright (C) 2009 Hauke Heibel +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_STDDEQUE_MODULE_H +#define EIGEN_STDDEQUE_MODULE_H + +#include "Core" +#include + +#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ + +#define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) + +#else + +#include "src/StlSupport/StdDeque.h" + +#endif + +#endif // EIGEN_STDDEQUE_MODULE_H diff --git a/simulation/externals/eigen/Eigen/StdList b/simulation/externals/eigen/Eigen/StdList new file mode 100644 index 0000000..4c6262c --- /dev/null +++ b/simulation/externals/eigen/Eigen/StdList @@ -0,0 +1,26 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Hauke Heibel +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_STDLIST_MODULE_H +#define EIGEN_STDLIST_MODULE_H + +#include "Core" +#include + +#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ + +#define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) + +#else + +#include "src/StlSupport/StdList.h" + +#endif + +#endif // EIGEN_STDLIST_MODULE_H diff --git a/simulation/externals/eigen/Eigen/StdVector b/simulation/externals/eigen/Eigen/StdVector new file mode 100644 index 0000000..0c4697a --- /dev/null +++ b/simulation/externals/eigen/Eigen/StdVector @@ -0,0 +1,27 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// Copyright (C) 2009 Hauke Heibel +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_STDVECTOR_MODULE_H +#define EIGEN_STDVECTOR_MODULE_H + +#include "Core" +#include + +#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ + +#define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) + +#else + +#include "src/StlSupport/StdVector.h" + +#endif + +#endif // EIGEN_STDVECTOR_MODULE_H diff --git a/simulation/externals/eigen/Eigen/SuperLUSupport b/simulation/externals/eigen/Eigen/SuperLUSupport new file mode 100644 index 0000000..59312a8 --- /dev/null +++ b/simulation/externals/eigen/Eigen/SuperLUSupport @@ -0,0 +1,64 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SUPERLUSUPPORT_MODULE_H +#define EIGEN_SUPERLUSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +#ifdef EMPTY +#define EIGEN_EMPTY_WAS_ALREADY_DEFINED +#endif + +typedef int int_t; +#include +#include +#include + +// slu_util.h defines a preprocessor token named EMPTY which is really polluting, +// so we remove it in favor of a SUPERLU_EMPTY token. +// If EMPTY was already defined then we don't undef it. + +#if defined(EIGEN_EMPTY_WAS_ALREADY_DEFINED) +# undef EIGEN_EMPTY_WAS_ALREADY_DEFINED +#elif defined(EMPTY) +# undef EMPTY +#endif + +#define SUPERLU_EMPTY (-1) + +namespace Eigen { struct SluMatrix; } + +/** \ingroup Support_modules + * \defgroup SuperLUSupport_Module SuperLUSupport module + * + * This module provides an interface to the SuperLU library. + * It provides the following factorization class: + * - class SuperLU: a supernodal sequential LU factorization. + * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). + * + * \warning This wrapper requires at least versions 4.0 of SuperLU. The 3.x versions are not supported. + * + * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. + * + * \code + * #include + * \endcode + * + * In order to use this module, the superlu headers must be accessible from the include paths, and your binary must be linked to the superlu library and its dependencies. + * The dependencies depend on how superlu has been compiled. + * For a cmake based project, you can use our FindSuperLU.cmake module to help you in this task. + * + */ + +#include "src/SuperLUSupport/SuperLUSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_SUPERLUSUPPORT_MODULE_H diff --git a/simulation/externals/eigen/Eigen/UmfPackSupport b/simulation/externals/eigen/Eigen/UmfPackSupport new file mode 100644 index 0000000..00eec80 --- /dev/null +++ b/simulation/externals/eigen/Eigen/UmfPackSupport @@ -0,0 +1,40 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_UMFPACKSUPPORT_MODULE_H +#define EIGEN_UMFPACKSUPPORT_MODULE_H + +#include "SparseCore" + +#include "src/Core/util/DisableStupidWarnings.h" + +extern "C" { +#include +} + +/** \ingroup Support_modules + * \defgroup UmfPackSupport_Module UmfPackSupport module + * + * This module provides an interface to the UmfPack library which is part of the suitesparse package. + * It provides the following factorization class: + * - class UmfPackLU: a multifrontal sequential LU factorization. + * + * \code + * #include + * \endcode + * + * In order to use this module, the umfpack headers must be accessible from the include paths, and your binary must be linked to the umfpack library and its dependencies. + * The dependencies depend on how umfpack has been compiled. + * For a cmake based project, you can use our FindUmfPack.cmake module to help you in this task. + * + */ + +#include "src/UmfPackSupport/UmfPackSupport.h" + +#include "src/Core/util/ReenableStupidWarnings.h" + +#endif // EIGEN_UMFPACKSUPPORT_MODULE_H diff --git a/simulation/externals/eigen/Eigen/src/Cholesky/LDLT.h b/simulation/externals/eigen/Eigen/src/Cholesky/LDLT.h new file mode 100644 index 0000000..fcee7b2 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Cholesky/LDLT.h @@ -0,0 +1,669 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2011 Gael Guennebaud +// Copyright (C) 2009 Keir Mierle +// Copyright (C) 2009 Benoit Jacob +// Copyright (C) 2011 Timothy E. Holy +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_LDLT_H +#define EIGEN_LDLT_H + +namespace Eigen { + +namespace internal { + template struct LDLT_Traits; + + // PositiveSemiDef means positive semi-definite and non-zero; same for NegativeSemiDef + enum SignMatrix { PositiveSemiDef, NegativeSemiDef, ZeroSign, Indefinite }; +} + +/** \ingroup Cholesky_Module + * + * \class LDLT + * + * \brief Robust Cholesky decomposition of a matrix with pivoting + * + * \tparam _MatrixType the type of the matrix of which to compute the LDL^T Cholesky decomposition + * \tparam _UpLo the triangular part that will be used for the decompositon: Lower (default) or Upper. + * The other triangular part won't be read. + * + * Perform a robust Cholesky decomposition of a positive semidefinite or negative semidefinite + * matrix \f$ A \f$ such that \f$ A = P^TLDL^*P \f$, where P is a permutation matrix, L + * is lower triangular with a unit diagonal and D is a diagonal matrix. + * + * The decomposition uses pivoting to ensure stability, so that L will have + * zeros in the bottom right rank(A) - n submatrix. Avoiding the square root + * on D also stabilizes the computation. + * + * Remember that Cholesky decompositions are not rank-revealing. Also, do not use a Cholesky + * decomposition to determine whether a system of equations has a solution. + * + * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. + * + * \sa MatrixBase::ldlt(), SelfAdjointView::ldlt(), class LLT + */ +template class LDLT +{ + public: + typedef _MatrixType MatrixType; + enum { + RowsAtCompileTime = MatrixType::RowsAtCompileTime, + ColsAtCompileTime = MatrixType::ColsAtCompileTime, + MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, + UpLo = _UpLo + }; + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 + typedef typename MatrixType::StorageIndex StorageIndex; + typedef Matrix TmpMatrixType; + + typedef Transpositions TranspositionType; + typedef PermutationMatrix PermutationType; + + typedef internal::LDLT_Traits Traits; + + /** \brief Default Constructor. + * + * The default constructor is useful in cases in which the user intends to + * perform decompositions via LDLT::compute(const MatrixType&). + */ + LDLT() + : m_matrix(), + m_transpositions(), + m_sign(internal::ZeroSign), + m_isInitialized(false) + {} + + /** \brief Default Constructor with memory preallocation + * + * Like the default constructor but with preallocation of the internal data + * according to the specified problem \a size. + * \sa LDLT() + */ + explicit LDLT(Index size) + : m_matrix(size, size), + m_transpositions(size), + m_temporary(size), + m_sign(internal::ZeroSign), + m_isInitialized(false) + {} + + /** \brief Constructor with decomposition + * + * This calculates the decomposition for the input \a matrix. + * + * \sa LDLT(Index size) + */ + template + explicit LDLT(const EigenBase& matrix) + : m_matrix(matrix.rows(), matrix.cols()), + m_transpositions(matrix.rows()), + m_temporary(matrix.rows()), + m_sign(internal::ZeroSign), + m_isInitialized(false) + { + compute(matrix.derived()); + } + + /** \brief Constructs a LDLT factorization from a given matrix + * + * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when \c MatrixType is a Eigen::Ref. + * + * \sa LDLT(const EigenBase&) + */ + template + explicit LDLT(EigenBase& matrix) + : m_matrix(matrix.derived()), + m_transpositions(matrix.rows()), + m_temporary(matrix.rows()), + m_sign(internal::ZeroSign), + m_isInitialized(false) + { + compute(matrix.derived()); + } + + /** Clear any existing decomposition + * \sa rankUpdate(w,sigma) + */ + void setZero() + { + m_isInitialized = false; + } + + /** \returns a view of the upper triangular matrix U */ + inline typename Traits::MatrixU matrixU() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return Traits::getU(m_matrix); + } + + /** \returns a view of the lower triangular matrix L */ + inline typename Traits::MatrixL matrixL() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return Traits::getL(m_matrix); + } + + /** \returns the permutation matrix P as a transposition sequence. + */ + inline const TranspositionType& transpositionsP() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_transpositions; + } + + /** \returns the coefficients of the diagonal matrix D */ + inline Diagonal vectorD() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_matrix.diagonal(); + } + + /** \returns true if the matrix is positive (semidefinite) */ + inline bool isPositive() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_sign == internal::PositiveSemiDef || m_sign == internal::ZeroSign; + } + + /** \returns true if the matrix is negative (semidefinite) */ + inline bool isNegative(void) const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_sign == internal::NegativeSemiDef || m_sign == internal::ZeroSign; + } + + /** \returns a solution x of \f$ A x = b \f$ using the current decomposition of A. + * + * This function also supports in-place solves using the syntax x = decompositionObject.solve(x) . + * + * \note_about_checking_solutions + * + * More precisely, this method solves \f$ A x = b \f$ using the decomposition \f$ A = P^T L D L^* P \f$ + * by solving the systems \f$ P^T y_1 = b \f$, \f$ L y_2 = y_1 \f$, \f$ D y_3 = y_2 \f$, + * \f$ L^* y_4 = y_3 \f$ and \f$ P x = y_4 \f$ in succession. If the matrix \f$ A \f$ is singular, then + * \f$ D \f$ will also be singular (all the other matrices are invertible). In that case, the + * least-square solution of \f$ D y_3 = y_2 \f$ is computed. This does not mean that this function + * computes the least-square solution of \f$ A x = b \f$ is \f$ A \f$ is singular. + * + * \sa MatrixBase::ldlt(), SelfAdjointView::ldlt() + */ + template + inline const Solve + solve(const MatrixBase& b) const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + eigen_assert(m_matrix.rows()==b.rows() + && "LDLT::solve(): invalid number of rows of the right hand side matrix b"); + return Solve(*this, b.derived()); + } + + template + bool solveInPlace(MatrixBase &bAndX) const; + + template + LDLT& compute(const EigenBase& matrix); + + /** \returns an estimate of the reciprocal condition number of the matrix of + * which \c *this is the LDLT decomposition. + */ + RealScalar rcond() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return internal::rcond_estimate_helper(m_l1_norm, *this); + } + + template + LDLT& rankUpdate(const MatrixBase& w, const RealScalar& alpha=1); + + /** \returns the internal LDLT decomposition matrix + * + * TODO: document the storage layout + */ + inline const MatrixType& matrixLDLT() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_matrix; + } + + MatrixType reconstructedMatrix() const; + + /** \returns the adjoint of \c *this, that is, a const reference to the decomposition itself as the underlying matrix is self-adjoint. + * + * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: + * \code x = decomposition.adjoint().solve(b) \endcode + */ + const LDLT& adjoint() const { return *this; }; + + inline Index rows() const { return m_matrix.rows(); } + inline Index cols() const { return m_matrix.cols(); } + + /** \brief Reports whether previous computation was successful. + * + * \returns \c Success if computation was succesful, + * \c NumericalIssue if the matrix.appears to be negative. + */ + ComputationInfo info() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return m_info; + } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + EIGEN_DEVICE_FUNC + void _solve_impl(const RhsType &rhs, DstType &dst) const; + #endif + + protected: + + static void check_template_parameters() + { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); + } + + /** \internal + * Used to compute and store the Cholesky decomposition A = L D L^* = U^* D U. + * The strict upper part is used during the decomposition, the strict lower + * part correspond to the coefficients of L (its diagonal is equal to 1 and + * is not stored), and the diagonal entries correspond to D. + */ + MatrixType m_matrix; + RealScalar m_l1_norm; + TranspositionType m_transpositions; + TmpMatrixType m_temporary; + internal::SignMatrix m_sign; + bool m_isInitialized; + ComputationInfo m_info; +}; + +namespace internal { + +template struct ldlt_inplace; + +template<> struct ldlt_inplace +{ + template + static bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, SignMatrix& sign) + { + using std::abs; + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + typedef typename TranspositionType::StorageIndex IndexType; + eigen_assert(mat.rows()==mat.cols()); + const Index size = mat.rows(); + bool found_zero_pivot = false; + bool ret = true; + + if (size <= 1) + { + transpositions.setIdentity(); + if (numext::real(mat.coeff(0,0)) > static_cast(0) ) sign = PositiveSemiDef; + else if (numext::real(mat.coeff(0,0)) < static_cast(0)) sign = NegativeSemiDef; + else sign = ZeroSign; + return true; + } + + for (Index k = 0; k < size; ++k) + { + // Find largest diagonal element + Index index_of_biggest_in_corner; + mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner); + index_of_biggest_in_corner += k; + + transpositions.coeffRef(k) = IndexType(index_of_biggest_in_corner); + if(k != index_of_biggest_in_corner) + { + // apply the transposition while taking care to consider only + // the lower triangular part + Index s = size-index_of_biggest_in_corner-1; // trailing size after the biggest element + mat.row(k).head(k).swap(mat.row(index_of_biggest_in_corner).head(k)); + mat.col(k).tail(s).swap(mat.col(index_of_biggest_in_corner).tail(s)); + std::swap(mat.coeffRef(k,k),mat.coeffRef(index_of_biggest_in_corner,index_of_biggest_in_corner)); + for(Index i=k+1;i::IsComplex) + mat.coeffRef(index_of_biggest_in_corner,k) = numext::conj(mat.coeff(index_of_biggest_in_corner,k)); + } + + // partition the matrix: + // A00 | - | - + // lu = A10 | A11 | - + // A20 | A21 | A22 + Index rs = size - k - 1; + Block A21(mat,k+1,k,rs,1); + Block A10(mat,k,0,1,k); + Block A20(mat,k+1,0,rs,k); + + if(k>0) + { + temp.head(k) = mat.diagonal().real().head(k).asDiagonal() * A10.adjoint(); + mat.coeffRef(k,k) -= (A10 * temp.head(k)).value(); + if(rs>0) + A21.noalias() -= A20 * temp.head(k); + } + + // In some previous versions of Eigen (e.g., 3.2.1), the scaling was omitted if the pivot + // was smaller than the cutoff value. However, since LDLT is not rank-revealing + // we should only make sure that we do not introduce INF or NaN values. + // Remark that LAPACK also uses 0 as the cutoff value. + RealScalar realAkk = numext::real(mat.coeffRef(k,k)); + bool pivot_is_valid = (abs(realAkk) > RealScalar(0)); + + if(k==0 && !pivot_is_valid) + { + // The entire diagonal is zero, there is nothing more to do + // except filling the transpositions, and checking whether the matrix is zero. + sign = ZeroSign; + for(Index j = 0; j0) && pivot_is_valid) + A21 /= realAkk; + + if(found_zero_pivot && pivot_is_valid) ret = false; // factorization failed + else if(!pivot_is_valid) found_zero_pivot = true; + + if (sign == PositiveSemiDef) { + if (realAkk < static_cast(0)) sign = Indefinite; + } else if (sign == NegativeSemiDef) { + if (realAkk > static_cast(0)) sign = Indefinite; + } else if (sign == ZeroSign) { + if (realAkk > static_cast(0)) sign = PositiveSemiDef; + else if (realAkk < static_cast(0)) sign = NegativeSemiDef; + } + } + + return ret; + } + + // Reference for the algorithm: Davis and Hager, "Multiple Rank + // Modifications of a Sparse Cholesky Factorization" (Algorithm 1) + // Trivial rearrangements of their computations (Timothy E. Holy) + // allow their algorithm to work for rank-1 updates even if the + // original matrix is not of full rank. + // Here only rank-1 updates are implemented, to reduce the + // requirement for intermediate storage and improve accuracy + template + static bool updateInPlace(MatrixType& mat, MatrixBase& w, const typename MatrixType::RealScalar& sigma=1) + { + using numext::isfinite; + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + + const Index size = mat.rows(); + eigen_assert(mat.cols() == size && w.size()==size); + + RealScalar alpha = 1; + + // Apply the update + for (Index j = 0; j < size; j++) + { + // Check for termination due to an original decomposition of low-rank + if (!(isfinite)(alpha)) + break; + + // Update the diagonal terms + RealScalar dj = numext::real(mat.coeff(j,j)); + Scalar wj = w.coeff(j); + RealScalar swj2 = sigma*numext::abs2(wj); + RealScalar gamma = dj*alpha + swj2; + + mat.coeffRef(j,j) += swj2/alpha; + alpha += swj2/dj; + + + // Update the terms of L + Index rs = size-j-1; + w.tail(rs) -= wj * mat.col(j).tail(rs); + if(gamma != 0) + mat.col(j).tail(rs) += (sigma*numext::conj(wj)/gamma)*w.tail(rs); + } + return true; + } + + template + static bool update(MatrixType& mat, const TranspositionType& transpositions, Workspace& tmp, const WType& w, const typename MatrixType::RealScalar& sigma=1) + { + // Apply the permutation to the input w + tmp = transpositions * w; + + return ldlt_inplace::updateInPlace(mat,tmp,sigma); + } +}; + +template<> struct ldlt_inplace +{ + template + static EIGEN_STRONG_INLINE bool unblocked(MatrixType& mat, TranspositionType& transpositions, Workspace& temp, SignMatrix& sign) + { + Transpose matt(mat); + return ldlt_inplace::unblocked(matt, transpositions, temp, sign); + } + + template + static EIGEN_STRONG_INLINE bool update(MatrixType& mat, TranspositionType& transpositions, Workspace& tmp, WType& w, const typename MatrixType::RealScalar& sigma=1) + { + Transpose matt(mat); + return ldlt_inplace::update(matt, transpositions, tmp, w.conjugate(), sigma); + } +}; + +template struct LDLT_Traits +{ + typedef const TriangularView MatrixL; + typedef const TriangularView MatrixU; + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m.adjoint()); } +}; + +template struct LDLT_Traits +{ + typedef const TriangularView MatrixL; + typedef const TriangularView MatrixU; + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m.adjoint()); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m); } +}; + +} // end namespace internal + +/** Compute / recompute the LDLT decomposition A = L D L^* = U^* D U of \a matrix + */ +template +template +LDLT& LDLT::compute(const EigenBase& a) +{ + check_template_parameters(); + + eigen_assert(a.rows()==a.cols()); + const Index size = a.rows(); + + m_matrix = a.derived(); + + // Compute matrix L1 norm = max abs column sum. + m_l1_norm = RealScalar(0); + // TODO move this code to SelfAdjointView + for (Index col = 0; col < size; ++col) { + RealScalar abs_col_sum; + if (_UpLo == Lower) + abs_col_sum = m_matrix.col(col).tail(size - col).template lpNorm<1>() + m_matrix.row(col).head(col).template lpNorm<1>(); + else + abs_col_sum = m_matrix.col(col).head(col).template lpNorm<1>() + m_matrix.row(col).tail(size - col).template lpNorm<1>(); + if (abs_col_sum > m_l1_norm) + m_l1_norm = abs_col_sum; + } + + m_transpositions.resize(size); + m_isInitialized = false; + m_temporary.resize(size); + m_sign = internal::ZeroSign; + + m_info = internal::ldlt_inplace::unblocked(m_matrix, m_transpositions, m_temporary, m_sign) ? Success : NumericalIssue; + + m_isInitialized = true; + return *this; +} + +/** Update the LDLT decomposition: given A = L D L^T, efficiently compute the decomposition of A + sigma w w^T. + * \param w a vector to be incorporated into the decomposition. + * \param sigma a scalar, +1 for updates and -1 for "downdates," which correspond to removing previously-added column vectors. Optional; default value is +1. + * \sa setZero() + */ +template +template +LDLT& LDLT::rankUpdate(const MatrixBase& w, const typename LDLT::RealScalar& sigma) +{ + typedef typename TranspositionType::StorageIndex IndexType; + const Index size = w.rows(); + if (m_isInitialized) + { + eigen_assert(m_matrix.rows()==size); + } + else + { + m_matrix.resize(size,size); + m_matrix.setZero(); + m_transpositions.resize(size); + for (Index i = 0; i < size; i++) + m_transpositions.coeffRef(i) = IndexType(i); + m_temporary.resize(size); + m_sign = sigma>=0 ? internal::PositiveSemiDef : internal::NegativeSemiDef; + m_isInitialized = true; + } + + internal::ldlt_inplace::update(m_matrix, m_transpositions, m_temporary, w, sigma); + + return *this; +} + +#ifndef EIGEN_PARSED_BY_DOXYGEN +template +template +void LDLT<_MatrixType,_UpLo>::_solve_impl(const RhsType &rhs, DstType &dst) const +{ + eigen_assert(rhs.rows() == rows()); + // dst = P b + dst = m_transpositions * rhs; + + // dst = L^-1 (P b) + matrixL().solveInPlace(dst); + + // dst = D^-1 (L^-1 P b) + // more precisely, use pseudo-inverse of D (see bug 241) + using std::abs; + const typename Diagonal::RealReturnType vecD(vectorD()); + // In some previous versions, tolerance was set to the max of 1/highest and the maximal diagonal entry * epsilon + // as motivated by LAPACK's xGELSS: + // RealScalar tolerance = numext::maxi(vecD.array().abs().maxCoeff() * NumTraits::epsilon(),RealScalar(1) / NumTraits::highest()); + // However, LDLT is not rank revealing, and so adjusting the tolerance wrt to the highest + // diagonal element is not well justified and leads to numerical issues in some cases. + // Moreover, Lapack's xSYTRS routines use 0 for the tolerance. + RealScalar tolerance = RealScalar(1) / NumTraits::highest(); + + for (Index i = 0; i < vecD.size(); ++i) + { + if(abs(vecD(i)) > tolerance) + dst.row(i) /= vecD(i); + else + dst.row(i).setZero(); + } + + // dst = L^-T (D^-1 L^-1 P b) + matrixU().solveInPlace(dst); + + // dst = P^-1 (L^-T D^-1 L^-1 P b) = A^-1 b + dst = m_transpositions.transpose() * dst; +} +#endif + +/** \internal use x = ldlt_object.solve(x); + * + * This is the \em in-place version of solve(). + * + * \param bAndX represents both the right-hand side matrix b and result x. + * + * \returns true always! If you need to check for existence of solutions, use another decomposition like LU, QR, or SVD. + * + * This version avoids a copy when the right hand side matrix b is not + * needed anymore. + * + * \sa LDLT::solve(), MatrixBase::ldlt() + */ +template +template +bool LDLT::solveInPlace(MatrixBase &bAndX) const +{ + eigen_assert(m_isInitialized && "LDLT is not initialized."); + eigen_assert(m_matrix.rows() == bAndX.rows()); + + bAndX = this->solve(bAndX); + + return true; +} + +/** \returns the matrix represented by the decomposition, + * i.e., it returns the product: P^T L D L^* P. + * This function is provided for debug purpose. */ +template +MatrixType LDLT::reconstructedMatrix() const +{ + eigen_assert(m_isInitialized && "LDLT is not initialized."); + const Index size = m_matrix.rows(); + MatrixType res(size,size); + + // P + res.setIdentity(); + res = transpositionsP() * res; + // L^* P + res = matrixU() * res; + // D(L^*P) + res = vectorD().real().asDiagonal() * res; + // L(DL^*P) + res = matrixL() * res; + // P^T (LDL^*P) + res = transpositionsP().transpose() * res; + + return res; +} + +/** \cholesky_module + * \returns the Cholesky decomposition with full pivoting without square root of \c *this + * \sa MatrixBase::ldlt() + */ +template +inline const LDLT::PlainObject, UpLo> +SelfAdjointView::ldlt() const +{ + return LDLT(m_matrix); +} + +/** \cholesky_module + * \returns the Cholesky decomposition with full pivoting without square root of \c *this + * \sa SelfAdjointView::ldlt() + */ +template +inline const LDLT::PlainObject> +MatrixBase::ldlt() const +{ + return LDLT(derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_LDLT_H diff --git a/simulation/externals/eigen/Eigen/src/Cholesky/LLT.h b/simulation/externals/eigen/Eigen/src/Cholesky/LLT.h new file mode 100644 index 0000000..87ca8d4 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Cholesky/LLT.h @@ -0,0 +1,534 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_LLT_H +#define EIGEN_LLT_H + +namespace Eigen { + +namespace internal{ +template struct LLT_Traits; +} + +/** \ingroup Cholesky_Module + * + * \class LLT + * + * \brief Standard Cholesky decomposition (LL^T) of a matrix and associated features + * + * \tparam _MatrixType the type of the matrix of which we are computing the LL^T Cholesky decomposition + * \tparam _UpLo the triangular part that will be used for the decompositon: Lower (default) or Upper. + * The other triangular part won't be read. + * + * This class performs a LL^T Cholesky decomposition of a symmetric, positive definite + * matrix A such that A = LL^* = U^*U, where L is lower triangular. + * + * While the Cholesky decomposition is particularly useful to solve selfadjoint problems like D^*D x = b, + * for that purpose, we recommend the Cholesky decomposition without square root which is more stable + * and even faster. Nevertheless, this standard Cholesky decomposition remains useful in many other + * situations like generalised eigen problems with hermitian matrices. + * + * Remember that Cholesky decompositions are not rank-revealing. This LLT decomposition is only stable on positive definite matrices, + * use LDLT instead for the semidefinite case. Also, do not use a Cholesky decomposition to determine whether a system of equations + * has a solution. + * + * Example: \include LLT_example.cpp + * Output: \verbinclude LLT_example.out + * + * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. + * + * \sa MatrixBase::llt(), SelfAdjointView::llt(), class LDLT + */ + /* HEY THIS DOX IS DISABLED BECAUSE THERE's A BUG EITHER HERE OR IN LDLT ABOUT THAT (OR BOTH) + * Note that during the decomposition, only the upper triangular part of A is considered. Therefore, + * the strict lower part does not have to store correct values. + */ +template class LLT +{ + public: + typedef _MatrixType MatrixType; + enum { + RowsAtCompileTime = MatrixType::RowsAtCompileTime, + ColsAtCompileTime = MatrixType::ColsAtCompileTime, + MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime + }; + typedef typename MatrixType::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + typedef Eigen::Index Index; ///< \deprecated since Eigen 3.3 + typedef typename MatrixType::StorageIndex StorageIndex; + + enum { + PacketSize = internal::packet_traits::size, + AlignmentMask = int(PacketSize)-1, + UpLo = _UpLo + }; + + typedef internal::LLT_Traits Traits; + + /** + * \brief Default Constructor. + * + * The default constructor is useful in cases in which the user intends to + * perform decompositions via LLT::compute(const MatrixType&). + */ + LLT() : m_matrix(), m_isInitialized(false) {} + + /** \brief Default Constructor with memory preallocation + * + * Like the default constructor but with preallocation of the internal data + * according to the specified problem \a size. + * \sa LLT() + */ + explicit LLT(Index size) : m_matrix(size, size), + m_isInitialized(false) {} + + template + explicit LLT(const EigenBase& matrix) + : m_matrix(matrix.rows(), matrix.cols()), + m_isInitialized(false) + { + compute(matrix.derived()); + } + + /** \brief Constructs a LDLT factorization from a given matrix + * + * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when + * \c MatrixType is a Eigen::Ref. + * + * \sa LLT(const EigenBase&) + */ + template + explicit LLT(EigenBase& matrix) + : m_matrix(matrix.derived()), + m_isInitialized(false) + { + compute(matrix.derived()); + } + + /** \returns a view of the upper triangular matrix U */ + inline typename Traits::MatrixU matrixU() const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + return Traits::getU(m_matrix); + } + + /** \returns a view of the lower triangular matrix L */ + inline typename Traits::MatrixL matrixL() const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + return Traits::getL(m_matrix); + } + + /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A. + * + * Since this LLT class assumes anyway that the matrix A is invertible, the solution + * theoretically exists and is unique regardless of b. + * + * Example: \include LLT_solve.cpp + * Output: \verbinclude LLT_solve.out + * + * \sa solveInPlace(), MatrixBase::llt(), SelfAdjointView::llt() + */ + template + inline const Solve + solve(const MatrixBase& b) const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + eigen_assert(m_matrix.rows()==b.rows() + && "LLT::solve(): invalid number of rows of the right hand side matrix b"); + return Solve(*this, b.derived()); + } + + template + void solveInPlace(MatrixBase &bAndX) const; + + template + LLT& compute(const EigenBase& matrix); + + /** \returns an estimate of the reciprocal condition number of the matrix of + * which \c *this is the Cholesky decomposition. + */ + RealScalar rcond() const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + eigen_assert(m_info == Success && "LLT failed because matrix appears to be negative"); + return internal::rcond_estimate_helper(m_l1_norm, *this); + } + + /** \returns the LLT decomposition matrix + * + * TODO: document the storage layout + */ + inline const MatrixType& matrixLLT() const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + return m_matrix; + } + + MatrixType reconstructedMatrix() const; + + + /** \brief Reports whether previous computation was successful. + * + * \returns \c Success if computation was succesful, + * \c NumericalIssue if the matrix.appears to be negative. + */ + ComputationInfo info() const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + return m_info; + } + + /** \returns the adjoint of \c *this, that is, a const reference to the decomposition itself as the underlying matrix is self-adjoint. + * + * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: + * \code x = decomposition.adjoint().solve(b) \endcode + */ + const LLT& adjoint() const { return *this; }; + + inline Index rows() const { return m_matrix.rows(); } + inline Index cols() const { return m_matrix.cols(); } + + template + LLT rankUpdate(const VectorType& vec, const RealScalar& sigma = 1); + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + EIGEN_DEVICE_FUNC + void _solve_impl(const RhsType &rhs, DstType &dst) const; + #endif + + protected: + + static void check_template_parameters() + { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); + } + + /** \internal + * Used to compute and store L + * The strict upper part is not used and even not initialized. + */ + MatrixType m_matrix; + RealScalar m_l1_norm; + bool m_isInitialized; + ComputationInfo m_info; +}; + +namespace internal { + +template struct llt_inplace; + +template +static Index llt_rank_update_lower(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) +{ + using std::sqrt; + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + typedef typename MatrixType::ColXpr ColXpr; + typedef typename internal::remove_all::type ColXprCleaned; + typedef typename ColXprCleaned::SegmentReturnType ColXprSegment; + typedef Matrix TempVectorType; + typedef typename TempVectorType::SegmentReturnType TempVecSegment; + + Index n = mat.cols(); + eigen_assert(mat.rows()==n && vec.size()==n); + + TempVectorType temp; + + if(sigma>0) + { + // This version is based on Givens rotations. + // It is faster than the other one below, but only works for updates, + // i.e., for sigma > 0 + temp = sqrt(sigma) * vec; + + for(Index i=0; i g; + g.makeGivens(mat(i,i), -temp(i), &mat(i,i)); + + Index rs = n-i-1; + if(rs>0) + { + ColXprSegment x(mat.col(i).tail(rs)); + TempVecSegment y(temp.tail(rs)); + apply_rotation_in_the_plane(x, y, g); + } + } + } + else + { + temp = vec; + RealScalar beta = 1; + for(Index j=0; j struct llt_inplace +{ + typedef typename NumTraits::Real RealScalar; + template + static Index unblocked(MatrixType& mat) + { + using std::sqrt; + + eigen_assert(mat.rows()==mat.cols()); + const Index size = mat.rows(); + for(Index k = 0; k < size; ++k) + { + Index rs = size-k-1; // remaining size + + Block A21(mat,k+1,k,rs,1); + Block A10(mat,k,0,1,k); + Block A20(mat,k+1,0,rs,k); + + RealScalar x = numext::real(mat.coeff(k,k)); + if (k>0) x -= A10.squaredNorm(); + if (x<=RealScalar(0)) + return k; + mat.coeffRef(k,k) = x = sqrt(x); + if (k>0 && rs>0) A21.noalias() -= A20 * A10.adjoint(); + if (rs>0) A21 /= x; + } + return -1; + } + + template + static Index blocked(MatrixType& m) + { + eigen_assert(m.rows()==m.cols()); + Index size = m.rows(); + if(size<32) + return unblocked(m); + + Index blockSize = size/8; + blockSize = (blockSize/16)*16; + blockSize = (std::min)((std::max)(blockSize,Index(8)), Index(128)); + + for (Index k=0; k A11(m,k, k, bs,bs); + Block A21(m,k+bs,k, rs,bs); + Block A22(m,k+bs,k+bs,rs,rs); + + Index ret; + if((ret=unblocked(A11))>=0) return k+ret; + if(rs>0) A11.adjoint().template triangularView().template solveInPlace(A21); + if(rs>0) A22.template selfadjointView().rankUpdate(A21,typename NumTraits::Literal(-1)); // bottleneck + } + return -1; + } + + template + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const RealScalar& sigma) + { + return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); + } +}; + +template struct llt_inplace +{ + typedef typename NumTraits::Real RealScalar; + + template + static EIGEN_STRONG_INLINE Index unblocked(MatrixType& mat) + { + Transpose matt(mat); + return llt_inplace::unblocked(matt); + } + template + static EIGEN_STRONG_INLINE Index blocked(MatrixType& mat) + { + Transpose matt(mat); + return llt_inplace::blocked(matt); + } + template + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const RealScalar& sigma) + { + Transpose matt(mat); + return llt_inplace::rankUpdate(matt, vec.conjugate(), sigma); + } +}; + +template struct LLT_Traits +{ + typedef const TriangularView MatrixL; + typedef const TriangularView MatrixU; + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m.adjoint()); } + static bool inplace_decomposition(MatrixType& m) + { return llt_inplace::blocked(m)==-1; } +}; + +template struct LLT_Traits +{ + typedef const TriangularView MatrixL; + typedef const TriangularView MatrixU; + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m.adjoint()); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m); } + static bool inplace_decomposition(MatrixType& m) + { return llt_inplace::blocked(m)==-1; } +}; + +} // end namespace internal + +/** Computes / recomputes the Cholesky decomposition A = LL^* = U^*U of \a matrix + * + * \returns a reference to *this + * + * Example: \include TutorialLinAlgComputeTwice.cpp + * Output: \verbinclude TutorialLinAlgComputeTwice.out + */ +template +template +LLT& LLT::compute(const EigenBase& a) +{ + check_template_parameters(); + + eigen_assert(a.rows()==a.cols()); + const Index size = a.rows(); + m_matrix.resize(size, size); + m_matrix = a.derived(); + + // Compute matrix L1 norm = max abs column sum. + m_l1_norm = RealScalar(0); + // TODO move this code to SelfAdjointView + for (Index col = 0; col < size; ++col) { + RealScalar abs_col_sum; + if (_UpLo == Lower) + abs_col_sum = m_matrix.col(col).tail(size - col).template lpNorm<1>() + m_matrix.row(col).head(col).template lpNorm<1>(); + else + abs_col_sum = m_matrix.col(col).head(col).template lpNorm<1>() + m_matrix.row(col).tail(size - col).template lpNorm<1>(); + if (abs_col_sum > m_l1_norm) + m_l1_norm = abs_col_sum; + } + + m_isInitialized = true; + bool ok = Traits::inplace_decomposition(m_matrix); + m_info = ok ? Success : NumericalIssue; + + return *this; +} + +/** Performs a rank one update (or dowdate) of the current decomposition. + * If A = LL^* before the rank one update, + * then after it we have LL^* = A + sigma * v v^* where \a v must be a vector + * of same dimension. + */ +template +template +LLT<_MatrixType,_UpLo> LLT<_MatrixType,_UpLo>::rankUpdate(const VectorType& v, const RealScalar& sigma) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorType); + eigen_assert(v.size()==m_matrix.cols()); + eigen_assert(m_isInitialized); + if(internal::llt_inplace::rankUpdate(m_matrix,v,sigma)>=0) + m_info = NumericalIssue; + else + m_info = Success; + + return *this; +} + +#ifndef EIGEN_PARSED_BY_DOXYGEN +template +template +void LLT<_MatrixType,_UpLo>::_solve_impl(const RhsType &rhs, DstType &dst) const +{ + dst = rhs; + solveInPlace(dst); +} +#endif + +/** \internal use x = llt_object.solve(x); + * + * This is the \em in-place version of solve(). + * + * \param bAndX represents both the right-hand side matrix b and result x. + * + * This version avoids a copy when the right hand side matrix b is not needed anymore. + * + * \sa LLT::solve(), MatrixBase::llt() + */ +template +template +void LLT::solveInPlace(MatrixBase &bAndX) const +{ + eigen_assert(m_isInitialized && "LLT is not initialized."); + eigen_assert(m_matrix.rows()==bAndX.rows()); + matrixL().solveInPlace(bAndX); + matrixU().solveInPlace(bAndX); +} + +/** \returns the matrix represented by the decomposition, + * i.e., it returns the product: L L^*. + * This function is provided for debug purpose. */ +template +MatrixType LLT::reconstructedMatrix() const +{ + eigen_assert(m_isInitialized && "LLT is not initialized."); + return matrixL() * matrixL().adjoint().toDenseMatrix(); +} + +/** \cholesky_module + * \returns the LLT decomposition of \c *this + * \sa SelfAdjointView::llt() + */ +template +inline const LLT::PlainObject> +MatrixBase::llt() const +{ + return LLT(derived()); +} + +/** \cholesky_module + * \returns the LLT decomposition of \c *this + * \sa SelfAdjointView::llt() + */ +template +inline const LLT::PlainObject, UpLo> +SelfAdjointView::llt() const +{ + return LLT(m_matrix); +} + +} // end namespace Eigen + +#endif // EIGEN_LLT_H diff --git a/simulation/externals/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h b/simulation/externals/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h new file mode 100644 index 0000000..bc6489e --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h @@ -0,0 +1,99 @@ +/* + Copyright (c) 2011, Intel Corporation. All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + ******************************************************************************** + * Content : Eigen bindings to LAPACKe + * LLt decomposition based on LAPACKE_?potrf function. + ******************************************************************************** +*/ + +#ifndef EIGEN_LLT_LAPACKE_H +#define EIGEN_LLT_LAPACKE_H + +namespace Eigen { + +namespace internal { + +template struct lapacke_llt; + +#define EIGEN_LAPACKE_LLT(EIGTYPE, BLASTYPE, LAPACKE_PREFIX) \ +template<> struct lapacke_llt \ +{ \ + template \ + static inline Index potrf(MatrixType& m, char uplo) \ + { \ + lapack_int matrix_order; \ + lapack_int size, lda, info, StorageOrder; \ + EIGTYPE* a; \ + eigen_assert(m.rows()==m.cols()); \ + /* Set up parameters for ?potrf */ \ + size = convert_index(m.rows()); \ + StorageOrder = MatrixType::Flags&RowMajorBit?RowMajor:ColMajor; \ + matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ + a = &(m.coeffRef(0,0)); \ + lda = convert_index(m.outerStride()); \ +\ + info = LAPACKE_##LAPACKE_PREFIX##potrf( matrix_order, uplo, size, (BLASTYPE*)a, lda ); \ + info = (info==0) ? -1 : info>0 ? info-1 : size; \ + return info; \ + } \ +}; \ +template<> struct llt_inplace \ +{ \ + template \ + static Index blocked(MatrixType& m) \ + { \ + return lapacke_llt::potrf(m, 'L'); \ + } \ + template \ + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \ + { return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); } \ +}; \ +template<> struct llt_inplace \ +{ \ + template \ + static Index blocked(MatrixType& m) \ + { \ + return lapacke_llt::potrf(m, 'U'); \ + } \ + template \ + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \ + { \ + Transpose matt(mat); \ + return llt_inplace::rankUpdate(matt, vec.conjugate(), sigma); \ + } \ +}; + +EIGEN_LAPACKE_LLT(double, double, d) +EIGEN_LAPACKE_LLT(float, float, s) +EIGEN_LAPACKE_LLT(dcomplex, lapack_complex_double, z) +EIGEN_LAPACKE_LLT(scomplex, lapack_complex_float, c) + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_LLT_LAPACKE_H diff --git a/simulation/externals/eigen/Eigen/src/CholmodSupport/CholmodSupport.h b/simulation/externals/eigen/Eigen/src/CholmodSupport/CholmodSupport.h new file mode 100644 index 0000000..5719720 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/CholmodSupport/CholmodSupport.h @@ -0,0 +1,639 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CHOLMODSUPPORT_H +#define EIGEN_CHOLMODSUPPORT_H + +namespace Eigen { + +namespace internal { + +template struct cholmod_configure_matrix; + +template<> struct cholmod_configure_matrix { + template + static void run(CholmodType& mat) { + mat.xtype = CHOLMOD_REAL; + mat.dtype = CHOLMOD_DOUBLE; + } +}; + +template<> struct cholmod_configure_matrix > { + template + static void run(CholmodType& mat) { + mat.xtype = CHOLMOD_COMPLEX; + mat.dtype = CHOLMOD_DOUBLE; + } +}; + +// Other scalar types are not yet suppotred by Cholmod +// template<> struct cholmod_configure_matrix { +// template +// static void run(CholmodType& mat) { +// mat.xtype = CHOLMOD_REAL; +// mat.dtype = CHOLMOD_SINGLE; +// } +// }; +// +// template<> struct cholmod_configure_matrix > { +// template +// static void run(CholmodType& mat) { +// mat.xtype = CHOLMOD_COMPLEX; +// mat.dtype = CHOLMOD_SINGLE; +// } +// }; + +} // namespace internal + +/** Wraps the Eigen sparse matrix \a mat into a Cholmod sparse matrix object. + * Note that the data are shared. + */ +template +cholmod_sparse viewAsCholmod(Ref > mat) +{ + cholmod_sparse res; + res.nzmax = mat.nonZeros(); + res.nrow = mat.rows(); + res.ncol = mat.cols(); + res.p = mat.outerIndexPtr(); + res.i = mat.innerIndexPtr(); + res.x = mat.valuePtr(); + res.z = 0; + res.sorted = 1; + if(mat.isCompressed()) + { + res.packed = 1; + res.nz = 0; + } + else + { + res.packed = 0; + res.nz = mat.innerNonZeroPtr(); + } + + res.dtype = 0; + res.stype = -1; + + if (internal::is_same<_StorageIndex,int>::value) + { + res.itype = CHOLMOD_INT; + } + else if (internal::is_same<_StorageIndex,long>::value) + { + res.itype = CHOLMOD_LONG; + } + else + { + eigen_assert(false && "Index type not supported yet"); + } + + // setup res.xtype + internal::cholmod_configure_matrix<_Scalar>::run(res); + + res.stype = 0; + + return res; +} + +template +const cholmod_sparse viewAsCholmod(const SparseMatrix<_Scalar,_Options,_Index>& mat) +{ + cholmod_sparse res = viewAsCholmod(Ref >(mat.const_cast_derived())); + return res; +} + +template +const cholmod_sparse viewAsCholmod(const SparseVector<_Scalar,_Options,_Index>& mat) +{ + cholmod_sparse res = viewAsCholmod(Ref >(mat.const_cast_derived())); + return res; +} + +/** Returns a view of the Eigen sparse matrix \a mat as Cholmod sparse matrix. + * The data are not copied but shared. */ +template +cholmod_sparse viewAsCholmod(const SparseSelfAdjointView, UpLo>& mat) +{ + cholmod_sparse res = viewAsCholmod(Ref >(mat.matrix().const_cast_derived())); + + if(UpLo==Upper) res.stype = 1; + if(UpLo==Lower) res.stype = -1; + + return res; +} + +/** Returns a view of the Eigen \b dense matrix \a mat as Cholmod dense matrix. + * The data are not copied but shared. */ +template +cholmod_dense viewAsCholmod(MatrixBase& mat) +{ + EIGEN_STATIC_ASSERT((internal::traits::Flags&RowMajorBit)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); + typedef typename Derived::Scalar Scalar; + + cholmod_dense res; + res.nrow = mat.rows(); + res.ncol = mat.cols(); + res.nzmax = res.nrow * res.ncol; + res.d = Derived::IsVectorAtCompileTime ? mat.derived().size() : mat.derived().outerStride(); + res.x = (void*)(mat.derived().data()); + res.z = 0; + + internal::cholmod_configure_matrix::run(res); + + return res; +} + +/** Returns a view of the Cholmod sparse matrix \a cm as an Eigen sparse matrix. + * The data are not copied but shared. */ +template +MappedSparseMatrix viewAsEigen(cholmod_sparse& cm) +{ + return MappedSparseMatrix + (cm.nrow, cm.ncol, static_cast(cm.p)[cm.ncol], + static_cast(cm.p), static_cast(cm.i),static_cast(cm.x) ); +} + +enum CholmodMode { + CholmodAuto, CholmodSimplicialLLt, CholmodSupernodalLLt, CholmodLDLt +}; + + +/** \ingroup CholmodSupport_Module + * \class CholmodBase + * \brief The base class for the direct Cholesky factorization of Cholmod + * \sa class CholmodSupernodalLLT, class CholmodSimplicialLDLT, class CholmodSimplicialLLT + */ +template +class CholmodBase : public SparseSolverBase +{ + protected: + typedef SparseSolverBase Base; + using Base::derived; + using Base::m_isInitialized; + public: + typedef _MatrixType MatrixType; + enum { UpLo = _UpLo }; + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + typedef MatrixType CholMatrixType; + typedef typename MatrixType::StorageIndex StorageIndex; + enum { + ColsAtCompileTime = MatrixType::ColsAtCompileTime, + MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime + }; + + public: + + CholmodBase() + : m_cholmodFactor(0), m_info(Success), m_factorizationIsOk(false), m_analysisIsOk(false) + { + EIGEN_STATIC_ASSERT((internal::is_same::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY); + m_shiftOffset[0] = m_shiftOffset[1] = 0.0; + cholmod_start(&m_cholmod); + } + + explicit CholmodBase(const MatrixType& matrix) + : m_cholmodFactor(0), m_info(Success), m_factorizationIsOk(false), m_analysisIsOk(false) + { + EIGEN_STATIC_ASSERT((internal::is_same::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY); + m_shiftOffset[0] = m_shiftOffset[1] = 0.0; + cholmod_start(&m_cholmod); + compute(matrix); + } + + ~CholmodBase() + { + if(m_cholmodFactor) + cholmod_free_factor(&m_cholmodFactor, &m_cholmod); + cholmod_finish(&m_cholmod); + } + + inline StorageIndex cols() const { return internal::convert_index(m_cholmodFactor->n); } + inline StorageIndex rows() const { return internal::convert_index(m_cholmodFactor->n); } + + /** \brief Reports whether previous computation was successful. + * + * \returns \c Success if computation was succesful, + * \c NumericalIssue if the matrix.appears to be negative. + */ + ComputationInfo info() const + { + eigen_assert(m_isInitialized && "Decomposition is not initialized."); + return m_info; + } + + /** Computes the sparse Cholesky decomposition of \a matrix */ + Derived& compute(const MatrixType& matrix) + { + analyzePattern(matrix); + factorize(matrix); + return derived(); + } + + /** Performs a symbolic decomposition on the sparsity pattern of \a matrix. + * + * This function is particularly useful when solving for several problems having the same structure. + * + * \sa factorize() + */ + void analyzePattern(const MatrixType& matrix) + { + if(m_cholmodFactor) + { + cholmod_free_factor(&m_cholmodFactor, &m_cholmod); + m_cholmodFactor = 0; + } + cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView()); + m_cholmodFactor = cholmod_analyze(&A, &m_cholmod); + + this->m_isInitialized = true; + this->m_info = Success; + m_analysisIsOk = true; + m_factorizationIsOk = false; + } + + /** Performs a numeric decomposition of \a matrix + * + * The given matrix must have the same sparsity pattern as the matrix on which the symbolic decomposition has been performed. + * + * \sa analyzePattern() + */ + void factorize(const MatrixType& matrix) + { + eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); + cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView()); + cholmod_factorize_p(&A, m_shiftOffset, 0, 0, m_cholmodFactor, &m_cholmod); + + // If the factorization failed, minor is the column at which it did. On success minor == n. + this->m_info = (m_cholmodFactor->minor == m_cholmodFactor->n ? Success : NumericalIssue); + m_factorizationIsOk = true; + } + + /** Returns a reference to the Cholmod's configuration structure to get a full control over the performed operations. + * See the Cholmod user guide for details. */ + cholmod_common& cholmod() { return m_cholmod; } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal */ + template + void _solve_impl(const MatrixBase &b, MatrixBase &dest) const + { + eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); + const Index size = m_cholmodFactor->n; + EIGEN_UNUSED_VARIABLE(size); + eigen_assert(size==b.rows()); + + // Cholmod needs column-major stoarge without inner-stride, which corresponds to the default behavior of Ref. + Ref > b_ref(b.derived()); + + cholmod_dense b_cd = viewAsCholmod(b_ref); + cholmod_dense* x_cd = cholmod_solve(CHOLMOD_A, m_cholmodFactor, &b_cd, &m_cholmod); + if(!x_cd) + { + this->m_info = NumericalIssue; + return; + } + // TODO optimize this copy by swapping when possible (be careful with alignment, etc.) + dest = Matrix::Map(reinterpret_cast(x_cd->x),b.rows(),b.cols()); + cholmod_free_dense(&x_cd, &m_cholmod); + } + + /** \internal */ + template + void _solve_impl(const SparseMatrixBase &b, SparseMatrixBase &dest) const + { + eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); + const Index size = m_cholmodFactor->n; + EIGEN_UNUSED_VARIABLE(size); + eigen_assert(size==b.rows()); + + // note: cs stands for Cholmod Sparse + Ref > b_ref(b.const_cast_derived()); + cholmod_sparse b_cs = viewAsCholmod(b_ref); + cholmod_sparse* x_cs = cholmod_spsolve(CHOLMOD_A, m_cholmodFactor, &b_cs, &m_cholmod); + if(!x_cs) + { + this->m_info = NumericalIssue; + return; + } + // TODO optimize this copy by swapping when possible (be careful with alignment, etc.) + dest.derived() = viewAsEigen(*x_cs); + cholmod_free_sparse(&x_cs, &m_cholmod); + } + #endif // EIGEN_PARSED_BY_DOXYGEN + + + /** Sets the shift parameter that will be used to adjust the diagonal coefficients during the numerical factorization. + * + * During the numerical factorization, an offset term is added to the diagonal coefficients:\n + * \c d_ii = \a offset + \c d_ii + * + * The default is \a offset=0. + * + * \returns a reference to \c *this. + */ + Derived& setShift(const RealScalar& offset) + { + m_shiftOffset[0] = double(offset); + return derived(); + } + + /** \returns the determinant of the underlying matrix from the current factorization */ + Scalar determinant() const + { + using std::exp; + return exp(logDeterminant()); + } + + /** \returns the log determinant of the underlying matrix from the current factorization */ + Scalar logDeterminant() const + { + using std::log; + using numext::real; + eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); + + RealScalar logDet = 0; + Scalar *x = static_cast(m_cholmodFactor->x); + if (m_cholmodFactor->is_super) + { + // Supernodal factorization stored as a packed list of dense column-major blocs, + // as described by the following structure: + + // super[k] == index of the first column of the j-th super node + StorageIndex *super = static_cast(m_cholmodFactor->super); + // pi[k] == offset to the description of row indices + StorageIndex *pi = static_cast(m_cholmodFactor->pi); + // px[k] == offset to the respective dense block + StorageIndex *px = static_cast(m_cholmodFactor->px); + + Index nb_super_nodes = m_cholmodFactor->nsuper; + for (Index k=0; k < nb_super_nodes; ++k) + { + StorageIndex ncols = super[k + 1] - super[k]; + StorageIndex nrows = pi[k + 1] - pi[k]; + + Map, 0, InnerStride<> > sk(x + px[k], ncols, InnerStride<>(nrows+1)); + logDet += sk.real().log().sum(); + } + } + else + { + // Simplicial factorization stored as standard CSC matrix. + StorageIndex *p = static_cast(m_cholmodFactor->p); + Index size = m_cholmodFactor->n; + for (Index k=0; kis_ll) + logDet *= 2.0; + return logDet; + }; + + template + void dumpMemory(Stream& /*s*/) + {} + + protected: + mutable cholmod_common m_cholmod; + cholmod_factor* m_cholmodFactor; + double m_shiftOffset[2]; + mutable ComputationInfo m_info; + int m_factorizationIsOk; + int m_analysisIsOk; +}; + +/** \ingroup CholmodSupport_Module + * \class CholmodSimplicialLLT + * \brief A simplicial direct Cholesky (LLT) factorization and solver based on Cholmod + * + * This class allows to solve for A.X = B sparse linear problems via a simplicial LL^T Cholesky factorization + * using the Cholmod library. + * This simplicial variant is equivalent to Eigen's built-in SimplicialLLT class. Therefore, it has little practical interest. + * The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices + * X and B can be either dense or sparse. + * + * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<> + * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower + * or Upper. Default is Lower. + * + * \implsparsesolverconcept + * + * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. + * + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept, class CholmodSupernodalLLT, class SimplicialLLT + */ +template +class CholmodSimplicialLLT : public CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLLT<_MatrixType, _UpLo> > +{ + typedef CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLLT> Base; + using Base::m_cholmod; + + public: + + typedef _MatrixType MatrixType; + + CholmodSimplicialLLT() : Base() { init(); } + + CholmodSimplicialLLT(const MatrixType& matrix) : Base() + { + init(); + this->compute(matrix); + } + + ~CholmodSimplicialLLT() {} + protected: + void init() + { + m_cholmod.final_asis = 0; + m_cholmod.supernodal = CHOLMOD_SIMPLICIAL; + m_cholmod.final_ll = 1; + } +}; + + +/** \ingroup CholmodSupport_Module + * \class CholmodSimplicialLDLT + * \brief A simplicial direct Cholesky (LDLT) factorization and solver based on Cholmod + * + * This class allows to solve for A.X = B sparse linear problems via a simplicial LDL^T Cholesky factorization + * using the Cholmod library. + * This simplicial variant is equivalent to Eigen's built-in SimplicialLDLT class. Therefore, it has little practical interest. + * The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices + * X and B can be either dense or sparse. + * + * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<> + * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower + * or Upper. Default is Lower. + * + * \implsparsesolverconcept + * + * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. + * + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept, class CholmodSupernodalLLT, class SimplicialLDLT + */ +template +class CholmodSimplicialLDLT : public CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLDLT<_MatrixType, _UpLo> > +{ + typedef CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLDLT> Base; + using Base::m_cholmod; + + public: + + typedef _MatrixType MatrixType; + + CholmodSimplicialLDLT() : Base() { init(); } + + CholmodSimplicialLDLT(const MatrixType& matrix) : Base() + { + init(); + this->compute(matrix); + } + + ~CholmodSimplicialLDLT() {} + protected: + void init() + { + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_SIMPLICIAL; + } +}; + +/** \ingroup CholmodSupport_Module + * \class CholmodSupernodalLLT + * \brief A supernodal Cholesky (LLT) factorization and solver based on Cholmod + * + * This class allows to solve for A.X = B sparse linear problems via a supernodal LL^T Cholesky factorization + * using the Cholmod library. + * This supernodal variant performs best on dense enough problems, e.g., 3D FEM, or very high order 2D FEM. + * The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices + * X and B can be either dense or sparse. + * + * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<> + * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower + * or Upper. Default is Lower. + * + * \implsparsesolverconcept + * + * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. + * + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept + */ +template +class CholmodSupernodalLLT : public CholmodBase<_MatrixType, _UpLo, CholmodSupernodalLLT<_MatrixType, _UpLo> > +{ + typedef CholmodBase<_MatrixType, _UpLo, CholmodSupernodalLLT> Base; + using Base::m_cholmod; + + public: + + typedef _MatrixType MatrixType; + + CholmodSupernodalLLT() : Base() { init(); } + + CholmodSupernodalLLT(const MatrixType& matrix) : Base() + { + init(); + this->compute(matrix); + } + + ~CholmodSupernodalLLT() {} + protected: + void init() + { + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_SUPERNODAL; + } +}; + +/** \ingroup CholmodSupport_Module + * \class CholmodDecomposition + * \brief A general Cholesky factorization and solver based on Cholmod + * + * This class allows to solve for A.X = B sparse linear problems via a LL^T or LDL^T Cholesky factorization + * using the Cholmod library. The sparse matrix A must be selfadjoint and positive definite. The vectors or matrices + * X and B can be either dense or sparse. + * + * This variant permits to change the underlying Cholesky method at runtime. + * On the other hand, it does not provide access to the result of the factorization. + * The default is to let Cholmod automatically choose between a simplicial and supernodal factorization. + * + * \tparam _MatrixType the type of the sparse matrix A, it must be a SparseMatrix<> + * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower + * or Upper. Default is Lower. + * + * \implsparsesolverconcept + * + * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. + * + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept + */ +template +class CholmodDecomposition : public CholmodBase<_MatrixType, _UpLo, CholmodDecomposition<_MatrixType, _UpLo> > +{ + typedef CholmodBase<_MatrixType, _UpLo, CholmodDecomposition> Base; + using Base::m_cholmod; + + public: + + typedef _MatrixType MatrixType; + + CholmodDecomposition() : Base() { init(); } + + CholmodDecomposition(const MatrixType& matrix) : Base() + { + init(); + this->compute(matrix); + } + + ~CholmodDecomposition() {} + + void setMode(CholmodMode mode) + { + switch(mode) + { + case CholmodAuto: + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_AUTO; + break; + case CholmodSimplicialLLt: + m_cholmod.final_asis = 0; + m_cholmod.supernodal = CHOLMOD_SIMPLICIAL; + m_cholmod.final_ll = 1; + break; + case CholmodSupernodalLLt: + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_SUPERNODAL; + break; + case CholmodLDLt: + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_SIMPLICIAL; + break; + default: + break; + } + } + protected: + void init() + { + m_cholmod.final_asis = 1; + m_cholmod.supernodal = CHOLMOD_AUTO; + } +}; + +} // end namespace Eigen + +#endif // EIGEN_CHOLMODSUPPORT_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Array.h b/simulation/externals/eigen/Eigen/src/Core/Array.h new file mode 100644 index 0000000..e10020d --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Array.h @@ -0,0 +1,331 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ARRAY_H +#define EIGEN_ARRAY_H + +namespace Eigen { + +namespace internal { +template +struct traits > : traits > +{ + typedef ArrayXpr XprKind; + typedef ArrayBase > XprBase; +}; +} + +/** \class Array + * \ingroup Core_Module + * + * \brief General-purpose arrays with easy API for coefficient-wise operations + * + * The %Array class is very similar to the Matrix class. It provides + * general-purpose one- and two-dimensional arrays. The difference between the + * %Array and the %Matrix class is primarily in the API: the API for the + * %Array class provides easy access to coefficient-wise operations, while the + * API for the %Matrix class provides easy access to linear-algebra + * operations. + * + * See documentation of class Matrix for detailed information on the template parameters + * storage layout. + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_ARRAY_PLUGIN. + * + * \sa \blank \ref TutorialArrayClass, \ref TopicClassHierarchy + */ +template +class Array + : public PlainObjectBase > +{ + public: + + typedef PlainObjectBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Array) + + enum { Options = _Options }; + typedef typename Base::PlainObject PlainObject; + + protected: + template + friend struct internal::conservative_resize_like_impl; + + using Base::m_storage; + + public: + + using Base::base; + using Base::coeff; + using Base::coeffRef; + + /** + * The usage of + * using Base::operator=; + * fails on MSVC. Since the code below is working with GCC and MSVC, we skipped + * the usage of 'using'. This should be done only for operator=. + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array& operator=(const EigenBase &other) + { + return Base::operator=(other); + } + + /** Set all the entries to \a value. + * \sa DenseBase::setConstant(), DenseBase::fill() + */ + /* This overload is needed because the usage of + * using Base::operator=; + * fails on MSVC. Since the code below is working with GCC and MSVC, we skipped + * the usage of 'using'. This should be done only for operator=. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array& operator=(const Scalar &value) + { + Base::setConstant(value); + return *this; + } + + /** Copies the value of the expression \a other into \c *this with automatic resizing. + * + * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized), + * it will be initialized. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array& operator=(const DenseBase& other) + { + return Base::_set(other); + } + + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array& operator=(const Array& other) + { + return Base::_set(other); + } + + /** Default constructor. + * + * For fixed-size matrices, does nothing. + * + * For dynamic-size matrices, creates an empty matrix of size 0. Does not allocate any array. Such a matrix + * is called a null matrix. This constructor is the unique way to create null matrices: resizing + * a matrix to 0 is not supported. + * + * \sa resize(Index,Index) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array() : Base() + { + Base::_check_template_params(); + EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + } + +#ifndef EIGEN_PARSED_BY_DOXYGEN + // FIXME is it still needed ?? + /** \internal */ + EIGEN_DEVICE_FUNC + Array(internal::constructor_without_unaligned_array_assert) + : Base(internal::constructor_without_unaligned_array_assert()) + { + Base::_check_template_params(); + EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + } +#endif + +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + Array(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible::value) + : Base(std::move(other)) + { + Base::_check_template_params(); + if (RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic) + Base::_set_noalias(other); + } + EIGEN_DEVICE_FUNC + Array& operator=(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable::value) + { + other.swap(*this); + return *this; + } +#endif + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE explicit Array(const T& x) + { + Base::_check_template_params(); + Base::template _init1(x); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const T0& val0, const T1& val1) + { + Base::_check_template_params(); + this->template _init2(val0, val1); + } + #else + /** \brief Constructs a fixed-sized array initialized with coefficients starting at \a data */ + EIGEN_DEVICE_FUNC explicit Array(const Scalar *data); + /** Constructs a vector or row-vector with given dimension. \only_for_vectors + * + * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, + * it is redundant to pass the dimension here, so it makes more sense to use the default + * constructor Array() instead. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE explicit Array(Index dim); + /** constructs an initialized 1x1 Array with the given coefficient */ + Array(const Scalar& value); + /** constructs an uninitialized array with \a rows rows and \a cols columns. + * + * This is useful for dynamic-size arrays. For fixed-size arrays, + * it is redundant to pass these parameters, so one should use the default constructor + * Array() instead. */ + Array(Index rows, Index cols); + /** constructs an initialized 2D vector with given coefficients */ + Array(const Scalar& val0, const Scalar& val1); + #endif + + /** constructs an initialized 3D vector with given coefficients */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const Scalar& val0, const Scalar& val1, const Scalar& val2) + { + Base::_check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 3) + m_storage.data()[0] = val0; + m_storage.data()[1] = val1; + m_storage.data()[2] = val2; + } + /** constructs an initialized 4D vector with given coefficients */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const Scalar& val0, const Scalar& val1, const Scalar& val2, const Scalar& val3) + { + Base::_check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Array, 4) + m_storage.data()[0] = val0; + m_storage.data()[1] = val1; + m_storage.data()[2] = val2; + m_storage.data()[3] = val3; + } + + /** Copy constructor */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const Array& other) + : Base(other) + { } + + private: + struct PrivateType {}; + public: + + /** \sa MatrixBase::operator=(const EigenBase&) */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const EigenBase &other, + typename internal::enable_if::value, + PrivateType>::type = PrivateType()) + : Base(other.derived()) + { } + + EIGEN_DEVICE_FUNC inline Index innerStride() const { return 1; } + EIGEN_DEVICE_FUNC inline Index outerStride() const { return this->innerSize(); } + + #ifdef EIGEN_ARRAY_PLUGIN + #include EIGEN_ARRAY_PLUGIN + #endif + + private: + + template + friend struct internal::matrix_swap_impl; +}; + +/** \defgroup arraytypedefs Global array typedefs + * \ingroup Core_Module + * + * Eigen defines several typedef shortcuts for most common 1D and 2D array types. + * + * The general patterns are the following: + * + * \c ArrayRowsColsType where \c Rows and \c Cols can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size, + * and where \c Type can be \c i for integer, \c f for float, \c d for double, \c cf for complex float, \c cd + * for complex double. + * + * For example, \c Array33d is a fixed-size 3x3 array type of doubles, and \c ArrayXXf is a dynamic-size matrix of floats. + * + * There are also \c ArraySizeType which are self-explanatory. For example, \c Array4cf is + * a fixed-size 1D array of 4 complex floats. + * + * \sa class Array + */ + +#define EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ +/** \ingroup arraytypedefs */ \ +typedef Array Array##SizeSuffix##SizeSuffix##TypeSuffix; \ +/** \ingroup arraytypedefs */ \ +typedef Array Array##SizeSuffix##TypeSuffix; + +#define EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \ +/** \ingroup arraytypedefs */ \ +typedef Array Array##Size##X##TypeSuffix; \ +/** \ingroup arraytypedefs */ \ +typedef Array Array##X##Size##TypeSuffix; + +#define EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ +EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 2, 2) \ +EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 3, 3) \ +EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, 4, 4) \ +EIGEN_MAKE_ARRAY_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \ +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \ +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \ +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Type, TypeSuffix, 4) + +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(int, i) +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(float, f) +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(double, d) +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex, cf) +EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex, cd) + +#undef EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES +#undef EIGEN_MAKE_ARRAY_TYPEDEFS + +#undef EIGEN_MAKE_ARRAY_TYPEDEFS_LARGE + +#define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ +using Eigen::Matrix##SizeSuffix##TypeSuffix; \ +using Eigen::Vector##SizeSuffix##TypeSuffix; \ +using Eigen::RowVector##SizeSuffix##TypeSuffix; + +#define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(TypeSuffix) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \ + +#define EIGEN_USING_ARRAY_TYPEDEFS \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(i) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(f) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(d) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(cf) \ +EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE(cd) + +} // end namespace Eigen + +#endif // EIGEN_ARRAY_H diff --git a/simulation/externals/eigen/Eigen/src/Core/ArrayBase.h b/simulation/externals/eigen/Eigen/src/Core/ArrayBase.h new file mode 100644 index 0000000..3dbc708 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/ArrayBase.h @@ -0,0 +1,226 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ARRAYBASE_H +#define EIGEN_ARRAYBASE_H + +namespace Eigen { + +template class MatrixWrapper; + +/** \class ArrayBase + * \ingroup Core_Module + * + * \brief Base class for all 1D and 2D array, and related expressions + * + * An array is similar to a dense vector or matrix. While matrices are mathematical + * objects with well defined linear algebra operators, an array is just a collection + * of scalar values arranged in a one or two dimensionnal fashion. As the main consequence, + * all operations applied to an array are performed coefficient wise. Furthermore, + * arrays support scalar math functions of the c++ standard library (e.g., std::sin(x)), and convenient + * constructors allowing to easily write generic code working for both scalar values + * and arrays. + * + * This class is the base that is inherited by all array expression types. + * + * \tparam Derived is the derived type, e.g., an array or an expression type. + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_ARRAYBASE_PLUGIN. + * + * \sa class MatrixBase, \ref TopicClassHierarchy + */ +template class ArrayBase + : public DenseBase +{ + public: +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** The base class for a given storage type. */ + typedef ArrayBase StorageBaseType; + + typedef ArrayBase Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + + typedef DenseBase Base; + using Base::RowsAtCompileTime; + using Base::ColsAtCompileTime; + using Base::SizeAtCompileTime; + using Base::MaxRowsAtCompileTime; + using Base::MaxColsAtCompileTime; + using Base::MaxSizeAtCompileTime; + using Base::IsVectorAtCompileTime; + using Base::Flags; + + using Base::derived; + using Base::const_cast_derived; + using Base::rows; + using Base::cols; + using Base::size; + using Base::coeff; + using Base::coeffRef; + using Base::lazyAssign; + using Base::operator=; + using Base::operator+=; + using Base::operator-=; + using Base::operator*=; + using Base::operator/=; + + typedef typename Base::CoeffReturnType CoeffReturnType; + +#endif // not EIGEN_PARSED_BY_DOXYGEN + +#ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename Base::PlainObject PlainObject; + + /** \internal Represents a matrix with all coefficients equal to one another*/ + typedef CwiseNullaryOp,PlainObject> ConstantReturnType; +#endif // not EIGEN_PARSED_BY_DOXYGEN + +#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::ArrayBase +#define EIGEN_DOC_UNARY_ADDONS(X,Y) +# include "../plugins/CommonCwiseUnaryOps.h" +# include "../plugins/MatrixCwiseUnaryOps.h" +# include "../plugins/ArrayCwiseUnaryOps.h" +# include "../plugins/CommonCwiseBinaryOps.h" +# include "../plugins/MatrixCwiseBinaryOps.h" +# include "../plugins/ArrayCwiseBinaryOps.h" +# ifdef EIGEN_ARRAYBASE_PLUGIN +# include EIGEN_ARRAYBASE_PLUGIN +# endif +#undef EIGEN_CURRENT_STORAGE_BASE_CLASS +#undef EIGEN_DOC_UNARY_ADDONS + + /** Special case of the template operator=, in order to prevent the compiler + * from generating a default operator= (issue hit with g++ 4.1) + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator=(const ArrayBase& other) + { + internal::call_assignment(derived(), other.derived()); + return derived(); + } + + /** Set all the entries to \a value. + * \sa DenseBase::setConstant(), DenseBase::fill() */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator=(const Scalar &value) + { Base::setConstant(value); return derived(); } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator+=(const Scalar& scalar); + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator-=(const Scalar& scalar); + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator+=(const ArrayBase& other); + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator-=(const ArrayBase& other); + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator*=(const ArrayBase& other); + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator/=(const ArrayBase& other); + + public: + EIGEN_DEVICE_FUNC + ArrayBase& array() { return *this; } + EIGEN_DEVICE_FUNC + const ArrayBase& array() const { return *this; } + + /** \returns an \link Eigen::MatrixBase Matrix \endlink expression of this array + * \sa MatrixBase::array() */ + EIGEN_DEVICE_FUNC + MatrixWrapper matrix() { return MatrixWrapper(derived()); } + EIGEN_DEVICE_FUNC + const MatrixWrapper matrix() const { return MatrixWrapper(derived()); } + +// template +// inline void evalTo(Dest& dst) const { dst = matrix(); } + + protected: + EIGEN_DEVICE_FUNC + ArrayBase() : Base() {} + + private: + explicit ArrayBase(Index); + ArrayBase(Index,Index); + template explicit ArrayBase(const ArrayBase&); + protected: + // mixing arrays and matrices is not legal + template Derived& operator+=(const MatrixBase& ) + {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;} + // mixing arrays and matrices is not legal + template Derived& operator-=(const MatrixBase& ) + {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;} +}; + +/** replaces \c *this by \c *this - \a other. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & +ArrayBase::operator-=(const ArrayBase &other) +{ + call_assignment(derived(), other.derived(), internal::sub_assign_op()); + return derived(); +} + +/** replaces \c *this by \c *this + \a other. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & +ArrayBase::operator+=(const ArrayBase& other) +{ + call_assignment(derived(), other.derived(), internal::add_assign_op()); + return derived(); +} + +/** replaces \c *this by \c *this * \a other coefficient wise. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & +ArrayBase::operator*=(const ArrayBase& other) +{ + call_assignment(derived(), other.derived(), internal::mul_assign_op()); + return derived(); +} + +/** replaces \c *this by \c *this / \a other coefficient wise. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & +ArrayBase::operator/=(const ArrayBase& other) +{ + call_assignment(derived(), other.derived(), internal::div_assign_op()); + return derived(); +} + +} // end namespace Eigen + +#endif // EIGEN_ARRAYBASE_H diff --git a/simulation/externals/eigen/Eigen/src/Core/ArrayWrapper.h b/simulation/externals/eigen/Eigen/src/Core/ArrayWrapper.h new file mode 100644 index 0000000..688aadd --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/ArrayWrapper.h @@ -0,0 +1,209 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ARRAYWRAPPER_H +#define EIGEN_ARRAYWRAPPER_H + +namespace Eigen { + +/** \class ArrayWrapper + * \ingroup Core_Module + * + * \brief Expression of a mathematical vector or matrix as an array object + * + * This class is the return type of MatrixBase::array(), and most of the time + * this is the only way it is use. + * + * \sa MatrixBase::array(), class MatrixWrapper + */ + +namespace internal { +template +struct traits > + : public traits::type > +{ + typedef ArrayXpr XprKind; + // Let's remove NestByRefBit + enum { + Flags0 = traits::type >::Flags, + LvalueBitFlag = is_lvalue::value ? LvalueBit : 0, + Flags = (Flags0 & ~(NestByRefBit | LvalueBit)) | LvalueBitFlag + }; +}; +} + +template +class ArrayWrapper : public ArrayBase > +{ + public: + typedef ArrayBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper) + typedef typename internal::remove_all::type NestedExpression; + + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + + typedef typename internal::ref_selector::non_const_type NestedExpressionType; + + using Base::coeffRef; + + EIGEN_DEVICE_FUNC + explicit EIGEN_STRONG_INLINE ArrayWrapper(ExpressionType& matrix) : m_expression(matrix) {} + + EIGEN_DEVICE_FUNC + inline Index rows() const { return m_expression.rows(); } + EIGEN_DEVICE_FUNC + inline Index cols() const { return m_expression.cols(); } + EIGEN_DEVICE_FUNC + inline Index outerStride() const { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC + inline Index innerStride() const { return m_expression.innerStride(); } + + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + EIGEN_DEVICE_FUNC + inline const Scalar* data() const { return m_expression.data(); } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const + { + return m_expression.coeffRef(rowId, colId); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index index) const + { + return m_expression.coeffRef(index); + } + + template + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& dst) const { dst = m_expression; } + + const typename internal::remove_all::type& + EIGEN_DEVICE_FUNC + nestedExpression() const + { + return m_expression; + } + + /** Forwards the resizing request to the nested expression + * \sa DenseBase::resize(Index) */ + EIGEN_DEVICE_FUNC + void resize(Index newSize) { m_expression.resize(newSize); } + /** Forwards the resizing request to the nested expression + * \sa DenseBase::resize(Index,Index)*/ + EIGEN_DEVICE_FUNC + void resize(Index rows, Index cols) { m_expression.resize(rows,cols); } + + protected: + NestedExpressionType m_expression; +}; + +/** \class MatrixWrapper + * \ingroup Core_Module + * + * \brief Expression of an array as a mathematical vector or matrix + * + * This class is the return type of ArrayBase::matrix(), and most of the time + * this is the only way it is use. + * + * \sa MatrixBase::matrix(), class ArrayWrapper + */ + +namespace internal { +template +struct traits > + : public traits::type > +{ + typedef MatrixXpr XprKind; + // Let's remove NestByRefBit + enum { + Flags0 = traits::type >::Flags, + LvalueBitFlag = is_lvalue::value ? LvalueBit : 0, + Flags = (Flags0 & ~(NestByRefBit | LvalueBit)) | LvalueBitFlag + }; +}; +} + +template +class MatrixWrapper : public MatrixBase > +{ + public: + typedef MatrixBase > Base; + EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper) + typedef typename internal::remove_all::type NestedExpression; + + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + + typedef typename internal::ref_selector::non_const_type NestedExpressionType; + + using Base::coeffRef; + + EIGEN_DEVICE_FUNC + explicit inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {} + + EIGEN_DEVICE_FUNC + inline Index rows() const { return m_expression.rows(); } + EIGEN_DEVICE_FUNC + inline Index cols() const { return m_expression.cols(); } + EIGEN_DEVICE_FUNC + inline Index outerStride() const { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC + inline Index innerStride() const { return m_expression.innerStride(); } + + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + EIGEN_DEVICE_FUNC + inline const Scalar* data() const { return m_expression.data(); } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const + { + return m_expression.derived().coeffRef(rowId, colId); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index index) const + { + return m_expression.coeffRef(index); + } + + EIGEN_DEVICE_FUNC + const typename internal::remove_all::type& + nestedExpression() const + { + return m_expression; + } + + /** Forwards the resizing request to the nested expression + * \sa DenseBase::resize(Index) */ + EIGEN_DEVICE_FUNC + void resize(Index newSize) { m_expression.resize(newSize); } + /** Forwards the resizing request to the nested expression + * \sa DenseBase::resize(Index,Index)*/ + EIGEN_DEVICE_FUNC + void resize(Index rows, Index cols) { m_expression.resize(rows,cols); } + + protected: + NestedExpressionType m_expression; +}; + +} // end namespace Eigen + +#endif // EIGEN_ARRAYWRAPPER_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Assign.h b/simulation/externals/eigen/Eigen/src/Core/Assign.h new file mode 100644 index 0000000..53806ba --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Assign.h @@ -0,0 +1,90 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007 Michael Olbrich +// Copyright (C) 2006-2010 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ASSIGN_H +#define EIGEN_ASSIGN_H + +namespace Eigen { + +template +template +EIGEN_STRONG_INLINE Derived& DenseBase + ::lazyAssign(const DenseBase& other) +{ + enum{ + SameType = internal::is_same::value + }; + + EIGEN_STATIC_ASSERT_LVALUE(Derived) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived) + EIGEN_STATIC_ASSERT(SameType,YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) + + eigen_assert(rows() == other.rows() && cols() == other.cols()); + internal::call_assignment_no_alias(derived(),other.derived()); + + return derived(); +} + +template +template +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) +{ + internal::call_assignment(derived(), other.derived()); + return derived(); +} + +template +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) +{ + internal::call_assignment(derived(), other.derived()); + return derived(); +} + +template +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const MatrixBase& other) +{ + internal::call_assignment(derived(), other.derived()); + return derived(); +} + +template +template +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const DenseBase& other) +{ + internal::call_assignment(derived(), other.derived()); + return derived(); +} + +template +template +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const EigenBase& other) +{ + internal::call_assignment(derived(), other.derived()); + return derived(); +} + +template +template +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const ReturnByValue& other) +{ + other.derived().evalTo(derived()); + return derived(); +} + +} // end namespace Eigen + +#endif // EIGEN_ASSIGN_H diff --git a/simulation/externals/eigen/Eigen/src/Core/AssignEvaluator.h b/simulation/externals/eigen/Eigen/src/Core/AssignEvaluator.h new file mode 100644 index 0000000..b0ec7b7 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/AssignEvaluator.h @@ -0,0 +1,935 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Benoit Jacob +// Copyright (C) 2011-2014 Gael Guennebaud +// Copyright (C) 2011-2012 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ASSIGN_EVALUATOR_H +#define EIGEN_ASSIGN_EVALUATOR_H + +namespace Eigen { + +// This implementation is based on Assign.h + +namespace internal { + +/*************************************************************************** +* Part 1 : the logic deciding a strategy for traversal and unrolling * +***************************************************************************/ + +// copy_using_evaluator_traits is based on assign_traits + +template +struct copy_using_evaluator_traits +{ + typedef typename DstEvaluator::XprType Dst; + typedef typename Dst::Scalar DstScalar; + + enum { + DstFlags = DstEvaluator::Flags, + SrcFlags = SrcEvaluator::Flags + }; + +public: + enum { + DstAlignment = DstEvaluator::Alignment, + SrcAlignment = SrcEvaluator::Alignment, + DstHasDirectAccess = DstFlags & DirectAccessBit, + JointAlignment = EIGEN_PLAIN_ENUM_MIN(DstAlignment,SrcAlignment) + }; + +private: + enum { + InnerSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::SizeAtCompileTime) + : int(DstFlags)&RowMajorBit ? int(Dst::ColsAtCompileTime) + : int(Dst::RowsAtCompileTime), + InnerMaxSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::MaxSizeAtCompileTime) + : int(DstFlags)&RowMajorBit ? int(Dst::MaxColsAtCompileTime) + : int(Dst::MaxRowsAtCompileTime), + OuterStride = int(outer_stride_at_compile_time::ret), + MaxSizeAtCompileTime = Dst::SizeAtCompileTime + }; + + // TODO distinguish between linear traversal and inner-traversals + typedef typename find_best_packet::type LinearPacketType; + typedef typename find_best_packet::type InnerPacketType; + + enum { + LinearPacketSize = unpacket_traits::size, + InnerPacketSize = unpacket_traits::size + }; + +public: + enum { + LinearRequiredAlignment = unpacket_traits::alignment, + InnerRequiredAlignment = unpacket_traits::alignment + }; + +private: + enum { + DstIsRowMajor = DstFlags&RowMajorBit, + SrcIsRowMajor = SrcFlags&RowMajorBit, + StorageOrdersAgree = (int(DstIsRowMajor) == int(SrcIsRowMajor)), + MightVectorize = bool(StorageOrdersAgree) + && (int(DstFlags) & int(SrcFlags) & ActualPacketAccessBit) + && bool(functor_traits::PacketAccess), + MayInnerVectorize = MightVectorize + && int(InnerSize)!=Dynamic && int(InnerSize)%int(InnerPacketSize)==0 + && int(OuterStride)!=Dynamic && int(OuterStride)%int(InnerPacketSize)==0 + && (EIGEN_UNALIGNED_VECTORIZE || int(JointAlignment)>=int(InnerRequiredAlignment)), + MayLinearize = bool(StorageOrdersAgree) && (int(DstFlags) & int(SrcFlags) & LinearAccessBit), + MayLinearVectorize = bool(MightVectorize) && MayLinearize && DstHasDirectAccess + && (EIGEN_UNALIGNED_VECTORIZE || (int(DstAlignment)>=int(LinearRequiredAlignment)) || MaxSizeAtCompileTime == Dynamic), + /* If the destination isn't aligned, we have to do runtime checks and we don't unroll, + so it's only good for large enough sizes. */ + MaySliceVectorize = bool(MightVectorize) && bool(DstHasDirectAccess) + && (int(InnerMaxSize)==Dynamic || int(InnerMaxSize)>=(EIGEN_UNALIGNED_VECTORIZE?InnerPacketSize:(3*InnerPacketSize))) + /* slice vectorization can be slow, so we only want it if the slices are big, which is + indicated by InnerMaxSize rather than InnerSize, think of the case of a dynamic block + in a fixed-size matrix + However, with EIGEN_UNALIGNED_VECTORIZE and unrolling, slice vectorization is still worth it */ + }; + +public: + enum { + Traversal = int(MayLinearVectorize) && (LinearPacketSize>InnerPacketSize) ? int(LinearVectorizedTraversal) + : int(MayInnerVectorize) ? int(InnerVectorizedTraversal) + : int(MayLinearVectorize) ? int(LinearVectorizedTraversal) + : int(MaySliceVectorize) ? int(SliceVectorizedTraversal) + : int(MayLinearize) ? int(LinearTraversal) + : int(DefaultTraversal), + Vectorized = int(Traversal) == InnerVectorizedTraversal + || int(Traversal) == LinearVectorizedTraversal + || int(Traversal) == SliceVectorizedTraversal + }; + + typedef typename conditional::type PacketType; + +private: + enum { + ActualPacketSize = int(Traversal)==LinearVectorizedTraversal ? LinearPacketSize + : Vectorized ? InnerPacketSize + : 1, + UnrollingLimit = EIGEN_UNROLLING_LIMIT * ActualPacketSize, + MayUnrollCompletely = int(Dst::SizeAtCompileTime) != Dynamic + && int(Dst::SizeAtCompileTime) * (int(DstEvaluator::CoeffReadCost)+int(SrcEvaluator::CoeffReadCost)) <= int(UnrollingLimit), + MayUnrollInner = int(InnerSize) != Dynamic + && int(InnerSize) * (int(DstEvaluator::CoeffReadCost)+int(SrcEvaluator::CoeffReadCost)) <= int(UnrollingLimit) + }; + +public: + enum { + Unrolling = (int(Traversal) == int(InnerVectorizedTraversal) || int(Traversal) == int(DefaultTraversal)) + ? ( + int(MayUnrollCompletely) ? int(CompleteUnrolling) + : int(MayUnrollInner) ? int(InnerUnrolling) + : int(NoUnrolling) + ) + : int(Traversal) == int(LinearVectorizedTraversal) + ? ( bool(MayUnrollCompletely) && ( EIGEN_UNALIGNED_VECTORIZE || (int(DstAlignment)>=int(LinearRequiredAlignment))) + ? int(CompleteUnrolling) + : int(NoUnrolling) ) + : int(Traversal) == int(LinearTraversal) + ? ( bool(MayUnrollCompletely) ? int(CompleteUnrolling) + : int(NoUnrolling) ) +#if EIGEN_UNALIGNED_VECTORIZE + : int(Traversal) == int(SliceVectorizedTraversal) + ? ( bool(MayUnrollInner) ? int(InnerUnrolling) + : int(NoUnrolling) ) +#endif + : int(NoUnrolling) + }; + +#ifdef EIGEN_DEBUG_ASSIGN + static void debug() + { + std::cerr << "DstXpr: " << typeid(typename DstEvaluator::XprType).name() << std::endl; + std::cerr << "SrcXpr: " << typeid(typename SrcEvaluator::XprType).name() << std::endl; + std::cerr.setf(std::ios::hex, std::ios::basefield); + std::cerr << "DstFlags" << " = " << DstFlags << " (" << demangle_flags(DstFlags) << " )" << std::endl; + std::cerr << "SrcFlags" << " = " << SrcFlags << " (" << demangle_flags(SrcFlags) << " )" << std::endl; + std::cerr.unsetf(std::ios::hex); + EIGEN_DEBUG_VAR(DstAlignment) + EIGEN_DEBUG_VAR(SrcAlignment) + EIGEN_DEBUG_VAR(LinearRequiredAlignment) + EIGEN_DEBUG_VAR(InnerRequiredAlignment) + EIGEN_DEBUG_VAR(JointAlignment) + EIGEN_DEBUG_VAR(InnerSize) + EIGEN_DEBUG_VAR(InnerMaxSize) + EIGEN_DEBUG_VAR(LinearPacketSize) + EIGEN_DEBUG_VAR(InnerPacketSize) + EIGEN_DEBUG_VAR(ActualPacketSize) + EIGEN_DEBUG_VAR(StorageOrdersAgree) + EIGEN_DEBUG_VAR(MightVectorize) + EIGEN_DEBUG_VAR(MayLinearize) + EIGEN_DEBUG_VAR(MayInnerVectorize) + EIGEN_DEBUG_VAR(MayLinearVectorize) + EIGEN_DEBUG_VAR(MaySliceVectorize) + std::cerr << "Traversal" << " = " << Traversal << " (" << demangle_traversal(Traversal) << ")" << std::endl; + EIGEN_DEBUG_VAR(SrcEvaluator::CoeffReadCost) + EIGEN_DEBUG_VAR(UnrollingLimit) + EIGEN_DEBUG_VAR(MayUnrollCompletely) + EIGEN_DEBUG_VAR(MayUnrollInner) + std::cerr << "Unrolling" << " = " << Unrolling << " (" << demangle_unrolling(Unrolling) << ")" << std::endl; + std::cerr << std::endl; + } +#endif +}; + +/*************************************************************************** +* Part 2 : meta-unrollers +***************************************************************************/ + +/************************ +*** Default traversal *** +************************/ + +template +struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling +{ + // FIXME: this is not very clean, perhaps this information should be provided by the kernel? + typedef typename Kernel::DstEvaluatorType DstEvaluatorType; + typedef typename DstEvaluatorType::XprType DstXprType; + + enum { + outer = Index / DstXprType::InnerSizeAtCompileTime, + inner = Index % DstXprType::InnerSizeAtCompileTime + }; + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + kernel.assignCoeffByOuterInner(outer, inner); + copy_using_evaluator_DefaultTraversal_CompleteUnrolling::run(kernel); + } +}; + +template +struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { } +}; + +template +struct copy_using_evaluator_DefaultTraversal_InnerUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, Index outer) + { + kernel.assignCoeffByOuterInner(outer, Index_); + copy_using_evaluator_DefaultTraversal_InnerUnrolling::run(kernel, outer); + } +}; + +template +struct copy_using_evaluator_DefaultTraversal_InnerUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&, Index) { } +}; + +/*********************** +*** Linear traversal *** +***********************/ + +template +struct copy_using_evaluator_LinearTraversal_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel& kernel) + { + kernel.assignCoeff(Index); + copy_using_evaluator_LinearTraversal_CompleteUnrolling::run(kernel); + } +}; + +template +struct copy_using_evaluator_LinearTraversal_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { } +}; + +/************************** +*** Inner vectorization *** +**************************/ + +template +struct copy_using_evaluator_innervec_CompleteUnrolling +{ + // FIXME: this is not very clean, perhaps this information should be provided by the kernel? + typedef typename Kernel::DstEvaluatorType DstEvaluatorType; + typedef typename DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::PacketType PacketType; + + enum { + outer = Index / DstXprType::InnerSizeAtCompileTime, + inner = Index % DstXprType::InnerSizeAtCompileTime, + SrcAlignment = Kernel::AssignmentTraits::SrcAlignment, + DstAlignment = Kernel::AssignmentTraits::DstAlignment + }; + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + kernel.template assignPacketByOuterInner(outer, inner); + enum { NextIndex = Index + unpacket_traits::size }; + copy_using_evaluator_innervec_CompleteUnrolling::run(kernel); + } +}; + +template +struct copy_using_evaluator_innervec_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { } +}; + +template +struct copy_using_evaluator_innervec_InnerUnrolling +{ + typedef typename Kernel::PacketType PacketType; + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, Index outer) + { + kernel.template assignPacketByOuterInner(outer, Index_); + enum { NextIndex = Index_ + unpacket_traits::size }; + copy_using_evaluator_innervec_InnerUnrolling::run(kernel, outer); + } +}; + +template +struct copy_using_evaluator_innervec_InnerUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &, Index) { } +}; + +/*************************************************************************** +* Part 3 : implementation of all cases +***************************************************************************/ + +// dense_assignment_loop is based on assign_impl + +template +struct dense_assignment_loop; + +/************************ +*** Default traversal *** +************************/ + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static void EIGEN_STRONG_INLINE run(Kernel &kernel) + { + for(Index outer = 0; outer < kernel.outerSize(); ++outer) { + for(Index inner = 0; inner < kernel.innerSize(); ++inner) { + kernel.assignCoeffByOuterInner(outer, inner); + } + } + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + copy_using_evaluator_DefaultTraversal_CompleteUnrolling::run(kernel); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + + const Index outerSize = kernel.outerSize(); + for(Index outer = 0; outer < outerSize; ++outer) + copy_using_evaluator_DefaultTraversal_InnerUnrolling::run(kernel, outer); + } +}; + +/*************************** +*** Linear vectorization *** +***************************/ + + +// The goal of unaligned_dense_assignment_loop is simply to factorize the handling +// of the non vectorizable beginning and ending parts + +template +struct unaligned_dense_assignment_loop +{ + // if IsAligned = true, then do nothing + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&, Index, Index) {} +}; + +template <> +struct unaligned_dense_assignment_loop +{ + // MSVC must not inline this functions. If it does, it fails to optimize the + // packet access path. + // FIXME check which version exhibits this issue +#if EIGEN_COMP_MSVC + template + static EIGEN_DONT_INLINE void run(Kernel &kernel, + Index start, + Index end) +#else + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, + Index start, + Index end) +#endif + { + for (Index index = start; index < end; ++index) + kernel.assignCoeff(index); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + const Index size = kernel.size(); + typedef typename Kernel::Scalar Scalar; + typedef typename Kernel::PacketType PacketType; + enum { + requestedAlignment = Kernel::AssignmentTraits::LinearRequiredAlignment, + packetSize = unpacket_traits::size, + dstIsAligned = int(Kernel::AssignmentTraits::DstAlignment)>=int(requestedAlignment), + dstAlignment = packet_traits::AlignedOnScalar ? int(requestedAlignment) + : int(Kernel::AssignmentTraits::DstAlignment), + srcAlignment = Kernel::AssignmentTraits::JointAlignment + }; + const Index alignedStart = dstIsAligned ? 0 : internal::first_aligned(kernel.dstDataPtr(), size); + const Index alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize; + + unaligned_dense_assignment_loop::run(kernel, 0, alignedStart); + + for(Index index = alignedStart; index < alignedEnd; index += packetSize) + kernel.template assignPacket(index); + + unaligned_dense_assignment_loop<>::run(kernel, alignedEnd, size); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::PacketType PacketType; + + enum { size = DstXprType::SizeAtCompileTime, + packetSize =unpacket_traits::size, + alignedSize = (size/packetSize)*packetSize }; + + copy_using_evaluator_innervec_CompleteUnrolling::run(kernel); + copy_using_evaluator_DefaultTraversal_CompleteUnrolling::run(kernel); + } +}; + +/************************** +*** Inner vectorization *** +**************************/ + +template +struct dense_assignment_loop +{ + typedef typename Kernel::PacketType PacketType; + enum { + SrcAlignment = Kernel::AssignmentTraits::SrcAlignment, + DstAlignment = Kernel::AssignmentTraits::DstAlignment + }; + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + const Index innerSize = kernel.innerSize(); + const Index outerSize = kernel.outerSize(); + const Index packetSize = unpacket_traits::size; + for(Index outer = 0; outer < outerSize; ++outer) + for(Index inner = 0; inner < innerSize; inner+=packetSize) + kernel.template assignPacketByOuterInner(outer, inner); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + copy_using_evaluator_innervec_CompleteUnrolling::run(kernel); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::AssignmentTraits Traits; + const Index outerSize = kernel.outerSize(); + for(Index outer = 0; outer < outerSize; ++outer) + copy_using_evaluator_innervec_InnerUnrolling::run(kernel, outer); + } +}; + +/*********************** +*** Linear traversal *** +***********************/ + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + const Index size = kernel.size(); + for(Index i = 0; i < size; ++i) + kernel.assignCoeff(i); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + copy_using_evaluator_LinearTraversal_CompleteUnrolling::run(kernel); + } +}; + +/************************** +*** Slice vectorization *** +***************************/ + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::Scalar Scalar; + typedef typename Kernel::PacketType PacketType; + enum { + packetSize = unpacket_traits::size, + requestedAlignment = int(Kernel::AssignmentTraits::InnerRequiredAlignment), + alignable = packet_traits::AlignedOnScalar || int(Kernel::AssignmentTraits::DstAlignment)>=sizeof(Scalar), + dstIsAligned = int(Kernel::AssignmentTraits::DstAlignment)>=int(requestedAlignment), + dstAlignment = alignable ? int(requestedAlignment) + : int(Kernel::AssignmentTraits::DstAlignment) + }; + const Scalar *dst_ptr = kernel.dstDataPtr(); + if((!bool(dstIsAligned)) && (UIntPtr(dst_ptr) % sizeof(Scalar))>0) + { + // the pointer is not aligend-on scalar, so alignment is not possible + return dense_assignment_loop::run(kernel); + } + const Index packetAlignedMask = packetSize - 1; + const Index innerSize = kernel.innerSize(); + const Index outerSize = kernel.outerSize(); + const Index alignedStep = alignable ? (packetSize - kernel.outerStride() % packetSize) & packetAlignedMask : 0; + Index alignedStart = ((!alignable) || bool(dstIsAligned)) ? 0 : internal::first_aligned(dst_ptr, innerSize); + + for(Index outer = 0; outer < outerSize; ++outer) + { + const Index alignedEnd = alignedStart + ((innerSize-alignedStart) & ~packetAlignedMask); + // do the non-vectorizable part of the assignment + for(Index inner = 0; inner(outer, inner); + + // do the non-vectorizable part of the assignment + for(Index inner = alignedEnd; inner +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::PacketType PacketType; + + enum { size = DstXprType::InnerSizeAtCompileTime, + packetSize =unpacket_traits::size, + vectorizableSize = (size/packetSize)*packetSize }; + + for(Index outer = 0; outer < kernel.outerSize(); ++outer) + { + copy_using_evaluator_innervec_InnerUnrolling::run(kernel, outer); + copy_using_evaluator_DefaultTraversal_InnerUnrolling::run(kernel, outer); + } + } +}; +#endif + + +/*************************************************************************** +* Part 4 : Generic dense assignment kernel +***************************************************************************/ + +// This class generalize the assignment of a coefficient (or packet) from one dense evaluator +// to another dense writable evaluator. +// It is parametrized by the two evaluators, and the actual assignment functor. +// This abstraction level permits to keep the evaluation loops as simple and as generic as possible. +// One can customize the assignment using this generic dense_assignment_kernel with different +// functors, or by completely overloading it, by-passing a functor. +template +class generic_dense_assignment_kernel +{ +protected: + typedef typename DstEvaluatorTypeT::XprType DstXprType; + typedef typename SrcEvaluatorTypeT::XprType SrcXprType; +public: + + typedef DstEvaluatorTypeT DstEvaluatorType; + typedef SrcEvaluatorTypeT SrcEvaluatorType; + typedef typename DstEvaluatorType::Scalar Scalar; + typedef copy_using_evaluator_traits AssignmentTraits; + typedef typename AssignmentTraits::PacketType PacketType; + + + EIGEN_DEVICE_FUNC generic_dense_assignment_kernel(DstEvaluatorType &dst, const SrcEvaluatorType &src, const Functor &func, DstXprType& dstExpr) + : m_dst(dst), m_src(src), m_functor(func), m_dstExpr(dstExpr) + { + #ifdef EIGEN_DEBUG_ASSIGN + AssignmentTraits::debug(); + #endif + } + + EIGEN_DEVICE_FUNC Index size() const { return m_dstExpr.size(); } + EIGEN_DEVICE_FUNC Index innerSize() const { return m_dstExpr.innerSize(); } + EIGEN_DEVICE_FUNC Index outerSize() const { return m_dstExpr.outerSize(); } + EIGEN_DEVICE_FUNC Index rows() const { return m_dstExpr.rows(); } + EIGEN_DEVICE_FUNC Index cols() const { return m_dstExpr.cols(); } + EIGEN_DEVICE_FUNC Index outerStride() const { return m_dstExpr.outerStride(); } + + EIGEN_DEVICE_FUNC DstEvaluatorType& dstEvaluator() { return m_dst; } + EIGEN_DEVICE_FUNC const SrcEvaluatorType& srcEvaluator() const { return m_src; } + + /// Assign src(row,col) to dst(row,col) through the assignment functor. + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Index row, Index col) + { + m_functor.assignCoeff(m_dst.coeffRef(row,col), m_src.coeff(row,col)); + } + + /// \sa assignCoeff(Index,Index) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Index index) + { + m_functor.assignCoeff(m_dst.coeffRef(index), m_src.coeff(index)); + } + + /// \sa assignCoeff(Index,Index) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeffByOuterInner(Index outer, Index inner) + { + Index row = rowIndexByOuterInner(outer, inner); + Index col = colIndexByOuterInner(outer, inner); + assignCoeff(row, col); + } + + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacket(Index row, Index col) + { + m_functor.template assignPacket(&m_dst.coeffRef(row,col), m_src.template packet(row,col)); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacket(Index index) + { + m_functor.template assignPacket(&m_dst.coeffRef(index), m_src.template packet(index)); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacketByOuterInner(Index outer, Index inner) + { + Index row = rowIndexByOuterInner(outer, inner); + Index col = colIndexByOuterInner(outer, inner); + assignPacket(row, col); + } + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Index rowIndexByOuterInner(Index outer, Index inner) + { + typedef typename DstEvaluatorType::ExpressionTraits Traits; + return int(Traits::RowsAtCompileTime) == 1 ? 0 + : int(Traits::ColsAtCompileTime) == 1 ? inner + : int(DstEvaluatorType::Flags)&RowMajorBit ? outer + : inner; + } + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Index colIndexByOuterInner(Index outer, Index inner) + { + typedef typename DstEvaluatorType::ExpressionTraits Traits; + return int(Traits::ColsAtCompileTime) == 1 ? 0 + : int(Traits::RowsAtCompileTime) == 1 ? inner + : int(DstEvaluatorType::Flags)&RowMajorBit ? inner + : outer; + } + + EIGEN_DEVICE_FUNC const Scalar* dstDataPtr() const + { + return m_dstExpr.data(); + } + +protected: + DstEvaluatorType& m_dst; + const SrcEvaluatorType& m_src; + const Functor &m_functor; + // TODO find a way to avoid the needs of the original expression + DstXprType& m_dstExpr; +}; + +/*************************************************************************** +* Part 5 : Entry point for dense rectangular assignment +***************************************************************************/ + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void resize_if_allowed(DstXprType &dst, const SrcXprType& src, const Functor &/*func*/) +{ + EIGEN_ONLY_USED_FOR_DEBUG(dst); + EIGEN_ONLY_USED_FOR_DEBUG(src); + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void resize_if_allowed(DstXprType &dst, const SrcXprType& src, const internal::assign_op &/*func*/) +{ + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if(((dst.rows()!=dstRows) || (dst.cols()!=dstCols))) + dst.resize(dstRows, dstCols); + eigen_assert(dst.rows() == dstRows && dst.cols() == dstCols); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src, const Functor &func) +{ + typedef evaluator DstEvaluatorType; + typedef evaluator SrcEvaluatorType; + + SrcEvaluatorType srcEvaluator(src); + + // NOTE To properly handle A = (A*A.transpose())/s with A rectangular, + // we need to resize the destination after the source evaluator has been created. + resize_if_allowed(dst, src, func); + + DstEvaluatorType dstEvaluator(dst); + + typedef generic_dense_assignment_kernel Kernel; + Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived()); + + dense_assignment_loop::run(kernel); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src) +{ + call_dense_assignment_loop(dst, src, internal::assign_op()); +} + +/*************************************************************************** +* Part 6 : Generic assignment +***************************************************************************/ + +// Based on the respective shapes of the destination and source, +// the class AssignmentKind determine the kind of assignment mechanism. +// AssignmentKind must define a Kind typedef. +template struct AssignmentKind; + +// Assignement kind defined in this file: +struct Dense2Dense {}; +struct EigenBase2EigenBase {}; + +template struct AssignmentKind { typedef EigenBase2EigenBase Kind; }; +template<> struct AssignmentKind { typedef Dense2Dense Kind; }; + +// This is the main assignment class +template< typename DstXprType, typename SrcXprType, typename Functor, + typename Kind = typename AssignmentKind< typename evaluator_traits::Shape , typename evaluator_traits::Shape >::Kind, + typename EnableIf = void> +struct Assignment; + + +// The only purpose of this call_assignment() function is to deal with noalias() / "assume-aliasing" and automatic transposition. +// Indeed, I (Gael) think that this concept of "assume-aliasing" was a mistake, and it makes thing quite complicated. +// So this intermediate function removes everything related to "assume-aliasing" such that Assignment +// does not has to bother about these annoying details. + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(Dst& dst, const Src& src) +{ + call_assignment(dst, src, internal::assign_op()); +} +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(const Dst& dst, const Src& src) +{ + call_assignment(dst, src, internal::assign_op()); +} + +// Deal with "assume-aliasing" +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if< evaluator_assume_aliasing::value, void*>::type = 0) +{ + typename plain_matrix_type::type tmp(src); + call_assignment_no_alias(dst, tmp, func); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if::value, void*>::type = 0) +{ + call_assignment_no_alias(dst, src, func); +} + +// by-pass "assume-aliasing" +// When there is no aliasing, we require that 'dst' has been properly resized +template class StorageBase, typename Src, typename Func> +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(NoAlias& dst, const Src& src, const Func& func) +{ + call_assignment_no_alias(dst.expression(), src, func); +} + + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias(Dst& dst, const Src& src, const Func& func) +{ + enum { + NeedToTranspose = ( (int(Dst::RowsAtCompileTime) == 1 && int(Src::ColsAtCompileTime) == 1) + || (int(Dst::ColsAtCompileTime) == 1 && int(Src::RowsAtCompileTime) == 1) + ) && int(Dst::SizeAtCompileTime) != 1 + }; + + typedef typename internal::conditional, Dst>::type ActualDstTypeCleaned; + typedef typename internal::conditional, Dst&>::type ActualDstType; + ActualDstType actualDst(dst); + + // TODO check whether this is the right place to perform these checks: + EIGEN_STATIC_ASSERT_LVALUE(Dst) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(ActualDstTypeCleaned,Src) + EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar); + + Assignment::run(actualDst, src, func); +} +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias(Dst& dst, const Src& src) +{ + call_assignment_no_alias(dst, src, internal::assign_op()); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias_no_transpose(Dst& dst, const Src& src, const Func& func) +{ + // TODO check whether this is the right place to perform these checks: + EIGEN_STATIC_ASSERT_LVALUE(Dst) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Dst,Src) + EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename Dst::Scalar,typename Src::Scalar); + + Assignment::run(dst, src, func); +} +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias_no_transpose(Dst& dst, const Src& src) +{ + call_assignment_no_alias_no_transpose(dst, src, internal::assign_op()); +} + +// forward declaration +template void check_for_aliasing(const Dst &dst, const Src &src); + +// Generic Dense to Dense assignment +// Note that the last template argument "Weak" is needed to make it possible to perform +// both partial specialization+SFINAE without ambiguous specialization +template< typename DstXprType, typename SrcXprType, typename Functor, typename Weak> +struct Assignment +{ + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const Functor &func) + { +#ifndef EIGEN_NO_DEBUG + internal::check_for_aliasing(dst, src); +#endif + + call_dense_assignment_loop(dst, src, func); + } +}; + +// Generic assignment through evalTo. +// TODO: not sure we have to keep that one, but it helps porting current code to new evaluator mechanism. +// Note that the last template argument "Weak" is needed to make it possible to perform +// both partial specialization+SFINAE without ambiguous specialization +template< typename DstXprType, typename SrcXprType, typename Functor, typename Weak> +struct Assignment +{ + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + src.evalTo(dst); + } + + // NOTE The following two functions are templated to avoid their instanciation if not needed + // This is needed because some expressions supports evalTo only and/or have 'void' as scalar type. + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + src.addTo(dst); + } + + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + src.subTo(dst); + } +}; + +} // namespace internal + +} // end namespace Eigen + +#endif // EIGEN_ASSIGN_EVALUATOR_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Assign_MKL.h b/simulation/externals/eigen/Eigen/src/Core/Assign_MKL.h new file mode 100644 index 0000000..6c2ab92 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Assign_MKL.h @@ -0,0 +1,176 @@ +/* + Copyright (c) 2011, Intel Corporation. All rights reserved. + Copyright (C) 2015 Gael Guennebaud + + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + * Neither the name of Intel Corporation nor the names of its contributors may + be used to endorse or promote products derived from this software without + specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + ******************************************************************************** + * Content : Eigen bindings to Intel(R) MKL + * MKL VML support for coefficient-wise unary Eigen expressions like a=b.sin() + ******************************************************************************** +*/ + +#ifndef EIGEN_ASSIGN_VML_H +#define EIGEN_ASSIGN_VML_H + +namespace Eigen { + +namespace internal { + +template +class vml_assign_traits +{ + private: + enum { + DstHasDirectAccess = Dst::Flags & DirectAccessBit, + SrcHasDirectAccess = Src::Flags & DirectAccessBit, + StorageOrdersAgree = (int(Dst::IsRowMajor) == int(Src::IsRowMajor)), + InnerSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::SizeAtCompileTime) + : int(Dst::Flags)&RowMajorBit ? int(Dst::ColsAtCompileTime) + : int(Dst::RowsAtCompileTime), + InnerMaxSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::MaxSizeAtCompileTime) + : int(Dst::Flags)&RowMajorBit ? int(Dst::MaxColsAtCompileTime) + : int(Dst::MaxRowsAtCompileTime), + MaxSizeAtCompileTime = Dst::SizeAtCompileTime, + + MightEnableVml = StorageOrdersAgree && DstHasDirectAccess && SrcHasDirectAccess && Src::InnerStrideAtCompileTime==1 && Dst::InnerStrideAtCompileTime==1, + MightLinearize = MightEnableVml && (int(Dst::Flags) & int(Src::Flags) & LinearAccessBit), + VmlSize = MightLinearize ? MaxSizeAtCompileTime : InnerMaxSize, + LargeEnough = VmlSize==Dynamic || VmlSize>=EIGEN_MKL_VML_THRESHOLD + }; + public: + enum { + EnableVml = MightEnableVml && LargeEnough, + Traversal = MightLinearize ? LinearTraversal : DefaultTraversal + }; +}; + +#define EIGEN_PP_EXPAND(ARG) ARG +#if !defined (EIGEN_FAST_MATH) || (EIGEN_FAST_MATH != 1) +#define EIGEN_VMLMODE_EXPAND_LA , VML_HA +#else +#define EIGEN_VMLMODE_EXPAND_LA , VML_LA +#endif + +#define EIGEN_VMLMODE_EXPAND__ + +#define EIGEN_VMLMODE_PREFIX_LA vm +#define EIGEN_VMLMODE_PREFIX__ v +#define EIGEN_VMLMODE_PREFIX(VMLMODE) EIGEN_CAT(EIGEN_VMLMODE_PREFIX_,VMLMODE) + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, VMLOP, EIGENTYPE, VMLTYPE, VMLMODE) \ + template< typename DstXprType, typename SrcXprNested> \ + struct Assignment, SrcXprNested>, assign_op, \ + Dense2Dense, typename enable_if::EnableVml>::type> { \ + typedef CwiseUnaryOp, SrcXprNested> SrcXprType; \ + static void run(DstXprType &dst, const SrcXprType &src, const assign_op &/*func*/) { \ + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); \ + if(vml_assign_traits::Traversal==LinearTraversal) { \ + VMLOP(dst.size(), (const VMLTYPE*)src.nestedExpression().data(), \ + (VMLTYPE*)dst.data() EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_##VMLMODE) ); \ + } else { \ + const Index outerSize = dst.outerSize(); \ + for(Index outer = 0; outer < outerSize; ++outer) { \ + const EIGENTYPE *src_ptr = src.IsRowMajor ? &(src.nestedExpression().coeffRef(outer,0)) : \ + &(src.nestedExpression().coeffRef(0, outer)); \ + EIGENTYPE *dst_ptr = dst.IsRowMajor ? &(dst.coeffRef(outer,0)) : &(dst.coeffRef(0, outer)); \ + VMLOP( dst.innerSize(), (const VMLTYPE*)src_ptr, \ + (VMLTYPE*)dst_ptr EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_##VMLMODE)); \ + } \ + } \ + } \ + }; \ + + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),s##VMLOP), float, float, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),d##VMLOP), double, double, VMLMODE) + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_CPLX(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),c##VMLOP), scomplex, MKL_Complex8, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),z##VMLOP), dcomplex, MKL_Complex16, VMLMODE) + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALLS_CPLX(EIGENOP, VMLOP, VMLMODE) + + +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(sin, Sin, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(asin, Asin, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(sinh, Sinh, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(cos, Cos, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(acos, Acos, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(cosh, Cosh, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(tan, Tan, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(atan, Atan, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(tanh, Tanh, LA) +// EIGEN_MKL_VML_DECLARE_UNARY_CALLS(abs, Abs, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(exp, Exp, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(log, Ln, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(log10, Log10, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(sqrt, Sqrt, _) + +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(square, Sqr, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_CPLX(arg, Arg, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(round, Round, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(floor, Floor, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(ceil, Ceil, _) + +#define EIGEN_MKL_VML_DECLARE_POW_CALL(EIGENOP, VMLOP, EIGENTYPE, VMLTYPE, VMLMODE) \ + template< typename DstXprType, typename SrcXprNested, typename Plain> \ + struct Assignment, SrcXprNested, \ + const CwiseNullaryOp,Plain> >, assign_op, \ + Dense2Dense, typename enable_if::EnableVml>::type> { \ + typedef CwiseBinaryOp, SrcXprNested, \ + const CwiseNullaryOp,Plain> > SrcXprType; \ + static void run(DstXprType &dst, const SrcXprType &src, const assign_op &/*func*/) { \ + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); \ + VMLTYPE exponent = reinterpret_cast(src.rhs().functor().m_other); \ + if(vml_assign_traits::Traversal==LinearTraversal) \ + { \ + VMLOP( dst.size(), (const VMLTYPE*)src.lhs().data(), exponent, \ + (VMLTYPE*)dst.data() EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_##VMLMODE) ); \ + } else { \ + const Index outerSize = dst.outerSize(); \ + for(Index outer = 0; outer < outerSize; ++outer) { \ + const EIGENTYPE *src_ptr = src.IsRowMajor ? &(src.lhs().coeffRef(outer,0)) : \ + &(src.lhs().coeffRef(0, outer)); \ + EIGENTYPE *dst_ptr = dst.IsRowMajor ? &(dst.coeffRef(outer,0)) : &(dst.coeffRef(0, outer)); \ + VMLOP( dst.innerSize(), (const VMLTYPE*)src_ptr, exponent, \ + (VMLTYPE*)dst_ptr EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_##VMLMODE)); \ + } \ + } \ + } \ + }; + +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmsPowx, float, float, LA) +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmdPowx, double, double, LA) +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmcPowx, scomplex, MKL_Complex8, LA) +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmzPowx, dcomplex, MKL_Complex16, LA) + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_ASSIGN_VML_H diff --git a/simulation/externals/eigen/Eigen/src/Core/BandMatrix.h b/simulation/externals/eigen/Eigen/src/Core/BandMatrix.h new file mode 100644 index 0000000..4978c91 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/BandMatrix.h @@ -0,0 +1,353 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_BANDMATRIX_H +#define EIGEN_BANDMATRIX_H + +namespace Eigen { + +namespace internal { + +template +class BandMatrixBase : public EigenBase +{ + public: + + enum { + Flags = internal::traits::Flags, + CoeffReadCost = internal::traits::CoeffReadCost, + RowsAtCompileTime = internal::traits::RowsAtCompileTime, + ColsAtCompileTime = internal::traits::ColsAtCompileTime, + MaxRowsAtCompileTime = internal::traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = internal::traits::MaxColsAtCompileTime, + Supers = internal::traits::Supers, + Subs = internal::traits::Subs, + Options = internal::traits::Options + }; + typedef typename internal::traits::Scalar Scalar; + typedef Matrix DenseMatrixType; + typedef typename DenseMatrixType::StorageIndex StorageIndex; + typedef typename internal::traits::CoefficientsType CoefficientsType; + typedef EigenBase Base; + + protected: + enum { + DataRowsAtCompileTime = ((Supers!=Dynamic) && (Subs!=Dynamic)) + ? 1 + Supers + Subs + : Dynamic, + SizeAtCompileTime = EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime,ColsAtCompileTime) + }; + + public: + + using Base::derived; + using Base::rows; + using Base::cols; + + /** \returns the number of super diagonals */ + inline Index supers() const { return derived().supers(); } + + /** \returns the number of sub diagonals */ + inline Index subs() const { return derived().subs(); } + + /** \returns an expression of the underlying coefficient matrix */ + inline const CoefficientsType& coeffs() const { return derived().coeffs(); } + + /** \returns an expression of the underlying coefficient matrix */ + inline CoefficientsType& coeffs() { return derived().coeffs(); } + + /** \returns a vector expression of the \a i -th column, + * only the meaningful part is returned. + * \warning the internal storage must be column major. */ + inline Block col(Index i) + { + EIGEN_STATIC_ASSERT((Options&RowMajor)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); + Index start = 0; + Index len = coeffs().rows(); + if (i<=supers()) + { + start = supers()-i; + len = (std::min)(rows(),std::max(0,coeffs().rows() - (supers()-i))); + } + else if (i>=rows()-subs()) + len = std::max(0,coeffs().rows() - (i + 1 - rows() + subs())); + return Block(coeffs(), start, i, len, 1); + } + + /** \returns a vector expression of the main diagonal */ + inline Block diagonal() + { return Block(coeffs(),supers(),0,1,(std::min)(rows(),cols())); } + + /** \returns a vector expression of the main diagonal (const version) */ + inline const Block diagonal() const + { return Block(coeffs(),supers(),0,1,(std::min)(rows(),cols())); } + + template struct DiagonalIntReturnType { + enum { + ReturnOpposite = (Options&SelfAdjoint) && (((Index)>0 && Supers==0) || ((Index)<0 && Subs==0)), + Conjugate = ReturnOpposite && NumTraits::IsComplex, + ActualIndex = ReturnOpposite ? -Index : Index, + DiagonalSize = (RowsAtCompileTime==Dynamic || ColsAtCompileTime==Dynamic) + ? Dynamic + : (ActualIndex<0 + ? EIGEN_SIZE_MIN_PREFER_DYNAMIC(ColsAtCompileTime, RowsAtCompileTime + ActualIndex) + : EIGEN_SIZE_MIN_PREFER_DYNAMIC(RowsAtCompileTime, ColsAtCompileTime - ActualIndex)) + }; + typedef Block BuildType; + typedef typename internal::conditional,BuildType >, + BuildType>::type Type; + }; + + /** \returns a vector expression of the \a N -th sub or super diagonal */ + template inline typename DiagonalIntReturnType::Type diagonal() + { + return typename DiagonalIntReturnType::BuildType(coeffs(), supers()-N, (std::max)(0,N), 1, diagonalLength(N)); + } + + /** \returns a vector expression of the \a N -th sub or super diagonal */ + template inline const typename DiagonalIntReturnType::Type diagonal() const + { + return typename DiagonalIntReturnType::BuildType(coeffs(), supers()-N, (std::max)(0,N), 1, diagonalLength(N)); + } + + /** \returns a vector expression of the \a i -th sub or super diagonal */ + inline Block diagonal(Index i) + { + eigen_assert((i<0 && -i<=subs()) || (i>=0 && i<=supers())); + return Block(coeffs(), supers()-i, std::max(0,i), 1, diagonalLength(i)); + } + + /** \returns a vector expression of the \a i -th sub or super diagonal */ + inline const Block diagonal(Index i) const + { + eigen_assert((i<0 && -i<=subs()) || (i>=0 && i<=supers())); + return Block(coeffs(), supers()-i, std::max(0,i), 1, diagonalLength(i)); + } + + template inline void evalTo(Dest& dst) const + { + dst.resize(rows(),cols()); + dst.setZero(); + dst.diagonal() = diagonal(); + for (Index i=1; i<=supers();++i) + dst.diagonal(i) = diagonal(i); + for (Index i=1; i<=subs();++i) + dst.diagonal(-i) = diagonal(-i); + } + + DenseMatrixType toDenseMatrix() const + { + DenseMatrixType res(rows(),cols()); + evalTo(res); + return res; + } + + protected: + + inline Index diagonalLength(Index i) const + { return i<0 ? (std::min)(cols(),rows()+i) : (std::min)(rows(),cols()-i); } +}; + +/** + * \class BandMatrix + * \ingroup Core_Module + * + * \brief Represents a rectangular matrix with a banded storage + * + * \tparam _Scalar Numeric type, i.e. float, double, int + * \tparam _Rows Number of rows, or \b Dynamic + * \tparam _Cols Number of columns, or \b Dynamic + * \tparam _Supers Number of super diagonal + * \tparam _Subs Number of sub diagonal + * \tparam _Options A combination of either \b #RowMajor or \b #ColMajor, and of \b #SelfAdjoint + * The former controls \ref TopicStorageOrders "storage order", and defaults to + * column-major. The latter controls whether the matrix represents a selfadjoint + * matrix in which case either Supers of Subs have to be null. + * + * \sa class TridiagonalMatrix + */ + +template +struct traits > +{ + typedef _Scalar Scalar; + typedef Dense StorageKind; + typedef Eigen::Index StorageIndex; + enum { + CoeffReadCost = NumTraits::ReadCost, + RowsAtCompileTime = _Rows, + ColsAtCompileTime = _Cols, + MaxRowsAtCompileTime = _Rows, + MaxColsAtCompileTime = _Cols, + Flags = LvalueBit, + Supers = _Supers, + Subs = _Subs, + Options = _Options, + DataRowsAtCompileTime = ((Supers!=Dynamic) && (Subs!=Dynamic)) ? 1 + Supers + Subs : Dynamic + }; + typedef Matrix CoefficientsType; +}; + +template +class BandMatrix : public BandMatrixBase > +{ + public: + + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::traits::StorageIndex StorageIndex; + typedef typename internal::traits::CoefficientsType CoefficientsType; + + explicit inline BandMatrix(Index rows=Rows, Index cols=Cols, Index supers=Supers, Index subs=Subs) + : m_coeffs(1+supers+subs,cols), + m_rows(rows), m_supers(supers), m_subs(subs) + { + } + + /** \returns the number of columns */ + inline Index rows() const { return m_rows.value(); } + + /** \returns the number of rows */ + inline Index cols() const { return m_coeffs.cols(); } + + /** \returns the number of super diagonals */ + inline Index supers() const { return m_supers.value(); } + + /** \returns the number of sub diagonals */ + inline Index subs() const { return m_subs.value(); } + + inline const CoefficientsType& coeffs() const { return m_coeffs; } + inline CoefficientsType& coeffs() { return m_coeffs; } + + protected: + + CoefficientsType m_coeffs; + internal::variable_if_dynamic m_rows; + internal::variable_if_dynamic m_supers; + internal::variable_if_dynamic m_subs; +}; + +template +class BandMatrixWrapper; + +template +struct traits > +{ + typedef typename _CoefficientsType::Scalar Scalar; + typedef typename _CoefficientsType::StorageKind StorageKind; + typedef typename _CoefficientsType::StorageIndex StorageIndex; + enum { + CoeffReadCost = internal::traits<_CoefficientsType>::CoeffReadCost, + RowsAtCompileTime = _Rows, + ColsAtCompileTime = _Cols, + MaxRowsAtCompileTime = _Rows, + MaxColsAtCompileTime = _Cols, + Flags = LvalueBit, + Supers = _Supers, + Subs = _Subs, + Options = _Options, + DataRowsAtCompileTime = ((Supers!=Dynamic) && (Subs!=Dynamic)) ? 1 + Supers + Subs : Dynamic + }; + typedef _CoefficientsType CoefficientsType; +}; + +template +class BandMatrixWrapper : public BandMatrixBase > +{ + public: + + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::traits::CoefficientsType CoefficientsType; + typedef typename internal::traits::StorageIndex StorageIndex; + + explicit inline BandMatrixWrapper(const CoefficientsType& coeffs, Index rows=_Rows, Index cols=_Cols, Index supers=_Supers, Index subs=_Subs) + : m_coeffs(coeffs), + m_rows(rows), m_supers(supers), m_subs(subs) + { + EIGEN_UNUSED_VARIABLE(cols); + //internal::assert(coeffs.cols()==cols() && (supers()+subs()+1)==coeffs.rows()); + } + + /** \returns the number of columns */ + inline Index rows() const { return m_rows.value(); } + + /** \returns the number of rows */ + inline Index cols() const { return m_coeffs.cols(); } + + /** \returns the number of super diagonals */ + inline Index supers() const { return m_supers.value(); } + + /** \returns the number of sub diagonals */ + inline Index subs() const { return m_subs.value(); } + + inline const CoefficientsType& coeffs() const { return m_coeffs; } + + protected: + + const CoefficientsType& m_coeffs; + internal::variable_if_dynamic m_rows; + internal::variable_if_dynamic m_supers; + internal::variable_if_dynamic m_subs; +}; + +/** + * \class TridiagonalMatrix + * \ingroup Core_Module + * + * \brief Represents a tridiagonal matrix with a compact banded storage + * + * \tparam Scalar Numeric type, i.e. float, double, int + * \tparam Size Number of rows and cols, or \b Dynamic + * \tparam Options Can be 0 or \b SelfAdjoint + * + * \sa class BandMatrix + */ +template +class TridiagonalMatrix : public BandMatrix +{ + typedef BandMatrix Base; + typedef typename Base::StorageIndex StorageIndex; + public: + explicit TridiagonalMatrix(Index size = Size) : Base(size,size,Options&SelfAdjoint?0:1,1) {} + + inline typename Base::template DiagonalIntReturnType<1>::Type super() + { return Base::template diagonal<1>(); } + inline const typename Base::template DiagonalIntReturnType<1>::Type super() const + { return Base::template diagonal<1>(); } + inline typename Base::template DiagonalIntReturnType<-1>::Type sub() + { return Base::template diagonal<-1>(); } + inline const typename Base::template DiagonalIntReturnType<-1>::Type sub() const + { return Base::template diagonal<-1>(); } + protected: +}; + + +struct BandShape {}; + +template +struct evaluator_traits > + : public evaluator_traits_base > +{ + typedef BandShape Shape; +}; + +template +struct evaluator_traits > + : public evaluator_traits_base > +{ + typedef BandShape Shape; +}; + +template<> struct AssignmentKind { typedef EigenBase2EigenBase Kind; }; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_BANDMATRIX_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Block.h b/simulation/externals/eigen/Eigen/src/Core/Block.h new file mode 100644 index 0000000..11de45c --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Block.h @@ -0,0 +1,452 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_BLOCK_H +#define EIGEN_BLOCK_H + +namespace Eigen { + +namespace internal { +template +struct traits > : traits +{ + typedef typename traits::Scalar Scalar; + typedef typename traits::StorageKind StorageKind; + typedef typename traits::XprKind XprKind; + typedef typename ref_selector::type XprTypeNested; + typedef typename remove_reference::type _XprTypeNested; + enum{ + MatrixRows = traits::RowsAtCompileTime, + MatrixCols = traits::ColsAtCompileTime, + RowsAtCompileTime = MatrixRows == 0 ? 0 : BlockRows, + ColsAtCompileTime = MatrixCols == 0 ? 0 : BlockCols, + MaxRowsAtCompileTime = BlockRows==0 ? 0 + : RowsAtCompileTime != Dynamic ? int(RowsAtCompileTime) + : int(traits::MaxRowsAtCompileTime), + MaxColsAtCompileTime = BlockCols==0 ? 0 + : ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime) + : int(traits::MaxColsAtCompileTime), + + XprTypeIsRowMajor = (int(traits::Flags)&RowMajorBit) != 0, + IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 + : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0 + : XprTypeIsRowMajor, + HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor), + InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime), + InnerStrideAtCompileTime = HasSameStorageOrderAsXprType + ? int(inner_stride_at_compile_time::ret) + : int(outer_stride_at_compile_time::ret), + OuterStrideAtCompileTime = HasSameStorageOrderAsXprType + ? int(outer_stride_at_compile_time::ret) + : int(inner_stride_at_compile_time::ret), + + // FIXME, this traits is rather specialized for dense object and it needs to be cleaned further + FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, + FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0, + Flags = (traits::Flags & (DirectAccessBit | (InnerPanel?CompressedAccessBit:0))) | FlagsLvalueBit | FlagsRowMajorBit, + // FIXME DirectAccessBit should not be handled by expressions + // + // Alignment is needed by MapBase's assertions + // We can sefely set it to false here. Internal alignment errors will be detected by an eigen_internal_assert in the respective evaluator + Alignment = 0 + }; +}; + +template::ret> class BlockImpl_dense; + +} // end namespace internal + +template class BlockImpl; + +/** \class Block + * \ingroup Core_Module + * + * \brief Expression of a fixed-size or dynamic-size block + * + * \tparam XprType the type of the expression in which we are taking a block + * \tparam BlockRows the number of rows of the block we are taking at compile time (optional) + * \tparam BlockCols the number of columns of the block we are taking at compile time (optional) + * \tparam InnerPanel is true, if the block maps to a set of rows of a row major matrix or + * to set of columns of a column major matrix (optional). The parameter allows to determine + * at compile time whether aligned access is possible on the block expression. + * + * This class represents an expression of either a fixed-size or dynamic-size block. It is the return + * type of DenseBase::block(Index,Index,Index,Index) and DenseBase::block(Index,Index) and + * most of the time this is the only way it is used. + * + * However, if you want to directly maniputate block expressions, + * for instance if you want to write a function returning such an expression, you + * will need to use this class. + * + * Here is an example illustrating the dynamic case: + * \include class_Block.cpp + * Output: \verbinclude class_Block.out + * + * \note Even though this expression has dynamic size, in the case where \a XprType + * has fixed size, this expression inherits a fixed maximal size which means that evaluating + * it does not cause a dynamic memory allocation. + * + * Here is an example illustrating the fixed-size case: + * \include class_FixedBlock.cpp + * Output: \verbinclude class_FixedBlock.out + * + * \sa DenseBase::block(Index,Index,Index,Index), DenseBase::block(Index,Index), class VectorBlock + */ +template class Block + : public BlockImpl::StorageKind> +{ + typedef BlockImpl::StorageKind> Impl; + public: + //typedef typename Impl::Base Base; + typedef Impl Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(Block) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block) + + typedef typename internal::remove_all::type NestedExpression; + + /** Column or Row constructor + */ + EIGEN_DEVICE_FUNC + inline Block(XprType& xpr, Index i) : Impl(xpr,i) + { + eigen_assert( (i>=0) && ( + ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i= 0 && BlockRows >= 0 && startRow + BlockRows <= xpr.rows() + && startCol >= 0 && BlockCols >= 0 && startCol + BlockCols <= xpr.cols()); + } + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC + inline Block(XprType& xpr, + Index startRow, Index startCol, + Index blockRows, Index blockCols) + : Impl(xpr, startRow, startCol, blockRows, blockCols) + { + eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows) + && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==blockCols)); + eigen_assert(startRow >= 0 && blockRows >= 0 && startRow <= xpr.rows() - blockRows + && startCol >= 0 && blockCols >= 0 && startCol <= xpr.cols() - blockCols); + } +}; + +// The generic default implementation for dense block simplu forward to the internal::BlockImpl_dense +// that must be specialized for direct and non-direct access... +template +class BlockImpl + : public internal::BlockImpl_dense +{ + typedef internal::BlockImpl_dense Impl; + typedef typename XprType::StorageIndex StorageIndex; + public: + typedef Impl Base; + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl) + EIGEN_DEVICE_FUNC inline BlockImpl(XprType& xpr, Index i) : Impl(xpr,i) {} + EIGEN_DEVICE_FUNC inline BlockImpl(XprType& xpr, Index startRow, Index startCol) : Impl(xpr, startRow, startCol) {} + EIGEN_DEVICE_FUNC + inline BlockImpl(XprType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols) + : Impl(xpr, startRow, startCol, blockRows, blockCols) {} +}; + +namespace internal { + +/** \internal Internal implementation of dense Blocks in the general case. */ +template class BlockImpl_dense + : public internal::dense_xpr_base >::type +{ + typedef Block BlockType; + typedef typename internal::ref_selector::non_const_type XprTypeNested; + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(BlockType) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl_dense) + + // class InnerIterator; // FIXME apparently never used + + /** Column or Row constructor + */ + EIGEN_DEVICE_FUNC + inline BlockImpl_dense(XprType& xpr, Index i) + : m_xpr(xpr), + // It is a row if and only if BlockRows==1 and BlockCols==XprType::ColsAtCompileTime, + // and it is a column if and only if BlockRows==XprType::RowsAtCompileTime and BlockCols==1, + // all other cases are invalid. + // The case a 1x1 matrix seems ambiguous, but the result is the same anyway. + m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0), + m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0), + m_blockRows(BlockRows==1 ? 1 : xpr.rows()), + m_blockCols(BlockCols==1 ? 1 : xpr.cols()) + {} + + /** Fixed-size constructor + */ + EIGEN_DEVICE_FUNC + inline BlockImpl_dense(XprType& xpr, Index startRow, Index startCol) + : m_xpr(xpr), m_startRow(startRow), m_startCol(startCol), + m_blockRows(BlockRows), m_blockCols(BlockCols) + {} + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC + inline BlockImpl_dense(XprType& xpr, + Index startRow, Index startCol, + Index blockRows, Index blockCols) + : m_xpr(xpr), m_startRow(startRow), m_startCol(startCol), + m_blockRows(blockRows), m_blockCols(blockCols) + {} + + EIGEN_DEVICE_FUNC inline Index rows() const { return m_blockRows.value(); } + EIGEN_DEVICE_FUNC inline Index cols() const { return m_blockCols.value(); } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index rowId, Index colId) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + return m_xpr.coeffRef(rowId + m_startRow.value(), colId + m_startCol.value()); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const + { + return m_xpr.derived().coeffRef(rowId + m_startRow.value(), colId + m_startCol.value()); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index rowId, Index colId) const + { + return m_xpr.coeff(rowId + m_startRow.value(), colId + m_startCol.value()); + } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index index) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + return m_xpr.coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index index) const + { + return m_xpr.coeffRef(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + } + + EIGEN_DEVICE_FUNC + inline const CoeffReturnType coeff(Index index) const + { + return m_xpr.coeff(m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + } + + template + inline PacketScalar packet(Index rowId, Index colId) const + { + return m_xpr.template packet(rowId + m_startRow.value(), colId + m_startCol.value()); + } + + template + inline void writePacket(Index rowId, Index colId, const PacketScalar& val) + { + m_xpr.template writePacket(rowId + m_startRow.value(), colId + m_startCol.value(), val); + } + + template + inline PacketScalar packet(Index index) const + { + return m_xpr.template packet + (m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0)); + } + + template + inline void writePacket(Index index, const PacketScalar& val) + { + m_xpr.template writePacket + (m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), + m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0), val); + } + + #ifdef EIGEN_PARSED_BY_DOXYGEN + /** \sa MapBase::data() */ + EIGEN_DEVICE_FUNC inline const Scalar* data() const; + EIGEN_DEVICE_FUNC inline Index innerStride() const; + EIGEN_DEVICE_FUNC inline Index outerStride() const; + #endif + + EIGEN_DEVICE_FUNC + const typename internal::remove_all::type& nestedExpression() const + { + return m_xpr; + } + + EIGEN_DEVICE_FUNC + XprType& nestedExpression() { return m_xpr; } + + EIGEN_DEVICE_FUNC + StorageIndex startRow() const + { + return m_startRow.value(); + } + + EIGEN_DEVICE_FUNC + StorageIndex startCol() const + { + return m_startCol.value(); + } + + protected: + + XprTypeNested m_xpr; + const internal::variable_if_dynamic m_startRow; + const internal::variable_if_dynamic m_startCol; + const internal::variable_if_dynamic m_blockRows; + const internal::variable_if_dynamic m_blockCols; +}; + +/** \internal Internal implementation of dense Blocks in the direct access case.*/ +template +class BlockImpl_dense + : public MapBase > +{ + typedef Block BlockType; + typedef typename internal::ref_selector::non_const_type XprTypeNested; + enum { + XprTypeIsRowMajor = (int(traits::Flags)&RowMajorBit) != 0 + }; + public: + + typedef MapBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(BlockType) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl_dense) + + /** Column or Row constructor + */ + EIGEN_DEVICE_FUNC + inline BlockImpl_dense(XprType& xpr, Index i) + : Base(xpr.data() + i * ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && (!XprTypeIsRowMajor)) + || ((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && ( XprTypeIsRowMajor)) ? xpr.innerStride() : xpr.outerStride()), + BlockRows==1 ? 1 : xpr.rows(), + BlockCols==1 ? 1 : xpr.cols()), + m_xpr(xpr), + m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0), + m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0) + { + init(); + } + + /** Fixed-size constructor + */ + EIGEN_DEVICE_FUNC + inline BlockImpl_dense(XprType& xpr, Index startRow, Index startCol) + : Base(xpr.data()+xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) + xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol)), + m_xpr(xpr), m_startRow(startRow), m_startCol(startCol) + { + init(); + } + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC + inline BlockImpl_dense(XprType& xpr, + Index startRow, Index startCol, + Index blockRows, Index blockCols) + : Base(xpr.data()+xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) + xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol), blockRows, blockCols), + m_xpr(xpr), m_startRow(startRow), m_startCol(startCol) + { + init(); + } + + EIGEN_DEVICE_FUNC + const typename internal::remove_all::type& nestedExpression() const + { + return m_xpr; + } + + EIGEN_DEVICE_FUNC + XprType& nestedExpression() { return m_xpr; } + + /** \sa MapBase::innerStride() */ + EIGEN_DEVICE_FUNC + inline Index innerStride() const + { + return internal::traits::HasSameStorageOrderAsXprType + ? m_xpr.innerStride() + : m_xpr.outerStride(); + } + + /** \sa MapBase::outerStride() */ + EIGEN_DEVICE_FUNC + inline Index outerStride() const + { + return m_outerStride; + } + + EIGEN_DEVICE_FUNC + StorageIndex startRow() const + { + return m_startRow.value(); + } + + EIGEN_DEVICE_FUNC + StorageIndex startCol() const + { + return m_startCol.value(); + } + + #ifndef __SUNPRO_CC + // FIXME sunstudio is not friendly with the above friend... + // META-FIXME there is no 'friend' keyword around here. Is this obsolete? + protected: + #endif + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal used by allowAligned() */ + EIGEN_DEVICE_FUNC + inline BlockImpl_dense(XprType& xpr, const Scalar* data, Index blockRows, Index blockCols) + : Base(data, blockRows, blockCols), m_xpr(xpr) + { + init(); + } + #endif + + protected: + EIGEN_DEVICE_FUNC + void init() + { + m_outerStride = internal::traits::HasSameStorageOrderAsXprType + ? m_xpr.outerStride() + : m_xpr.innerStride(); + } + + XprTypeNested m_xpr; + const internal::variable_if_dynamic m_startRow; + const internal::variable_if_dynamic m_startCol; + Index m_outerStride; +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_BLOCK_H diff --git a/simulation/externals/eigen/Eigen/src/Core/BooleanRedux.h b/simulation/externals/eigen/Eigen/src/Core/BooleanRedux.h new file mode 100644 index 0000000..8409d87 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/BooleanRedux.h @@ -0,0 +1,164 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ALLANDANY_H +#define EIGEN_ALLANDANY_H + +namespace Eigen { + +namespace internal { + +template +struct all_unroller +{ + typedef typename Derived::ExpressionTraits Traits; + enum { + col = (UnrollCount-1) / Traits::RowsAtCompileTime, + row = (UnrollCount-1) % Traits::RowsAtCompileTime + }; + + static inline bool run(const Derived &mat) + { + return all_unroller::run(mat) && mat.coeff(row, col); + } +}; + +template +struct all_unroller +{ + static inline bool run(const Derived &/*mat*/) { return true; } +}; + +template +struct all_unroller +{ + static inline bool run(const Derived &) { return false; } +}; + +template +struct any_unroller +{ + typedef typename Derived::ExpressionTraits Traits; + enum { + col = (UnrollCount-1) / Traits::RowsAtCompileTime, + row = (UnrollCount-1) % Traits::RowsAtCompileTime + }; + + static inline bool run(const Derived &mat) + { + return any_unroller::run(mat) || mat.coeff(row, col); + } +}; + +template +struct any_unroller +{ + static inline bool run(const Derived & /*mat*/) { return false; } +}; + +template +struct any_unroller +{ + static inline bool run(const Derived &) { return false; } +}; + +} // end namespace internal + +/** \returns true if all coefficients are true + * + * Example: \include MatrixBase_all.cpp + * Output: \verbinclude MatrixBase_all.out + * + * \sa any(), Cwise::operator<() + */ +template +inline bool DenseBase::all() const +{ + typedef internal::evaluator Evaluator; + enum { + unroll = SizeAtCompileTime != Dynamic + && SizeAtCompileTime * (Evaluator::CoeffReadCost + NumTraits::AddCost) <= EIGEN_UNROLLING_LIMIT + }; + Evaluator evaluator(derived()); + if(unroll) + return internal::all_unroller::run(evaluator); + else + { + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < rows(); ++i) + if (!evaluator.coeff(i, j)) return false; + return true; + } +} + +/** \returns true if at least one coefficient is true + * + * \sa all() + */ +template +inline bool DenseBase::any() const +{ + typedef internal::evaluator Evaluator; + enum { + unroll = SizeAtCompileTime != Dynamic + && SizeAtCompileTime * (Evaluator::CoeffReadCost + NumTraits::AddCost) <= EIGEN_UNROLLING_LIMIT + }; + Evaluator evaluator(derived()); + if(unroll) + return internal::any_unroller::run(evaluator); + else + { + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < rows(); ++i) + if (evaluator.coeff(i, j)) return true; + return false; + } +} + +/** \returns the number of coefficients which evaluate to true + * + * \sa all(), any() + */ +template +inline Eigen::Index DenseBase::count() const +{ + return derived().template cast().template cast().sum(); +} + +/** \returns true is \c *this contains at least one Not A Number (NaN). + * + * \sa allFinite() + */ +template +inline bool DenseBase::hasNaN() const +{ +#if EIGEN_COMP_MSVC || (defined __FAST_MATH__) + return derived().array().isNaN().any(); +#else + return !((derived().array()==derived().array()).all()); +#endif +} + +/** \returns true if \c *this contains only finite numbers, i.e., no NaN and no +/-INF values. + * + * \sa hasNaN() + */ +template +inline bool DenseBase::allFinite() const +{ +#if EIGEN_COMP_MSVC || (defined __FAST_MATH__) + return derived().array().isFinite().all(); +#else + return !((derived()-derived()).hasNaN()); +#endif +} + +} // end namespace Eigen + +#endif // EIGEN_ALLANDANY_H diff --git a/simulation/externals/eigen/Eigen/src/Core/CommaInitializer.h b/simulation/externals/eigen/Eigen/src/Core/CommaInitializer.h new file mode 100644 index 0000000..d218e98 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/CommaInitializer.h @@ -0,0 +1,160 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_COMMAINITIALIZER_H +#define EIGEN_COMMAINITIALIZER_H + +namespace Eigen { + +/** \class CommaInitializer + * \ingroup Core_Module + * + * \brief Helper class used by the comma initializer operator + * + * This class is internally used to implement the comma initializer feature. It is + * the return type of MatrixBase::operator<<, and most of the time this is the only + * way it is used. + * + * \sa \blank \ref MatrixBaseCommaInitRef "MatrixBase::operator<<", CommaInitializer::finished() + */ +template +struct CommaInitializer +{ + typedef typename XprType::Scalar Scalar; + + EIGEN_DEVICE_FUNC + inline CommaInitializer(XprType& xpr, const Scalar& s) + : m_xpr(xpr), m_row(0), m_col(1), m_currentBlockRows(1) + { + m_xpr.coeffRef(0,0) = s; + } + + template + EIGEN_DEVICE_FUNC + inline CommaInitializer(XprType& xpr, const DenseBase& other) + : m_xpr(xpr), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows()) + { + m_xpr.block(0, 0, other.rows(), other.cols()) = other; + } + + /* Copy/Move constructor which transfers ownership. This is crucial in + * absence of return value optimization to avoid assertions during destruction. */ + // FIXME in C++11 mode this could be replaced by a proper RValue constructor + EIGEN_DEVICE_FUNC + inline CommaInitializer(const CommaInitializer& o) + : m_xpr(o.m_xpr), m_row(o.m_row), m_col(o.m_col), m_currentBlockRows(o.m_currentBlockRows) { + // Mark original object as finished. In absence of R-value references we need to const_cast: + const_cast(o).m_row = m_xpr.rows(); + const_cast(o).m_col = m_xpr.cols(); + const_cast(o).m_currentBlockRows = 0; + } + + /* inserts a scalar value in the target matrix */ + EIGEN_DEVICE_FUNC + CommaInitializer& operator,(const Scalar& s) + { + if (m_col==m_xpr.cols()) + { + m_row+=m_currentBlockRows; + m_col = 0; + m_currentBlockRows = 1; + eigen_assert(m_row + EIGEN_DEVICE_FUNC + CommaInitializer& operator,(const DenseBase& other) + { + if (m_col==m_xpr.cols() && (other.cols()!=0 || other.rows()!=m_currentBlockRows)) + { + m_row+=m_currentBlockRows; + m_col = 0; + m_currentBlockRows = other.rows(); + eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows() + && "Too many rows passed to comma initializer (operator<<)"); + } + eigen_assert((m_col + other.cols() <= m_xpr.cols()) + && "Too many coefficients passed to comma initializer (operator<<)"); + eigen_assert(m_currentBlockRows==other.rows()); + m_xpr.template block + (m_row, m_col, other.rows(), other.cols()) = other; + m_col += other.cols(); + return *this; + } + + EIGEN_DEVICE_FUNC + inline ~CommaInitializer() +#if defined VERIFY_RAISES_ASSERT && (!defined EIGEN_NO_ASSERTION_CHECKING) && defined EIGEN_EXCEPTIONS + EIGEN_EXCEPTION_SPEC(Eigen::eigen_assert_exception) +#endif + { + finished(); + } + + /** \returns the built matrix once all its coefficients have been set. + * Calling finished is 100% optional. Its purpose is to write expressions + * like this: + * \code + * quaternion.fromRotationMatrix((Matrix3f() << axis0, axis1, axis2).finished()); + * \endcode + */ + EIGEN_DEVICE_FUNC + inline XprType& finished() { + eigen_assert(((m_row+m_currentBlockRows) == m_xpr.rows() || m_xpr.cols() == 0) + && m_col == m_xpr.cols() + && "Too few coefficients passed to comma initializer (operator<<)"); + return m_xpr; + } + + XprType& m_xpr; // target expression + Index m_row; // current row id + Index m_col; // current col id + Index m_currentBlockRows; // current block height +}; + +/** \anchor MatrixBaseCommaInitRef + * Convenient operator to set the coefficients of a matrix. + * + * The coefficients must be provided in a row major order and exactly match + * the size of the matrix. Otherwise an assertion is raised. + * + * Example: \include MatrixBase_set.cpp + * Output: \verbinclude MatrixBase_set.out + * + * \note According the c++ standard, the argument expressions of this comma initializer are evaluated in arbitrary order. + * + * \sa CommaInitializer::finished(), class CommaInitializer + */ +template +inline CommaInitializer DenseBase::operator<< (const Scalar& s) +{ + return CommaInitializer(*static_cast(this), s); +} + +/** \sa operator<<(const Scalar&) */ +template +template +inline CommaInitializer +DenseBase::operator<<(const DenseBase& other) +{ + return CommaInitializer(*static_cast(this), other); +} + +} // end namespace Eigen + +#endif // EIGEN_COMMAINITIALIZER_H diff --git a/simulation/externals/eigen/Eigen/src/Core/ConditionEstimator.h b/simulation/externals/eigen/Eigen/src/Core/ConditionEstimator.h new file mode 100644 index 0000000..aa7efdc --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/ConditionEstimator.h @@ -0,0 +1,175 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2016 Rasmus Munk Larsen (rmlarsen@google.com) +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CONDITIONESTIMATOR_H +#define EIGEN_CONDITIONESTIMATOR_H + +namespace Eigen { + +namespace internal { + +template +struct rcond_compute_sign { + static inline Vector run(const Vector& v) { + const RealVector v_abs = v.cwiseAbs(); + return (v_abs.array() == static_cast(0)) + .select(Vector::Ones(v.size()), v.cwiseQuotient(v_abs)); + } +}; + +// Partial specialization to avoid elementwise division for real vectors. +template +struct rcond_compute_sign { + static inline Vector run(const Vector& v) { + return (v.array() < static_cast(0)) + .select(-Vector::Ones(v.size()), Vector::Ones(v.size())); + } +}; + +/** + * \returns an estimate of ||inv(matrix)||_1 given a decomposition of + * \a matrix that implements .solve() and .adjoint().solve() methods. + * + * This function implements Algorithms 4.1 and 5.1 from + * http://www.maths.manchester.ac.uk/~higham/narep/narep135.pdf + * which also forms the basis for the condition number estimators in + * LAPACK. Since at most 10 calls to the solve method of dec are + * performed, the total cost is O(dims^2), as opposed to O(dims^3) + * needed to compute the inverse matrix explicitly. + * + * The most common usage is in estimating the condition number + * ||matrix||_1 * ||inv(matrix)||_1. The first term ||matrix||_1 can be + * computed directly in O(n^2) operations. + * + * Supports the following decompositions: FullPivLU, PartialPivLU, LDLT, and + * LLT. + * + * \sa FullPivLU, PartialPivLU, LDLT, LLT. + */ +template +typename Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomposition& dec) +{ + typedef typename Decomposition::MatrixType MatrixType; + typedef typename Decomposition::Scalar Scalar; + typedef typename Decomposition::RealScalar RealScalar; + typedef typename internal::plain_col_type::type Vector; + typedef typename internal::plain_col_type::type RealVector; + const bool is_complex = (NumTraits::IsComplex != 0); + + eigen_assert(dec.rows() == dec.cols()); + const Index n = dec.rows(); + if (n == 0) + return 0; + + // Disable Index to float conversion warning +#ifdef __INTEL_COMPILER + #pragma warning push + #pragma warning ( disable : 2259 ) +#endif + Vector v = dec.solve(Vector::Ones(n) / Scalar(n)); +#ifdef __INTEL_COMPILER + #pragma warning pop +#endif + + // lower_bound is a lower bound on + // ||inv(matrix)||_1 = sup_v ||inv(matrix) v||_1 / ||v||_1 + // and is the objective maximized by the ("super-") gradient ascent + // algorithm below. + RealScalar lower_bound = v.template lpNorm<1>(); + if (n == 1) + return lower_bound; + + // Gradient ascent algorithm follows: We know that the optimum is achieved at + // one of the simplices v = e_i, so in each iteration we follow a + // super-gradient to move towards the optimal one. + RealScalar old_lower_bound = lower_bound; + Vector sign_vector(n); + Vector old_sign_vector; + Index v_max_abs_index = -1; + Index old_v_max_abs_index = v_max_abs_index; + for (int k = 0; k < 4; ++k) + { + sign_vector = internal::rcond_compute_sign::run(v); + if (k > 0 && !is_complex && sign_vector == old_sign_vector) { + // Break if the solution stagnated. + break; + } + // v_max_abs_index = argmax |real( inv(matrix)^T * sign_vector )| + v = dec.adjoint().solve(sign_vector); + v.real().cwiseAbs().maxCoeff(&v_max_abs_index); + if (v_max_abs_index == old_v_max_abs_index) { + // Break if the solution stagnated. + break; + } + // Move to the new simplex e_j, where j = v_max_abs_index. + v = dec.solve(Vector::Unit(n, v_max_abs_index)); // v = inv(matrix) * e_j. + lower_bound = v.template lpNorm<1>(); + if (lower_bound <= old_lower_bound) { + // Break if the gradient step did not increase the lower_bound. + break; + } + if (!is_complex) { + old_sign_vector = sign_vector; + } + old_v_max_abs_index = v_max_abs_index; + old_lower_bound = lower_bound; + } + // The following calculates an independent estimate of ||matrix||_1 by + // multiplying matrix by a vector with entries of slowly increasing + // magnitude and alternating sign: + // v_i = (-1)^{i} (1 + (i / (dim-1))), i = 0,...,dim-1. + // This improvement to Hager's algorithm above is due to Higham. It was + // added to make the algorithm more robust in certain corner cases where + // large elements in the matrix might otherwise escape detection due to + // exact cancellation (especially when op and op_adjoint correspond to a + // sequence of backsubstitutions and permutations), which could cause + // Hager's algorithm to vastly underestimate ||matrix||_1. + Scalar alternating_sign(RealScalar(1)); + for (Index i = 0; i < n; ++i) { + // The static_cast is needed when Scalar is a complex and RealScalar implements expression templates + v[i] = alternating_sign * static_cast(RealScalar(1) + (RealScalar(i) / (RealScalar(n - 1)))); + alternating_sign = -alternating_sign; + } + v = dec.solve(v); + const RealScalar alternate_lower_bound = (2 * v.template lpNorm<1>()) / (3 * RealScalar(n)); + return numext::maxi(lower_bound, alternate_lower_bound); +} + +/** \brief Reciprocal condition number estimator. + * + * Computing a decomposition of a dense matrix takes O(n^3) operations, while + * this method estimates the condition number quickly and reliably in O(n^2) + * operations. + * + * \returns an estimate of the reciprocal condition number + * (1 / (||matrix||_1 * ||inv(matrix)||_1)) of matrix, given ||matrix||_1 and + * its decomposition. Supports the following decompositions: FullPivLU, + * PartialPivLU, LDLT, and LLT. + * + * \sa FullPivLU, PartialPivLU, LDLT, LLT. + */ +template +typename Decomposition::RealScalar +rcond_estimate_helper(typename Decomposition::RealScalar matrix_norm, const Decomposition& dec) +{ + typedef typename Decomposition::RealScalar RealScalar; + eigen_assert(dec.rows() == dec.cols()); + if (dec.rows() == 0) return RealScalar(1); + if (matrix_norm == RealScalar(0)) return RealScalar(0); + if (dec.rows() == 1) return RealScalar(1); + const RealScalar inverse_matrix_norm = rcond_invmatrix_L1_norm_estimate(dec); + return (inverse_matrix_norm == RealScalar(0) ? RealScalar(0) + : (RealScalar(1) / inverse_matrix_norm) / matrix_norm); +} + +} // namespace internal + +} // namespace Eigen + +#endif diff --git a/simulation/externals/eigen/Eigen/src/Core/CoreEvaluators.h b/simulation/externals/eigen/Eigen/src/Core/CoreEvaluators.h new file mode 100644 index 0000000..f7c1eff --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/CoreEvaluators.h @@ -0,0 +1,1671 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Benoit Jacob +// Copyright (C) 2011-2014 Gael Guennebaud +// Copyright (C) 2011-2012 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +#ifndef EIGEN_COREEVALUATORS_H +#define EIGEN_COREEVALUATORS_H + +namespace Eigen { + +namespace internal { + +// This class returns the evaluator kind from the expression storage kind. +// Default assumes index based accessors +template +struct storage_kind_to_evaluator_kind { + typedef IndexBased Kind; +}; + +// This class returns the evaluator shape from the expression storage kind. +// It can be Dense, Sparse, Triangular, Diagonal, SelfAdjoint, Band, etc. +template struct storage_kind_to_shape; + +template<> struct storage_kind_to_shape { typedef DenseShape Shape; }; +template<> struct storage_kind_to_shape { typedef SolverShape Shape; }; +template<> struct storage_kind_to_shape { typedef PermutationShape Shape; }; +template<> struct storage_kind_to_shape { typedef TranspositionsShape Shape; }; + +// Evaluators have to be specialized with respect to various criteria such as: +// - storage/structure/shape +// - scalar type +// - etc. +// Therefore, we need specialization of evaluator providing additional template arguments for each kind of evaluators. +// We currently distinguish the following kind of evaluators: +// - unary_evaluator for expressions taking only one arguments (CwiseUnaryOp, CwiseUnaryView, Transpose, MatrixWrapper, ArrayWrapper, Reverse, Replicate) +// - binary_evaluator for expression taking two arguments (CwiseBinaryOp) +// - ternary_evaluator for expression taking three arguments (CwiseTernaryOp) +// - product_evaluator for linear algebra products (Product); special case of binary_evaluator because it requires additional tags for dispatching. +// - mapbase_evaluator for Map, Block, Ref +// - block_evaluator for Block (special dispatching to a mapbase_evaluator or unary_evaluator) + +template< typename T, + typename Arg1Kind = typename evaluator_traits::Kind, + typename Arg2Kind = typename evaluator_traits::Kind, + typename Arg3Kind = typename evaluator_traits::Kind, + typename Arg1Scalar = typename traits::Scalar, + typename Arg2Scalar = typename traits::Scalar, + typename Arg3Scalar = typename traits::Scalar> struct ternary_evaluator; + +template< typename T, + typename LhsKind = typename evaluator_traits::Kind, + typename RhsKind = typename evaluator_traits::Kind, + typename LhsScalar = typename traits::Scalar, + typename RhsScalar = typename traits::Scalar> struct binary_evaluator; + +template< typename T, + typename Kind = typename evaluator_traits::Kind, + typename Scalar = typename T::Scalar> struct unary_evaluator; + +// evaluator_traits contains traits for evaluator + +template +struct evaluator_traits_base +{ + // by default, get evaluator kind and shape from storage + typedef typename storage_kind_to_evaluator_kind::StorageKind>::Kind Kind; + typedef typename storage_kind_to_shape::StorageKind>::Shape Shape; +}; + +// Default evaluator traits +template +struct evaluator_traits : public evaluator_traits_base +{ +}; + +template::Shape > +struct evaluator_assume_aliasing { + static const bool value = false; +}; + +// By default, we assume a unary expression: +template +struct evaluator : public unary_evaluator +{ + typedef unary_evaluator Base; + EIGEN_DEVICE_FUNC explicit evaluator(const T& xpr) : Base(xpr) {} +}; + + +// TODO: Think about const-correctness +template +struct evaluator + : evaluator +{ + EIGEN_DEVICE_FUNC + explicit evaluator(const T& xpr) : evaluator(xpr) {} +}; + +// ---------- base class for all evaluators ---------- + +template +struct evaluator_base : public noncopyable +{ + // TODO that's not very nice to have to propagate all these traits. They are currently only needed to handle outer,inner indices. + typedef traits ExpressionTraits; + + enum { + Alignment = 0 + }; +}; + +// -------------------- Matrix and Array -------------------- +// +// evaluator is a common base class for the +// Matrix and Array evaluators. +// Here we directly specialize evaluator. This is not really a unary expression, and it is, by definition, dense, +// so no need for more sophisticated dispatching. + +template +struct evaluator > + : evaluator_base +{ + typedef PlainObjectBase PlainObjectType; + typedef typename PlainObjectType::Scalar Scalar; + typedef typename PlainObjectType::CoeffReturnType CoeffReturnType; + + enum { + IsRowMajor = PlainObjectType::IsRowMajor, + IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime, + RowsAtCompileTime = PlainObjectType::RowsAtCompileTime, + ColsAtCompileTime = PlainObjectType::ColsAtCompileTime, + + CoeffReadCost = NumTraits::ReadCost, + Flags = traits::EvaluatorFlags, + Alignment = traits::Alignment + }; + + EIGEN_DEVICE_FUNC evaluator() + : m_data(0), + m_outerStride(IsVectorAtCompileTime ? 0 + : int(IsRowMajor) ? ColsAtCompileTime + : RowsAtCompileTime) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC explicit evaluator(const PlainObjectType& m) + : m_data(m.data()), m_outerStride(IsVectorAtCompileTime ? 0 : m.outerStride()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + if (IsRowMajor) + return m_data[row * m_outerStride.value() + col]; + else + return m_data[row + col * m_outerStride.value()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_data[index]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + if (IsRowMajor) + return const_cast(m_data)[row * m_outerStride.value() + col]; + else + return const_cast(m_data)[row + col * m_outerStride.value()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return const_cast(m_data)[index]; + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + if (IsRowMajor) + return ploadt(m_data + row * m_outerStride.value() + col); + else + return ploadt(m_data + row + col * m_outerStride.value()); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return ploadt(m_data + index); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + if (IsRowMajor) + return pstoret + (const_cast(m_data) + row * m_outerStride.value() + col, x); + else + return pstoret + (const_cast(m_data) + row + col * m_outerStride.value(), x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + return pstoret(const_cast(m_data) + index, x); + } + +protected: + const Scalar *m_data; + + // We do not need to know the outer stride for vectors + variable_if_dynamic m_outerStride; +}; + +template +struct evaluator > + : evaluator > > +{ + typedef Matrix XprType; + + EIGEN_DEVICE_FUNC evaluator() {} + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& m) + : evaluator >(m) + { } +}; + +template +struct evaluator > + : evaluator > > +{ + typedef Array XprType; + + EIGEN_DEVICE_FUNC evaluator() {} + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& m) + : evaluator >(m) + { } +}; + +// -------------------- Transpose -------------------- + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef Transpose XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + Flags = evaluator::Flags ^ RowMajorBit, + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& t) : m_argImpl(t.nestedExpression()) {} + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(col, row); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(index); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(col, row); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + typename XprType::Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_argImpl.template packet(col, row); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_argImpl.template packet(index); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + m_argImpl.template writePacket(col, row, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + m_argImpl.template writePacket(index, x); + } + +protected: + evaluator m_argImpl; +}; + +// -------------------- CwiseNullaryOp -------------------- +// Like Matrix and Array, this is not really a unary expression, so we directly specialize evaluator. +// Likewise, there is not need to more sophisticated dispatching here. + +template::value, + bool has_unary = has_unary_operator::value, + bool has_binary = has_binary_operator::value> +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const { return op(i,j); } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const { return op(i); } + + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const { return op.template packetOp(i,j); } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const { return op.template packetOp(i); } +}; + +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType=0, IndexType=0) const { return op(); } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType=0, IndexType=0) const { return op.template packetOp(); } +}; + +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j=0) const { return op(i,j); } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j=0) const { return op.template packetOp(i,j); } +}; + +// We need the following specialization for vector-only functors assigned to a runtime vector, +// for instance, using linspace and assigning a RowVectorXd to a MatrixXd or even a row of a MatrixXd. +// In this case, i==0 and j is used for the actual iteration. +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const { + eigen_assert(i==0 || j==0); + return op(i+j); + } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const { + eigen_assert(i==0 || j==0); + return op.template packetOp(i+j); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const { return op(i); } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const { return op.template packetOp(i); } +}; + +template +struct nullary_wrapper {}; + +#if 0 && EIGEN_COMP_MSVC>0 +// Disable this ugly workaround. This is now handled in traits::match, +// but this piece of code might still become handly if some other weird compilation +// erros pop up again. + +// MSVC exhibits a weird compilation error when +// compiling: +// Eigen::MatrixXf A = MatrixXf::Random(3,3); +// Ref R = 2.f*A; +// and that has_*ary_operator> have not been instantiated yet. +// The "problem" is that evaluator<2.f*A> is instantiated by traits::match<2.f*A> +// and at that time has_*ary_operator returns true regardless of T. +// Then nullary_wrapper is badly instantiated as nullary_wrapper<.,.,true,true,true>. +// The trick is thus to defer the proper instantiation of nullary_wrapper when coeff(), +// and packet() are really instantiated as implemented below: + +// This is a simple wrapper around Index to enforce the re-instantiation of +// has_*ary_operator when needed. +template struct nullary_wrapper_workaround_msvc { + nullary_wrapper_workaround_msvc(const T&); + operator T()const; +}; + +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().operator()(op,i,j); + } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().operator()(op,i); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().template packetOp(op,i,j); + } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().template packetOp(op,i); + } +}; +#endif // MSVC workaround + +template +struct evaluator > + : evaluator_base > +{ + typedef CwiseNullaryOp XprType; + typedef typename internal::remove_all::type PlainObjectTypeCleaned; + + enum { + CoeffReadCost = internal::functor_traits::Cost, + + Flags = (evaluator::Flags + & ( HereditaryBits + | (functor_has_linear_access::ret ? LinearAccessBit : 0) + | (functor_traits::PacketAccess ? PacketAccessBit : 0))) + | (functor_traits::IsRepeatable ? 0 : EvalBeforeNestingBit), + Alignment = AlignedMax + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& n) + : m_functor(n.functor()), m_wrapper() + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(IndexType row, IndexType col) const + { + return m_wrapper(m_functor, row, col); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(IndexType index) const + { + return m_wrapper(m_functor,index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(IndexType row, IndexType col) const + { + return m_wrapper.template packetOp(m_functor, row, col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(IndexType index) const + { + return m_wrapper.template packetOp(m_functor, index); + } + +protected: + const NullaryOp m_functor; + const internal::nullary_wrapper m_wrapper; +}; + +// -------------------- CwiseUnaryOp -------------------- + +template +struct unary_evaluator, IndexBased > + : evaluator_base > +{ + typedef CwiseUnaryOp XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost + functor_traits::Cost, + + Flags = evaluator::Flags + & (HereditaryBits | LinearAccessBit | (functor_traits::PacketAccess ? PacketAccessBit : 0)), + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& op) + : m_functor(op.functor()), + m_argImpl(op.nestedExpression()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_functor(m_argImpl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_functor(m_argImpl.coeff(index)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_functor.packetOp(m_argImpl.template packet(row, col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_functor.packetOp(m_argImpl.template packet(index)); + } + +protected: + const UnaryOp m_functor; + evaluator m_argImpl; +}; + +// -------------------- CwiseTernaryOp -------------------- + +// this is a ternary expression +template +struct evaluator > + : public ternary_evaluator > +{ + typedef CwiseTernaryOp XprType; + typedef ternary_evaluator > Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : Base(xpr) {} +}; + +template +struct ternary_evaluator, IndexBased, IndexBased> + : evaluator_base > +{ + typedef CwiseTernaryOp XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost + evaluator::CoeffReadCost + evaluator::CoeffReadCost + functor_traits::Cost, + + Arg1Flags = evaluator::Flags, + Arg2Flags = evaluator::Flags, + Arg3Flags = evaluator::Flags, + SameType = is_same::value && is_same::value, + StorageOrdersAgree = (int(Arg1Flags)&RowMajorBit)==(int(Arg2Flags)&RowMajorBit) && (int(Arg1Flags)&RowMajorBit)==(int(Arg3Flags)&RowMajorBit), + Flags0 = (int(Arg1Flags) | int(Arg2Flags) | int(Arg3Flags)) & ( + HereditaryBits + | (int(Arg1Flags) & int(Arg2Flags) & int(Arg3Flags) & + ( (StorageOrdersAgree ? LinearAccessBit : 0) + | (functor_traits::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0) + ) + ) + ), + Flags = (Flags0 & ~RowMajorBit) | (Arg1Flags & RowMajorBit), + Alignment = EIGEN_PLAIN_ENUM_MIN( + EIGEN_PLAIN_ENUM_MIN(evaluator::Alignment, evaluator::Alignment), + evaluator::Alignment) + }; + + EIGEN_DEVICE_FUNC explicit ternary_evaluator(const XprType& xpr) + : m_functor(xpr.functor()), + m_arg1Impl(xpr.arg1()), + m_arg2Impl(xpr.arg2()), + m_arg3Impl(xpr.arg3()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_functor(m_arg1Impl.coeff(row, col), m_arg2Impl.coeff(row, col), m_arg3Impl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_functor(m_arg1Impl.coeff(index), m_arg2Impl.coeff(index), m_arg3Impl.coeff(index)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_functor.packetOp(m_arg1Impl.template packet(row, col), + m_arg2Impl.template packet(row, col), + m_arg3Impl.template packet(row, col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_functor.packetOp(m_arg1Impl.template packet(index), + m_arg2Impl.template packet(index), + m_arg3Impl.template packet(index)); + } + +protected: + const TernaryOp m_functor; + evaluator m_arg1Impl; + evaluator m_arg2Impl; + evaluator m_arg3Impl; +}; + +// -------------------- CwiseBinaryOp -------------------- + +// this is a binary expression +template +struct evaluator > + : public binary_evaluator > +{ + typedef CwiseBinaryOp XprType; + typedef binary_evaluator > Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : Base(xpr) {} +}; + +template +struct binary_evaluator, IndexBased, IndexBased> + : evaluator_base > +{ + typedef CwiseBinaryOp XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost + evaluator::CoeffReadCost + functor_traits::Cost, + + LhsFlags = evaluator::Flags, + RhsFlags = evaluator::Flags, + SameType = is_same::value, + StorageOrdersAgree = (int(LhsFlags)&RowMajorBit)==(int(RhsFlags)&RowMajorBit), + Flags0 = (int(LhsFlags) | int(RhsFlags)) & ( + HereditaryBits + | (int(LhsFlags) & int(RhsFlags) & + ( (StorageOrdersAgree ? LinearAccessBit : 0) + | (functor_traits::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0) + ) + ) + ), + Flags = (Flags0 & ~RowMajorBit) | (LhsFlags & RowMajorBit), + Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator::Alignment,evaluator::Alignment) + }; + + EIGEN_DEVICE_FUNC explicit binary_evaluator(const XprType& xpr) + : m_functor(xpr.functor()), + m_lhsImpl(xpr.lhs()), + m_rhsImpl(xpr.rhs()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_functor(m_lhsImpl.coeff(row, col), m_rhsImpl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_functor(m_lhsImpl.coeff(index), m_rhsImpl.coeff(index)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_functor.packetOp(m_lhsImpl.template packet(row, col), + m_rhsImpl.template packet(row, col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_functor.packetOp(m_lhsImpl.template packet(index), + m_rhsImpl.template packet(index)); + } + +protected: + const BinaryOp m_functor; + evaluator m_lhsImpl; + evaluator m_rhsImpl; +}; + +// -------------------- CwiseUnaryView -------------------- + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef CwiseUnaryView XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost + functor_traits::Cost, + + Flags = (evaluator::Flags & (HereditaryBits | LinearAccessBit | DirectAccessBit)), + + Alignment = 0 // FIXME it is not very clear why alignment is necessarily lost... + }; + + EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& op) + : m_unaryOp(op.functor()), + m_argImpl(op.nestedExpression()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_unaryOp(m_argImpl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_unaryOp(m_argImpl.coeff(index)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_unaryOp(m_argImpl.coeffRef(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_unaryOp(m_argImpl.coeffRef(index)); + } + +protected: + const UnaryOp m_unaryOp; + evaluator m_argImpl; +}; + +// -------------------- Map -------------------- + +// FIXME perhaps the PlainObjectType could be provided by Derived::PlainObject ? +// but that might complicate template specialization +template +struct mapbase_evaluator; + +template +struct mapbase_evaluator : evaluator_base +{ + typedef Derived XprType; + typedef typename XprType::PointerType PointerType; + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + enum { + IsRowMajor = XprType::RowsAtCompileTime, + ColsAtCompileTime = XprType::ColsAtCompileTime, + CoeffReadCost = NumTraits::ReadCost + }; + + EIGEN_DEVICE_FUNC explicit mapbase_evaluator(const XprType& map) + : m_data(const_cast(map.data())), + m_innerStride(map.innerStride()), + m_outerStride(map.outerStride()) + { + EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(evaluator::Flags&PacketAccessBit, internal::inner_stride_at_compile_time::ret==1), + PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_data[col * colStride() + row * rowStride()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_data[index * m_innerStride.value()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_data[col * colStride() + row * rowStride()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_data[index * m_innerStride.value()]; + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + PointerType ptr = m_data + row * rowStride() + col * colStride(); + return internal::ploadt(ptr); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return internal::ploadt(m_data + index * m_innerStride.value()); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + PointerType ptr = m_data + row * rowStride() + col * colStride(); + return internal::pstoret(ptr, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + internal::pstoret(m_data + index * m_innerStride.value(), x); + } +protected: + EIGEN_DEVICE_FUNC + inline Index rowStride() const { return XprType::IsRowMajor ? m_outerStride.value() : m_innerStride.value(); } + EIGEN_DEVICE_FUNC + inline Index colStride() const { return XprType::IsRowMajor ? m_innerStride.value() : m_outerStride.value(); } + + PointerType m_data; + const internal::variable_if_dynamic m_innerStride; + const internal::variable_if_dynamic m_outerStride; +}; + +template +struct evaluator > + : public mapbase_evaluator, PlainObjectType> +{ + typedef Map XprType; + typedef typename XprType::Scalar Scalar; + // TODO: should check for smaller packet types once we can handle multi-sized packet types + typedef typename packet_traits::type PacketScalar; + + enum { + InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0 + ? int(PlainObjectType::InnerStrideAtCompileTime) + : int(StrideType::InnerStrideAtCompileTime), + OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 + ? int(PlainObjectType::OuterStrideAtCompileTime) + : int(StrideType::OuterStrideAtCompileTime), + HasNoInnerStride = InnerStrideAtCompileTime == 1, + HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0, + HasNoStride = HasNoInnerStride && HasNoOuterStride, + IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic, + + PacketAccessMask = bool(HasNoInnerStride) ? ~int(0) : ~int(PacketAccessBit), + LinearAccessMask = bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime) ? ~int(0) : ~int(LinearAccessBit), + Flags = int( evaluator::Flags) & (LinearAccessMask&PacketAccessMask), + + Alignment = int(MapOptions)&int(AlignedMask) + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& map) + : mapbase_evaluator(map) + { } +}; + +// -------------------- Ref -------------------- + +template +struct evaluator > + : public mapbase_evaluator, PlainObjectType> +{ + typedef Ref XprType; + + enum { + Flags = evaluator >::Flags, + Alignment = evaluator >::Alignment + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& ref) + : mapbase_evaluator(ref) + { } +}; + +// -------------------- Block -------------------- + +template::ret> struct block_evaluator; + +template +struct evaluator > + : block_evaluator +{ + typedef Block XprType; + typedef typename XprType::Scalar Scalar; + // TODO: should check for smaller packet types once we can handle multi-sized packet types + typedef typename packet_traits::type PacketScalar; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + + RowsAtCompileTime = traits::RowsAtCompileTime, + ColsAtCompileTime = traits::ColsAtCompileTime, + MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = traits::MaxColsAtCompileTime, + + ArgTypeIsRowMajor = (int(evaluator::Flags)&RowMajorBit) != 0, + IsRowMajor = (MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1) ? 1 + : (MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1) ? 0 + : ArgTypeIsRowMajor, + HasSameStorageOrderAsArgType = (IsRowMajor == ArgTypeIsRowMajor), + InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime), + InnerStrideAtCompileTime = HasSameStorageOrderAsArgType + ? int(inner_stride_at_compile_time::ret) + : int(outer_stride_at_compile_time::ret), + OuterStrideAtCompileTime = HasSameStorageOrderAsArgType + ? int(outer_stride_at_compile_time::ret) + : int(inner_stride_at_compile_time::ret), + MaskPacketAccessBit = (InnerStrideAtCompileTime == 1) ? PacketAccessBit : 0, + + FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 || (InnerPanel && (evaluator::Flags&LinearAccessBit))) ? LinearAccessBit : 0, + FlagsRowMajorBit = XprType::Flags&RowMajorBit, + Flags0 = evaluator::Flags & ( (HereditaryBits & ~RowMajorBit) | + DirectAccessBit | + MaskPacketAccessBit), + Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit, + + PacketAlignment = unpacket_traits::alignment, + Alignment0 = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % int(PacketAlignment)) == 0)) ? int(PacketAlignment) : 0, + Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator::Alignment, Alignment0) + }; + typedef block_evaluator block_evaluator_type; + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& block) : block_evaluator_type(block) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } +}; + +// no direct-access => dispatch to a unary evaluator +template +struct block_evaluator + : unary_evaluator > +{ + typedef Block XprType; + + EIGEN_DEVICE_FUNC explicit block_evaluator(const XprType& block) + : unary_evaluator(block) + {} +}; + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef Block XprType; + + EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& block) + : m_argImpl(block.nestedExpression()), + m_startRow(block.startRow()), + m_startCol(block.startCol()) + { } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + enum { + RowsAtCompileTime = XprType::RowsAtCompileTime + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(m_startRow.value() + row, m_startCol.value() + col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return coeff(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(m_startRow.value() + row, m_startCol.value() + col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return coeffRef(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_argImpl.template packet(m_startRow.value() + row, m_startCol.value() + col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return packet(RowsAtCompileTime == 1 ? 0 : index, + RowsAtCompileTime == 1 ? index : 0); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + return m_argImpl.template writePacket(m_startRow.value() + row, m_startCol.value() + col, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + return writePacket(RowsAtCompileTime == 1 ? 0 : index, + RowsAtCompileTime == 1 ? index : 0, + x); + } + +protected: + evaluator m_argImpl; + const variable_if_dynamic m_startRow; + const variable_if_dynamic m_startCol; +}; + +// TODO: This evaluator does not actually use the child evaluator; +// all action is via the data() as returned by the Block expression. + +template +struct block_evaluator + : mapbase_evaluator, + typename Block::PlainObject> +{ + typedef Block XprType; + typedef typename XprType::Scalar Scalar; + + EIGEN_DEVICE_FUNC explicit block_evaluator(const XprType& block) + : mapbase_evaluator(block) + { + // TODO: for the 3.3 release, this should be turned to an internal assertion, but let's keep it as is for the beta lifetime + eigen_assert(((internal::UIntPtr(block.data()) % EIGEN_PLAIN_ENUM_MAX(1,evaluator::Alignment)) == 0) && "data is not aligned"); + } +}; + + +// -------------------- Select -------------------- +// NOTE shall we introduce a ternary_evaluator? + +// TODO enable vectorization for Select +template +struct evaluator > + : evaluator_base > +{ + typedef Select XprType; + enum { + CoeffReadCost = evaluator::CoeffReadCost + + EIGEN_PLAIN_ENUM_MAX(evaluator::CoeffReadCost, + evaluator::CoeffReadCost), + + Flags = (unsigned int)evaluator::Flags & evaluator::Flags & HereditaryBits, + + Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator::Alignment, evaluator::Alignment) + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& select) + : m_conditionImpl(select.conditionMatrix()), + m_thenImpl(select.thenMatrix()), + m_elseImpl(select.elseMatrix()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + if (m_conditionImpl.coeff(row, col)) + return m_thenImpl.coeff(row, col); + else + return m_elseImpl.coeff(row, col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + if (m_conditionImpl.coeff(index)) + return m_thenImpl.coeff(index); + else + return m_elseImpl.coeff(index); + } + +protected: + evaluator m_conditionImpl; + evaluator m_thenImpl; + evaluator m_elseImpl; +}; + + +// -------------------- Replicate -------------------- + +template +struct unary_evaluator > + : evaluator_base > +{ + typedef Replicate XprType; + typedef typename XprType::CoeffReturnType CoeffReturnType; + enum { + Factor = (RowFactor==Dynamic || ColFactor==Dynamic) ? Dynamic : RowFactor*ColFactor + }; + typedef typename internal::nested_eval::type ArgTypeNested; + typedef typename internal::remove_all::type ArgTypeNestedCleaned; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + LinearAccessMask = XprType::IsVectorAtCompileTime ? LinearAccessBit : 0, + Flags = (evaluator::Flags & (HereditaryBits|LinearAccessMask) & ~RowMajorBit) | (traits::Flags & RowMajorBit), + + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& replicate) + : m_arg(replicate.nestedExpression()), + m_argImpl(m_arg), + m_rows(replicate.nestedExpression().rows()), + m_cols(replicate.nestedExpression().cols()) + {} + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + // try to avoid using modulo; this is a pure optimization strategy + const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 + : RowFactor==1 ? row + : row % m_rows.value(); + const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 + : ColFactor==1 ? col + : col % m_cols.value(); + + return m_argImpl.coeff(actual_row, actual_col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + // try to avoid using modulo; this is a pure optimization strategy + const Index actual_index = internal::traits::RowsAtCompileTime==1 + ? (ColFactor==1 ? index : index%m_cols.value()) + : (RowFactor==1 ? index : index%m_rows.value()); + + return m_argImpl.coeff(actual_index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 + : RowFactor==1 ? row + : row % m_rows.value(); + const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 + : ColFactor==1 ? col + : col % m_cols.value(); + + return m_argImpl.template packet(actual_row, actual_col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + const Index actual_index = internal::traits::RowsAtCompileTime==1 + ? (ColFactor==1 ? index : index%m_cols.value()) + : (RowFactor==1 ? index : index%m_rows.value()); + + return m_argImpl.template packet(actual_index); + } + +protected: + const ArgTypeNested m_arg; + evaluator m_argImpl; + const variable_if_dynamic m_rows; + const variable_if_dynamic m_cols; +}; + + +// -------------------- PartialReduxExpr -------------------- + +template< typename ArgType, typename MemberOp, int Direction> +struct evaluator > + : evaluator_base > +{ + typedef PartialReduxExpr XprType; + typedef typename internal::nested_eval::type ArgTypeNested; + typedef typename internal::remove_all::type ArgTypeNestedCleaned; + typedef typename ArgType::Scalar InputScalar; + typedef typename XprType::Scalar Scalar; + enum { + TraversalSize = Direction==int(Vertical) ? int(ArgType::RowsAtCompileTime) : int(ArgType::ColsAtCompileTime) + }; + typedef typename MemberOp::template Cost CostOpType; + enum { + CoeffReadCost = TraversalSize==Dynamic ? HugeCost + : TraversalSize * evaluator::CoeffReadCost + int(CostOpType::value), + + Flags = (traits::Flags&RowMajorBit) | (evaluator::Flags&(HereditaryBits&(~RowMajorBit))) | LinearAccessBit, + + Alignment = 0 // FIXME this will need to be improved once PartialReduxExpr is vectorized + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType xpr) + : m_arg(xpr.nestedExpression()), m_functor(xpr.functor()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(TraversalSize==Dynamic ? HugeCost : int(CostOpType::value)); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const Scalar coeff(Index i, Index j) const + { + if (Direction==Vertical) + return m_functor(m_arg.col(j)); + else + return m_functor(m_arg.row(i)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const Scalar coeff(Index index) const + { + if (Direction==Vertical) + return m_functor(m_arg.col(index)); + else + return m_functor(m_arg.row(index)); + } + +protected: + typename internal::add_const_on_value_type::type m_arg; + const MemberOp m_functor; +}; + + +// -------------------- MatrixWrapper and ArrayWrapper -------------------- +// +// evaluator_wrapper_base is a common base class for the +// MatrixWrapper and ArrayWrapper evaluators. + +template +struct evaluator_wrapper_base + : evaluator_base +{ + typedef typename remove_all::type ArgType; + enum { + CoeffReadCost = evaluator::CoeffReadCost, + Flags = evaluator::Flags, + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC explicit evaluator_wrapper_base(const ArgType& arg) : m_argImpl(arg) {} + + typedef typename ArgType::Scalar Scalar; + typedef typename ArgType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(row, col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(index); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(row, col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_argImpl.template packet(row, col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_argImpl.template packet(index); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + m_argImpl.template writePacket(row, col, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + m_argImpl.template writePacket(index, x); + } + +protected: + evaluator m_argImpl; +}; + +template +struct unary_evaluator > + : evaluator_wrapper_base > +{ + typedef MatrixWrapper XprType; + + EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& wrapper) + : evaluator_wrapper_base >(wrapper.nestedExpression()) + { } +}; + +template +struct unary_evaluator > + : evaluator_wrapper_base > +{ + typedef ArrayWrapper XprType; + + EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& wrapper) + : evaluator_wrapper_base >(wrapper.nestedExpression()) + { } +}; + + +// -------------------- Reverse -------------------- + +// defined in Reverse.h: +template struct reverse_packet_cond; + +template +struct unary_evaluator > + : evaluator_base > +{ + typedef Reverse XprType; + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + enum { + IsRowMajor = XprType::IsRowMajor, + IsColMajor = !IsRowMajor, + ReverseRow = (Direction == Vertical) || (Direction == BothDirections), + ReverseCol = (Direction == Horizontal) || (Direction == BothDirections), + ReversePacket = (Direction == BothDirections) + || ((Direction == Vertical) && IsColMajor) + || ((Direction == Horizontal) && IsRowMajor), + + CoeffReadCost = evaluator::CoeffReadCost, + + // let's enable LinearAccess only with vectorization because of the product overhead + // FIXME enable DirectAccess with negative strides? + Flags0 = evaluator::Flags, + LinearAccess = ( (Direction==BothDirections) && (int(Flags0)&PacketAccessBit) ) + || ((ReverseRow && XprType::ColsAtCompileTime==1) || (ReverseCol && XprType::RowsAtCompileTime==1)) + ? LinearAccessBit : 0, + + Flags = int(Flags0) & (HereditaryBits | PacketAccessBit | LinearAccess), + + Alignment = 0 // FIXME in some rare cases, Alignment could be preserved, like a Vector4f. + }; + + EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& reverse) + : m_argImpl(reverse.nestedExpression()), + m_rows(ReverseRow ? reverse.nestedExpression().rows() : 1), + m_cols(ReverseCol ? reverse.nestedExpression().cols() : 1) + { } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(ReverseRow ? m_rows.value() - row - 1 : row, + ReverseCol ? m_cols.value() - col - 1 : col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(m_rows.value() * m_cols.value() - index - 1); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(ReverseRow ? m_rows.value() - row - 1 : row, + ReverseCol ? m_cols.value() - col - 1 : col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(m_rows.value() * m_cols.value() - index - 1); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + enum { + PacketSize = unpacket_traits::size, + OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1, + OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1 + }; + typedef internal::reverse_packet_cond reverse_packet; + return reverse_packet::run(m_argImpl.template packet( + ReverseRow ? m_rows.value() - row - OffsetRow : row, + ReverseCol ? m_cols.value() - col - OffsetCol : col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + enum { PacketSize = unpacket_traits::size }; + return preverse(m_argImpl.template packet(m_rows.value() * m_cols.value() - index - PacketSize)); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + // FIXME we could factorize some code with packet(i,j) + enum { + PacketSize = unpacket_traits::size, + OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1, + OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1 + }; + typedef internal::reverse_packet_cond reverse_packet; + m_argImpl.template writePacket( + ReverseRow ? m_rows.value() - row - OffsetRow : row, + ReverseCol ? m_cols.value() - col - OffsetCol : col, + reverse_packet::run(x)); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + enum { PacketSize = unpacket_traits::size }; + m_argImpl.template writePacket + (m_rows.value() * m_cols.value() - index - PacketSize, preverse(x)); + } + +protected: + evaluator m_argImpl; + + // If we do not reverse rows, then we do not need to know the number of rows; same for columns + // Nonetheless, in this case it is important to set to 1 such that the coeff(index) method works fine for vectors. + const variable_if_dynamic m_rows; + const variable_if_dynamic m_cols; +}; + + +// -------------------- Diagonal -------------------- + +template +struct evaluator > + : evaluator_base > +{ + typedef Diagonal XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + + Flags = (unsigned int)(evaluator::Flags & (HereditaryBits | DirectAccessBit) & ~RowMajorBit) | LinearAccessBit, + + Alignment = 0 + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& diagonal) + : m_argImpl(diagonal.nestedExpression()), + m_index(diagonal.index()) + { } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index) const + { + return m_argImpl.coeff(row + rowOffset(), row + colOffset()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(index + rowOffset(), index + colOffset()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index) + { + return m_argImpl.coeffRef(row + rowOffset(), row + colOffset()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(index + rowOffset(), index + colOffset()); + } + +protected: + evaluator m_argImpl; + const internal::variable_if_dynamicindex m_index; + +private: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rowOffset() const { return m_index.value() > 0 ? 0 : -m_index.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index colOffset() const { return m_index.value() > 0 ? m_index.value() : 0; } +}; + + +//---------------------------------------------------------------------- +// deprecated code +//---------------------------------------------------------------------- + +// -------------------- EvalToTemp -------------------- + +// expression class for evaluating nested expression to a temporary + +template class EvalToTemp; + +template +struct traits > + : public traits +{ }; + +template +class EvalToTemp + : public dense_xpr_base >::type +{ + public: + + typedef typename dense_xpr_base::type Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(EvalToTemp) + + explicit EvalToTemp(const ArgType& arg) + : m_arg(arg) + { } + + const ArgType& arg() const + { + return m_arg; + } + + Index rows() const + { + return m_arg.rows(); + } + + Index cols() const + { + return m_arg.cols(); + } + + private: + const ArgType& m_arg; +}; + +template +struct evaluator > + : public evaluator +{ + typedef EvalToTemp XprType; + typedef typename ArgType::PlainObject PlainObject; + typedef evaluator Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) + : m_result(xpr.arg()) + { + ::new (static_cast(this)) Base(m_result); + } + + // This constructor is used when nesting an EvalTo evaluator in another evaluator + EIGEN_DEVICE_FUNC evaluator(const ArgType& arg) + : m_result(arg) + { + ::new (static_cast(this)) Base(m_result); + } + +protected: + PlainObject m_result; +}; + +} // namespace internal + +} // end namespace Eigen + +#endif // EIGEN_COREEVALUATORS_H diff --git a/simulation/externals/eigen/Eigen/src/Core/CoreIterators.h b/simulation/externals/eigen/Eigen/src/Core/CoreIterators.h new file mode 100644 index 0000000..4eb42b9 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/CoreIterators.h @@ -0,0 +1,127 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2014 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_COREITERATORS_H +#define EIGEN_COREITERATORS_H + +namespace Eigen { + +/* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core + */ + +namespace internal { + +template +class inner_iterator_selector; + +} + +/** \class InnerIterator + * \brief An InnerIterator allows to loop over the element of any matrix expression. + * + * \warning To be used with care because an evaluator is constructed every time an InnerIterator iterator is constructed. + * + * TODO: add a usage example + */ +template +class InnerIterator +{ +protected: + typedef internal::inner_iterator_selector::Kind> IteratorType; + typedef internal::evaluator EvaluatorType; + typedef typename internal::traits::Scalar Scalar; +public: + /** Construct an iterator over the \a outerId -th row or column of \a xpr */ + InnerIterator(const XprType &xpr, const Index &outerId) + : m_eval(xpr), m_iter(m_eval, outerId, xpr.innerSize()) + {} + + /// \returns the value of the current coefficient. + EIGEN_STRONG_INLINE Scalar value() const { return m_iter.value(); } + /** Increment the iterator \c *this to the next non-zero coefficient. + * Explicit zeros are not skipped over. To skip explicit zeros, see class SparseView + */ + EIGEN_STRONG_INLINE InnerIterator& operator++() { m_iter.operator++(); return *this; } + /// \returns the column or row index of the current coefficient. + EIGEN_STRONG_INLINE Index index() const { return m_iter.index(); } + /// \returns the row index of the current coefficient. + EIGEN_STRONG_INLINE Index row() const { return m_iter.row(); } + /// \returns the column index of the current coefficient. + EIGEN_STRONG_INLINE Index col() const { return m_iter.col(); } + /// \returns \c true if the iterator \c *this still references a valid coefficient. + EIGEN_STRONG_INLINE operator bool() const { return m_iter; } + +protected: + EvaluatorType m_eval; + IteratorType m_iter; +private: + // If you get here, then you're not using the right InnerIterator type, e.g.: + // SparseMatrix A; + // SparseMatrix::InnerIterator it(A,0); + template InnerIterator(const EigenBase&,Index outer); +}; + +namespace internal { + +// Generic inner iterator implementation for dense objects +template +class inner_iterator_selector +{ +protected: + typedef evaluator EvaluatorType; + typedef typename traits::Scalar Scalar; + enum { IsRowMajor = (XprType::Flags&RowMajorBit)==RowMajorBit }; + +public: + EIGEN_STRONG_INLINE inner_iterator_selector(const EvaluatorType &eval, const Index &outerId, const Index &innerSize) + : m_eval(eval), m_inner(0), m_outer(outerId), m_end(innerSize) + {} + + EIGEN_STRONG_INLINE Scalar value() const + { + return (IsRowMajor) ? m_eval.coeff(m_outer, m_inner) + : m_eval.coeff(m_inner, m_outer); + } + + EIGEN_STRONG_INLINE inner_iterator_selector& operator++() { m_inner++; return *this; } + + EIGEN_STRONG_INLINE Index index() const { return m_inner; } + inline Index row() const { return IsRowMajor ? m_outer : index(); } + inline Index col() const { return IsRowMajor ? index() : m_outer; } + + EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } + +protected: + const EvaluatorType& m_eval; + Index m_inner; + const Index m_outer; + const Index m_end; +}; + +// For iterator-based evaluator, inner-iterator is already implemented as +// evaluator<>::InnerIterator +template +class inner_iterator_selector + : public evaluator::InnerIterator +{ +protected: + typedef typename evaluator::InnerIterator Base; + typedef evaluator EvaluatorType; + +public: + EIGEN_STRONG_INLINE inner_iterator_selector(const EvaluatorType &eval, const Index &outerId, const Index &/*innerSize*/) + : Base(eval, outerId) + {} +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_COREITERATORS_H diff --git a/simulation/externals/eigen/Eigen/src/Core/CwiseBinaryOp.h b/simulation/externals/eigen/Eigen/src/Core/CwiseBinaryOp.h new file mode 100644 index 0000000..a36765e --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/CwiseBinaryOp.h @@ -0,0 +1,184 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2014 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CWISE_BINARY_OP_H +#define EIGEN_CWISE_BINARY_OP_H + +namespace Eigen { + +namespace internal { +template +struct traits > +{ + // we must not inherit from traits since it has + // the potential to cause problems with MSVC + typedef typename remove_all::type Ancestor; + typedef typename traits::XprKind XprKind; + enum { + RowsAtCompileTime = traits::RowsAtCompileTime, + ColsAtCompileTime = traits::ColsAtCompileTime, + MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = traits::MaxColsAtCompileTime + }; + + // even though we require Lhs and Rhs to have the same scalar type (see CwiseBinaryOp constructor), + // we still want to handle the case when the result type is different. + typedef typename result_of< + BinaryOp( + const typename Lhs::Scalar&, + const typename Rhs::Scalar& + ) + >::type Scalar; + typedef typename cwise_promote_storage_type::StorageKind, + typename traits::StorageKind, + BinaryOp>::ret StorageKind; + typedef typename promote_index_type::StorageIndex, + typename traits::StorageIndex>::type StorageIndex; + typedef typename Lhs::Nested LhsNested; + typedef typename Rhs::Nested RhsNested; + typedef typename remove_reference::type _LhsNested; + typedef typename remove_reference::type _RhsNested; + enum { + Flags = cwise_promote_storage_order::StorageKind,typename traits::StorageKind,_LhsNested::Flags & RowMajorBit,_RhsNested::Flags & RowMajorBit>::value + }; +}; +} // end namespace internal + +template +class CwiseBinaryOpImpl; + +/** \class CwiseBinaryOp + * \ingroup Core_Module + * + * \brief Generic expression where a coefficient-wise binary operator is applied to two expressions + * + * \tparam BinaryOp template functor implementing the operator + * \tparam LhsType the type of the left-hand side + * \tparam RhsType the type of the right-hand side + * + * This class represents an expression where a coefficient-wise binary operator is applied to two expressions. + * It is the return type of binary operators, by which we mean only those binary operators where + * both the left-hand side and the right-hand side are Eigen expressions. + * For example, the return type of matrix1+matrix2 is a CwiseBinaryOp. + * + * Most of the time, this is the only way that it is used, so you typically don't have to name + * CwiseBinaryOp types explicitly. + * + * \sa MatrixBase::binaryExpr(const MatrixBase &,const CustomBinaryOp &) const, class CwiseUnaryOp, class CwiseNullaryOp + */ +template +class CwiseBinaryOp : + public CwiseBinaryOpImpl< + BinaryOp, LhsType, RhsType, + typename internal::cwise_promote_storage_type::StorageKind, + typename internal::traits::StorageKind, + BinaryOp>::ret>, + internal::no_assignment_operator +{ + public: + + typedef typename internal::remove_all::type Functor; + typedef typename internal::remove_all::type Lhs; + typedef typename internal::remove_all::type Rhs; + + typedef typename CwiseBinaryOpImpl< + BinaryOp, LhsType, RhsType, + typename internal::cwise_promote_storage_type::StorageKind, + typename internal::traits::StorageKind, + BinaryOp>::ret>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseBinaryOp) + + typedef typename internal::ref_selector::type LhsNested; + typedef typename internal::ref_selector::type RhsNested; + typedef typename internal::remove_reference::type _LhsNested; + typedef typename internal::remove_reference::type _RhsNested; + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CwiseBinaryOp(const Lhs& aLhs, const Rhs& aRhs, const BinaryOp& func = BinaryOp()) + : m_lhs(aLhs), m_rhs(aRhs), m_functor(func) + { + EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename Rhs::Scalar); + // require the sizes to match + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Lhs, Rhs) + eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols()); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index rows() const { + // return the fixed size type if available to enable compile time optimizations + if (internal::traits::type>::RowsAtCompileTime==Dynamic) + return m_rhs.rows(); + else + return m_lhs.rows(); + } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index cols() const { + // return the fixed size type if available to enable compile time optimizations + if (internal::traits::type>::ColsAtCompileTime==Dynamic) + return m_rhs.cols(); + else + return m_lhs.cols(); + } + + /** \returns the left hand side nested expression */ + EIGEN_DEVICE_FUNC + const _LhsNested& lhs() const { return m_lhs; } + /** \returns the right hand side nested expression */ + EIGEN_DEVICE_FUNC + const _RhsNested& rhs() const { return m_rhs; } + /** \returns the functor representing the binary operation */ + EIGEN_DEVICE_FUNC + const BinaryOp& functor() const { return m_functor; } + + protected: + LhsNested m_lhs; + RhsNested m_rhs; + const BinaryOp m_functor; +}; + +// Generic API dispatcher +template +class CwiseBinaryOpImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; +}; + +/** replaces \c *this by \c *this - \a other. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_STRONG_INLINE Derived & +MatrixBase::operator-=(const MatrixBase &other) +{ + call_assignment(derived(), other.derived(), internal::sub_assign_op()); + return derived(); +} + +/** replaces \c *this by \c *this + \a other. + * + * \returns a reference to \c *this + */ +template +template +EIGEN_STRONG_INLINE Derived & +MatrixBase::operator+=(const MatrixBase& other) +{ + call_assignment(derived(), other.derived(), internal::add_assign_op()); + return derived(); +} + +} // end namespace Eigen + +#endif // EIGEN_CWISE_BINARY_OP_H + diff --git a/simulation/externals/eigen/Eigen/src/Core/CwiseNullaryOp.h b/simulation/externals/eigen/Eigen/src/Core/CwiseNullaryOp.h new file mode 100644 index 0000000..ddd607e --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/CwiseNullaryOp.h @@ -0,0 +1,866 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CWISE_NULLARY_OP_H +#define EIGEN_CWISE_NULLARY_OP_H + +namespace Eigen { + +namespace internal { +template +struct traits > : traits +{ + enum { + Flags = traits::Flags & RowMajorBit + }; +}; + +} // namespace internal + +/** \class CwiseNullaryOp + * \ingroup Core_Module + * + * \brief Generic expression of a matrix where all coefficients are defined by a functor + * + * \tparam NullaryOp template functor implementing the operator + * \tparam PlainObjectType the underlying plain matrix/array type + * + * This class represents an expression of a generic nullary operator. + * It is the return type of the Ones(), Zero(), Constant(), Identity() and Random() methods, + * and most of the time this is the only way it is used. + * + * However, if you want to write a function returning such an expression, you + * will need to use this class. + * + * The functor NullaryOp must expose one of the following method: + + + + +
\c operator()() if the procedural generation does not depend on the coefficient entries (e.g., random numbers)
\c operator()(Index i)if the procedural generation makes sense for vectors only and that it depends on the coefficient index \c i (e.g., linspace)
\c operator()(Index i,Index j)if the procedural generation depends on the matrix coordinates \c i, \c j (e.g., to generate a checkerboard with 0 and 1)
+ * It is also possible to expose the last two operators if the generation makes sense for matrices but can be optimized for vectors. + * + * See DenseBase::NullaryExpr(Index,const CustomNullaryOp&) for an example binding + * C++11 random number generators. + * + * A nullary expression can also be used to implement custom sophisticated matrix manipulations + * that cannot be covered by the existing set of natively supported matrix manipulations. + * See this \ref TopicCustomizing_NullaryExpr "page" for some examples and additional explanations + * on the behavior of CwiseNullaryOp. + * + * \sa class CwiseUnaryOp, class CwiseBinaryOp, DenseBase::NullaryExpr + */ +template +class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp >::type, internal::no_assignment_operator +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp) + + EIGEN_DEVICE_FUNC + CwiseNullaryOp(Index rows, Index cols, const NullaryOp& func = NullaryOp()) + : m_rows(rows), m_cols(cols), m_functor(func) + { + eigen_assert(rows >= 0 + && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) + && cols >= 0 + && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index rows() const { return m_rows.value(); } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index cols() const { return m_cols.value(); } + + /** \returns the functor representing the nullary operation */ + EIGEN_DEVICE_FUNC + const NullaryOp& functor() const { return m_functor; } + + protected: + const internal::variable_if_dynamic m_rows; + const internal::variable_if_dynamic m_cols; + const NullaryOp m_functor; +}; + + +/** \returns an expression of a matrix defined by a custom functor \a func + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used + * instead. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseNullaryOp::PlainObject> +DenseBase::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func) +{ + return CwiseNullaryOp(rows, cols, func); +} + +/** \returns an expression of a matrix defined by a custom functor \a func + * + * The parameter \a size is the size of the returned vector. + * Must be compatible with this MatrixBase type. + * + * \only_for_vectors + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Zero() should be used + * instead. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * Here is an example with C++11 random generators: \include random_cpp11.cpp + * Output: \verbinclude random_cpp11.out + * + * \sa class CwiseNullaryOp + */ +template +template +EIGEN_STRONG_INLINE const CwiseNullaryOp::PlainObject> +DenseBase::NullaryExpr(Index size, const CustomNullaryOp& func) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + if(RowsAtCompileTime == 1) return CwiseNullaryOp(1, size, func); + else return CwiseNullaryOp(size, 1, func); +} + +/** \returns an expression of a matrix defined by a custom functor \a func + * + * This variant is only for fixed-size DenseBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseNullaryOp::PlainObject> +DenseBase::NullaryExpr(const CustomNullaryOp& func) +{ + return CwiseNullaryOp(RowsAtCompileTime, ColsAtCompileTime, func); +} + +/** \returns an expression of a constant matrix of value \a value + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this DenseBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used + * instead. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Constant(Index rows, Index cols, const Scalar& value) +{ + return DenseBase::NullaryExpr(rows, cols, internal::scalar_constant_op(value)); +} + +/** \returns an expression of a constant matrix of value \a value + * + * The parameter \a size is the size of the returned vector. + * Must be compatible with this DenseBase type. + * + * \only_for_vectors + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Zero() should be used + * instead. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Constant(Index size, const Scalar& value) +{ + return DenseBase::NullaryExpr(size, internal::scalar_constant_op(value)); +} + +/** \returns an expression of a constant matrix of value \a value + * + * This variant is only for fixed-size DenseBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * The template parameter \a CustomNullaryOp is the type of the functor. + * + * \sa class CwiseNullaryOp + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Constant(const Scalar& value) +{ + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + return DenseBase::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_constant_op(value)); +} + +/** \deprecated because of accuracy loss. In Eigen 3.3, it is an alias for LinSpaced(Index,const Scalar&,const Scalar&) + * + * \sa LinSpaced(Index,Scalar,Scalar), setLinSpaced(Index,const Scalar&,const Scalar&) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType +DenseBase::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); +} + +/** \deprecated because of accuracy loss. In Eigen 3.3, it is an alias for LinSpaced(const Scalar&,const Scalar&) + * + * \sa LinSpaced(Scalar,Scalar) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType +DenseBase::LinSpaced(Sequential_t, const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); +} + +/** + * \brief Sets a linearly spaced vector. + * + * The function generates 'size' equally spaced values in the closed interval [low,high]. + * When size is set to 1, a vector of length 1 containing 'high' is returned. + * + * \only_for_vectors + * + * Example: \include DenseBase_LinSpaced.cpp + * Output: \verbinclude DenseBase_LinSpaced.out + * + * For integer scalar types, an even spacing is possible if and only if the length of the range, + * i.e., \c high-low is a scalar multiple of \c size-1, or if \c size is a scalar multiple of the + * number of values \c high-low+1 (meaning each value can be repeated the same number of time). + * If one of these two considions is not satisfied, then \c high is lowered to the largest value + * satisfying one of this constraint. + * Here are some examples: + * + * Example: \include DenseBase_LinSpacedInt.cpp + * Output: \verbinclude DenseBase_LinSpacedInt.out + * + * \sa setLinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType +DenseBase::LinSpaced(Index size, const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); +} + +/** + * \copydoc DenseBase::LinSpaced(Index, const Scalar&, const Scalar&) + * Special version for fixed size types which does not require the size parameter. + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType +DenseBase::LinSpaced(const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); +} + +/** \returns true if all coefficients in this matrix are approximately equal to \a val, to within precision \a prec */ +template +EIGEN_DEVICE_FUNC bool DenseBase::isApproxToConstant +(const Scalar& val, const RealScalar& prec) const +{ + typename internal::nested_eval::type self(derived()); + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < rows(); ++i) + if(!internal::isApprox(self.coeff(i, j), val, prec)) + return false; + return true; +} + +/** This is just an alias for isApproxToConstant(). + * + * \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */ +template +EIGEN_DEVICE_FUNC bool DenseBase::isConstant +(const Scalar& val, const RealScalar& prec) const +{ + return isApproxToConstant(val, prec); +} + +/** Alias for setConstant(): sets all coefficients in this expression to \a val. + * + * \sa setConstant(), Constant(), class CwiseNullaryOp + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void DenseBase::fill(const Scalar& val) +{ + setConstant(val); +} + +/** Sets all coefficients in this expression to value \a val. + * + * \sa fill(), setConstant(Index,const Scalar&), setConstant(Index,Index,const Scalar&), setZero(), setOnes(), Constant(), class CwiseNullaryOp, setZero(), setOnes() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setConstant(const Scalar& val) +{ + return derived() = Constant(rows(), cols(), val); +} + +/** Resizes to the given \a size, and sets all coefficients in this expression to the given value \a val. + * + * \only_for_vectors + * + * Example: \include Matrix_setConstant_int.cpp + * Output: \verbinclude Matrix_setConstant_int.out + * + * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(Index size, const Scalar& val) +{ + resize(size); + return setConstant(val); +} + +/** Resizes to the given size, and sets all coefficients in this expression to the given value \a val. + * + * \param rows the new number of rows + * \param cols the new number of columns + * \param val the value to which all coefficients are set + * + * Example: \include Matrix_setConstant_int_int.cpp + * Output: \verbinclude Matrix_setConstant_int_int.out + * + * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(Index rows, Index cols, const Scalar& val) +{ + resize(rows, cols); + return setConstant(val); +} + +/** + * \brief Sets a linearly spaced vector. + * + * The function generates 'size' equally spaced values in the closed interval [low,high]. + * When size is set to 1, a vector of length 1 containing 'high' is returned. + * + * \only_for_vectors + * + * Example: \include DenseBase_setLinSpaced.cpp + * Output: \verbinclude DenseBase_setLinSpaced.out + * + * For integer scalar types, do not miss the explanations on the definition + * of \link LinSpaced(Index,const Scalar&,const Scalar&) even spacing \endlink. + * + * \sa LinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(Index newSize, const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return derived() = Derived::NullaryExpr(newSize, internal::linspaced_op(low,high,newSize)); +} + +/** + * \brief Sets a linearly spaced vector. + * + * The function fills \c *this with equally spaced values in the closed interval [low,high]. + * When size is set to 1, a vector of length 1 containing 'high' is returned. + * + * \only_for_vectors + * + * For integer scalar types, do not miss the explanations on the definition + * of \link LinSpaced(Index,const Scalar&,const Scalar&) even spacing \endlink. + * + * \sa LinSpaced(Index,const Scalar&,const Scalar&), setLinSpaced(Index, const Scalar&, const Scalar&), CwiseNullaryOp + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(const Scalar& low, const Scalar& high) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return setLinSpaced(size(), low, high); +} + +// zero: + +/** \returns an expression of a zero matrix. + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used + * instead. + * + * Example: \include MatrixBase_zero_int_int.cpp + * Output: \verbinclude MatrixBase_zero_int_int.out + * + * \sa Zero(), Zero(Index) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Zero(Index rows, Index cols) +{ + return Constant(rows, cols, Scalar(0)); +} + +/** \returns an expression of a zero vector. + * + * The parameter \a size is the size of the returned vector. + * Must be compatible with this MatrixBase type. + * + * \only_for_vectors + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Zero() should be used + * instead. + * + * Example: \include MatrixBase_zero_int.cpp + * Output: \verbinclude MatrixBase_zero_int.out + * + * \sa Zero(), Zero(Index,Index) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Zero(Index size) +{ + return Constant(size, Scalar(0)); +} + +/** \returns an expression of a fixed-size zero matrix or vector. + * + * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * Example: \include MatrixBase_zero.cpp + * Output: \verbinclude MatrixBase_zero.out + * + * \sa Zero(Index), Zero(Index,Index) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Zero() +{ + return Constant(Scalar(0)); +} + +/** \returns true if *this is approximately equal to the zero matrix, + * within the precision given by \a prec. + * + * Example: \include MatrixBase_isZero.cpp + * Output: \verbinclude MatrixBase_isZero.out + * + * \sa class CwiseNullaryOp, Zero() + */ +template +EIGEN_DEVICE_FUNC bool DenseBase::isZero(const RealScalar& prec) const +{ + typename internal::nested_eval::type self(derived()); + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < rows(); ++i) + if(!internal::isMuchSmallerThan(self.coeff(i, j), static_cast(1), prec)) + return false; + return true; +} + +/** Sets all coefficients in this expression to zero. + * + * Example: \include MatrixBase_setZero.cpp + * Output: \verbinclude MatrixBase_setZero.out + * + * \sa class CwiseNullaryOp, Zero() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setZero() +{ + return setConstant(Scalar(0)); +} + +/** Resizes to the given \a size, and sets all coefficients in this expression to zero. + * + * \only_for_vectors + * + * Example: \include Matrix_setZero_int.cpp + * Output: \verbinclude Matrix_setZero_int.out + * + * \sa DenseBase::setZero(), setZero(Index,Index), class CwiseNullaryOp, DenseBase::Zero() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setZero(Index newSize) +{ + resize(newSize); + return setConstant(Scalar(0)); +} + +/** Resizes to the given size, and sets all coefficients in this expression to zero. + * + * \param rows the new number of rows + * \param cols the new number of columns + * + * Example: \include Matrix_setZero_int_int.cpp + * Output: \verbinclude Matrix_setZero_int_int.out + * + * \sa DenseBase::setZero(), setZero(Index), class CwiseNullaryOp, DenseBase::Zero() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setZero(Index rows, Index cols) +{ + resize(rows, cols); + return setConstant(Scalar(0)); +} + +// ones: + +/** \returns an expression of a matrix where all coefficients equal one. + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Ones() should be used + * instead. + * + * Example: \include MatrixBase_ones_int_int.cpp + * Output: \verbinclude MatrixBase_ones_int_int.out + * + * \sa Ones(), Ones(Index), isOnes(), class Ones + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Ones(Index rows, Index cols) +{ + return Constant(rows, cols, Scalar(1)); +} + +/** \returns an expression of a vector where all coefficients equal one. + * + * The parameter \a newSize is the size of the returned vector. + * Must be compatible with this MatrixBase type. + * + * \only_for_vectors + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Ones() should be used + * instead. + * + * Example: \include MatrixBase_ones_int.cpp + * Output: \verbinclude MatrixBase_ones_int.out + * + * \sa Ones(), Ones(Index,Index), isOnes(), class Ones + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Ones(Index newSize) +{ + return Constant(newSize, Scalar(1)); +} + +/** \returns an expression of a fixed-size matrix or vector where all coefficients equal one. + * + * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * Example: \include MatrixBase_ones.cpp + * Output: \verbinclude MatrixBase_ones.out + * + * \sa Ones(Index), Ones(Index,Index), isOnes(), class Ones + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Ones() +{ + return Constant(Scalar(1)); +} + +/** \returns true if *this is approximately equal to the matrix where all coefficients + * are equal to 1, within the precision given by \a prec. + * + * Example: \include MatrixBase_isOnes.cpp + * Output: \verbinclude MatrixBase_isOnes.out + * + * \sa class CwiseNullaryOp, Ones() + */ +template +EIGEN_DEVICE_FUNC bool DenseBase::isOnes +(const RealScalar& prec) const +{ + return isApproxToConstant(Scalar(1), prec); +} + +/** Sets all coefficients in this expression to one. + * + * Example: \include MatrixBase_setOnes.cpp + * Output: \verbinclude MatrixBase_setOnes.out + * + * \sa class CwiseNullaryOp, Ones() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setOnes() +{ + return setConstant(Scalar(1)); +} + +/** Resizes to the given \a newSize, and sets all coefficients in this expression to one. + * + * \only_for_vectors + * + * Example: \include Matrix_setOnes_int.cpp + * Output: \verbinclude Matrix_setOnes_int.out + * + * \sa MatrixBase::setOnes(), setOnes(Index,Index), class CwiseNullaryOp, MatrixBase::Ones() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setOnes(Index newSize) +{ + resize(newSize); + return setConstant(Scalar(1)); +} + +/** Resizes to the given size, and sets all coefficients in this expression to one. + * + * \param rows the new number of rows + * \param cols the new number of columns + * + * Example: \include Matrix_setOnes_int_int.cpp + * Output: \verbinclude Matrix_setOnes_int_int.out + * + * \sa MatrixBase::setOnes(), setOnes(Index), class CwiseNullaryOp, MatrixBase::Ones() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setOnes(Index rows, Index cols) +{ + resize(rows, cols); + return setConstant(Scalar(1)); +} + +// Identity: + +/** \returns an expression of the identity matrix (not necessarily square). + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Identity() should be used + * instead. + * + * Example: \include MatrixBase_identity_int_int.cpp + * Output: \verbinclude MatrixBase_identity_int_int.out + * + * \sa Identity(), setIdentity(), isIdentity() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType +MatrixBase::Identity(Index rows, Index cols) +{ + return DenseBase::NullaryExpr(rows, cols, internal::scalar_identity_op()); +} + +/** \returns an expression of the identity matrix (not necessarily square). + * + * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you + * need to use the variant taking size arguments. + * + * Example: \include MatrixBase_identity.cpp + * Output: \verbinclude MatrixBase_identity.out + * + * \sa Identity(Index,Index), setIdentity(), isIdentity() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType +MatrixBase::Identity() +{ + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + return MatrixBase::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_identity_op()); +} + +/** \returns true if *this is approximately equal to the identity matrix + * (not necessarily square), + * within the precision given by \a prec. + * + * Example: \include MatrixBase_isIdentity.cpp + * Output: \verbinclude MatrixBase_isIdentity.out + * + * \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), setIdentity() + */ +template +bool MatrixBase::isIdentity +(const RealScalar& prec) const +{ + typename internal::nested_eval::type self(derived()); + for(Index j = 0; j < cols(); ++j) + { + for(Index i = 0; i < rows(); ++i) + { + if(i == j) + { + if(!internal::isApprox(self.coeff(i, j), static_cast(1), prec)) + return false; + } + else + { + if(!internal::isMuchSmallerThan(self.coeff(i, j), static_cast(1), prec)) + return false; + } + } + } + return true; +} + +namespace internal { + +template=16)> +struct setIdentity_impl +{ + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Derived& run(Derived& m) + { + return m = Derived::Identity(m.rows(), m.cols()); + } +}; + +template +struct setIdentity_impl +{ + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Derived& run(Derived& m) + { + m.setZero(); + const Index size = numext::mini(m.rows(), m.cols()); + for(Index i = 0; i < size; ++i) m.coeffRef(i,i) = typename Derived::Scalar(1); + return m; + } +}; + +} // end namespace internal + +/** Writes the identity expression (not necessarily square) into *this. + * + * Example: \include MatrixBase_setIdentity.cpp + * Output: \verbinclude MatrixBase_setIdentity.out + * + * \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), isIdentity() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity() +{ + return internal::setIdentity_impl::run(derived()); +} + +/** \brief Resizes to the given size, and writes the identity expression (not necessarily square) into *this. + * + * \param rows the new number of rows + * \param cols the new number of columns + * + * Example: \include Matrix_setIdentity_int_int.cpp + * Output: \verbinclude Matrix_setIdentity_int_int.out + * + * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Identity() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity(Index rows, Index cols) +{ + derived().resize(rows, cols); + return setIdentity(); +} + +/** \returns an expression of the i-th unit (basis) vector. + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index newSize, Index i) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return BasisReturnType(SquareMatrixType::Identity(newSize,newSize), i); +} + +/** \returns an expression of the i-th unit (basis) vector. + * + * \only_for_vectors + * + * This variant is for fixed-size vector only. + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index i) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + return BasisReturnType(SquareMatrixType::Identity(),i); +} + +/** \returns an expression of the X axis unit vector (1{,0}^*) + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitX() +{ return Derived::Unit(0); } + +/** \returns an expression of the Y axis unit vector (0,1{,0}^*) + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitY() +{ return Derived::Unit(1); } + +/** \returns an expression of the Z axis unit vector (0,0,1{,0}^*) + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitZ() +{ return Derived::Unit(2); } + +/** \returns an expression of the W axis unit vector (0,0,0,1) + * + * \only_for_vectors + * + * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitW() +{ return Derived::Unit(3); } + +} // end namespace Eigen + +#endif // EIGEN_CWISE_NULLARY_OP_H diff --git a/simulation/externals/eigen/Eigen/src/Core/CwiseTernaryOp.h b/simulation/externals/eigen/Eigen/src/Core/CwiseTernaryOp.h new file mode 100644 index 0000000..9f3576f --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/CwiseTernaryOp.h @@ -0,0 +1,197 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2014 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2016 Eugene Brevdo +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CWISE_TERNARY_OP_H +#define EIGEN_CWISE_TERNARY_OP_H + +namespace Eigen { + +namespace internal { +template +struct traits > { + // we must not inherit from traits since it has + // the potential to cause problems with MSVC + typedef typename remove_all::type Ancestor; + typedef typename traits::XprKind XprKind; + enum { + RowsAtCompileTime = traits::RowsAtCompileTime, + ColsAtCompileTime = traits::ColsAtCompileTime, + MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = traits::MaxColsAtCompileTime + }; + + // even though we require Arg1, Arg2, and Arg3 to have the same scalar type + // (see CwiseTernaryOp constructor), + // we still want to handle the case when the result type is different. + typedef typename result_of::type Scalar; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::StorageIndex StorageIndex; + + typedef typename Arg1::Nested Arg1Nested; + typedef typename Arg2::Nested Arg2Nested; + typedef typename Arg3::Nested Arg3Nested; + typedef typename remove_reference::type _Arg1Nested; + typedef typename remove_reference::type _Arg2Nested; + typedef typename remove_reference::type _Arg3Nested; + enum { Flags = _Arg1Nested::Flags & RowMajorBit }; +}; +} // end namespace internal + +template +class CwiseTernaryOpImpl; + +/** \class CwiseTernaryOp + * \ingroup Core_Module + * + * \brief Generic expression where a coefficient-wise ternary operator is + * applied to two expressions + * + * \tparam TernaryOp template functor implementing the operator + * \tparam Arg1Type the type of the first argument + * \tparam Arg2Type the type of the second argument + * \tparam Arg3Type the type of the third argument + * + * This class represents an expression where a coefficient-wise ternary + * operator is applied to three expressions. + * It is the return type of ternary operators, by which we mean only those + * ternary operators where + * all three arguments are Eigen expressions. + * For example, the return type of betainc(matrix1, matrix2, matrix3) is a + * CwiseTernaryOp. + * + * Most of the time, this is the only way that it is used, so you typically + * don't have to name + * CwiseTernaryOp types explicitly. + * + * \sa MatrixBase::ternaryExpr(const MatrixBase &, const + * MatrixBase &, const CustomTernaryOp &) const, class CwiseBinaryOp, + * class CwiseUnaryOp, class CwiseNullaryOp + */ +template +class CwiseTernaryOp : public CwiseTernaryOpImpl< + TernaryOp, Arg1Type, Arg2Type, Arg3Type, + typename internal::traits::StorageKind>, + internal::no_assignment_operator +{ + public: + typedef typename internal::remove_all::type Arg1; + typedef typename internal::remove_all::type Arg2; + typedef typename internal::remove_all::type Arg3; + + typedef typename CwiseTernaryOpImpl< + TernaryOp, Arg1Type, Arg2Type, Arg3Type, + typename internal::traits::StorageKind>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseTernaryOp) + + typedef typename internal::ref_selector::type Arg1Nested; + typedef typename internal::ref_selector::type Arg2Nested; + typedef typename internal::ref_selector::type Arg3Nested; + typedef typename internal::remove_reference::type _Arg1Nested; + typedef typename internal::remove_reference::type _Arg2Nested; + typedef typename internal::remove_reference::type _Arg3Nested; + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CwiseTernaryOp(const Arg1& a1, const Arg2& a2, + const Arg3& a3, + const TernaryOp& func = TernaryOp()) + : m_arg1(a1), m_arg2(a2), m_arg3(a3), m_functor(func) { + // require the sizes to match + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg2) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg3) + + // The index types should match + EIGEN_STATIC_ASSERT((internal::is_same< + typename internal::traits::StorageKind, + typename internal::traits::StorageKind>::value), + STORAGE_KIND_MUST_MATCH) + EIGEN_STATIC_ASSERT((internal::is_same< + typename internal::traits::StorageKind, + typename internal::traits::StorageKind>::value), + STORAGE_KIND_MUST_MATCH) + + eigen_assert(a1.rows() == a2.rows() && a1.cols() == a2.cols() && + a1.rows() == a3.rows() && a1.cols() == a3.cols()); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index rows() const { + // return the fixed size type if available to enable compile time + // optimizations + if (internal::traits::type>:: + RowsAtCompileTime == Dynamic && + internal::traits::type>:: + RowsAtCompileTime == Dynamic) + return m_arg3.rows(); + else if (internal::traits::type>:: + RowsAtCompileTime == Dynamic && + internal::traits::type>:: + RowsAtCompileTime == Dynamic) + return m_arg2.rows(); + else + return m_arg1.rows(); + } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index cols() const { + // return the fixed size type if available to enable compile time + // optimizations + if (internal::traits::type>:: + ColsAtCompileTime == Dynamic && + internal::traits::type>:: + ColsAtCompileTime == Dynamic) + return m_arg3.cols(); + else if (internal::traits::type>:: + ColsAtCompileTime == Dynamic && + internal::traits::type>:: + ColsAtCompileTime == Dynamic) + return m_arg2.cols(); + else + return m_arg1.cols(); + } + + /** \returns the first argument nested expression */ + EIGEN_DEVICE_FUNC + const _Arg1Nested& arg1() const { return m_arg1; } + /** \returns the first argument nested expression */ + EIGEN_DEVICE_FUNC + const _Arg2Nested& arg2() const { return m_arg2; } + /** \returns the third argument nested expression */ + EIGEN_DEVICE_FUNC + const _Arg3Nested& arg3() const { return m_arg3; } + /** \returns the functor representing the ternary operation */ + EIGEN_DEVICE_FUNC + const TernaryOp& functor() const { return m_functor; } + + protected: + Arg1Nested m_arg1; + Arg2Nested m_arg2; + Arg3Nested m_arg3; + const TernaryOp m_functor; +}; + +// Generic API dispatcher +template +class CwiseTernaryOpImpl + : public internal::generic_xpr_base< + CwiseTernaryOp >::type { + public: + typedef typename internal::generic_xpr_base< + CwiseTernaryOp >::type Base; +}; + +} // end namespace Eigen + +#endif // EIGEN_CWISE_TERNARY_OP_H diff --git a/simulation/externals/eigen/Eigen/src/Core/CwiseUnaryOp.h b/simulation/externals/eigen/Eigen/src/Core/CwiseUnaryOp.h new file mode 100644 index 0000000..1d2dd19 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/CwiseUnaryOp.h @@ -0,0 +1,103 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2014 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CWISE_UNARY_OP_H +#define EIGEN_CWISE_UNARY_OP_H + +namespace Eigen { + +namespace internal { +template +struct traits > + : traits +{ + typedef typename result_of< + UnaryOp(const typename XprType::Scalar&) + >::type Scalar; + typedef typename XprType::Nested XprTypeNested; + typedef typename remove_reference::type _XprTypeNested; + enum { + Flags = _XprTypeNested::Flags & RowMajorBit + }; +}; +} + +template +class CwiseUnaryOpImpl; + +/** \class CwiseUnaryOp + * \ingroup Core_Module + * + * \brief Generic expression where a coefficient-wise unary operator is applied to an expression + * + * \tparam UnaryOp template functor implementing the operator + * \tparam XprType the type of the expression to which we are applying the unary operator + * + * This class represents an expression where a unary operator is applied to an expression. + * It is the return type of all operations taking exactly 1 input expression, regardless of the + * presence of other inputs such as scalars. For example, the operator* in the expression 3*matrix + * is considered unary, because only the right-hand side is an expression, and its + * return type is a specialization of CwiseUnaryOp. + * + * Most of the time, this is the only way that it is used, so you typically don't have to name + * CwiseUnaryOp types explicitly. + * + * \sa MatrixBase::unaryExpr(const CustomUnaryOp &) const, class CwiseBinaryOp, class CwiseNullaryOp + */ +template +class CwiseUnaryOp : public CwiseUnaryOpImpl::StorageKind>, internal::no_assignment_operator +{ + public: + + typedef typename CwiseUnaryOpImpl::StorageKind>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp) + typedef typename internal::ref_selector::type XprTypeNested; + typedef typename internal::remove_all::type NestedExpression; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp()) + : m_xpr(xpr), m_functor(func) {} + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Index rows() const { return m_xpr.rows(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Index cols() const { return m_xpr.cols(); } + + /** \returns the functor representing the unary operation */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const UnaryOp& functor() const { return m_functor; } + + /** \returns the nested expression */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const typename internal::remove_all::type& + nestedExpression() const { return m_xpr; } + + /** \returns the nested expression */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + typename internal::remove_all::type& + nestedExpression() { return m_xpr; } + + protected: + XprTypeNested m_xpr; + const UnaryOp m_functor; +}; + +// Generic API dispatcher +template +class CwiseUnaryOpImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; +}; + +} // end namespace Eigen + +#endif // EIGEN_CWISE_UNARY_OP_H diff --git a/simulation/externals/eigen/Eigen/src/Core/CwiseUnaryView.h b/simulation/externals/eigen/Eigen/src/Core/CwiseUnaryView.h new file mode 100644 index 0000000..2710330 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/CwiseUnaryView.h @@ -0,0 +1,128 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CWISE_UNARY_VIEW_H +#define EIGEN_CWISE_UNARY_VIEW_H + +namespace Eigen { + +namespace internal { +template +struct traits > + : traits +{ + typedef typename result_of< + ViewOp(const typename traits::Scalar&) + >::type Scalar; + typedef typename MatrixType::Nested MatrixTypeNested; + typedef typename remove_all::type _MatrixTypeNested; + enum { + FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, + Flags = traits<_MatrixTypeNested>::Flags & (RowMajorBit | FlagsLvalueBit | DirectAccessBit), // FIXME DirectAccessBit should not be handled by expressions + MatrixTypeInnerStride = inner_stride_at_compile_time::ret, + // need to cast the sizeof's from size_t to int explicitly, otherwise: + // "error: no integral type can represent all of the enumerator values + InnerStrideAtCompileTime = MatrixTypeInnerStride == Dynamic + ? int(Dynamic) + : int(MatrixTypeInnerStride) * int(sizeof(typename traits::Scalar) / sizeof(Scalar)), + OuterStrideAtCompileTime = outer_stride_at_compile_time::ret == Dynamic + ? int(Dynamic) + : outer_stride_at_compile_time::ret * int(sizeof(typename traits::Scalar) / sizeof(Scalar)) + }; +}; +} + +template +class CwiseUnaryViewImpl; + +/** \class CwiseUnaryView + * \ingroup Core_Module + * + * \brief Generic lvalue expression of a coefficient-wise unary operator of a matrix or a vector + * + * \tparam ViewOp template functor implementing the view + * \tparam MatrixType the type of the matrix we are applying the unary operator + * + * This class represents a lvalue expression of a generic unary view operator of a matrix or a vector. + * It is the return type of real() and imag(), and most of the time this is the only way it is used. + * + * \sa MatrixBase::unaryViewExpr(const CustomUnaryOp &) const, class CwiseUnaryOp + */ +template +class CwiseUnaryView : public CwiseUnaryViewImpl::StorageKind> +{ + public: + + typedef typename CwiseUnaryViewImpl::StorageKind>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryView) + typedef typename internal::ref_selector::non_const_type MatrixTypeNested; + typedef typename internal::remove_all::type NestedExpression; + + explicit inline CwiseUnaryView(MatrixType& mat, const ViewOp& func = ViewOp()) + : m_matrix(mat), m_functor(func) {} + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryView) + + EIGEN_STRONG_INLINE Index rows() const { return m_matrix.rows(); } + EIGEN_STRONG_INLINE Index cols() const { return m_matrix.cols(); } + + /** \returns the functor representing unary operation */ + const ViewOp& functor() const { return m_functor; } + + /** \returns the nested expression */ + const typename internal::remove_all::type& + nestedExpression() const { return m_matrix; } + + /** \returns the nested expression */ + typename internal::remove_reference::type& + nestedExpression() { return m_matrix.const_cast_derived(); } + + protected: + MatrixTypeNested m_matrix; + ViewOp m_functor; +}; + +// Generic API dispatcher +template +class CwiseUnaryViewImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; +}; + +template +class CwiseUnaryViewImpl + : public internal::dense_xpr_base< CwiseUnaryView >::type +{ + public: + + typedef CwiseUnaryView Derived; + typedef typename internal::dense_xpr_base< CwiseUnaryView >::type Base; + + EIGEN_DENSE_PUBLIC_INTERFACE(Derived) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryViewImpl) + + EIGEN_DEVICE_FUNC inline Scalar* data() { return &(this->coeffRef(0)); } + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return &(this->coeff(0)); } + + EIGEN_DEVICE_FUNC inline Index innerStride() const + { + return derived().nestedExpression().innerStride() * sizeof(typename internal::traits::Scalar) / sizeof(Scalar); + } + + EIGEN_DEVICE_FUNC inline Index outerStride() const + { + return derived().nestedExpression().outerStride() * sizeof(typename internal::traits::Scalar) / sizeof(Scalar); + } +}; + +} // end namespace Eigen + +#endif // EIGEN_CWISE_UNARY_VIEW_H diff --git a/simulation/externals/eigen/Eigen/src/Core/DenseBase.h b/simulation/externals/eigen/Eigen/src/Core/DenseBase.h new file mode 100644 index 0000000..90066ae --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/DenseBase.h @@ -0,0 +1,611 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007-2010 Benoit Jacob +// Copyright (C) 2008-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_DENSEBASE_H +#define EIGEN_DENSEBASE_H + +namespace Eigen { + +namespace internal { + +// The index type defined by EIGEN_DEFAULT_DENSE_INDEX_TYPE must be a signed type. +// This dummy function simply aims at checking that at compile time. +static inline void check_DenseIndex_is_signed() { + EIGEN_STATIC_ASSERT(NumTraits::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE); +} + +} // end namespace internal + +/** \class DenseBase + * \ingroup Core_Module + * + * \brief Base class for all dense matrices, vectors, and arrays + * + * This class is the base that is inherited by all dense objects (matrix, vector, arrays, + * and related expression types). The common Eigen API for dense objects is contained in this class. + * + * \tparam Derived is the derived type, e.g., a matrix type or an expression. + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_DENSEBASE_PLUGIN. + * + * \sa \blank \ref TopicClassHierarchy + */ +template class DenseBase +#ifndef EIGEN_PARSED_BY_DOXYGEN + : public DenseCoeffsBase +#else + : public DenseCoeffsBase +#endif // not EIGEN_PARSED_BY_DOXYGEN +{ + public: + + /** Inner iterator type to iterate over the coefficients of a row or column. + * \sa class InnerIterator + */ + typedef Eigen::InnerIterator InnerIterator; + + typedef typename internal::traits::StorageKind StorageKind; + + /** + * \brief The type used to store indices + * \details This typedef is relevant for types that store multiple indices such as + * PermutationMatrix or Transpositions, otherwise it defaults to Eigen::Index + * \sa \blank \ref TopicPreprocessorDirectives, Eigen::Index, SparseMatrixBase. + */ + typedef typename internal::traits::StorageIndex StorageIndex; + + /** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex, etc. */ + typedef typename internal::traits::Scalar Scalar; + + /** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex, etc. + * + * It is an alias for the Scalar type */ + typedef Scalar value_type; + + typedef typename NumTraits::Real RealScalar; + typedef DenseCoeffsBase Base; + + using Base::derived; + using Base::const_cast_derived; + using Base::rows; + using Base::cols; + using Base::size; + using Base::rowIndexByOuterInner; + using Base::colIndexByOuterInner; + using Base::coeff; + using Base::coeffByOuterInner; + using Base::operator(); + using Base::operator[]; + using Base::x; + using Base::y; + using Base::z; + using Base::w; + using Base::stride; + using Base::innerStride; + using Base::outerStride; + using Base::rowStride; + using Base::colStride; + typedef typename Base::CoeffReturnType CoeffReturnType; + + enum { + + RowsAtCompileTime = internal::traits::RowsAtCompileTime, + /**< The number of rows at compile-time. This is just a copy of the value provided + * by the \a Derived type. If a value is not known at compile-time, + * it is set to the \a Dynamic constant. + * \sa MatrixBase::rows(), MatrixBase::cols(), ColsAtCompileTime, SizeAtCompileTime */ + + ColsAtCompileTime = internal::traits::ColsAtCompileTime, + /**< The number of columns at compile-time. This is just a copy of the value provided + * by the \a Derived type. If a value is not known at compile-time, + * it is set to the \a Dynamic constant. + * \sa MatrixBase::rows(), MatrixBase::cols(), RowsAtCompileTime, SizeAtCompileTime */ + + + SizeAtCompileTime = (internal::size_at_compile_time::RowsAtCompileTime, + internal::traits::ColsAtCompileTime>::ret), + /**< This is equal to the number of coefficients, i.e. the number of + * rows times the number of columns, or to \a Dynamic if this is not + * known at compile-time. \sa RowsAtCompileTime, ColsAtCompileTime */ + + MaxRowsAtCompileTime = internal::traits::MaxRowsAtCompileTime, + /**< This value is equal to the maximum possible number of rows that this expression + * might have. If this expression might have an arbitrarily high number of rows, + * this value is set to \a Dynamic. + * + * This value is useful to know when evaluating an expression, in order to determine + * whether it is possible to avoid doing a dynamic memory allocation. + * + * \sa RowsAtCompileTime, MaxColsAtCompileTime, MaxSizeAtCompileTime + */ + + MaxColsAtCompileTime = internal::traits::MaxColsAtCompileTime, + /**< This value is equal to the maximum possible number of columns that this expression + * might have. If this expression might have an arbitrarily high number of columns, + * this value is set to \a Dynamic. + * + * This value is useful to know when evaluating an expression, in order to determine + * whether it is possible to avoid doing a dynamic memory allocation. + * + * \sa ColsAtCompileTime, MaxRowsAtCompileTime, MaxSizeAtCompileTime + */ + + MaxSizeAtCompileTime = (internal::size_at_compile_time::MaxRowsAtCompileTime, + internal::traits::MaxColsAtCompileTime>::ret), + /**< This value is equal to the maximum possible number of coefficients that this expression + * might have. If this expression might have an arbitrarily high number of coefficients, + * this value is set to \a Dynamic. + * + * This value is useful to know when evaluating an expression, in order to determine + * whether it is possible to avoid doing a dynamic memory allocation. + * + * \sa SizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime + */ + + IsVectorAtCompileTime = internal::traits::MaxRowsAtCompileTime == 1 + || internal::traits::MaxColsAtCompileTime == 1, + /**< This is set to true if either the number of rows or the number of + * columns is known at compile-time to be equal to 1. Indeed, in that case, + * we are dealing with a column-vector (if there is only one column) or with + * a row-vector (if there is only one row). */ + + Flags = internal::traits::Flags, + /**< This stores expression \ref flags flags which may or may not be inherited by new expressions + * constructed from this one. See the \ref flags "list of flags". + */ + + IsRowMajor = int(Flags) & RowMajorBit, /**< True if this expression has row-major storage order. */ + + InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? int(SizeAtCompileTime) + : int(IsRowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime), + + InnerStrideAtCompileTime = internal::inner_stride_at_compile_time::ret, + OuterStrideAtCompileTime = internal::outer_stride_at_compile_time::ret + }; + + typedef typename internal::find_best_packet::type PacketScalar; + + enum { IsPlainObjectBase = 0 }; + + /** The plain matrix type corresponding to this expression. + * \sa PlainObject */ + typedef Matrix::Scalar, + internal::traits::RowsAtCompileTime, + internal::traits::ColsAtCompileTime, + AutoAlign | (internal::traits::Flags&RowMajorBit ? RowMajor : ColMajor), + internal::traits::MaxRowsAtCompileTime, + internal::traits::MaxColsAtCompileTime + > PlainMatrix; + + /** The plain array type corresponding to this expression. + * \sa PlainObject */ + typedef Array::Scalar, + internal::traits::RowsAtCompileTime, + internal::traits::ColsAtCompileTime, + AutoAlign | (internal::traits::Flags&RowMajorBit ? RowMajor : ColMajor), + internal::traits::MaxRowsAtCompileTime, + internal::traits::MaxColsAtCompileTime + > PlainArray; + + /** \brief The plain matrix or array type corresponding to this expression. + * + * This is not necessarily exactly the return type of eval(). In the case of plain matrices, + * the return type of eval() is a const reference to a matrix, not a matrix! It is however guaranteed + * that the return type of eval() is either PlainObject or const PlainObject&. + */ + typedef typename internal::conditional::XprKind,MatrixXpr >::value, + PlainMatrix, PlainArray>::type PlainObject; + + /** \returns the number of nonzero coefficients which is in practice the number + * of stored coefficients. */ + EIGEN_DEVICE_FUNC + inline Index nonZeros() const { return size(); } + + /** \returns the outer size. + * + * \note For a vector, this returns just 1. For a matrix (non-vector), this is the major dimension + * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of columns for a + * column-major matrix, and the number of rows for a row-major matrix. */ + EIGEN_DEVICE_FUNC + Index outerSize() const + { + return IsVectorAtCompileTime ? 1 + : int(IsRowMajor) ? this->rows() : this->cols(); + } + + /** \returns the inner size. + * + * \note For a vector, this is just the size. For a matrix (non-vector), this is the minor dimension + * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of rows for a + * column-major matrix, and the number of columns for a row-major matrix. */ + EIGEN_DEVICE_FUNC + Index innerSize() const + { + return IsVectorAtCompileTime ? this->size() + : int(IsRowMajor) ? this->cols() : this->rows(); + } + + /** Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods are + * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does + * nothing else. + */ + EIGEN_DEVICE_FUNC + void resize(Index newSize) + { + EIGEN_ONLY_USED_FOR_DEBUG(newSize); + eigen_assert(newSize == this->size() + && "DenseBase::resize() does not actually allow to resize."); + } + /** Only plain matrices/arrays, not expressions, may be resized; therefore the only useful resize methods are + * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does + * nothing else. + */ + EIGEN_DEVICE_FUNC + void resize(Index rows, Index cols) + { + EIGEN_ONLY_USED_FOR_DEBUG(rows); + EIGEN_ONLY_USED_FOR_DEBUG(cols); + eigen_assert(rows == this->rows() && cols == this->cols() + && "DenseBase::resize() does not actually allow to resize."); + } + +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal Represents a matrix with all coefficients equal to one another*/ + typedef CwiseNullaryOp,PlainObject> ConstantReturnType; + /** \internal \deprecated Represents a vector with linearly spaced coefficients that allows sequential access only. */ + typedef CwiseNullaryOp,PlainObject> SequentialLinSpacedReturnType; + /** \internal Represents a vector with linearly spaced coefficients that allows random access. */ + typedef CwiseNullaryOp,PlainObject> RandomAccessLinSpacedReturnType; + /** \internal the return type of MatrixBase::eigenvalues() */ + typedef Matrix::Scalar>::Real, internal::traits::ColsAtCompileTime, 1> EigenvaluesReturnType; + +#endif // not EIGEN_PARSED_BY_DOXYGEN + + /** Copies \a other into *this. \returns a reference to *this. */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator=(const DenseBase& other); + + /** Special case of the template operator=, in order to prevent the compiler + * from generating a default operator= (issue hit with g++ 4.1) + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator=(const DenseBase& other); + + template + EIGEN_DEVICE_FUNC + Derived& operator=(const EigenBase &other); + + template + EIGEN_DEVICE_FUNC + Derived& operator+=(const EigenBase &other); + + template + EIGEN_DEVICE_FUNC + Derived& operator-=(const EigenBase &other); + + template + EIGEN_DEVICE_FUNC + Derived& operator=(const ReturnByValue& func); + + /** \internal + * Copies \a other into *this without evaluating other. \returns a reference to *this. + * \deprecated */ + template + EIGEN_DEVICE_FUNC + Derived& lazyAssign(const DenseBase& other); + + EIGEN_DEVICE_FUNC + CommaInitializer operator<< (const Scalar& s); + + /** \deprecated it now returns \c *this */ + template + EIGEN_DEPRECATED + const Derived& flagged() const + { return derived(); } + + template + EIGEN_DEVICE_FUNC + CommaInitializer operator<< (const DenseBase& other); + + typedef Transpose TransposeReturnType; + EIGEN_DEVICE_FUNC + TransposeReturnType transpose(); + typedef typename internal::add_const >::type ConstTransposeReturnType; + EIGEN_DEVICE_FUNC + ConstTransposeReturnType transpose() const; + EIGEN_DEVICE_FUNC + void transposeInPlace(); + + EIGEN_DEVICE_FUNC static const ConstantReturnType + Constant(Index rows, Index cols, const Scalar& value); + EIGEN_DEVICE_FUNC static const ConstantReturnType + Constant(Index size, const Scalar& value); + EIGEN_DEVICE_FUNC static const ConstantReturnType + Constant(const Scalar& value); + + EIGEN_DEVICE_FUNC static const SequentialLinSpacedReturnType + LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high); + EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType + LinSpaced(Index size, const Scalar& low, const Scalar& high); + EIGEN_DEVICE_FUNC static const SequentialLinSpacedReturnType + LinSpaced(Sequential_t, const Scalar& low, const Scalar& high); + EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType + LinSpaced(const Scalar& low, const Scalar& high); + + template EIGEN_DEVICE_FUNC + static const CwiseNullaryOp + NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func); + template EIGEN_DEVICE_FUNC + static const CwiseNullaryOp + NullaryExpr(Index size, const CustomNullaryOp& func); + template EIGEN_DEVICE_FUNC + static const CwiseNullaryOp + NullaryExpr(const CustomNullaryOp& func); + + EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(Index rows, Index cols); + EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(Index size); + EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(); + EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(Index rows, Index cols); + EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(Index size); + EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(); + + EIGEN_DEVICE_FUNC void fill(const Scalar& value); + EIGEN_DEVICE_FUNC Derived& setConstant(const Scalar& value); + EIGEN_DEVICE_FUNC Derived& setLinSpaced(Index size, const Scalar& low, const Scalar& high); + EIGEN_DEVICE_FUNC Derived& setLinSpaced(const Scalar& low, const Scalar& high); + EIGEN_DEVICE_FUNC Derived& setZero(); + EIGEN_DEVICE_FUNC Derived& setOnes(); + EIGEN_DEVICE_FUNC Derived& setRandom(); + + template EIGEN_DEVICE_FUNC + bool isApprox(const DenseBase& other, + const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC + bool isMuchSmallerThan(const RealScalar& other, + const RealScalar& prec = NumTraits::dummy_precision()) const; + template EIGEN_DEVICE_FUNC + bool isMuchSmallerThan(const DenseBase& other, + const RealScalar& prec = NumTraits::dummy_precision()) const; + + EIGEN_DEVICE_FUNC bool isApproxToConstant(const Scalar& value, const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isConstant(const Scalar& value, const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isZero(const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isOnes(const RealScalar& prec = NumTraits::dummy_precision()) const; + + inline bool hasNaN() const; + inline bool allFinite() const; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator*=(const Scalar& other); + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator/=(const Scalar& other); + + typedef typename internal::add_const_on_value_type::type>::type EvalReturnType; + /** \returns the matrix or vector obtained by evaluating this expression. + * + * Notice that in the case of a plain matrix or vector (not an expression) this function just returns + * a const reference, in order to avoid a useless copy. + * + * \warning Be carefull with eval() and the auto C++ keyword, as detailed in this \link TopicPitfalls_auto_keyword page \endlink. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE EvalReturnType eval() const + { + // Even though MSVC does not honor strong inlining when the return type + // is a dynamic matrix, we desperately need strong inlining for fixed + // size types on MSVC. + return typename internal::eval::type(derived()); + } + + /** swaps *this with the expression \a other. + * + */ + template + EIGEN_DEVICE_FUNC + void swap(const DenseBase& other) + { + EIGEN_STATIC_ASSERT(!OtherDerived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); + eigen_assert(rows()==other.rows() && cols()==other.cols()); + call_assignment(derived(), other.const_cast_derived(), internal::swap_assign_op()); + } + + /** swaps *this with the matrix or array \a other. + * + */ + template + EIGEN_DEVICE_FUNC + void swap(PlainObjectBase& other) + { + eigen_assert(rows()==other.rows() && cols()==other.cols()); + call_assignment(derived(), other.derived(), internal::swap_assign_op()); + } + + EIGEN_DEVICE_FUNC inline const NestByValue nestByValue() const; + EIGEN_DEVICE_FUNC inline const ForceAlignedAccess forceAlignedAccess() const; + EIGEN_DEVICE_FUNC inline ForceAlignedAccess forceAlignedAccess(); + template EIGEN_DEVICE_FUNC + inline const typename internal::conditional,Derived&>::type forceAlignedAccessIf() const; + template EIGEN_DEVICE_FUNC + inline typename internal::conditional,Derived&>::type forceAlignedAccessIf(); + + EIGEN_DEVICE_FUNC Scalar sum() const; + EIGEN_DEVICE_FUNC Scalar mean() const; + EIGEN_DEVICE_FUNC Scalar trace() const; + + EIGEN_DEVICE_FUNC Scalar prod() const; + + EIGEN_DEVICE_FUNC typename internal::traits::Scalar minCoeff() const; + EIGEN_DEVICE_FUNC typename internal::traits::Scalar maxCoeff() const; + + template EIGEN_DEVICE_FUNC + typename internal::traits::Scalar minCoeff(IndexType* row, IndexType* col) const; + template EIGEN_DEVICE_FUNC + typename internal::traits::Scalar maxCoeff(IndexType* row, IndexType* col) const; + template EIGEN_DEVICE_FUNC + typename internal::traits::Scalar minCoeff(IndexType* index) const; + template EIGEN_DEVICE_FUNC + typename internal::traits::Scalar maxCoeff(IndexType* index) const; + + template + EIGEN_DEVICE_FUNC + Scalar redux(const BinaryOp& func) const; + + template + EIGEN_DEVICE_FUNC + void visit(Visitor& func) const; + + /** \returns a WithFormat proxy object allowing to print a matrix the with given + * format \a fmt. + * + * See class IOFormat for some examples. + * + * \sa class IOFormat, class WithFormat + */ + inline const WithFormat format(const IOFormat& fmt) const + { + return WithFormat(derived(), fmt); + } + + /** \returns the unique coefficient of a 1x1 expression */ + EIGEN_DEVICE_FUNC + CoeffReturnType value() const + { + EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) + eigen_assert(this->rows() == 1 && this->cols() == 1); + return derived().coeff(0,0); + } + + EIGEN_DEVICE_FUNC bool all() const; + EIGEN_DEVICE_FUNC bool any() const; + EIGEN_DEVICE_FUNC Index count() const; + + typedef VectorwiseOp RowwiseReturnType; + typedef const VectorwiseOp ConstRowwiseReturnType; + typedef VectorwiseOp ColwiseReturnType; + typedef const VectorwiseOp ConstColwiseReturnType; + + /** \returns a VectorwiseOp wrapper of *this providing additional partial reduction operations + * + * Example: \include MatrixBase_rowwise.cpp + * Output: \verbinclude MatrixBase_rowwise.out + * + * \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting + */ + //Code moved here due to a CUDA compiler bug + EIGEN_DEVICE_FUNC inline ConstRowwiseReturnType rowwise() const { + return ConstRowwiseReturnType(derived()); + } + EIGEN_DEVICE_FUNC RowwiseReturnType rowwise(); + + /** \returns a VectorwiseOp wrapper of *this providing additional partial reduction operations + * + * Example: \include MatrixBase_colwise.cpp + * Output: \verbinclude MatrixBase_colwise.out + * + * \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting + */ + EIGEN_DEVICE_FUNC inline ConstColwiseReturnType colwise() const { + return ConstColwiseReturnType(derived()); + } + EIGEN_DEVICE_FUNC ColwiseReturnType colwise(); + + typedef CwiseNullaryOp,PlainObject> RandomReturnType; + static const RandomReturnType Random(Index rows, Index cols); + static const RandomReturnType Random(Index size); + static const RandomReturnType Random(); + + template + const Select + select(const DenseBase& thenMatrix, + const DenseBase& elseMatrix) const; + + template + inline const Select + select(const DenseBase& thenMatrix, const typename ThenDerived::Scalar& elseScalar) const; + + template + inline const Select + select(const typename ElseDerived::Scalar& thenScalar, const DenseBase& elseMatrix) const; + + template RealScalar lpNorm() const; + + template + EIGEN_DEVICE_FUNC + const Replicate replicate() const; + /** + * \return an expression of the replication of \c *this + * + * Example: \include MatrixBase_replicate_int_int.cpp + * Output: \verbinclude MatrixBase_replicate_int_int.out + * + * \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate + */ + //Code moved here due to a CUDA compiler bug + EIGEN_DEVICE_FUNC + const Replicate replicate(Index rowFactor, Index colFactor) const + { + return Replicate(derived(), rowFactor, colFactor); + } + + typedef Reverse ReverseReturnType; + typedef const Reverse ConstReverseReturnType; + EIGEN_DEVICE_FUNC ReverseReturnType reverse(); + /** This is the const version of reverse(). */ + //Code moved here due to a CUDA compiler bug + EIGEN_DEVICE_FUNC ConstReverseReturnType reverse() const + { + return ConstReverseReturnType(derived()); + } + EIGEN_DEVICE_FUNC void reverseInPlace(); + +#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase +#define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL +#define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND) +# include "../plugins/BlockMethods.h" +# ifdef EIGEN_DENSEBASE_PLUGIN +# include EIGEN_DENSEBASE_PLUGIN +# endif +#undef EIGEN_CURRENT_STORAGE_BASE_CLASS +#undef EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL +#undef EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF + + // disable the use of evalTo for dense objects with a nice compilation error + template + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& ) const + { + EIGEN_STATIC_ASSERT((internal::is_same::value),THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS); + } + + protected: + /** Default constructor. Do nothing. */ + EIGEN_DEVICE_FUNC DenseBase() + { + /* Just checks for self-consistency of the flags. + * Only do it when debugging Eigen, as this borders on paranoiac and could slow compilation down + */ +#ifdef EIGEN_INTERNAL_DEBUGGING + EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, int(IsRowMajor)) + && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, int(!IsRowMajor))), + INVALID_STORAGE_ORDER_FOR_THIS_VECTOR_EXPRESSION) +#endif + } + + private: + EIGEN_DEVICE_FUNC explicit DenseBase(int); + EIGEN_DEVICE_FUNC DenseBase(int,int); + template EIGEN_DEVICE_FUNC explicit DenseBase(const DenseBase&); +}; + +} // end namespace Eigen + +#endif // EIGEN_DENSEBASE_H diff --git a/simulation/externals/eigen/Eigen/src/Core/DenseCoeffsBase.h b/simulation/externals/eigen/Eigen/src/Core/DenseCoeffsBase.h new file mode 100644 index 0000000..c4af48a --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/DenseCoeffsBase.h @@ -0,0 +1,681 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_DENSECOEFFSBASE_H +#define EIGEN_DENSECOEFFSBASE_H + +namespace Eigen { + +namespace internal { +template struct add_const_on_value_type_if_arithmetic +{ + typedef typename conditional::value, T, typename add_const_on_value_type::type>::type type; +}; +} + +/** \brief Base class providing read-only coefficient access to matrices and arrays. + * \ingroup Core_Module + * \tparam Derived Type of the derived class + * \tparam #ReadOnlyAccessors Constant indicating read-only access + * + * This class defines the \c operator() \c const function and friends, which can be used to read specific + * entries of a matrix or array. + * + * \sa DenseCoeffsBase, DenseCoeffsBase, + * \ref TopicClassHierarchy + */ +template +class DenseCoeffsBase : public EigenBase +{ + public: + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + + // Explanation for this CoeffReturnType typedef. + // - This is the return type of the coeff() method. + // - The LvalueBit means exactly that we can offer a coeffRef() method, which means exactly that we can get references + // to coeffs, which means exactly that we can have coeff() return a const reference (as opposed to returning a value). + // - The is_artihmetic check is required since "const int", "const double", etc. will cause warnings on some systems + // while the declaration of "const T", where T is a non arithmetic type does not. Always returning "const Scalar&" is + // not possible, since the underlying expressions might not offer a valid address the reference could be referring to. + typedef typename internal::conditional::Flags&LvalueBit), + const Scalar&, + typename internal::conditional::value, Scalar, const Scalar>::type + >::type CoeffReturnType; + + typedef typename internal::add_const_on_value_type_if_arithmetic< + typename internal::packet_traits::type + >::type PacketReturnType; + + typedef EigenBase Base; + using Base::rows; + using Base::cols; + using Base::size; + using Base::derived; + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index rowIndexByOuterInner(Index outer, Index inner) const + { + return int(Derived::RowsAtCompileTime) == 1 ? 0 + : int(Derived::ColsAtCompileTime) == 1 ? inner + : int(Derived::Flags)&RowMajorBit ? outer + : inner; + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index colIndexByOuterInner(Index outer, Index inner) const + { + return int(Derived::ColsAtCompileTime) == 1 ? 0 + : int(Derived::RowsAtCompileTime) == 1 ? inner + : int(Derived::Flags)&RowMajorBit ? inner + : outer; + } + + /** Short version: don't use this function, use + * \link operator()(Index,Index) const \endlink instead. + * + * Long version: this function is similar to + * \link operator()(Index,Index) const \endlink, but without the assertion. + * Use this for limiting the performance cost of debugging code when doing + * repeated coefficient access. Only use this when it is guaranteed that the + * parameters \a row and \a col are in range. + * + * If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this + * function equivalent to \link operator()(Index,Index) const \endlink. + * + * \sa operator()(Index,Index) const, coeffRef(Index,Index), coeff(Index) const + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const + { + eigen_internal_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + return internal::evaluator(derived()).coeff(row,col); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType coeffByOuterInner(Index outer, Index inner) const + { + return coeff(rowIndexByOuterInner(outer, inner), + colIndexByOuterInner(outer, inner)); + } + + /** \returns the coefficient at given the given row and column. + * + * \sa operator()(Index,Index), operator[](Index) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType operator()(Index row, Index col) const + { + eigen_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + return coeff(row, col); + } + + /** Short version: don't use this function, use + * \link operator[](Index) const \endlink instead. + * + * Long version: this function is similar to + * \link operator[](Index) const \endlink, but without the assertion. + * Use this for limiting the performance cost of debugging code when doing + * repeated coefficient access. Only use this when it is guaranteed that the + * parameter \a index is in range. + * + * If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this + * function equivalent to \link operator[](Index) const \endlink. + * + * \sa operator[](Index) const, coeffRef(Index), coeff(Index,Index) const + */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType + coeff(Index index) const + { + EIGEN_STATIC_ASSERT(internal::evaluator::Flags & LinearAccessBit, + THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS) + eigen_internal_assert(index >= 0 && index < size()); + return internal::evaluator(derived()).coeff(index); + } + + + /** \returns the coefficient at given index. + * + * This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit. + * + * \sa operator[](Index), operator()(Index,Index) const, x() const, y() const, + * z() const, w() const + */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType + operator[](Index index) const + { + EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime, + THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD) + eigen_assert(index >= 0 && index < size()); + return coeff(index); + } + + /** \returns the coefficient at given index. + * + * This is synonymous to operator[](Index) const. + * + * This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit. + * + * \sa operator[](Index), operator()(Index,Index) const, x() const, y() const, + * z() const, w() const + */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType + operator()(Index index) const + { + eigen_assert(index >= 0 && index < size()); + return coeff(index); + } + + /** equivalent to operator[](0). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType + x() const { return (*this)[0]; } + + /** equivalent to operator[](1). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType + y() const + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS); + return (*this)[1]; + } + + /** equivalent to operator[](2). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType + z() const + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS); + return (*this)[2]; + } + + /** equivalent to operator[](3). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CoeffReturnType + w() const + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS); + return (*this)[3]; + } + + /** \internal + * \returns the packet of coefficients starting at the given row and column. It is your responsibility + * to ensure that a packet really starts there. This method is only available on expressions having the + * PacketAccessBit. + * + * The \a LoadMode parameter may have the value \a #Aligned or \a #Unaligned. Its effect is to select + * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets + * starting at an address which is a multiple of the packet size. + */ + + template + EIGEN_STRONG_INLINE PacketReturnType packet(Index row, Index col) const + { + typedef typename internal::packet_traits::type DefaultPacketType; + eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); + return internal::evaluator(derived()).template packet(row,col); + } + + + /** \internal */ + template + EIGEN_STRONG_INLINE PacketReturnType packetByOuterInner(Index outer, Index inner) const + { + return packet(rowIndexByOuterInner(outer, inner), + colIndexByOuterInner(outer, inner)); + } + + /** \internal + * \returns the packet of coefficients starting at the given index. It is your responsibility + * to ensure that a packet really starts there. This method is only available on expressions having the + * PacketAccessBit and the LinearAccessBit. + * + * The \a LoadMode parameter may have the value \a #Aligned or \a #Unaligned. Its effect is to select + * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets + * starting at an address which is a multiple of the packet size. + */ + + template + EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const + { + EIGEN_STATIC_ASSERT(internal::evaluator::Flags & LinearAccessBit, + THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS) + typedef typename internal::packet_traits::type DefaultPacketType; + eigen_internal_assert(index >= 0 && index < size()); + return internal::evaluator(derived()).template packet(index); + } + + protected: + // explanation: DenseBase is doing "using ..." on the methods from DenseCoeffsBase. + // But some methods are only available in the DirectAccess case. + // So we add dummy methods here with these names, so that "using... " doesn't fail. + // It's not private so that the child class DenseBase can access them, and it's not public + // either since it's an implementation detail, so has to be protected. + void coeffRef(); + void coeffRefByOuterInner(); + void writePacket(); + void writePacketByOuterInner(); + void copyCoeff(); + void copyCoeffByOuterInner(); + void copyPacket(); + void copyPacketByOuterInner(); + void stride(); + void innerStride(); + void outerStride(); + void rowStride(); + void colStride(); +}; + +/** \brief Base class providing read/write coefficient access to matrices and arrays. + * \ingroup Core_Module + * \tparam Derived Type of the derived class + * \tparam #WriteAccessors Constant indicating read/write access + * + * This class defines the non-const \c operator() function and friends, which can be used to write specific + * entries of a matrix or array. This class inherits DenseCoeffsBase which + * defines the const variant for reading specific entries. + * + * \sa DenseCoeffsBase, \ref TopicClassHierarchy + */ +template +class DenseCoeffsBase : public DenseCoeffsBase +{ + public: + + typedef DenseCoeffsBase Base; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + + using Base::coeff; + using Base::rows; + using Base::cols; + using Base::size; + using Base::derived; + using Base::rowIndexByOuterInner; + using Base::colIndexByOuterInner; + using Base::operator[]; + using Base::operator(); + using Base::x; + using Base::y; + using Base::z; + using Base::w; + + /** Short version: don't use this function, use + * \link operator()(Index,Index) \endlink instead. + * + * Long version: this function is similar to + * \link operator()(Index,Index) \endlink, but without the assertion. + * Use this for limiting the performance cost of debugging code when doing + * repeated coefficient access. Only use this when it is guaranteed that the + * parameters \a row and \a col are in range. + * + * If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this + * function equivalent to \link operator()(Index,Index) \endlink. + * + * \sa operator()(Index,Index), coeff(Index, Index) const, coeffRef(Index) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) + { + eigen_internal_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + return internal::evaluator(derived()).coeffRef(row,col); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + coeffRefByOuterInner(Index outer, Index inner) + { + return coeffRef(rowIndexByOuterInner(outer, inner), + colIndexByOuterInner(outer, inner)); + } + + /** \returns a reference to the coefficient at given the given row and column. + * + * \sa operator[](Index) + */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + operator()(Index row, Index col) + { + eigen_assert(row >= 0 && row < rows() + && col >= 0 && col < cols()); + return coeffRef(row, col); + } + + + /** Short version: don't use this function, use + * \link operator[](Index) \endlink instead. + * + * Long version: this function is similar to + * \link operator[](Index) \endlink, but without the assertion. + * Use this for limiting the performance cost of debugging code when doing + * repeated coefficient access. Only use this when it is guaranteed that the + * parameters \a row and \a col are in range. + * + * If EIGEN_INTERNAL_DEBUGGING is defined, an assertion will be made, making this + * function equivalent to \link operator[](Index) \endlink. + * + * \sa operator[](Index), coeff(Index) const, coeffRef(Index,Index) + */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + coeffRef(Index index) + { + EIGEN_STATIC_ASSERT(internal::evaluator::Flags & LinearAccessBit, + THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS) + eigen_internal_assert(index >= 0 && index < size()); + return internal::evaluator(derived()).coeffRef(index); + } + + /** \returns a reference to the coefficient at given index. + * + * This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit. + * + * \sa operator[](Index) const, operator()(Index,Index), x(), y(), z(), w() + */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + operator[](Index index) + { + EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime, + THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD) + eigen_assert(index >= 0 && index < size()); + return coeffRef(index); + } + + /** \returns a reference to the coefficient at given index. + * + * This is synonymous to operator[](Index). + * + * This method is allowed only for vector expressions, and for matrix expressions having the LinearAccessBit. + * + * \sa operator[](Index) const, operator()(Index,Index), x(), y(), z(), w() + */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + operator()(Index index) + { + eigen_assert(index >= 0 && index < size()); + return coeffRef(index); + } + + /** equivalent to operator[](0). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + x() { return (*this)[0]; } + + /** equivalent to operator[](1). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + y() + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS); + return (*this)[1]; + } + + /** equivalent to operator[](2). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + z() + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS); + return (*this)[2]; + } + + /** equivalent to operator[](3). */ + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + w() + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS); + return (*this)[3]; + } +}; + +/** \brief Base class providing direct read-only coefficient access to matrices and arrays. + * \ingroup Core_Module + * \tparam Derived Type of the derived class + * \tparam #DirectAccessors Constant indicating direct access + * + * This class defines functions to work with strides which can be used to access entries directly. This class + * inherits DenseCoeffsBase which defines functions to access entries read-only using + * \c operator() . + * + * \sa \blank \ref TopicClassHierarchy + */ +template +class DenseCoeffsBase : public DenseCoeffsBase +{ + public: + + typedef DenseCoeffsBase Base; + typedef typename internal::traits::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + + using Base::rows; + using Base::cols; + using Base::size; + using Base::derived; + + /** \returns the pointer increment between two consecutive elements within a slice in the inner direction. + * + * \sa outerStride(), rowStride(), colStride() + */ + EIGEN_DEVICE_FUNC + inline Index innerStride() const + { + return derived().innerStride(); + } + + /** \returns the pointer increment between two consecutive inner slices (for example, between two consecutive columns + * in a column-major matrix). + * + * \sa innerStride(), rowStride(), colStride() + */ + EIGEN_DEVICE_FUNC + inline Index outerStride() const + { + return derived().outerStride(); + } + + // FIXME shall we remove it ? + inline Index stride() const + { + return Derived::IsVectorAtCompileTime ? innerStride() : outerStride(); + } + + /** \returns the pointer increment between two consecutive rows. + * + * \sa innerStride(), outerStride(), colStride() + */ + EIGEN_DEVICE_FUNC + inline Index rowStride() const + { + return Derived::IsRowMajor ? outerStride() : innerStride(); + } + + /** \returns the pointer increment between two consecutive columns. + * + * \sa innerStride(), outerStride(), rowStride() + */ + EIGEN_DEVICE_FUNC + inline Index colStride() const + { + return Derived::IsRowMajor ? innerStride() : outerStride(); + } +}; + +/** \brief Base class providing direct read/write coefficient access to matrices and arrays. + * \ingroup Core_Module + * \tparam Derived Type of the derived class + * \tparam #DirectWriteAccessors Constant indicating direct access + * + * This class defines functions to work with strides which can be used to access entries directly. This class + * inherits DenseCoeffsBase which defines functions to access entries read/write using + * \c operator(). + * + * \sa \blank \ref TopicClassHierarchy + */ +template +class DenseCoeffsBase + : public DenseCoeffsBase +{ + public: + + typedef DenseCoeffsBase Base; + typedef typename internal::traits::Scalar Scalar; + typedef typename NumTraits::Real RealScalar; + + using Base::rows; + using Base::cols; + using Base::size; + using Base::derived; + + /** \returns the pointer increment between two consecutive elements within a slice in the inner direction. + * + * \sa outerStride(), rowStride(), colStride() + */ + EIGEN_DEVICE_FUNC + inline Index innerStride() const + { + return derived().innerStride(); + } + + /** \returns the pointer increment between two consecutive inner slices (for example, between two consecutive columns + * in a column-major matrix). + * + * \sa innerStride(), rowStride(), colStride() + */ + EIGEN_DEVICE_FUNC + inline Index outerStride() const + { + return derived().outerStride(); + } + + // FIXME shall we remove it ? + inline Index stride() const + { + return Derived::IsVectorAtCompileTime ? innerStride() : outerStride(); + } + + /** \returns the pointer increment between two consecutive rows. + * + * \sa innerStride(), outerStride(), colStride() + */ + EIGEN_DEVICE_FUNC + inline Index rowStride() const + { + return Derived::IsRowMajor ? outerStride() : innerStride(); + } + + /** \returns the pointer increment between two consecutive columns. + * + * \sa innerStride(), outerStride(), rowStride() + */ + EIGEN_DEVICE_FUNC + inline Index colStride() const + { + return Derived::IsRowMajor ? innerStride() : outerStride(); + } +}; + +namespace internal { + +template +struct first_aligned_impl +{ + static inline Index run(const Derived&) + { return 0; } +}; + +template +struct first_aligned_impl +{ + static inline Index run(const Derived& m) + { + return internal::first_aligned(m.data(), m.size()); + } +}; + +/** \internal \returns the index of the first element of the array stored by \a m that is properly aligned with respect to \a Alignment for vectorization. + * + * \tparam Alignment requested alignment in Bytes. + * + * There is also the variant first_aligned(const Scalar*, Integer) defined in Memory.h. See it for more + * documentation. + */ +template +static inline Index first_aligned(const DenseBase& m) +{ + enum { ReturnZero = (int(evaluator::Alignment) >= Alignment) || !(Derived::Flags & DirectAccessBit) }; + return first_aligned_impl::run(m.derived()); +} + +template +static inline Index first_default_aligned(const DenseBase& m) +{ + typedef typename Derived::Scalar Scalar; + typedef typename packet_traits::type DefaultPacketType; + return internal::first_aligned::alignment),Derived>(m); +} + +template::ret> +struct inner_stride_at_compile_time +{ + enum { ret = traits::InnerStrideAtCompileTime }; +}; + +template +struct inner_stride_at_compile_time +{ + enum { ret = 0 }; +}; + +template::ret> +struct outer_stride_at_compile_time +{ + enum { ret = traits::OuterStrideAtCompileTime }; +}; + +template +struct outer_stride_at_compile_time +{ + enum { ret = 0 }; +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_DENSECOEFFSBASE_H diff --git a/simulation/externals/eigen/Eigen/src/Core/DenseStorage.h b/simulation/externals/eigen/Eigen/src/Core/DenseStorage.h new file mode 100644 index 0000000..7958fee --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/DenseStorage.h @@ -0,0 +1,570 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2009 Benoit Jacob +// Copyright (C) 2010-2013 Hauke Heibel +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MATRIXSTORAGE_H +#define EIGEN_MATRIXSTORAGE_H + +#ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(X) X; EIGEN_DENSE_STORAGE_CTOR_PLUGIN; +#else + #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(X) +#endif + +namespace Eigen { + +namespace internal { + +struct constructor_without_unaligned_array_assert {}; + +template +EIGEN_DEVICE_FUNC +void check_static_allocation_size() +{ + // if EIGEN_STACK_ALLOCATION_LIMIT is defined to 0, then no limit + #if EIGEN_STACK_ALLOCATION_LIMIT + EIGEN_STATIC_ASSERT(Size * sizeof(T) <= EIGEN_STACK_ALLOCATION_LIMIT, OBJECT_ALLOCATED_ON_STACK_IS_TOO_BIG); + #endif +} + +/** \internal + * Static array. If the MatrixOrArrayOptions require auto-alignment, the array will be automatically aligned: + * to 16 bytes boundary if the total size is a multiple of 16 bytes. + */ +template ::value > +struct plain_array +{ + T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + +#if defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT) + #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) +#elif EIGEN_GNUC_AT_LEAST(4,7) + // GCC 4.7 is too aggressive in its optimizations and remove the alignement test based on the fact the array is declared to be aligned. + // See this bug report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53900 + // Hiding the origin of the array pointer behind a function argument seems to do the trick even if the function is inlined: + template + EIGEN_ALWAYS_INLINE PtrType eigen_unaligned_array_assert_workaround_gcc47(PtrType array) { return array; } + #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \ + eigen_assert((internal::UIntPtr(eigen_unaligned_array_assert_workaround_gcc47(array)) & (sizemask)) == 0 \ + && "this assertion is explained here: " \ + "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \ + " **** READ THIS WEB PAGE !!! ****"); +#else + #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \ + eigen_assert((internal::UIntPtr(array) & (sizemask)) == 0 \ + && "this assertion is explained here: " \ + "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \ + " **** READ THIS WEB PAGE !!! ****"); +#endif + +template +struct plain_array +{ + EIGEN_ALIGN_TO_BOUNDARY(8) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(7); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + +template +struct plain_array +{ + EIGEN_ALIGN_TO_BOUNDARY(16) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(15); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + +template +struct plain_array +{ + EIGEN_ALIGN_TO_BOUNDARY(32) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(31); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + +template +struct plain_array +{ + EIGEN_ALIGN_TO_BOUNDARY(64) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(63); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + +template +struct plain_array +{ + T array[1]; + EIGEN_DEVICE_FUNC plain_array() {} + EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert) {} +}; + +} // end namespace internal + +/** \internal + * + * \class DenseStorage + * \ingroup Core_Module + * + * \brief Stores the data of a matrix + * + * This class stores the data of fixed-size, dynamic-size or mixed matrices + * in a way as compact as possible. + * + * \sa Matrix + */ +template class DenseStorage; + +// purely fixed-size matrix +template class DenseStorage +{ + internal::plain_array m_data; + public: + EIGEN_DEVICE_FUNC DenseStorage() { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = Size) + } + EIGEN_DEVICE_FUNC + explicit DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(internal::constructor_without_unaligned_array_assert()) {} + EIGEN_DEVICE_FUNC + DenseStorage(const DenseStorage& other) : m_data(other.m_data) { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = Size) + } + EIGEN_DEVICE_FUNC + DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) m_data = other.m_data; + return *this; + } + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows==_Rows && cols==_Cols); + EIGEN_UNUSED_VARIABLE(size); + EIGEN_UNUSED_VARIABLE(rows); + EIGEN_UNUSED_VARIABLE(cols); + } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { std::swap(m_data,other.m_data); } + EIGEN_DEVICE_FUNC static Index rows(void) {return _Rows;} + EIGEN_DEVICE_FUNC static Index cols(void) {return _Cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC void resize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } +}; + +// null matrix +template class DenseStorage +{ + public: + EIGEN_DEVICE_FUNC DenseStorage() {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) {} + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage&) {} + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage&) { return *this; } + EIGEN_DEVICE_FUNC DenseStorage(Index,Index,Index) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& ) {} + EIGEN_DEVICE_FUNC static Index rows(void) {return _Rows;} + EIGEN_DEVICE_FUNC static Index cols(void) {return _Cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC void resize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC const T *data() const { return 0; } + EIGEN_DEVICE_FUNC T *data() { return 0; } +}; + +// more specializations for null matrices; these are necessary to resolve ambiguities +template class DenseStorage +: public DenseStorage { }; + +template class DenseStorage +: public DenseStorage { }; + +template class DenseStorage +: public DenseStorage { }; + +// dynamic-size matrix with fixed-size storage +template class DenseStorage +{ + internal::plain_array m_data; + Index m_rows; + Index m_cols; + public: + EIGEN_DEVICE_FUNC DenseStorage() : m_rows(0), m_cols(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {} + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows), m_cols(other.m_cols) {} + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + m_data = other.m_data; + m_rows = other.m_rows; + m_cols = other.m_cols; + } + return *this; + } + EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index cols) : m_rows(rows), m_cols(cols) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) + { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); } + EIGEN_DEVICE_FUNC Index rows() const {return m_rows;} + EIGEN_DEVICE_FUNC Index cols() const {return m_cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index, Index rows, Index cols) { m_rows = rows; m_cols = cols; } + EIGEN_DEVICE_FUNC void resize(Index, Index rows, Index cols) { m_rows = rows; m_cols = cols; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } +}; + +// dynamic-size matrix with fixed-size storage and fixed width +template class DenseStorage +{ + internal::plain_array m_data; + Index m_rows; + public: + EIGEN_DEVICE_FUNC DenseStorage() : m_rows(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0) {} + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows) {} + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + m_data = other.m_data; + m_rows = other.m_rows; + } + return *this; + } + EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index) : m_rows(rows) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); } + EIGEN_DEVICE_FUNC Index rows(void) const {return m_rows;} + EIGEN_DEVICE_FUNC Index cols(void) const {return _Cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index, Index rows, Index) { m_rows = rows; } + EIGEN_DEVICE_FUNC void resize(Index, Index rows, Index) { m_rows = rows; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } +}; + +// dynamic-size matrix with fixed-size storage and fixed height +template class DenseStorage +{ + internal::plain_array m_data; + Index m_cols; + public: + EIGEN_DEVICE_FUNC DenseStorage() : m_cols(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(internal::constructor_without_unaligned_array_assert()), m_cols(0) {} + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) : m_data(other.m_data), m_cols(other.m_cols) {} + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + m_data = other.m_data; + m_cols = other.m_cols; + } + return *this; + } + EIGEN_DEVICE_FUNC DenseStorage(Index, Index, Index cols) : m_cols(cols) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); } + EIGEN_DEVICE_FUNC Index rows(void) const {return _Rows;} + EIGEN_DEVICE_FUNC Index cols(void) const {return m_cols;} + void conservativeResize(Index, Index, Index cols) { m_cols = cols; } + void resize(Index, Index, Index cols) { m_cols = cols; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } +}; + +// purely dynamic matrix. +template class DenseStorage +{ + T *m_data; + Index m_rows; + Index m_cols; + public: + EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_rows(0), m_cols(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) + : m_data(0), m_rows(0), m_cols(0) {} + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) + : m_data(internal::conditional_aligned_new_auto(size)), m_rows(rows), m_cols(cols) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows>=0 && cols >=0); + } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::conditional_aligned_new_auto(other.m_rows*other.m_cols)) + , m_rows(other.m_rows) + , m_cols(other.m_cols) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_rows*m_cols) + internal::smart_copy(other.m_data, other.m_data+other.m_rows*other.m_cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + DenseStorage tmp(other); + this->swap(tmp); + } + return *this; + } +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT + : m_data(std::move(other.m_data)) + , m_rows(std::move(other.m_rows)) + , m_cols(std::move(other.m_cols)) + { + other.m_data = nullptr; + other.m_rows = 0; + other.m_cols = 0; + } + EIGEN_DEVICE_FUNC + DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT + { + using std::swap; + swap(m_data, other.m_data); + swap(m_rows, other.m_rows); + swap(m_cols, other.m_cols); + return *this; + } +#endif + EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, m_rows*m_cols); } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) + { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); } + EIGEN_DEVICE_FUNC Index rows(void) const {return m_rows;} + EIGEN_DEVICE_FUNC Index cols(void) const {return m_cols;} + void conservativeResize(Index size, Index rows, Index cols) + { + m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, m_rows*m_cols); + m_rows = rows; + m_cols = cols; + } + EIGEN_DEVICE_FUNC void resize(Index size, Index rows, Index cols) + { + if(size != m_rows*m_cols) + { + internal::conditional_aligned_delete_auto(m_data, m_rows*m_cols); + if (size) + m_data = internal::conditional_aligned_new_auto(size); + else + m_data = 0; + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + } + m_rows = rows; + m_cols = cols; + } + EIGEN_DEVICE_FUNC const T *data() const { return m_data; } + EIGEN_DEVICE_FUNC T *data() { return m_data; } +}; + +// matrix with dynamic width and fixed height (so that matrix has dynamic size). +template class DenseStorage +{ + T *m_data; + Index m_cols; + public: + EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_cols(0) {} + explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {} + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) : m_data(internal::conditional_aligned_new_auto(size)), m_cols(cols) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows==_Rows && cols >=0); + EIGEN_UNUSED_VARIABLE(rows); + } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::conditional_aligned_new_auto(_Rows*other.m_cols)) + , m_cols(other.m_cols) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_cols*_Rows) + internal::smart_copy(other.m_data, other.m_data+_Rows*m_cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + DenseStorage tmp(other); + this->swap(tmp); + } + return *this; + } +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT + : m_data(std::move(other.m_data)) + , m_cols(std::move(other.m_cols)) + { + other.m_data = nullptr; + other.m_cols = 0; + } + EIGEN_DEVICE_FUNC + DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT + { + using std::swap; + swap(m_data, other.m_data); + swap(m_cols, other.m_cols); + return *this; + } +#endif + EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, _Rows*m_cols); } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); } + EIGEN_DEVICE_FUNC static Index rows(void) {return _Rows;} + EIGEN_DEVICE_FUNC Index cols(void) const {return m_cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index size, Index, Index cols) + { + m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, _Rows*m_cols); + m_cols = cols; + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index size, Index, Index cols) + { + if(size != _Rows*m_cols) + { + internal::conditional_aligned_delete_auto(m_data, _Rows*m_cols); + if (size) + m_data = internal::conditional_aligned_new_auto(size); + else + m_data = 0; + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + } + m_cols = cols; + } + EIGEN_DEVICE_FUNC const T *data() const { return m_data; } + EIGEN_DEVICE_FUNC T *data() { return m_data; } +}; + +// matrix with dynamic height and fixed width (so that matrix has dynamic size). +template class DenseStorage +{ + T *m_data; + Index m_rows; + public: + EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_rows(0) {} + explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {} + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) : m_data(internal::conditional_aligned_new_auto(size)), m_rows(rows) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows>=0 && cols == _Cols); + EIGEN_UNUSED_VARIABLE(cols); + } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::conditional_aligned_new_auto(other.m_rows*_Cols)) + , m_rows(other.m_rows) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_rows*_Cols) + internal::smart_copy(other.m_data, other.m_data+other.m_rows*_Cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + DenseStorage tmp(other); + this->swap(tmp); + } + return *this; + } +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT + : m_data(std::move(other.m_data)) + , m_rows(std::move(other.m_rows)) + { + other.m_data = nullptr; + other.m_rows = 0; + } + EIGEN_DEVICE_FUNC + DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT + { + using std::swap; + swap(m_data, other.m_data); + swap(m_rows, other.m_rows); + return *this; + } +#endif + EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, _Cols*m_rows); } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); } + EIGEN_DEVICE_FUNC Index rows(void) const {return m_rows;} + EIGEN_DEVICE_FUNC static Index cols(void) {return _Cols;} + void conservativeResize(Index size, Index rows, Index) + { + m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, m_rows*_Cols); + m_rows = rows; + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index size, Index rows, Index) + { + if(size != m_rows*_Cols) + { + internal::conditional_aligned_delete_auto(m_data, _Cols*m_rows); + if (size) + m_data = internal::conditional_aligned_new_auto(size); + else + m_data = 0; + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + } + m_rows = rows; + } + EIGEN_DEVICE_FUNC const T *data() const { return m_data; } + EIGEN_DEVICE_FUNC T *data() { return m_data; } +}; + +} // end namespace Eigen + +#endif // EIGEN_MATRIX_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Diagonal.h b/simulation/externals/eigen/Eigen/src/Core/Diagonal.h new file mode 100644 index 0000000..49e7112 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Diagonal.h @@ -0,0 +1,257 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007-2009 Benoit Jacob +// Copyright (C) 2009-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_DIAGONAL_H +#define EIGEN_DIAGONAL_H + +namespace Eigen { + +/** \class Diagonal + * \ingroup Core_Module + * + * \brief Expression of a diagonal/subdiagonal/superdiagonal in a matrix + * + * \param MatrixType the type of the object in which we are taking a sub/main/super diagonal + * \param DiagIndex the index of the sub/super diagonal. The default is 0 and it means the main diagonal. + * A positive value means a superdiagonal, a negative value means a subdiagonal. + * You can also use DynamicIndex so the index can be set at runtime. + * + * The matrix is not required to be square. + * + * This class represents an expression of the main diagonal, or any sub/super diagonal + * of a square matrix. It is the return type of MatrixBase::diagonal() and MatrixBase::diagonal(Index) and most of the + * time this is the only way it is used. + * + * \sa MatrixBase::diagonal(), MatrixBase::diagonal(Index) + */ + +namespace internal { +template +struct traits > + : traits +{ + typedef typename ref_selector::type MatrixTypeNested; + typedef typename remove_reference::type _MatrixTypeNested; + typedef typename MatrixType::StorageKind StorageKind; + enum { + RowsAtCompileTime = (int(DiagIndex) == DynamicIndex || int(MatrixType::SizeAtCompileTime) == Dynamic) ? Dynamic + : (EIGEN_PLAIN_ENUM_MIN(MatrixType::RowsAtCompileTime - EIGEN_PLAIN_ENUM_MAX(-DiagIndex, 0), + MatrixType::ColsAtCompileTime - EIGEN_PLAIN_ENUM_MAX( DiagIndex, 0))), + ColsAtCompileTime = 1, + MaxRowsAtCompileTime = int(MatrixType::MaxSizeAtCompileTime) == Dynamic ? Dynamic + : DiagIndex == DynamicIndex ? EIGEN_SIZE_MIN_PREFER_FIXED(MatrixType::MaxRowsAtCompileTime, + MatrixType::MaxColsAtCompileTime) + : (EIGEN_PLAIN_ENUM_MIN(MatrixType::MaxRowsAtCompileTime - EIGEN_PLAIN_ENUM_MAX(-DiagIndex, 0), + MatrixType::MaxColsAtCompileTime - EIGEN_PLAIN_ENUM_MAX( DiagIndex, 0))), + MaxColsAtCompileTime = 1, + MaskLvalueBit = is_lvalue::value ? LvalueBit : 0, + Flags = (unsigned int)_MatrixTypeNested::Flags & (RowMajorBit | MaskLvalueBit | DirectAccessBit) & ~RowMajorBit, // FIXME DirectAccessBit should not be handled by expressions + MatrixTypeOuterStride = outer_stride_at_compile_time::ret, + InnerStrideAtCompileTime = MatrixTypeOuterStride == Dynamic ? Dynamic : MatrixTypeOuterStride+1, + OuterStrideAtCompileTime = 0 + }; +}; +} + +template class Diagonal + : public internal::dense_xpr_base< Diagonal >::type +{ + public: + + enum { DiagIndex = _DiagIndex }; + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal) + + EIGEN_DEVICE_FUNC + explicit inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex) : m_matrix(matrix), m_index(a_index) {} + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Diagonal) + + EIGEN_DEVICE_FUNC + inline Index rows() const + { + return m_index.value()<0 ? numext::mini(m_matrix.cols(),m_matrix.rows()+m_index.value()) + : numext::mini(m_matrix.rows(),m_matrix.cols()-m_index.value()); + } + + EIGEN_DEVICE_FUNC + inline Index cols() const { return 1; } + + EIGEN_DEVICE_FUNC + inline Index innerStride() const + { + return m_matrix.outerStride() + 1; + } + + EIGEN_DEVICE_FUNC + inline Index outerStride() const + { + return 0; + } + + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue* data() { return &(m_matrix.coeffRef(rowOffset(), colOffset())); } + EIGEN_DEVICE_FUNC + inline const Scalar* data() const { return &(m_matrix.coeffRef(rowOffset(), colOffset())); } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index row, Index) + { + EIGEN_STATIC_ASSERT_LVALUE(MatrixType) + return m_matrix.coeffRef(row+rowOffset(), row+colOffset()); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index row, Index) const + { + return m_matrix.coeffRef(row+rowOffset(), row+colOffset()); + } + + EIGEN_DEVICE_FUNC + inline CoeffReturnType coeff(Index row, Index) const + { + return m_matrix.coeff(row+rowOffset(), row+colOffset()); + } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index idx) + { + EIGEN_STATIC_ASSERT_LVALUE(MatrixType) + return m_matrix.coeffRef(idx+rowOffset(), idx+colOffset()); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index idx) const + { + return m_matrix.coeffRef(idx+rowOffset(), idx+colOffset()); + } + + EIGEN_DEVICE_FUNC + inline CoeffReturnType coeff(Index idx) const + { + return m_matrix.coeff(idx+rowOffset(), idx+colOffset()); + } + + EIGEN_DEVICE_FUNC + inline const typename internal::remove_all::type& + nestedExpression() const + { + return m_matrix; + } + + EIGEN_DEVICE_FUNC + inline Index index() const + { + return m_index.value(); + } + + protected: + typename internal::ref_selector::non_const_type m_matrix; + const internal::variable_if_dynamicindex m_index; + + private: + // some compilers may fail to optimize std::max etc in case of compile-time constants... + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index absDiagIndex() const { return m_index.value()>0 ? m_index.value() : -m_index.value(); } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index rowOffset() const { return m_index.value()>0 ? 0 : -m_index.value(); } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index colOffset() const { return m_index.value()>0 ? m_index.value() : 0; } + // trigger a compile-time error if someone try to call packet + template typename MatrixType::PacketReturnType packet(Index) const; + template typename MatrixType::PacketReturnType packet(Index,Index) const; +}; + +/** \returns an expression of the main diagonal of the matrix \c *this + * + * \c *this is not required to be square. + * + * Example: \include MatrixBase_diagonal.cpp + * Output: \verbinclude MatrixBase_diagonal.out + * + * \sa class Diagonal */ +template +inline typename MatrixBase::DiagonalReturnType +MatrixBase::diagonal() +{ + return DiagonalReturnType(derived()); +} + +/** This is the const version of diagonal(). */ +template +inline typename MatrixBase::ConstDiagonalReturnType +MatrixBase::diagonal() const +{ + return ConstDiagonalReturnType(derived()); +} + +/** \returns an expression of the \a DiagIndex-th sub or super diagonal of the matrix \c *this + * + * \c *this is not required to be square. + * + * The template parameter \a DiagIndex represent a super diagonal if \a DiagIndex > 0 + * and a sub diagonal otherwise. \a DiagIndex == 0 is equivalent to the main diagonal. + * + * Example: \include MatrixBase_diagonal_int.cpp + * Output: \verbinclude MatrixBase_diagonal_int.out + * + * \sa MatrixBase::diagonal(), class Diagonal */ +template +inline typename MatrixBase::DiagonalDynamicIndexReturnType +MatrixBase::diagonal(Index index) +{ + return DiagonalDynamicIndexReturnType(derived(), index); +} + +/** This is the const version of diagonal(Index). */ +template +inline typename MatrixBase::ConstDiagonalDynamicIndexReturnType +MatrixBase::diagonal(Index index) const +{ + return ConstDiagonalDynamicIndexReturnType(derived(), index); +} + +/** \returns an expression of the \a DiagIndex-th sub or super diagonal of the matrix \c *this + * + * \c *this is not required to be square. + * + * The template parameter \a DiagIndex represent a super diagonal if \a DiagIndex > 0 + * and a sub diagonal otherwise. \a DiagIndex == 0 is equivalent to the main diagonal. + * + * Example: \include MatrixBase_diagonal_template_int.cpp + * Output: \verbinclude MatrixBase_diagonal_template_int.out + * + * \sa MatrixBase::diagonal(), class Diagonal */ +template +template +inline typename MatrixBase::template DiagonalIndexReturnType::Type +MatrixBase::diagonal() +{ + return typename DiagonalIndexReturnType::Type(derived()); +} + +/** This is the const version of diagonal(). */ +template +template +inline typename MatrixBase::template ConstDiagonalIndexReturnType::Type +MatrixBase::diagonal() const +{ + return typename ConstDiagonalIndexReturnType::Type(derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_DIAGONAL_H diff --git a/simulation/externals/eigen/Eigen/src/Core/DiagonalMatrix.h b/simulation/externals/eigen/Eigen/src/Core/DiagonalMatrix.h new file mode 100644 index 0000000..ecfdce8 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/DiagonalMatrix.h @@ -0,0 +1,343 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// Copyright (C) 2007-2009 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_DIAGONALMATRIX_H +#define EIGEN_DIAGONALMATRIX_H + +namespace Eigen { + +#ifndef EIGEN_PARSED_BY_DOXYGEN +template +class DiagonalBase : public EigenBase +{ + public: + typedef typename internal::traits::DiagonalVectorType DiagonalVectorType; + typedef typename DiagonalVectorType::Scalar Scalar; + typedef typename DiagonalVectorType::RealScalar RealScalar; + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::StorageIndex StorageIndex; + + enum { + RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, + ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, + MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, + MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, + IsVectorAtCompileTime = 0, + Flags = NoPreferredStorageOrderBit + }; + + typedef Matrix DenseMatrixType; + typedef DenseMatrixType DenseType; + typedef DiagonalMatrix PlainObject; + + EIGEN_DEVICE_FUNC + inline const Derived& derived() const { return *static_cast(this); } + EIGEN_DEVICE_FUNC + inline Derived& derived() { return *static_cast(this); } + + EIGEN_DEVICE_FUNC + DenseMatrixType toDenseMatrix() const { return derived(); } + + EIGEN_DEVICE_FUNC + inline const DiagonalVectorType& diagonal() const { return derived().diagonal(); } + EIGEN_DEVICE_FUNC + inline DiagonalVectorType& diagonal() { return derived().diagonal(); } + + EIGEN_DEVICE_FUNC + inline Index rows() const { return diagonal().size(); } + EIGEN_DEVICE_FUNC + inline Index cols() const { return diagonal().size(); } + + template + EIGEN_DEVICE_FUNC + const Product + operator*(const MatrixBase &matrix) const + { + return Product(derived(),matrix.derived()); + } + + typedef DiagonalWrapper, const DiagonalVectorType> > InverseReturnType; + EIGEN_DEVICE_FUNC + inline const InverseReturnType + inverse() const + { + return InverseReturnType(diagonal().cwiseInverse()); + } + + EIGEN_DEVICE_FUNC + inline const DiagonalWrapper + operator*(const Scalar& scalar) const + { + return DiagonalWrapper(diagonal() * scalar); + } + EIGEN_DEVICE_FUNC + friend inline const DiagonalWrapper + operator*(const Scalar& scalar, const DiagonalBase& other) + { + return DiagonalWrapper(scalar * other.diagonal()); + } +}; + +#endif + +/** \class DiagonalMatrix + * \ingroup Core_Module + * + * \brief Represents a diagonal matrix with its storage + * + * \param _Scalar the type of coefficients + * \param SizeAtCompileTime the dimension of the matrix, or Dynamic + * \param MaxSizeAtCompileTime the dimension of the matrix, or Dynamic. This parameter is optional and defaults + * to SizeAtCompileTime. Most of the time, you do not need to specify it. + * + * \sa class DiagonalWrapper + */ + +namespace internal { +template +struct traits > + : traits > +{ + typedef Matrix<_Scalar,SizeAtCompileTime,1,0,MaxSizeAtCompileTime,1> DiagonalVectorType; + typedef DiagonalShape StorageKind; + enum { + Flags = LvalueBit | NoPreferredStorageOrderBit + }; +}; +} +template +class DiagonalMatrix + : public DiagonalBase > +{ + public: + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename internal::traits::DiagonalVectorType DiagonalVectorType; + typedef const DiagonalMatrix& Nested; + typedef _Scalar Scalar; + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::StorageIndex StorageIndex; + #endif + + protected: + + DiagonalVectorType m_diagonal; + + public: + + /** const version of diagonal(). */ + EIGEN_DEVICE_FUNC + inline const DiagonalVectorType& diagonal() const { return m_diagonal; } + /** \returns a reference to the stored vector of diagonal coefficients. */ + EIGEN_DEVICE_FUNC + inline DiagonalVectorType& diagonal() { return m_diagonal; } + + /** Default constructor without initialization */ + EIGEN_DEVICE_FUNC + inline DiagonalMatrix() {} + + /** Constructs a diagonal matrix with given dimension */ + EIGEN_DEVICE_FUNC + explicit inline DiagonalMatrix(Index dim) : m_diagonal(dim) {} + + /** 2D constructor. */ + EIGEN_DEVICE_FUNC + inline DiagonalMatrix(const Scalar& x, const Scalar& y) : m_diagonal(x,y) {} + + /** 3D constructor. */ + EIGEN_DEVICE_FUNC + inline DiagonalMatrix(const Scalar& x, const Scalar& y, const Scalar& z) : m_diagonal(x,y,z) {} + + /** Copy constructor. */ + template + EIGEN_DEVICE_FUNC + inline DiagonalMatrix(const DiagonalBase& other) : m_diagonal(other.diagonal()) {} + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** copy constructor. prevent a default copy constructor from hiding the other templated constructor */ + inline DiagonalMatrix(const DiagonalMatrix& other) : m_diagonal(other.diagonal()) {} + #endif + + /** generic constructor from expression of the diagonal coefficients */ + template + EIGEN_DEVICE_FUNC + explicit inline DiagonalMatrix(const MatrixBase& other) : m_diagonal(other) + {} + + /** Copy operator. */ + template + EIGEN_DEVICE_FUNC + DiagonalMatrix& operator=(const DiagonalBase& other) + { + m_diagonal = other.diagonal(); + return *this; + } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + EIGEN_DEVICE_FUNC + DiagonalMatrix& operator=(const DiagonalMatrix& other) + { + m_diagonal = other.diagonal(); + return *this; + } + #endif + + /** Resizes to given size. */ + EIGEN_DEVICE_FUNC + inline void resize(Index size) { m_diagonal.resize(size); } + /** Sets all coefficients to zero. */ + EIGEN_DEVICE_FUNC + inline void setZero() { m_diagonal.setZero(); } + /** Resizes and sets all coefficients to zero. */ + EIGEN_DEVICE_FUNC + inline void setZero(Index size) { m_diagonal.setZero(size); } + /** Sets this matrix to be the identity matrix of the current size. */ + EIGEN_DEVICE_FUNC + inline void setIdentity() { m_diagonal.setOnes(); } + /** Sets this matrix to be the identity matrix of the given size. */ + EIGEN_DEVICE_FUNC + inline void setIdentity(Index size) { m_diagonal.setOnes(size); } +}; + +/** \class DiagonalWrapper + * \ingroup Core_Module + * + * \brief Expression of a diagonal matrix + * + * \param _DiagonalVectorType the type of the vector of diagonal coefficients + * + * This class is an expression of a diagonal matrix, but not storing its own vector of diagonal coefficients, + * instead wrapping an existing vector expression. It is the return type of MatrixBase::asDiagonal() + * and most of the time this is the only way that it is used. + * + * \sa class DiagonalMatrix, class DiagonalBase, MatrixBase::asDiagonal() + */ + +namespace internal { +template +struct traits > +{ + typedef _DiagonalVectorType DiagonalVectorType; + typedef typename DiagonalVectorType::Scalar Scalar; + typedef typename DiagonalVectorType::StorageIndex StorageIndex; + typedef DiagonalShape StorageKind; + typedef typename traits::XprKind XprKind; + enum { + RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, + ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, + MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, + MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, + Flags = (traits::Flags & LvalueBit) | NoPreferredStorageOrderBit + }; +}; +} + +template +class DiagonalWrapper + : public DiagonalBase >, internal::no_assignment_operator +{ + public: + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef _DiagonalVectorType DiagonalVectorType; + typedef DiagonalWrapper Nested; + #endif + + /** Constructor from expression of diagonal coefficients to wrap. */ + EIGEN_DEVICE_FUNC + explicit inline DiagonalWrapper(DiagonalVectorType& a_diagonal) : m_diagonal(a_diagonal) {} + + /** \returns a const reference to the wrapped expression of diagonal coefficients. */ + EIGEN_DEVICE_FUNC + const DiagonalVectorType& diagonal() const { return m_diagonal; } + + protected: + typename DiagonalVectorType::Nested m_diagonal; +}; + +/** \returns a pseudo-expression of a diagonal matrix with *this as vector of diagonal coefficients + * + * \only_for_vectors + * + * Example: \include MatrixBase_asDiagonal.cpp + * Output: \verbinclude MatrixBase_asDiagonal.out + * + * \sa class DiagonalWrapper, class DiagonalMatrix, diagonal(), isDiagonal() + **/ +template +inline const DiagonalWrapper +MatrixBase::asDiagonal() const +{ + return DiagonalWrapper(derived()); +} + +/** \returns true if *this is approximately equal to a diagonal matrix, + * within the precision given by \a prec. + * + * Example: \include MatrixBase_isDiagonal.cpp + * Output: \verbinclude MatrixBase_isDiagonal.out + * + * \sa asDiagonal() + */ +template +bool MatrixBase::isDiagonal(const RealScalar& prec) const +{ + if(cols() != rows()) return false; + RealScalar maxAbsOnDiagonal = static_cast(-1); + for(Index j = 0; j < cols(); ++j) + { + RealScalar absOnDiagonal = numext::abs(coeff(j,j)); + if(absOnDiagonal > maxAbsOnDiagonal) maxAbsOnDiagonal = absOnDiagonal; + } + for(Index j = 0; j < cols(); ++j) + for(Index i = 0; i < j; ++i) + { + if(!internal::isMuchSmallerThan(coeff(i, j), maxAbsOnDiagonal, prec)) return false; + if(!internal::isMuchSmallerThan(coeff(j, i), maxAbsOnDiagonal, prec)) return false; + } + return true; +} + +namespace internal { + +template<> struct storage_kind_to_shape { typedef DiagonalShape Shape; }; + +struct Diagonal2Dense {}; + +template<> struct AssignmentKind { typedef Diagonal2Dense Kind; }; + +// Diagonal matrix to Dense assignment +template< typename DstXprType, typename SrcXprType, typename Functor> +struct Assignment +{ + static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + dst.setZero(); + dst.diagonal() = src.diagonal(); + } + + static void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op &/*func*/) + { dst.diagonal() += src.diagonal(); } + + static void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op &/*func*/) + { dst.diagonal() -= src.diagonal(); } +}; + +} // namespace internal + +} // end namespace Eigen + +#endif // EIGEN_DIAGONALMATRIX_H diff --git a/simulation/externals/eigen/Eigen/src/Core/DiagonalProduct.h b/simulation/externals/eigen/Eigen/src/Core/DiagonalProduct.h new file mode 100644 index 0000000..d372b93 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/DiagonalProduct.h @@ -0,0 +1,28 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2007-2009 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_DIAGONALPRODUCT_H +#define EIGEN_DIAGONALPRODUCT_H + +namespace Eigen { + +/** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal. + */ +template +template +inline const Product +MatrixBase::operator*(const DiagonalBase &a_diagonal) const +{ + return Product(derived(),a_diagonal.derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_DIAGONALPRODUCT_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Dot.h b/simulation/externals/eigen/Eigen/src/Core/Dot.h new file mode 100644 index 0000000..06ef18b --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Dot.h @@ -0,0 +1,315 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008, 2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_DOT_H +#define EIGEN_DOT_H + +namespace Eigen { + +namespace internal { + +// helper function for dot(). The problem is that if we put that in the body of dot(), then upon calling dot +// with mismatched types, the compiler emits errors about failing to instantiate cwiseProduct BEFORE +// looking at the static assertions. Thus this is a trick to get better compile errors. +template +struct dot_nocheck +{ + typedef scalar_conj_product_op::Scalar,typename traits::Scalar> conj_prod; + typedef typename conj_prod::result_type ResScalar; + EIGEN_DEVICE_FUNC + static inline ResScalar run(const MatrixBase& a, const MatrixBase& b) + { + return a.template binaryExpr(b).sum(); + } +}; + +template +struct dot_nocheck +{ + typedef scalar_conj_product_op::Scalar,typename traits::Scalar> conj_prod; + typedef typename conj_prod::result_type ResScalar; + EIGEN_DEVICE_FUNC + static inline ResScalar run(const MatrixBase& a, const MatrixBase& b) + { + return a.transpose().template binaryExpr(b).sum(); + } +}; + +} // end namespace internal + +/** \fn MatrixBase::dot + * \returns the dot product of *this with other. + * + * \only_for_vectors + * + * \note If the scalar type is complex numbers, then this function returns the hermitian + * (sesquilinear) dot product, conjugate-linear in the first variable and linear in the + * second variable. + * + * \sa squaredNorm(), norm() + */ +template +template +EIGEN_DEVICE_FUNC +typename ScalarBinaryOpTraits::Scalar,typename internal::traits::Scalar>::ReturnType +MatrixBase::dot(const MatrixBase& other) const +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) + EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) +#if !(defined(EIGEN_NO_STATIC_ASSERT) && defined(EIGEN_NO_DEBUG)) + typedef internal::scalar_conj_product_op func; + EIGEN_CHECK_BINARY_COMPATIBILIY(func,Scalar,typename OtherDerived::Scalar); +#endif + + eigen_assert(size() == other.size()); + + return internal::dot_nocheck::run(*this, other); +} + +//---------- implementation of L2 norm and related functions ---------- + +/** \returns, for vectors, the squared \em l2 norm of \c *this, and for matrices the Frobenius norm. + * In both cases, it consists in the sum of the square of all the matrix entries. + * For vectors, this is also equals to the dot product of \c *this with itself. + * + * \sa dot(), norm(), lpNorm() + */ +template +EIGEN_STRONG_INLINE typename NumTraits::Scalar>::Real MatrixBase::squaredNorm() const +{ + return numext::real((*this).cwiseAbs2().sum()); +} + +/** \returns, for vectors, the \em l2 norm of \c *this, and for matrices the Frobenius norm. + * In both cases, it consists in the square root of the sum of the square of all the matrix entries. + * For vectors, this is also equals to the square root of the dot product of \c *this with itself. + * + * \sa lpNorm(), dot(), squaredNorm() + */ +template +inline typename NumTraits::Scalar>::Real MatrixBase::norm() const +{ + return numext::sqrt(squaredNorm()); +} + +/** \returns an expression of the quotient of \c *this by its own norm. + * + * \warning If the input vector is too small (i.e., this->norm()==0), + * then this function returns a copy of the input. + * + * \only_for_vectors + * + * \sa norm(), normalize() + */ +template +inline const typename MatrixBase::PlainObject +MatrixBase::normalized() const +{ + typedef typename internal::nested_eval::type _Nested; + _Nested n(derived()); + RealScalar z = n.squaredNorm(); + // NOTE: after extensive benchmarking, this conditional does not impact performance, at least on recent x86 CPU + if(z>RealScalar(0)) + return n / numext::sqrt(z); + else + return n; +} + +/** Normalizes the vector, i.e. divides it by its own norm. + * + * \only_for_vectors + * + * \warning If the input vector is too small (i.e., this->norm()==0), then \c *this is left unchanged. + * + * \sa norm(), normalized() + */ +template +inline void MatrixBase::normalize() +{ + RealScalar z = squaredNorm(); + // NOTE: after extensive benchmarking, this conditional does not impact performance, at least on recent x86 CPU + if(z>RealScalar(0)) + derived() /= numext::sqrt(z); +} + +/** \returns an expression of the quotient of \c *this by its own norm while avoiding underflow and overflow. + * + * \only_for_vectors + * + * This method is analogue to the normalized() method, but it reduces the risk of + * underflow and overflow when computing the norm. + * + * \warning If the input vector is too small (i.e., this->norm()==0), + * then this function returns a copy of the input. + * + * \sa stableNorm(), stableNormalize(), normalized() + */ +template +inline const typename MatrixBase::PlainObject +MatrixBase::stableNormalized() const +{ + typedef typename internal::nested_eval::type _Nested; + _Nested n(derived()); + RealScalar w = n.cwiseAbs().maxCoeff(); + RealScalar z = (n/w).squaredNorm(); + if(z>RealScalar(0)) + return n / (numext::sqrt(z)*w); + else + return n; +} + +/** Normalizes the vector while avoid underflow and overflow + * + * \only_for_vectors + * + * This method is analogue to the normalize() method, but it reduces the risk of + * underflow and overflow when computing the norm. + * + * \warning If the input vector is too small (i.e., this->norm()==0), then \c *this is left unchanged. + * + * \sa stableNorm(), stableNormalized(), normalize() + */ +template +inline void MatrixBase::stableNormalize() +{ + RealScalar w = cwiseAbs().maxCoeff(); + RealScalar z = (derived()/w).squaredNorm(); + if(z>RealScalar(0)) + derived() /= numext::sqrt(z)*w; +} + +//---------- implementation of other norms ---------- + +namespace internal { + +template +struct lpNorm_selector +{ + typedef typename NumTraits::Scalar>::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const MatrixBase& m) + { + EIGEN_USING_STD_MATH(pow) + return pow(m.cwiseAbs().array().pow(p).sum(), RealScalar(1)/p); + } +}; + +template +struct lpNorm_selector +{ + EIGEN_DEVICE_FUNC + static inline typename NumTraits::Scalar>::Real run(const MatrixBase& m) + { + return m.cwiseAbs().sum(); + } +}; + +template +struct lpNorm_selector +{ + EIGEN_DEVICE_FUNC + static inline typename NumTraits::Scalar>::Real run(const MatrixBase& m) + { + return m.norm(); + } +}; + +template +struct lpNorm_selector +{ + typedef typename NumTraits::Scalar>::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const MatrixBase& m) + { + if(Derived::SizeAtCompileTime==0 || (Derived::SizeAtCompileTime==Dynamic && m.size()==0)) + return RealScalar(0); + return m.cwiseAbs().maxCoeff(); + } +}; + +} // end namespace internal + +/** \returns the \b coefficient-wise \f$ \ell^p \f$ norm of \c *this, that is, returns the p-th root of the sum of the p-th powers of the absolute values + * of the coefficients of \c *this. If \a p is the special value \a Eigen::Infinity, this function returns the \f$ \ell^\infty \f$ + * norm, that is the maximum of the absolute values of the coefficients of \c *this. + * + * In all cases, if \c *this is empty, then the value 0 is returned. + * + * \note For matrices, this function does not compute the operator-norm. That is, if \c *this is a matrix, then its coefficients are interpreted as a 1D vector. Nonetheless, you can easily compute the 1-norm and \f$\infty\f$-norm matrix operator norms using \link TutorialReductionsVisitorsBroadcastingReductionsNorm partial reductions \endlink. + * + * \sa norm() + */ +template +template +#ifndef EIGEN_PARSED_BY_DOXYGEN +inline typename NumTraits::Scalar>::Real +#else +MatrixBase::RealScalar +#endif +MatrixBase::lpNorm() const +{ + return internal::lpNorm_selector::run(*this); +} + +//---------- implementation of isOrthogonal / isUnitary ---------- + +/** \returns true if *this is approximately orthogonal to \a other, + * within the precision given by \a prec. + * + * Example: \include MatrixBase_isOrthogonal.cpp + * Output: \verbinclude MatrixBase_isOrthogonal.out + */ +template +template +bool MatrixBase::isOrthogonal +(const MatrixBase& other, const RealScalar& prec) const +{ + typename internal::nested_eval::type nested(derived()); + typename internal::nested_eval::type otherNested(other.derived()); + return numext::abs2(nested.dot(otherNested)) <= prec * prec * nested.squaredNorm() * otherNested.squaredNorm(); +} + +/** \returns true if *this is approximately an unitary matrix, + * within the precision given by \a prec. In the case where the \a Scalar + * type is real numbers, a unitary matrix is an orthogonal matrix, whence the name. + * + * \note This can be used to check whether a family of vectors forms an orthonormal basis. + * Indeed, \c m.isUnitary() returns true if and only if the columns (equivalently, the rows) of m form an + * orthonormal basis. + * + * Example: \include MatrixBase_isUnitary.cpp + * Output: \verbinclude MatrixBase_isUnitary.out + */ +template +bool MatrixBase::isUnitary(const RealScalar& prec) const +{ + typename internal::nested_eval::type self(derived()); + for(Index i = 0; i < cols(); ++i) + { + if(!internal::isApprox(self.col(i).squaredNorm(), static_cast(1), prec)) + return false; + for(Index j = 0; j < i; ++j) + if(!internal::isMuchSmallerThan(self.col(i).dot(self.col(j)), static_cast(1), prec)) + return false; + } + return true; +} + +} // end namespace Eigen + +#endif // EIGEN_DOT_H diff --git a/simulation/externals/eigen/Eigen/src/Core/EigenBase.h b/simulation/externals/eigen/Eigen/src/Core/EigenBase.h new file mode 100644 index 0000000..b195506 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/EigenBase.h @@ -0,0 +1,159 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Benoit Jacob +// Copyright (C) 2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_EIGENBASE_H +#define EIGEN_EIGENBASE_H + +namespace Eigen { + +/** \class EigenBase + * \ingroup Core_Module + * + * Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor MatrixBase(T). + * + * In other words, an EigenBase object is an object that can be copied into a MatrixBase. + * + * Besides MatrixBase-derived classes, this also includes special matrix classes such as diagonal matrices, etc. + * + * Notice that this class is trivial, it is only used to disambiguate overloaded functions. + * + * \sa \blank \ref TopicClassHierarchy + */ +template struct EigenBase +{ +// typedef typename internal::plain_matrix_type::type PlainObject; + + /** \brief The interface type of indices + * \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE. + * \deprecated Since Eigen 3.3, its usage is deprecated. Use Eigen::Index instead. + * \sa StorageIndex, \ref TopicPreprocessorDirectives. + */ + typedef Eigen::Index Index; + + // FIXME is it needed? + typedef typename internal::traits::StorageKind StorageKind; + + /** \returns a reference to the derived object */ + EIGEN_DEVICE_FUNC + Derived& derived() { return *static_cast(this); } + /** \returns a const reference to the derived object */ + EIGEN_DEVICE_FUNC + const Derived& derived() const { return *static_cast(this); } + + EIGEN_DEVICE_FUNC + inline Derived& const_cast_derived() const + { return *static_cast(const_cast(this)); } + EIGEN_DEVICE_FUNC + inline const Derived& const_derived() const + { return *static_cast(this); } + + /** \returns the number of rows. \sa cols(), RowsAtCompileTime */ + EIGEN_DEVICE_FUNC + inline Index rows() const { return derived().rows(); } + /** \returns the number of columns. \sa rows(), ColsAtCompileTime*/ + EIGEN_DEVICE_FUNC + inline Index cols() const { return derived().cols(); } + /** \returns the number of coefficients, which is rows()*cols(). + * \sa rows(), cols(), SizeAtCompileTime. */ + EIGEN_DEVICE_FUNC + inline Index size() const { return rows() * cols(); } + + /** \internal Don't use it, but do the equivalent: \code dst = *this; \endcode */ + template + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& dst) const + { derived().evalTo(dst); } + + /** \internal Don't use it, but do the equivalent: \code dst += *this; \endcode */ + template + EIGEN_DEVICE_FUNC + inline void addTo(Dest& dst) const + { + // This is the default implementation, + // derived class can reimplement it in a more optimized way. + typename Dest::PlainObject res(rows(),cols()); + evalTo(res); + dst += res; + } + + /** \internal Don't use it, but do the equivalent: \code dst -= *this; \endcode */ + template + EIGEN_DEVICE_FUNC + inline void subTo(Dest& dst) const + { + // This is the default implementation, + // derived class can reimplement it in a more optimized way. + typename Dest::PlainObject res(rows(),cols()); + evalTo(res); + dst -= res; + } + + /** \internal Don't use it, but do the equivalent: \code dst.applyOnTheRight(*this); \endcode */ + template + EIGEN_DEVICE_FUNC inline void applyThisOnTheRight(Dest& dst) const + { + // This is the default implementation, + // derived class can reimplement it in a more optimized way. + dst = dst * this->derived(); + } + + /** \internal Don't use it, but do the equivalent: \code dst.applyOnTheLeft(*this); \endcode */ + template + EIGEN_DEVICE_FUNC inline void applyThisOnTheLeft(Dest& dst) const + { + // This is the default implementation, + // derived class can reimplement it in a more optimized way. + dst = this->derived() * dst; + } + +}; + +/*************************************************************************** +* Implementation of matrix base methods +***************************************************************************/ + +/** \brief Copies the generic expression \a other into *this. + * + * \details The expression must provide a (templated) evalTo(Derived& dst) const + * function which does the actual job. In practice, this allows any user to write + * its own special matrix without having to modify MatrixBase + * + * \returns a reference to *this. + */ +template +template +EIGEN_DEVICE_FUNC +Derived& DenseBase::operator=(const EigenBase &other) +{ + call_assignment(derived(), other.derived()); + return derived(); +} + +template +template +EIGEN_DEVICE_FUNC +Derived& DenseBase::operator+=(const EigenBase &other) +{ + call_assignment(derived(), other.derived(), internal::add_assign_op()); + return derived(); +} + +template +template +EIGEN_DEVICE_FUNC +Derived& DenseBase::operator-=(const EigenBase &other) +{ + call_assignment(derived(), other.derived(), internal::sub_assign_op()); + return derived(); +} + +} // end namespace Eigen + +#endif // EIGEN_EIGENBASE_H diff --git a/simulation/externals/eigen/Eigen/src/Core/ForceAlignedAccess.h b/simulation/externals/eigen/Eigen/src/Core/ForceAlignedAccess.h new file mode 100644 index 0000000..7b08b45 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/ForceAlignedAccess.h @@ -0,0 +1,146 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_FORCEALIGNEDACCESS_H +#define EIGEN_FORCEALIGNEDACCESS_H + +namespace Eigen { + +/** \class ForceAlignedAccess + * \ingroup Core_Module + * + * \brief Enforce aligned packet loads and stores regardless of what is requested + * + * \param ExpressionType the type of the object of which we are forcing aligned packet access + * + * This class is the return type of MatrixBase::forceAlignedAccess() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::forceAlignedAccess() + */ + +namespace internal { +template +struct traits > : public traits +{}; +} + +template class ForceAlignedAccess + : public internal::dense_xpr_base< ForceAlignedAccess >::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess) + + EIGEN_DEVICE_FUNC explicit inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {} + + EIGEN_DEVICE_FUNC inline Index rows() const { return m_expression.rows(); } + EIGEN_DEVICE_FUNC inline Index cols() const { return m_expression.cols(); } + EIGEN_DEVICE_FUNC inline Index outerStride() const { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC inline Index innerStride() const { return m_expression.innerStride(); } + + EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index row, Index col) const + { + return m_expression.coeff(row, col); + } + + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index col) + { + return m_expression.const_cast_derived().coeffRef(row, col); + } + + EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index index) const + { + return m_expression.coeff(index); + } + + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index) + { + return m_expression.const_cast_derived().coeffRef(index); + } + + template + inline const PacketScalar packet(Index row, Index col) const + { + return m_expression.template packet(row, col); + } + + template + inline void writePacket(Index row, Index col, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacket(row, col, x); + } + + template + inline const PacketScalar packet(Index index) const + { + return m_expression.template packet(index); + } + + template + inline void writePacket(Index index, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacket(index, x); + } + + EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; } + + protected: + const ExpressionType& m_expression; + + private: + ForceAlignedAccess& operator=(const ForceAlignedAccess&); +}; + +/** \returns an expression of *this with forced aligned access + * \sa forceAlignedAccessIf(),class ForceAlignedAccess + */ +template +inline const ForceAlignedAccess +MatrixBase::forceAlignedAccess() const +{ + return ForceAlignedAccess(derived()); +} + +/** \returns an expression of *this with forced aligned access + * \sa forceAlignedAccessIf(), class ForceAlignedAccess + */ +template +inline ForceAlignedAccess +MatrixBase::forceAlignedAccess() +{ + return ForceAlignedAccess(derived()); +} + +/** \returns an expression of *this with forced aligned access if \a Enable is true. + * \sa forceAlignedAccess(), class ForceAlignedAccess + */ +template +template +inline typename internal::add_const_on_value_type,Derived&>::type>::type +MatrixBase::forceAlignedAccessIf() const +{ + return derived(); // FIXME This should not work but apparently is never used +} + +/** \returns an expression of *this with forced aligned access if \a Enable is true. + * \sa forceAlignedAccess(), class ForceAlignedAccess + */ +template +template +inline typename internal::conditional,Derived&>::type +MatrixBase::forceAlignedAccessIf() +{ + return derived(); // FIXME This should not work but apparently is never used +} + +} // end namespace Eigen + +#endif // EIGEN_FORCEALIGNEDACCESS_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Fuzzy.h b/simulation/externals/eigen/Eigen/src/Core/Fuzzy.h new file mode 100644 index 0000000..3e403a0 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Fuzzy.h @@ -0,0 +1,155 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_FUZZY_H +#define EIGEN_FUZZY_H + +namespace Eigen { + +namespace internal +{ + +template::IsInteger> +struct isApprox_selector +{ + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec) + { + typename internal::nested_eval::type nested(x); + typename internal::nested_eval::type otherNested(y); + return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * numext::mini(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum()); + } +}; + +template +struct isApprox_selector +{ + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar&) + { + return x.matrix() == y.matrix(); + } +}; + +template::IsInteger> +struct isMuchSmallerThan_object_selector +{ + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec) + { + return x.cwiseAbs2().sum() <= numext::abs2(prec) * y.cwiseAbs2().sum(); + } +}; + +template +struct isMuchSmallerThan_object_selector +{ + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const OtherDerived&, const typename Derived::RealScalar&) + { + return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix(); + } +}; + +template::IsInteger> +struct isMuchSmallerThan_scalar_selector +{ + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const typename Derived::RealScalar& y, const typename Derived::RealScalar& prec) + { + return x.cwiseAbs2().sum() <= numext::abs2(prec * y); + } +}; + +template +struct isMuchSmallerThan_scalar_selector +{ + EIGEN_DEVICE_FUNC + static bool run(const Derived& x, const typename Derived::RealScalar&, const typename Derived::RealScalar&) + { + return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix(); + } +}; + +} // end namespace internal + + +/** \returns \c true if \c *this is approximately equal to \a other, within the precision + * determined by \a prec. + * + * \note The fuzzy compares are done multiplicatively. Two vectors \f$ v \f$ and \f$ w \f$ + * are considered to be approximately equal within precision \f$ p \f$ if + * \f[ \Vert v - w \Vert \leqslant p\,\min(\Vert v\Vert, \Vert w\Vert). \f] + * For matrices, the comparison is done using the Hilbert-Schmidt norm (aka Frobenius norm + * L2 norm). + * + * \note Because of the multiplicativeness of this comparison, one can't use this function + * to check whether \c *this is approximately equal to the zero matrix or vector. + * Indeed, \c isApprox(zero) returns false unless \c *this itself is exactly the zero matrix + * or vector. If you want to test whether \c *this is zero, use internal::isMuchSmallerThan(const + * RealScalar&, RealScalar) instead. + * + * \sa internal::isMuchSmallerThan(const RealScalar&, RealScalar) const + */ +template +template +bool DenseBase::isApprox( + const DenseBase& other, + const RealScalar& prec +) const +{ + return internal::isApprox_selector::run(derived(), other.derived(), prec); +} + +/** \returns \c true if the norm of \c *this is much smaller than \a other, + * within the precision determined by \a prec. + * + * \note The fuzzy compares are done multiplicatively. A vector \f$ v \f$ is + * considered to be much smaller than \f$ x \f$ within precision \f$ p \f$ if + * \f[ \Vert v \Vert \leqslant p\,\vert x\vert. \f] + * + * For matrices, the comparison is done using the Hilbert-Schmidt norm. For this reason, + * the value of the reference scalar \a other should come from the Hilbert-Schmidt norm + * of a reference matrix of same dimensions. + * + * \sa isApprox(), isMuchSmallerThan(const DenseBase&, RealScalar) const + */ +template +bool DenseBase::isMuchSmallerThan( + const typename NumTraits::Real& other, + const RealScalar& prec +) const +{ + return internal::isMuchSmallerThan_scalar_selector::run(derived(), other, prec); +} + +/** \returns \c true if the norm of \c *this is much smaller than the norm of \a other, + * within the precision determined by \a prec. + * + * \note The fuzzy compares are done multiplicatively. A vector \f$ v \f$ is + * considered to be much smaller than a vector \f$ w \f$ within precision \f$ p \f$ if + * \f[ \Vert v \Vert \leqslant p\,\Vert w\Vert. \f] + * For matrices, the comparison is done using the Hilbert-Schmidt norm. + * + * \sa isApprox(), isMuchSmallerThan(const RealScalar&, RealScalar) const + */ +template +template +bool DenseBase::isMuchSmallerThan( + const DenseBase& other, + const RealScalar& prec +) const +{ + return internal::isMuchSmallerThan_object_selector::run(derived(), other.derived(), prec); +} + +} // end namespace Eigen + +#endif // EIGEN_FUZZY_H diff --git a/simulation/externals/eigen/Eigen/src/Core/GeneralProduct.h b/simulation/externals/eigen/Eigen/src/Core/GeneralProduct.h new file mode 100644 index 0000000..0f16cd8 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/GeneralProduct.h @@ -0,0 +1,454 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008-2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_GENERAL_PRODUCT_H +#define EIGEN_GENERAL_PRODUCT_H + +namespace Eigen { + +enum { + Large = 2, + Small = 3 +}; + +namespace internal { + +template struct product_type_selector; + +template struct product_size_category +{ + enum { is_large = MaxSize == Dynamic || + Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD || + (Size==Dynamic && MaxSize>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD), + value = is_large ? Large + : Size == 1 ? 1 + : Small + }; +}; + +template struct product_type +{ + typedef typename remove_all::type _Lhs; + typedef typename remove_all::type _Rhs; + enum { + MaxRows = traits<_Lhs>::MaxRowsAtCompileTime, + Rows = traits<_Lhs>::RowsAtCompileTime, + MaxCols = traits<_Rhs>::MaxColsAtCompileTime, + Cols = traits<_Rhs>::ColsAtCompileTime, + MaxDepth = EIGEN_SIZE_MIN_PREFER_FIXED(traits<_Lhs>::MaxColsAtCompileTime, + traits<_Rhs>::MaxRowsAtCompileTime), + Depth = EIGEN_SIZE_MIN_PREFER_FIXED(traits<_Lhs>::ColsAtCompileTime, + traits<_Rhs>::RowsAtCompileTime) + }; + + // the splitting into different lines of code here, introducing the _select enums and the typedef below, + // is to work around an internal compiler error with gcc 4.1 and 4.2. +private: + enum { + rows_select = product_size_category::value, + cols_select = product_size_category::value, + depth_select = product_size_category::value + }; + typedef product_type_selector selector; + +public: + enum { + value = selector::ret, + ret = selector::ret + }; +#ifdef EIGEN_DEBUG_PRODUCT + static void debug() + { + EIGEN_DEBUG_VAR(Rows); + EIGEN_DEBUG_VAR(Cols); + EIGEN_DEBUG_VAR(Depth); + EIGEN_DEBUG_VAR(rows_select); + EIGEN_DEBUG_VAR(cols_select); + EIGEN_DEBUG_VAR(depth_select); + EIGEN_DEBUG_VAR(value); + } +#endif +}; + +/* The following allows to select the kind of product at compile time + * based on the three dimensions of the product. + * This is a compile time mapping from {1,Small,Large}^3 -> {product types} */ +// FIXME I'm not sure the current mapping is the ideal one. +template struct product_type_selector { enum { ret = OuterProduct }; }; +template struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template struct product_type_selector<1, N, 1> { enum { ret = LazyCoeffBasedProductMode }; }; +template struct product_type_selector<1, 1, Depth> { enum { ret = InnerProduct }; }; +template<> struct product_type_selector<1, 1, 1> { enum { ret = InnerProduct }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector<1, Small,Small> { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template<> struct product_type_selector<1, Large,Small> { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector<1, Large,Large> { enum { ret = GemvProduct }; }; +template<> struct product_type_selector<1, Small,Large> { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = GemvProduct }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = GemmProduct }; }; + +} // end namespace internal + +/*********************************************************************** +* Implementation of Inner Vector Vector Product +***********************************************************************/ + +// FIXME : maybe the "inner product" could return a Scalar +// instead of a 1x1 matrix ?? +// Pro: more natural for the user +// Cons: this could be a problem if in a meta unrolled algorithm a matrix-matrix +// product ends up to a row-vector times col-vector product... To tackle this use +// case, we could have a specialization for Block with: operator=(Scalar x); + +/*********************************************************************** +* Implementation of Outer Vector Vector Product +***********************************************************************/ + +/*********************************************************************** +* Implementation of General Matrix Vector Product +***********************************************************************/ + +/* According to the shape/flags of the matrix we have to distinghish 3 different cases: + * 1 - the matrix is col-major, BLAS compatible and M is large => call fast BLAS-like colmajor routine + * 2 - the matrix is row-major, BLAS compatible and N is large => call fast BLAS-like rowmajor routine + * 3 - all other cases are handled using a simple loop along the outer-storage direction. + * Therefore we need a lower level meta selector. + * Furthermore, if the matrix is the rhs, then the product has to be transposed. + */ +namespace internal { + +template +struct gemv_dense_selector; + +} // end namespace internal + +namespace internal { + +template struct gemv_static_vector_if; + +template +struct gemv_static_vector_if +{ + EIGEN_STRONG_INLINE Scalar* data() { eigen_internal_assert(false && "should never be called"); return 0; } +}; + +template +struct gemv_static_vector_if +{ + EIGEN_STRONG_INLINE Scalar* data() { return 0; } +}; + +template +struct gemv_static_vector_if +{ + enum { + ForceAlignment = internal::packet_traits::Vectorizable, + PacketSize = internal::packet_traits::size + }; + #if EIGEN_MAX_STATIC_ALIGN_BYTES!=0 + internal::plain_array m_data; + EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; } + #else + // Some architectures cannot align on the stack, + // => let's manually enforce alignment by allocating more data and return the address of the first aligned element. + internal::plain_array m_data; + EIGEN_STRONG_INLINE Scalar* data() { + return ForceAlignment + ? reinterpret_cast((internal::UIntPtr(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES-1))) + EIGEN_MAX_ALIGN_BYTES) + : m_data.array; + } + #endif +}; + +// The vector is on the left => transposition +template +struct gemv_dense_selector +{ + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + Transpose destT(dest); + enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor }; + gemv_dense_selector + ::run(rhs.transpose(), lhs.transpose(), destT, alpha); + } +}; + +template<> struct gemv_dense_selector +{ + template + static inline void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + typedef typename Lhs::Scalar LhsScalar; + typedef typename Rhs::Scalar RhsScalar; + typedef typename Dest::Scalar ResScalar; + typedef typename Dest::RealScalar RealScalar; + + typedef internal::blas_traits LhsBlasTraits; + typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType; + typedef internal::blas_traits RhsBlasTraits; + typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType; + + typedef Map, EIGEN_PLAIN_ENUM_MIN(AlignedMax,internal::packet_traits::size)> MappedDest; + + ActualLhsType actualLhs = LhsBlasTraits::extract(lhs); + ActualRhsType actualRhs = RhsBlasTraits::extract(rhs); + + ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(lhs) + * RhsBlasTraits::extractScalarFactor(rhs); + + // make sure Dest is a compile-time vector type (bug 1166) + typedef typename conditional::type ActualDest; + + enum { + // FIXME find a way to allow an inner stride on the result if packet_traits::size==1 + // on, the other hand it is good for the cache to pack the vector anyways... + EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime==1), + ComplexByReal = (NumTraits::IsComplex) && (!NumTraits::IsComplex), + MightCannotUseDest = (!EvalToDestAtCompileTime) || ComplexByReal + }; + + typedef const_blas_data_mapper LhsMapper; + typedef const_blas_data_mapper RhsMapper; + RhsScalar compatibleAlpha = get_factor::run(actualAlpha); + + if(!MightCannotUseDest) + { + // shortcut if we are sure to be able to use dest directly, + // this ease the compiler to generate cleaner and more optimzized code for most common cases + general_matrix_vector_product + ::run( + actualLhs.rows(), actualLhs.cols(), + LhsMapper(actualLhs.data(), actualLhs.outerStride()), + RhsMapper(actualRhs.data(), actualRhs.innerStride()), + dest.data(), 1, + compatibleAlpha); + } + else + { + gemv_static_vector_if static_dest; + + const bool alphaIsCompatible = (!ComplexByReal) || (numext::imag(actualAlpha)==RealScalar(0)); + const bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible; + + ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(), + evalToDest ? dest.data() : static_dest.data()); + + if(!evalToDest) + { + #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + Index size = dest.size(); + EIGEN_DENSE_STORAGE_CTOR_PLUGIN + #endif + if(!alphaIsCompatible) + { + MappedDest(actualDestPtr, dest.size()).setZero(); + compatibleAlpha = RhsScalar(1); + } + else + MappedDest(actualDestPtr, dest.size()) = dest; + } + + general_matrix_vector_product + ::run( + actualLhs.rows(), actualLhs.cols(), + LhsMapper(actualLhs.data(), actualLhs.outerStride()), + RhsMapper(actualRhs.data(), actualRhs.innerStride()), + actualDestPtr, 1, + compatibleAlpha); + + if (!evalToDest) + { + if(!alphaIsCompatible) + dest.matrix() += actualAlpha * MappedDest(actualDestPtr, dest.size()); + else + dest = MappedDest(actualDestPtr, dest.size()); + } + } + } +}; + +template<> struct gemv_dense_selector +{ + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + typedef typename Lhs::Scalar LhsScalar; + typedef typename Rhs::Scalar RhsScalar; + typedef typename Dest::Scalar ResScalar; + + typedef internal::blas_traits LhsBlasTraits; + typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType; + typedef internal::blas_traits RhsBlasTraits; + typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType; + typedef typename internal::remove_all::type ActualRhsTypeCleaned; + + typename add_const::type actualLhs = LhsBlasTraits::extract(lhs); + typename add_const::type actualRhs = RhsBlasTraits::extract(rhs); + + ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(lhs) + * RhsBlasTraits::extractScalarFactor(rhs); + + enum { + // FIXME find a way to allow an inner stride on the result if packet_traits::size==1 + // on, the other hand it is good for the cache to pack the vector anyways... + DirectlyUseRhs = ActualRhsTypeCleaned::InnerStrideAtCompileTime==1 + }; + + gemv_static_vector_if static_rhs; + + ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhsPtr,actualRhs.size(), + DirectlyUseRhs ? const_cast(actualRhs.data()) : static_rhs.data()); + + if(!DirectlyUseRhs) + { + #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + Index size = actualRhs.size(); + EIGEN_DENSE_STORAGE_CTOR_PLUGIN + #endif + Map(actualRhsPtr, actualRhs.size()) = actualRhs; + } + + typedef const_blas_data_mapper LhsMapper; + typedef const_blas_data_mapper RhsMapper; + general_matrix_vector_product + ::run( + actualLhs.rows(), actualLhs.cols(), + LhsMapper(actualLhs.data(), actualLhs.outerStride()), + RhsMapper(actualRhsPtr, 1), + dest.data(), dest.col(0).innerStride(), //NOTE if dest is not a vector at compile-time, then dest.innerStride() might be wrong. (bug 1166) + actualAlpha); + } +}; + +template<> struct gemv_dense_selector +{ + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + EIGEN_STATIC_ASSERT((!nested_eval::Evaluate),EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE); + // TODO if rhs is large enough it might be beneficial to make sure that dest is sequentially stored in memory, otherwise use a temp + typename nested_eval::type actual_rhs(rhs); + const Index size = rhs.rows(); + for(Index k=0; k struct gemv_dense_selector +{ + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + EIGEN_STATIC_ASSERT((!nested_eval::Evaluate),EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE); + typename nested_eval::type actual_rhs(rhs); + const Index rows = dest.rows(); + for(Index i=0; i +template +inline const Product +MatrixBase::operator*(const MatrixBase &other) const +{ + // A note regarding the function declaration: In MSVC, this function will sometimes + // not be inlined since DenseStorage is an unwindable object for dynamic + // matrices and product types are holding a member to store the result. + // Thus it does not help tagging this function with EIGEN_STRONG_INLINE. + enum { + ProductIsValid = Derived::ColsAtCompileTime==Dynamic + || OtherDerived::RowsAtCompileTime==Dynamic + || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime), + AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime, + SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived) + }; + // note to the lost user: + // * for a dot product use: v1.dot(v2) + // * for a coeff-wise product use: v1.cwiseProduct(v2) + EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes), + INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS) + EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors), + INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION) + EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT) +#ifdef EIGEN_DEBUG_PRODUCT + internal::product_type::debug(); +#endif + + return Product(derived(), other.derived()); +} + +#endif // __CUDACC__ + +/** \returns an expression of the matrix product of \c *this and \a other without implicit evaluation. + * + * The returned product will behave like any other expressions: the coefficients of the product will be + * computed once at a time as requested. This might be useful in some extremely rare cases when only + * a small and no coherent fraction of the result's coefficients have to be computed. + * + * \warning This version of the matrix product can be much much slower. So use it only if you know + * what you are doing and that you measured a true speed improvement. + * + * \sa operator*(const MatrixBase&) + */ +template +template +const Product +MatrixBase::lazyProduct(const MatrixBase &other) const +{ + enum { + ProductIsValid = Derived::ColsAtCompileTime==Dynamic + || OtherDerived::RowsAtCompileTime==Dynamic + || int(Derived::ColsAtCompileTime)==int(OtherDerived::RowsAtCompileTime), + AreVectors = Derived::IsVectorAtCompileTime && OtherDerived::IsVectorAtCompileTime, + SameSizes = EIGEN_PREDICATE_SAME_MATRIX_SIZE(Derived,OtherDerived) + }; + // note to the lost user: + // * for a dot product use: v1.dot(v2) + // * for a coeff-wise product use: v1.cwiseProduct(v2) + EIGEN_STATIC_ASSERT(ProductIsValid || !(AreVectors && SameSizes), + INVALID_VECTOR_VECTOR_PRODUCT__IF_YOU_WANTED_A_DOT_OR_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTIONS) + EIGEN_STATIC_ASSERT(ProductIsValid || !(SameSizes && !AreVectors), + INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION) + EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT) + + return Product(derived(), other.derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_PRODUCT_H diff --git a/simulation/externals/eigen/Eigen/src/Core/GenericPacketMath.h b/simulation/externals/eigen/Eigen/src/Core/GenericPacketMath.h new file mode 100644 index 0000000..029f8ac --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/GenericPacketMath.h @@ -0,0 +1,593 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_GENERIC_PACKET_MATH_H +#define EIGEN_GENERIC_PACKET_MATH_H + +namespace Eigen { + +namespace internal { + +/** \internal + * \file GenericPacketMath.h + * + * Default implementation for types not supported by the vectorization. + * In practice these functions are provided to make easier the writing + * of generic vectorized code. + */ + +#ifndef EIGEN_DEBUG_ALIGNED_LOAD +#define EIGEN_DEBUG_ALIGNED_LOAD +#endif + +#ifndef EIGEN_DEBUG_UNALIGNED_LOAD +#define EIGEN_DEBUG_UNALIGNED_LOAD +#endif + +#ifndef EIGEN_DEBUG_ALIGNED_STORE +#define EIGEN_DEBUG_ALIGNED_STORE +#endif + +#ifndef EIGEN_DEBUG_UNALIGNED_STORE +#define EIGEN_DEBUG_UNALIGNED_STORE +#endif + +struct default_packet_traits +{ + enum { + HasHalfPacket = 0, + + HasAdd = 1, + HasSub = 1, + HasMul = 1, + HasNegate = 1, + HasAbs = 1, + HasArg = 0, + HasAbs2 = 1, + HasMin = 1, + HasMax = 1, + HasConj = 1, + HasSetLinear = 1, + HasBlend = 0, + + HasDiv = 0, + HasSqrt = 0, + HasRsqrt = 0, + HasExp = 0, + HasLog = 0, + HasLog1p = 0, + HasLog10 = 0, + HasPow = 0, + + HasSin = 0, + HasCos = 0, + HasTan = 0, + HasASin = 0, + HasACos = 0, + HasATan = 0, + HasSinh = 0, + HasCosh = 0, + HasTanh = 0, + HasLGamma = 0, + HasDiGamma = 0, + HasZeta = 0, + HasPolygamma = 0, + HasErf = 0, + HasErfc = 0, + HasIGamma = 0, + HasIGammac = 0, + HasBetaInc = 0, + + HasRound = 0, + HasFloor = 0, + HasCeil = 0, + + HasSign = 0 + }; +}; + +template struct packet_traits : default_packet_traits +{ + typedef T type; + typedef T half; + enum { + Vectorizable = 0, + size = 1, + AlignedOnScalar = 0, + HasHalfPacket = 0 + }; + enum { + HasAdd = 0, + HasSub = 0, + HasMul = 0, + HasNegate = 0, + HasAbs = 0, + HasAbs2 = 0, + HasMin = 0, + HasMax = 0, + HasConj = 0, + HasSetLinear = 0 + }; +}; + +template struct packet_traits : packet_traits { }; + +template struct type_casting_traits { + enum { + VectorizedCast = 0, + SrcCoeffRatio = 1, + TgtCoeffRatio = 1 + }; +}; + + +/** \internal \returns static_cast(a) (coeff-wise) */ +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a) { + return static_cast(a); +} +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a, const SrcPacket& /*b*/) { + return static_cast(a); +} + +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a, const SrcPacket& /*b*/, const SrcPacket& /*c*/, const SrcPacket& /*d*/) { + return static_cast(a); +} + +/** \internal \returns a + b (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +padd(const Packet& a, + const Packet& b) { return a+b; } + +/** \internal \returns a - b (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +psub(const Packet& a, + const Packet& b) { return a-b; } + +/** \internal \returns -a (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +pnegate(const Packet& a) { return -a; } + +/** \internal \returns conj(a) (coeff-wise) */ + +template EIGEN_DEVICE_FUNC inline Packet +pconj(const Packet& a) { return numext::conj(a); } + +/** \internal \returns a * b (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +pmul(const Packet& a, + const Packet& b) { return a*b; } + +/** \internal \returns a / b (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +pdiv(const Packet& a, + const Packet& b) { return a/b; } + +/** \internal \returns the min of \a a and \a b (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +pmin(const Packet& a, + const Packet& b) { return numext::mini(a, b); } + +/** \internal \returns the max of \a a and \a b (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +pmax(const Packet& a, + const Packet& b) { return numext::maxi(a, b); } + +/** \internal \returns the absolute value of \a a */ +template EIGEN_DEVICE_FUNC inline Packet +pabs(const Packet& a) { using std::abs; return abs(a); } + +/** \internal \returns the phase angle of \a a */ +template EIGEN_DEVICE_FUNC inline Packet +parg(const Packet& a) { using numext::arg; return arg(a); } + +/** \internal \returns the bitwise and of \a a and \a b */ +template EIGEN_DEVICE_FUNC inline Packet +pand(const Packet& a, const Packet& b) { return a & b; } + +/** \internal \returns the bitwise or of \a a and \a b */ +template EIGEN_DEVICE_FUNC inline Packet +por(const Packet& a, const Packet& b) { return a | b; } + +/** \internal \returns the bitwise xor of \a a and \a b */ +template EIGEN_DEVICE_FUNC inline Packet +pxor(const Packet& a, const Packet& b) { return a ^ b; } + +/** \internal \returns the bitwise andnot of \a a and \a b */ +template EIGEN_DEVICE_FUNC inline Packet +pandnot(const Packet& a, const Packet& b) { return a & (!b); } + +/** \internal \returns a packet version of \a *from, from must be 16 bytes aligned */ +template EIGEN_DEVICE_FUNC inline Packet +pload(const typename unpacket_traits::type* from) { return *from; } + +/** \internal \returns a packet version of \a *from, (un-aligned load) */ +template EIGEN_DEVICE_FUNC inline Packet +ploadu(const typename unpacket_traits::type* from) { return *from; } + +/** \internal \returns a packet with constant coefficients \a a, e.g.: (a,a,a,a) */ +template EIGEN_DEVICE_FUNC inline Packet +pset1(const typename unpacket_traits::type& a) { return a; } + +/** \internal \returns a packet with constant coefficients \a a[0], e.g.: (a[0],a[0],a[0],a[0]) */ +template EIGEN_DEVICE_FUNC inline Packet +pload1(const typename unpacket_traits::type *a) { return pset1(*a); } + +/** \internal \returns a packet with elements of \a *from duplicated. + * For instance, for a packet of 8 elements, 4 scalars will be read from \a *from and + * duplicated to form: {from[0],from[0],from[1],from[1],from[2],from[2],from[3],from[3]} + * Currently, this function is only used for scalar * complex products. + */ +template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet +ploaddup(const typename unpacket_traits::type* from) { return *from; } + +/** \internal \returns a packet with elements of \a *from quadrupled. + * For instance, for a packet of 8 elements, 2 scalars will be read from \a *from and + * replicated to form: {from[0],from[0],from[0],from[0],from[1],from[1],from[1],from[1]} + * Currently, this function is only used in matrix products. + * For packet-size smaller or equal to 4, this function is equivalent to pload1 + */ +template EIGEN_DEVICE_FUNC inline Packet +ploadquad(const typename unpacket_traits::type* from) +{ return pload1(from); } + +/** \internal equivalent to + * \code + * a0 = pload1(a+0); + * a1 = pload1(a+1); + * a2 = pload1(a+2); + * a3 = pload1(a+3); + * \endcode + * \sa pset1, pload1, ploaddup, pbroadcast2 + */ +template EIGEN_DEVICE_FUNC +inline void pbroadcast4(const typename unpacket_traits::type *a, + Packet& a0, Packet& a1, Packet& a2, Packet& a3) +{ + a0 = pload1(a+0); + a1 = pload1(a+1); + a2 = pload1(a+2); + a3 = pload1(a+3); +} + +/** \internal equivalent to + * \code + * a0 = pload1(a+0); + * a1 = pload1(a+1); + * \endcode + * \sa pset1, pload1, ploaddup, pbroadcast4 + */ +template EIGEN_DEVICE_FUNC +inline void pbroadcast2(const typename unpacket_traits::type *a, + Packet& a0, Packet& a1) +{ + a0 = pload1(a+0); + a1 = pload1(a+1); +} + +/** \internal \brief Returns a packet with coefficients (a,a+1,...,a+packet_size-1). */ +template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet +plset(const typename unpacket_traits::type& a) { return a; } + +/** \internal copy the packet \a from to \a *to, \a to must be 16 bytes aligned */ +template EIGEN_DEVICE_FUNC inline void pstore(Scalar* to, const Packet& from) +{ (*to) = from; } + +/** \internal copy the packet \a from to \a *to, (un-aligned store) */ +template EIGEN_DEVICE_FUNC inline void pstoreu(Scalar* to, const Packet& from) +{ (*to) = from; } + + template EIGEN_DEVICE_FUNC inline Packet pgather(const Scalar* from, Index /*stride*/) + { return ploadu(from); } + + template EIGEN_DEVICE_FUNC inline void pscatter(Scalar* to, const Packet& from, Index /*stride*/) + { pstore(to, from); } + +/** \internal tries to do cache prefetching of \a addr */ +template EIGEN_DEVICE_FUNC inline void prefetch(const Scalar* addr) +{ +#ifdef __CUDA_ARCH__ +#if defined(__LP64__) + // 64-bit pointer operand constraint for inlined asm + asm(" prefetch.L1 [ %1 ];" : "=l"(addr) : "l"(addr)); +#else + // 32-bit pointer operand constraint for inlined asm + asm(" prefetch.L1 [ %1 ];" : "=r"(addr) : "r"(addr)); +#endif +#elif (!EIGEN_COMP_MSVC) && (EIGEN_COMP_GNUC || EIGEN_COMP_CLANG || EIGEN_COMP_ICC) + __builtin_prefetch(addr); +#endif +} + +/** \internal \returns the first element of a packet */ +template EIGEN_DEVICE_FUNC inline typename unpacket_traits::type pfirst(const Packet& a) +{ return a; } + +/** \internal \returns a packet where the element i contains the sum of the packet of \a vec[i] */ +template EIGEN_DEVICE_FUNC inline Packet +preduxp(const Packet* vecs) { return vecs[0]; } + +/** \internal \returns the sum of the elements of \a a*/ +template EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux(const Packet& a) +{ return a; } + +/** \internal \returns the sum of the elements of \a a by block of 4 elements. + * For a packet {a0, a1, a2, a3, a4, a5, a6, a7}, it returns a half packet {a0+a4, a1+a5, a2+a6, a3+a7} + * For packet-size smaller or equal to 4, this boils down to a noop. + */ +template EIGEN_DEVICE_FUNC inline +typename conditional<(unpacket_traits::size%8)==0,typename unpacket_traits::half,Packet>::type +predux_downto4(const Packet& a) +{ return a; } + +/** \internal \returns the product of the elements of \a a*/ +template EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_mul(const Packet& a) +{ return a; } + +/** \internal \returns the min of the elements of \a a*/ +template EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_min(const Packet& a) +{ return a; } + +/** \internal \returns the max of the elements of \a a*/ +template EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_max(const Packet& a) +{ return a; } + +/** \internal \returns the reversed elements of \a a*/ +template EIGEN_DEVICE_FUNC inline Packet preverse(const Packet& a) +{ return a; } + +/** \internal \returns \a a with real and imaginary part flipped (for complex type only) */ +template EIGEN_DEVICE_FUNC inline Packet pcplxflip(const Packet& a) +{ + // FIXME: uncomment the following in case we drop the internal imag and real functions. +// using std::imag; +// using std::real; + return Packet(imag(a),real(a)); +} + +/************************** +* Special math functions +***************************/ + +/** \internal \returns the sine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet psin(const Packet& a) { using std::sin; return sin(a); } + +/** \internal \returns the cosine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pcos(const Packet& a) { using std::cos; return cos(a); } + +/** \internal \returns the tan of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet ptan(const Packet& a) { using std::tan; return tan(a); } + +/** \internal \returns the arc sine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pasin(const Packet& a) { using std::asin; return asin(a); } + +/** \internal \returns the arc cosine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pacos(const Packet& a) { using std::acos; return acos(a); } + +/** \internal \returns the arc tangent of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet patan(const Packet& a) { using std::atan; return atan(a); } + +/** \internal \returns the hyperbolic sine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet psinh(const Packet& a) { using std::sinh; return sinh(a); } + +/** \internal \returns the hyperbolic cosine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pcosh(const Packet& a) { using std::cosh; return cosh(a); } + +/** \internal \returns the hyperbolic tan of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet ptanh(const Packet& a) { using std::tanh; return tanh(a); } + +/** \internal \returns the exp of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pexp(const Packet& a) { using std::exp; return exp(a); } + +/** \internal \returns the log of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet plog(const Packet& a) { using std::log; return log(a); } + +/** \internal \returns the log1p of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet plog1p(const Packet& a) { return numext::log1p(a); } + +/** \internal \returns the log10 of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet plog10(const Packet& a) { using std::log10; return log10(a); } + +/** \internal \returns the square-root of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet psqrt(const Packet& a) { using std::sqrt; return sqrt(a); } + +/** \internal \returns the reciprocal square-root of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet prsqrt(const Packet& a) { + return pdiv(pset1(1), psqrt(a)); +} + +/** \internal \returns the rounded value of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pround(const Packet& a) { using numext::round; return round(a); } + +/** \internal \returns the floor of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pfloor(const Packet& a) { using numext::floor; return floor(a); } + +/** \internal \returns the ceil of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pceil(const Packet& a) { using numext::ceil; return ceil(a); } + +/*************************************************************************** +* The following functions might not have to be overwritten for vectorized types +***************************************************************************/ + +/** \internal copy a packet with constant coeficient \a a (e.g., [a,a,a,a]) to \a *to. \a to must be 16 bytes aligned */ +// NOTE: this function must really be templated on the packet type (think about different packet types for the same scalar type) +template +inline void pstore1(typename unpacket_traits::type* to, const typename unpacket_traits::type& a) +{ + pstore(to, pset1(a)); +} + +/** \internal \returns a * b + c (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +pmadd(const Packet& a, + const Packet& b, + const Packet& c) +{ return padd(pmul(a, b),c); } + +/** \internal \returns a packet version of \a *from. + * The pointer \a from must be aligned on a \a Alignment bytes boundary. */ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet ploadt(const typename unpacket_traits::type* from) +{ + if(Alignment >= unpacket_traits::alignment) + return pload(from); + else + return ploadu(from); +} + +/** \internal copy the packet \a from to \a *to. + * The pointer \a from must be aligned on a \a Alignment bytes boundary. */ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstoret(Scalar* to, const Packet& from) +{ + if(Alignment >= unpacket_traits::alignment) + pstore(to, from); + else + pstoreu(to, from); +} + +/** \internal \returns a packet version of \a *from. + * Unlike ploadt, ploadt_ro takes advantage of the read-only memory path on the + * hardware if available to speedup the loading of data that won't be modified + * by the current computation. + */ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet ploadt_ro(const typename unpacket_traits::type* from) +{ + return ploadt(from); +} + +/** \internal default implementation of palign() allowing partial specialization */ +template +struct palign_impl +{ + // by default data are aligned, so there is nothing to be done :) + static inline void run(PacketType&, const PacketType&) {} +}; + +/** \internal update \a first using the concatenation of the packet_size minus \a Offset last elements + * of \a first and \a Offset first elements of \a second. + * + * This function is currently only used to optimize matrix-vector products on unligned matrices. + * It takes 2 packets that represent a contiguous memory array, and returns a packet starting + * at the position \a Offset. For instance, for packets of 4 elements, we have: + * Input: + * - first = {f0,f1,f2,f3} + * - second = {s0,s1,s2,s3} + * Output: + * - if Offset==0 then {f0,f1,f2,f3} + * - if Offset==1 then {f1,f2,f3,s0} + * - if Offset==2 then {f2,f3,s0,s1} + * - if Offset==3 then {f3,s0,s1,s3} + */ +template +inline void palign(PacketType& first, const PacketType& second) +{ + palign_impl::run(first,second); +} + +/*************************************************************************** +* Fast complex products (GCC generates a function call which is very slow) +***************************************************************************/ + +// Eigen+CUDA does not support complexes. +#ifndef __CUDACC__ + +template<> inline std::complex pmul(const std::complex& a, const std::complex& b) +{ return std::complex(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); } + +template<> inline std::complex pmul(const std::complex& a, const std::complex& b) +{ return std::complex(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); } + +#endif + + +/*************************************************************************** + * PacketBlock, that is a collection of N packets where the number of words + * in the packet is a multiple of N. +***************************************************************************/ +template ::size> struct PacketBlock { + Packet packet[N]; +}; + +template EIGEN_DEVICE_FUNC inline void +ptranspose(PacketBlock& /*kernel*/) { + // Nothing to do in the scalar case, i.e. a 1x1 matrix. +} + +/*************************************************************************** + * Selector, i.e. vector of N boolean values used to select (i.e. blend) + * words from 2 packets. +***************************************************************************/ +template struct Selector { + bool select[N]; +}; + +template EIGEN_DEVICE_FUNC inline Packet +pblend(const Selector::size>& ifPacket, const Packet& thenPacket, const Packet& elsePacket) { + return ifPacket.select[0] ? thenPacket : elsePacket; +} + +/** \internal \returns \a a with the first coefficient replaced by the scalar b */ +template EIGEN_DEVICE_FUNC inline Packet +pinsertfirst(const Packet& a, typename unpacket_traits::type b) +{ + // Default implementation based on pblend. + // It must be specialized for higher performance. + Selector::size> mask; + mask.select[0] = true; + // This for loop should be optimized away by the compiler. + for(Index i=1; i::size; ++i) + mask.select[i] = false; + return pblend(mask, pset1(b), a); +} + +/** \internal \returns \a a with the last coefficient replaced by the scalar b */ +template EIGEN_DEVICE_FUNC inline Packet +pinsertlast(const Packet& a, typename unpacket_traits::type b) +{ + // Default implementation based on pblend. + // It must be specialized for higher performance. + Selector::size> mask; + // This for loop should be optimized away by the compiler. + for(Index i=0; i::size-1; ++i) + mask.select[i] = false; + mask.select[unpacket_traits::size-1] = true; + return pblend(mask, pset1(b), a); +} + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_GENERIC_PACKET_MATH_H diff --git a/simulation/externals/eigen/Eigen/src/Core/GlobalFunctions.h b/simulation/externals/eigen/Eigen/src/Core/GlobalFunctions.h new file mode 100644 index 0000000..769dc25 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/GlobalFunctions.h @@ -0,0 +1,187 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2010-2016 Gael Guennebaud +// Copyright (C) 2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_GLOBAL_FUNCTIONS_H +#define EIGEN_GLOBAL_FUNCTIONS_H + +#ifdef EIGEN_PARSED_BY_DOXYGEN + +#define EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(NAME,FUNCTOR,DOC_OP,DOC_DETAILS) \ + /** \returns an expression of the coefficient-wise DOC_OP of \a x + + DOC_DETAILS + + \sa Math functions, class CwiseUnaryOp + */ \ + template \ + inline const Eigen::CwiseUnaryOp, const Derived> \ + NAME(const Eigen::ArrayBase& x); + +#else + +#define EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(NAME,FUNCTOR,DOC_OP,DOC_DETAILS) \ + template \ + inline const Eigen::CwiseUnaryOp, const Derived> \ + (NAME)(const Eigen::ArrayBase& x) { \ + return Eigen::CwiseUnaryOp, const Derived>(x.derived()); \ + } + +#endif // EIGEN_PARSED_BY_DOXYGEN + +#define EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(NAME,FUNCTOR) \ + \ + template \ + struct NAME##_retval > \ + { \ + typedef const Eigen::CwiseUnaryOp, const Derived> type; \ + }; \ + template \ + struct NAME##_impl > \ + { \ + static inline typename NAME##_retval >::type run(const Eigen::ArrayBase& x) \ + { \ + return typename NAME##_retval >::type(x.derived()); \ + } \ + }; + +namespace Eigen +{ + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(real,scalar_real_op,real part,\sa ArrayBase::real) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(imag,scalar_imag_op,imaginary part,\sa ArrayBase::imag) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(conj,scalar_conjugate_op,complex conjugate,\sa ArrayBase::conjugate) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(inverse,scalar_inverse_op,inverse,\sa ArrayBase::inverse) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sin,scalar_sin_op,sine,\sa ArrayBase::sin) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cos,scalar_cos_op,cosine,\sa ArrayBase::cos) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tan,scalar_tan_op,tangent,\sa ArrayBase::tan) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(atan,scalar_atan_op,arc-tangent,\sa ArrayBase::atan) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(asin,scalar_asin_op,arc-sine,\sa ArrayBase::asin) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(acos,scalar_acos_op,arc-consine,\sa ArrayBase::acos) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sinh,scalar_sinh_op,hyperbolic sine,\sa ArrayBase::sinh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cosh,scalar_cosh_op,hyperbolic cosine,\sa ArrayBase::cosh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tanh,scalar_tanh_op,hyperbolic tangent,\sa ArrayBase::tanh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(lgamma,scalar_lgamma_op,natural logarithm of the gamma function,\sa ArrayBase::lgamma) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(digamma,scalar_digamma_op,derivative of lgamma,\sa ArrayBase::digamma) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erf,scalar_erf_op,error function,\sa ArrayBase::erf) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erfc,scalar_erfc_op,complement error function,\sa ArrayBase::erfc) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(exp,scalar_exp_op,exponential,\sa ArrayBase::exp) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log,scalar_log_op,natural logarithm,\sa Eigen::log10 DOXCOMMA ArrayBase::log) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log1p,scalar_log1p_op,natural logarithm of 1 plus the value,\sa ArrayBase::log1p) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log10,scalar_log10_op,base 10 logarithm,\sa Eigen::log DOXCOMMA ArrayBase::log) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(abs,scalar_abs_op,absolute value,\sa ArrayBase::abs DOXCOMMA MatrixBase::cwiseAbs) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(abs2,scalar_abs2_op,squared absolute value,\sa ArrayBase::abs2 DOXCOMMA MatrixBase::cwiseAbs2) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(arg,scalar_arg_op,complex argument,\sa ArrayBase::arg) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sqrt,scalar_sqrt_op,square root,\sa ArrayBase::sqrt DOXCOMMA MatrixBase::cwiseSqrt) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(rsqrt,scalar_rsqrt_op,reciprocal square root,\sa ArrayBase::rsqrt) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(square,scalar_square_op,square (power 2),\sa Eigen::abs2 DOXCOMMA Eigen::pow DOXCOMMA ArrayBase::square) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cube,scalar_cube_op,cube (power 3),\sa Eigen::pow DOXCOMMA ArrayBase::cube) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(round,scalar_round_op,nearest integer,\sa Eigen::floor DOXCOMMA Eigen::ceil DOXCOMMA ArrayBase::round) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(floor,scalar_floor_op,nearest integer not greater than the giben value,\sa Eigen::ceil DOXCOMMA ArrayBase::floor) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(ceil,scalar_ceil_op,nearest integer not less than the giben value,\sa Eigen::floor DOXCOMMA ArrayBase::ceil) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isnan,scalar_isnan_op,not-a-number test,\sa Eigen::isinf DOXCOMMA Eigen::isfinite DOXCOMMA ArrayBase::isnan) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isinf,scalar_isinf_op,infinite value test,\sa Eigen::isnan DOXCOMMA Eigen::isfinite DOXCOMMA ArrayBase::isinf) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isfinite,scalar_isfinite_op,finite value test,\sa Eigen::isinf DOXCOMMA Eigen::isnan DOXCOMMA ArrayBase::isfinite) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sign,scalar_sign_op,sign (or 0),\sa ArrayBase::sign) + + /** \returns an expression of the coefficient-wise power of \a x to the given constant \a exponent. + * + * \tparam ScalarExponent is the scalar type of \a exponent. It must be compatible with the scalar type of the given expression (\c Derived::Scalar). + * + * \sa ArrayBase::pow() + * + * \relates ArrayBase + */ +#ifdef EIGEN_PARSED_BY_DOXYGEN + template + inline const CwiseBinaryOp,Derived,Constant > + pow(const Eigen::ArrayBase& x, const ScalarExponent& exponent); +#else + template + inline typename internal::enable_if< !(internal::is_same::value) && EIGEN_SCALAR_BINARY_SUPPORTED(pow,typename Derived::Scalar,ScalarExponent), + const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,ScalarExponent,pow) >::type + pow(const Eigen::ArrayBase& x, const ScalarExponent& exponent) { + return x.derived().pow(exponent); + } + + template + inline const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,typename Derived::Scalar,pow) + pow(const Eigen::ArrayBase& x, const typename Derived::Scalar& exponent) { + return x.derived().pow(exponent); + } +#endif + + /** \returns an expression of the coefficient-wise power of \a x to the given array of \a exponents. + * + * This function computes the coefficient-wise power. + * + * Example: \include Cwise_array_power_array.cpp + * Output: \verbinclude Cwise_array_power_array.out + * + * \sa ArrayBase::pow() + * + * \relates ArrayBase + */ + template + inline const Eigen::CwiseBinaryOp, const Derived, const ExponentDerived> + pow(const Eigen::ArrayBase& x, const Eigen::ArrayBase& exponents) + { + return Eigen::CwiseBinaryOp, const Derived, const ExponentDerived>( + x.derived(), + exponents.derived() + ); + } + + /** \returns an expression of the coefficient-wise power of the scalar \a x to the given array of \a exponents. + * + * This function computes the coefficient-wise power between a scalar and an array of exponents. + * + * \tparam Scalar is the scalar type of \a x. It must be compatible with the scalar type of the given array expression (\c Derived::Scalar). + * + * Example: \include Cwise_scalar_power_array.cpp + * Output: \verbinclude Cwise_scalar_power_array.out + * + * \sa ArrayBase::pow() + * + * \relates ArrayBase + */ +#ifdef EIGEN_PARSED_BY_DOXYGEN + template + inline const CwiseBinaryOp,Constant,Derived> + pow(const Scalar& x,const Eigen::ArrayBase& x); +#else + template + inline typename internal::enable_if< !(internal::is_same::value) && EIGEN_SCALAR_BINARY_SUPPORTED(pow,Scalar,typename Derived::Scalar), + const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar,Derived,pow) >::type + pow(const Scalar& x, const Eigen::ArrayBase& exponents) + { + return EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(Scalar,Derived,pow)( + typename internal::plain_constant_type::type(exponents.rows(), exponents.cols(), x), exponents.derived() ); + } + + template + inline const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(typename Derived::Scalar,Derived,pow) + pow(const typename Derived::Scalar& x, const Eigen::ArrayBase& exponents) + { + return EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(typename Derived::Scalar,Derived,pow)( + typename internal::plain_constant_type::type(exponents.rows(), exponents.cols(), x), exponents.derived() ); + } +#endif + + + namespace internal + { + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(real,scalar_real_op) + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(imag,scalar_imag_op) + EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(abs2,scalar_abs2_op) + } +} + +// TODO: cleanly disable those functions that are not supported on Array (numext::real_ref, internal::random, internal::isApprox...) + +#endif // EIGEN_GLOBAL_FUNCTIONS_H diff --git a/simulation/externals/eigen/Eigen/src/Core/IO.h b/simulation/externals/eigen/Eigen/src/Core/IO.h new file mode 100644 index 0000000..da7fd6c --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/IO.h @@ -0,0 +1,225 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_IO_H +#define EIGEN_IO_H + +namespace Eigen { + +enum { DontAlignCols = 1 }; +enum { StreamPrecision = -1, + FullPrecision = -2 }; + +namespace internal { +template +std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& fmt); +} + +/** \class IOFormat + * \ingroup Core_Module + * + * \brief Stores a set of parameters controlling the way matrices are printed + * + * List of available parameters: + * - \b precision number of digits for floating point values, or one of the special constants \c StreamPrecision and \c FullPrecision. + * The default is the special value \c StreamPrecision which means to use the + * stream's own precision setting, as set for instance using \c cout.precision(3). The other special value + * \c FullPrecision means that the number of digits will be computed to match the full precision of each floating-point + * type. + * - \b flags an OR-ed combination of flags, the default value is 0, the only currently available flag is \c DontAlignCols which + * allows to disable the alignment of columns, resulting in faster code. + * - \b coeffSeparator string printed between two coefficients of the same row + * - \b rowSeparator string printed between two rows + * - \b rowPrefix string printed at the beginning of each row + * - \b rowSuffix string printed at the end of each row + * - \b matPrefix string printed at the beginning of the matrix + * - \b matSuffix string printed at the end of the matrix + * + * Example: \include IOFormat.cpp + * Output: \verbinclude IOFormat.out + * + * \sa DenseBase::format(), class WithFormat + */ +struct IOFormat +{ + /** Default constructor, see class IOFormat for the meaning of the parameters */ + IOFormat(int _precision = StreamPrecision, int _flags = 0, + const std::string& _coeffSeparator = " ", + const std::string& _rowSeparator = "\n", const std::string& _rowPrefix="", const std::string& _rowSuffix="", + const std::string& _matPrefix="", const std::string& _matSuffix="") + : matPrefix(_matPrefix), matSuffix(_matSuffix), rowPrefix(_rowPrefix), rowSuffix(_rowSuffix), rowSeparator(_rowSeparator), + rowSpacer(""), coeffSeparator(_coeffSeparator), precision(_precision), flags(_flags) + { + // TODO check if rowPrefix, rowSuffix or rowSeparator contains a newline + // don't add rowSpacer if columns are not to be aligned + if((flags & DontAlignCols)) + return; + int i = int(matSuffix.length())-1; + while (i>=0 && matSuffix[i]!='\n') + { + rowSpacer += ' '; + i--; + } + } + std::string matPrefix, matSuffix; + std::string rowPrefix, rowSuffix, rowSeparator, rowSpacer; + std::string coeffSeparator; + int precision; + int flags; +}; + +/** \class WithFormat + * \ingroup Core_Module + * + * \brief Pseudo expression providing matrix output with given format + * + * \tparam ExpressionType the type of the object on which IO stream operations are performed + * + * This class represents an expression with stream operators controlled by a given IOFormat. + * It is the return type of DenseBase::format() + * and most of the time this is the only way it is used. + * + * See class IOFormat for some examples. + * + * \sa DenseBase::format(), class IOFormat + */ +template +class WithFormat +{ + public: + + WithFormat(const ExpressionType& matrix, const IOFormat& format) + : m_matrix(matrix), m_format(format) + {} + + friend std::ostream & operator << (std::ostream & s, const WithFormat& wf) + { + return internal::print_matrix(s, wf.m_matrix.eval(), wf.m_format); + } + + protected: + typename ExpressionType::Nested m_matrix; + IOFormat m_format; +}; + +namespace internal { + +// NOTE: This helper is kept for backward compatibility with previous code specializing +// this internal::significant_decimals_impl structure. In the future we should directly +// call digits10() which has been introduced in July 2016 in 3.3. +template +struct significant_decimals_impl +{ + static inline int run() + { + return NumTraits::digits10(); + } +}; + +/** \internal + * print the matrix \a _m to the output stream \a s using the output format \a fmt */ +template +std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& fmt) +{ + if(_m.size() == 0) + { + s << fmt.matPrefix << fmt.matSuffix; + return s; + } + + typename Derived::Nested m = _m; + typedef typename Derived::Scalar Scalar; + + Index width = 0; + + std::streamsize explicit_precision; + if(fmt.precision == StreamPrecision) + { + explicit_precision = 0; + } + else if(fmt.precision == FullPrecision) + { + if (NumTraits::IsInteger) + { + explicit_precision = 0; + } + else + { + explicit_precision = significant_decimals_impl::run(); + } + } + else + { + explicit_precision = fmt.precision; + } + + std::streamsize old_precision = 0; + if(explicit_precision) old_precision = s.precision(explicit_precision); + + bool align_cols = !(fmt.flags & DontAlignCols); + if(align_cols) + { + // compute the largest width + for(Index j = 0; j < m.cols(); ++j) + for(Index i = 0; i < m.rows(); ++i) + { + std::stringstream sstr; + sstr.copyfmt(s); + sstr << m.coeff(i,j); + width = std::max(width, Index(sstr.str().length())); + } + } + s << fmt.matPrefix; + for(Index i = 0; i < m.rows(); ++i) + { + if (i) + s << fmt.rowSpacer; + s << fmt.rowPrefix; + if(width) s.width(width); + s << m.coeff(i, 0); + for(Index j = 1; j < m.cols(); ++j) + { + s << fmt.coeffSeparator; + if (width) s.width(width); + s << m.coeff(i, j); + } + s << fmt.rowSuffix; + if( i < m.rows() - 1) + s << fmt.rowSeparator; + } + s << fmt.matSuffix; + if(explicit_precision) s.precision(old_precision); + return s; +} + +} // end namespace internal + +/** \relates DenseBase + * + * Outputs the matrix, to the given stream. + * + * If you wish to print the matrix with a format different than the default, use DenseBase::format(). + * + * It is also possible to change the default format by defining EIGEN_DEFAULT_IO_FORMAT before including Eigen headers. + * If not defined, this will automatically be defined to Eigen::IOFormat(), that is the Eigen::IOFormat with default parameters. + * + * \sa DenseBase::format() + */ +template +std::ostream & operator << +(std::ostream & s, + const DenseBase & m) +{ + return internal::print_matrix(s, m.eval(), EIGEN_DEFAULT_IO_FORMAT); +} + +} // end namespace Eigen + +#endif // EIGEN_IO_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Inverse.h b/simulation/externals/eigen/Eigen/src/Core/Inverse.h new file mode 100644 index 0000000..b76f043 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Inverse.h @@ -0,0 +1,118 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2014 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_INVERSE_H +#define EIGEN_INVERSE_H + +namespace Eigen { + +template class InverseImpl; + +namespace internal { + +template +struct traits > + : traits +{ + typedef typename XprType::PlainObject PlainObject; + typedef traits BaseTraits; + enum { + Flags = BaseTraits::Flags & RowMajorBit + }; +}; + +} // end namespace internal + +/** \class Inverse + * + * \brief Expression of the inverse of another expression + * + * \tparam XprType the type of the expression we are taking the inverse + * + * This class represents an abstract expression of A.inverse() + * and most of the time this is the only way it is used. + * + */ +template +class Inverse : public InverseImpl::StorageKind> +{ +public: + typedef typename XprType::StorageIndex StorageIndex; + typedef typename XprType::PlainObject PlainObject; + typedef typename XprType::Scalar Scalar; + typedef typename internal::ref_selector::type XprTypeNested; + typedef typename internal::remove_all::type XprTypeNestedCleaned; + typedef typename internal::ref_selector::type Nested; + typedef typename internal::remove_all::type NestedExpression; + + explicit EIGEN_DEVICE_FUNC Inverse(const XprType &xpr) + : m_xpr(xpr) + {} + + EIGEN_DEVICE_FUNC Index rows() const { return m_xpr.rows(); } + EIGEN_DEVICE_FUNC Index cols() const { return m_xpr.cols(); } + + EIGEN_DEVICE_FUNC const XprTypeNestedCleaned& nestedExpression() const { return m_xpr; } + +protected: + XprTypeNested m_xpr; +}; + +// Generic API dispatcher +template +class InverseImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; + typedef typename XprType::Scalar Scalar; +private: + + Scalar coeff(Index row, Index col) const; + Scalar coeff(Index i) const; +}; + +namespace internal { + +/** \internal + * \brief Default evaluator for Inverse expression. + * + * This default evaluator for Inverse expression simply evaluate the inverse into a temporary + * by a call to internal::call_assignment_no_alias. + * Therefore, inverse implementers only have to specialize Assignment, ...> for + * there own nested expression. + * + * \sa class Inverse + */ +template +struct unary_evaluator > + : public evaluator::PlainObject> +{ + typedef Inverse InverseType; + typedef typename InverseType::PlainObject PlainObject; + typedef evaluator Base; + + enum { Flags = Base::Flags | EvalBeforeNestingBit }; + + unary_evaluator(const InverseType& inv_xpr) + : m_result(inv_xpr.rows(), inv_xpr.cols()) + { + ::new (static_cast(this)) Base(m_result); + internal::call_assignment_no_alias(m_result, inv_xpr); + } + +protected: + PlainObject m_result; +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_INVERSE_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Map.h b/simulation/externals/eigen/Eigen/src/Core/Map.h new file mode 100644 index 0000000..06d1967 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Map.h @@ -0,0 +1,164 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007-2010 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MAP_H +#define EIGEN_MAP_H + +namespace Eigen { + +namespace internal { +template +struct traits > + : public traits +{ + typedef traits TraitsBase; + enum { + InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0 + ? int(PlainObjectType::InnerStrideAtCompileTime) + : int(StrideType::InnerStrideAtCompileTime), + OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 + ? int(PlainObjectType::OuterStrideAtCompileTime) + : int(StrideType::OuterStrideAtCompileTime), + Alignment = int(MapOptions)&int(AlignedMask), + Flags0 = TraitsBase::Flags & (~NestByRefBit), + Flags = is_lvalue::value ? int(Flags0) : (int(Flags0) & ~LvalueBit) + }; +private: + enum { Options }; // Expressions don't have Options +}; +} + +/** \class Map + * \ingroup Core_Module + * + * \brief A matrix or vector expression mapping an existing array of data. + * + * \tparam PlainObjectType the equivalent matrix type of the mapped data + * \tparam MapOptions specifies the pointer alignment in bytes. It can be: \c #Aligned128, , \c #Aligned64, \c #Aligned32, \c #Aligned16, \c #Aligned8 or \c #Unaligned. + * The default is \c #Unaligned. + * \tparam StrideType optionally specifies strides. By default, Map assumes the memory layout + * of an ordinary, contiguous array. This can be overridden by specifying strides. + * The type passed here must be a specialization of the Stride template, see examples below. + * + * This class represents a matrix or vector expression mapping an existing array of data. + * It can be used to let Eigen interface without any overhead with non-Eigen data structures, + * such as plain C arrays or structures from other libraries. By default, it assumes that the + * data is laid out contiguously in memory. You can however override this by explicitly specifying + * inner and outer strides. + * + * Here's an example of simply mapping a contiguous array as a \ref TopicStorageOrders "column-major" matrix: + * \include Map_simple.cpp + * Output: \verbinclude Map_simple.out + * + * If you need to map non-contiguous arrays, you can do so by specifying strides: + * + * Here's an example of mapping an array as a vector, specifying an inner stride, that is, the pointer + * increment between two consecutive coefficients. Here, we're specifying the inner stride as a compile-time + * fixed value. + * \include Map_inner_stride.cpp + * Output: \verbinclude Map_inner_stride.out + * + * Here's an example of mapping an array while specifying an outer stride. Here, since we're mapping + * as a column-major matrix, 'outer stride' means the pointer increment between two consecutive columns. + * Here, we're specifying the outer stride as a runtime parameter. Note that here \c OuterStride<> is + * a short version of \c OuterStride because the default template parameter of OuterStride + * is \c Dynamic + * \include Map_outer_stride.cpp + * Output: \verbinclude Map_outer_stride.out + * + * For more details and for an example of specifying both an inner and an outer stride, see class Stride. + * + * \b Tip: to change the array of data mapped by a Map object, you can use the C++ + * placement new syntax: + * + * Example: \include Map_placement_new.cpp + * Output: \verbinclude Map_placement_new.out + * + * This class is the return type of PlainObjectBase::Map() but can also be used directly. + * + * \sa PlainObjectBase::Map(), \ref TopicStorageOrders + */ +template class Map + : public MapBase > +{ + public: + + typedef MapBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Map) + + typedef typename Base::PointerType PointerType; + typedef PointerType PointerArgType; + EIGEN_DEVICE_FUNC + inline PointerType cast_to_pointer_type(PointerArgType ptr) { return ptr; } + + EIGEN_DEVICE_FUNC + inline Index innerStride() const + { + return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1; + } + + EIGEN_DEVICE_FUNC + inline Index outerStride() const + { + return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer() + : IsVectorAtCompileTime ? this->size() + : int(Flags)&RowMajorBit ? this->cols() + : this->rows(); + } + + /** Constructor in the fixed-size case. + * + * \param dataPtr pointer to the array to map + * \param stride optional Stride object, passing the strides. + */ + EIGEN_DEVICE_FUNC + explicit inline Map(PointerArgType dataPtr, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr)), m_stride(stride) + { + PlainObjectType::Base::_check_template_params(); + } + + /** Constructor in the dynamic-size vector case. + * + * \param dataPtr pointer to the array to map + * \param size the size of the vector expression + * \param stride optional Stride object, passing the strides. + */ + EIGEN_DEVICE_FUNC + inline Map(PointerArgType dataPtr, Index size, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr), size), m_stride(stride) + { + PlainObjectType::Base::_check_template_params(); + } + + /** Constructor in the dynamic-size matrix case. + * + * \param dataPtr pointer to the array to map + * \param rows the number of rows of the matrix expression + * \param cols the number of columns of the matrix expression + * \param stride optional Stride object, passing the strides. + */ + EIGEN_DEVICE_FUNC + inline Map(PointerArgType dataPtr, Index rows, Index cols, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr), rows, cols), m_stride(stride) + { + PlainObjectType::Base::_check_template_params(); + } + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Map) + + protected: + StrideType m_stride; +}; + + +} // end namespace Eigen + +#endif // EIGEN_MAP_H diff --git a/simulation/externals/eigen/Eigen/src/Core/MapBase.h b/simulation/externals/eigen/Eigen/src/Core/MapBase.h new file mode 100644 index 0000000..020f939 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/MapBase.h @@ -0,0 +1,299 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2007-2010 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MAPBASE_H +#define EIGEN_MAPBASE_H + +#define EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) \ + EIGEN_STATIC_ASSERT((int(internal::evaluator::Flags) & LinearAccessBit) || Derived::IsVectorAtCompileTime, \ + YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT) + +namespace Eigen { + +/** \ingroup Core_Module + * + * \brief Base class for dense Map and Block expression with direct access + * + * This base class provides the const low-level accessors (e.g. coeff, coeffRef) of dense + * Map and Block objects with direct access. + * Typical users do not have to directly deal with this class. + * + * This class can be extended by through the macro plugin \c EIGEN_MAPBASE_PLUGIN. + * See \link TopicCustomizing_Plugins customizing Eigen \endlink for details. + * + * The \c Derived class has to provide the following two methods describing the memory layout: + * \code Index innerStride() const; \endcode + * \code Index outerStride() const; \endcode + * + * \sa class Map, class Block + */ +template class MapBase + : public internal::dense_xpr_base::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + enum { + RowsAtCompileTime = internal::traits::RowsAtCompileTime, + ColsAtCompileTime = internal::traits::ColsAtCompileTime, + SizeAtCompileTime = Base::SizeAtCompileTime + }; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + typedef typename internal::conditional< + bool(internal::is_lvalue::value), + Scalar *, + const Scalar *>::type + PointerType; + + using Base::derived; +// using Base::RowsAtCompileTime; +// using Base::ColsAtCompileTime; +// using Base::SizeAtCompileTime; + using Base::MaxRowsAtCompileTime; + using Base::MaxColsAtCompileTime; + using Base::MaxSizeAtCompileTime; + using Base::IsVectorAtCompileTime; + using Base::Flags; + using Base::IsRowMajor; + + using Base::rows; + using Base::cols; + using Base::size; + using Base::coeff; + using Base::coeffRef; + using Base::lazyAssign; + using Base::eval; + + using Base::innerStride; + using Base::outerStride; + using Base::rowStride; + using Base::colStride; + + // bug 217 - compile error on ICC 11.1 + using Base::operator=; + + typedef typename Base::CoeffReturnType CoeffReturnType; + + /** \copydoc DenseBase::rows() */ + EIGEN_DEVICE_FUNC inline Index rows() const { return m_rows.value(); } + /** \copydoc DenseBase::cols() */ + EIGEN_DEVICE_FUNC inline Index cols() const { return m_cols.value(); } + + /** Returns a pointer to the first coefficient of the matrix or vector. + * + * \note When addressing this data, make sure to honor the strides returned by innerStride() and outerStride(). + * + * \sa innerStride(), outerStride() + */ + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return m_data; } + + /** \copydoc PlainObjectBase::coeff(Index,Index) const */ + EIGEN_DEVICE_FUNC + inline const Scalar& coeff(Index rowId, Index colId) const + { + return m_data[colId * colStride() + rowId * rowStride()]; + } + + /** \copydoc PlainObjectBase::coeff(Index) const */ + EIGEN_DEVICE_FUNC + inline const Scalar& coeff(Index index) const + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + return m_data[index * innerStride()]; + } + + /** \copydoc PlainObjectBase::coeffRef(Index,Index) const */ + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const + { + return this->m_data[colId * colStride() + rowId * rowStride()]; + } + + /** \copydoc PlainObjectBase::coeffRef(Index) const */ + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index index) const + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + return this->m_data[index * innerStride()]; + } + + /** \internal */ + template + inline PacketScalar packet(Index rowId, Index colId) const + { + return internal::ploadt + (m_data + (colId * colStride() + rowId * rowStride())); + } + + /** \internal */ + template + inline PacketScalar packet(Index index) const + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + return internal::ploadt(m_data + index * innerStride()); + } + + /** \internal Constructor for fixed size matrices or vectors */ + EIGEN_DEVICE_FUNC + explicit inline MapBase(PointerType dataPtr) : m_data(dataPtr), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime) + { + EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) + checkSanity(); + } + + /** \internal Constructor for dynamically sized vectors */ + EIGEN_DEVICE_FUNC + inline MapBase(PointerType dataPtr, Index vecSize) + : m_data(dataPtr), + m_rows(RowsAtCompileTime == Dynamic ? vecSize : Index(RowsAtCompileTime)), + m_cols(ColsAtCompileTime == Dynamic ? vecSize : Index(ColsAtCompileTime)) + { + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) + eigen_assert(vecSize >= 0); + eigen_assert(dataPtr == 0 || SizeAtCompileTime == Dynamic || SizeAtCompileTime == vecSize); + checkSanity(); + } + + /** \internal Constructor for dynamically sized matrices */ + EIGEN_DEVICE_FUNC + inline MapBase(PointerType dataPtr, Index rows, Index cols) + : m_data(dataPtr), m_rows(rows), m_cols(cols) + { + eigen_assert( (dataPtr == 0) + || ( rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) + && cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols))); + checkSanity(); + } + + #ifdef EIGEN_MAPBASE_PLUGIN + #include EIGEN_MAPBASE_PLUGIN + #endif + + protected: + + template + EIGEN_DEVICE_FUNC + void checkSanity(typename internal::enable_if<(internal::traits::Alignment>0),void*>::type = 0) const + { +#if EIGEN_MAX_ALIGN_BYTES>0 + eigen_assert(( ((internal::UIntPtr(m_data) % internal::traits::Alignment) == 0) + || (cols() * rows() * innerStride() * sizeof(Scalar)) < internal::traits::Alignment ) && "data is not aligned"); +#endif + } + + template + EIGEN_DEVICE_FUNC + void checkSanity(typename internal::enable_if::Alignment==0,void*>::type = 0) const + {} + + PointerType m_data; + const internal::variable_if_dynamic m_rows; + const internal::variable_if_dynamic m_cols; +}; + +/** \ingroup Core_Module + * + * \brief Base class for non-const dense Map and Block expression with direct access + * + * This base class provides the non-const low-level accessors (e.g. coeff and coeffRef) of + * dense Map and Block objects with direct access. + * It inherits MapBase which defines the const variant for reading specific entries. + * + * \sa class Map, class Block + */ +template class MapBase + : public MapBase +{ + typedef MapBase ReadOnlyMapBase; + public: + + typedef MapBase Base; + + typedef typename Base::Scalar Scalar; + typedef typename Base::PacketScalar PacketScalar; + typedef typename Base::StorageIndex StorageIndex; + typedef typename Base::PointerType PointerType; + + using Base::derived; + using Base::rows; + using Base::cols; + using Base::size; + using Base::coeff; + using Base::coeffRef; + + using Base::innerStride; + using Base::outerStride; + using Base::rowStride; + using Base::colStride; + + typedef typename internal::conditional< + internal::is_lvalue::value, + Scalar, + const Scalar + >::type ScalarWithConstIfNotLvalue; + + EIGEN_DEVICE_FUNC + inline const Scalar* data() const { return this->m_data; } + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue* data() { return this->m_data; } // no const-cast here so non-const-correct code will give a compile error + + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue& coeffRef(Index row, Index col) + { + return this->m_data[col * colStride() + row * rowStride()]; + } + + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue& coeffRef(Index index) + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + return this->m_data[index * innerStride()]; + } + + template + inline void writePacket(Index row, Index col, const PacketScalar& val) + { + internal::pstoret + (this->m_data + (col * colStride() + row * rowStride()), val); + } + + template + inline void writePacket(Index index, const PacketScalar& val) + { + EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) + internal::pstoret + (this->m_data + index * innerStride(), val); + } + + EIGEN_DEVICE_FUNC explicit inline MapBase(PointerType dataPtr) : Base(dataPtr) {} + EIGEN_DEVICE_FUNC inline MapBase(PointerType dataPtr, Index vecSize) : Base(dataPtr, vecSize) {} + EIGEN_DEVICE_FUNC inline MapBase(PointerType dataPtr, Index rows, Index cols) : Base(dataPtr, rows, cols) {} + + EIGEN_DEVICE_FUNC + Derived& operator=(const MapBase& other) + { + ReadOnlyMapBase::Base::operator=(other); + return derived(); + } + + // In theory we could simply refer to Base:Base::operator=, but MSVC does not like Base::Base, + // see bugs 821 and 920. + using ReadOnlyMapBase::Base::operator=; +}; + +#undef EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS + +} // end namespace Eigen + +#endif // EIGEN_MAPBASE_H diff --git a/simulation/externals/eigen/Eigen/src/Core/MathFunctions.h b/simulation/externals/eigen/Eigen/src/Core/MathFunctions.h new file mode 100644 index 0000000..a648aa0 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/MathFunctions.h @@ -0,0 +1,1431 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MATHFUNCTIONS_H +#define EIGEN_MATHFUNCTIONS_H + +// source: http://www.geom.uiuc.edu/~huberty/math5337/groupe/digits.html +// TODO this should better be moved to NumTraits +#define EIGEN_PI 3.141592653589793238462643383279502884197169399375105820974944592307816406L + + +namespace Eigen { + +// On WINCE, std::abs is defined for int only, so let's defined our own overloads: +// This issue has been confirmed with MSVC 2008 only, but the issue might exist for more recent versions too. +#if EIGEN_OS_WINCE && EIGEN_COMP_MSVC && EIGEN_COMP_MSVC<=1500 +long abs(long x) { return (labs(x)); } +double abs(double x) { return (fabs(x)); } +float abs(float x) { return (fabsf(x)); } +long double abs(long double x) { return (fabsl(x)); } +#endif + +namespace internal { + +/** \internal \class global_math_functions_filtering_base + * + * What it does: + * Defines a typedef 'type' as follows: + * - if type T has a member typedef Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl, then + * global_math_functions_filtering_base::type is a typedef for it. + * - otherwise, global_math_functions_filtering_base::type is a typedef for T. + * + * How it's used: + * To allow to defined the global math functions (like sin...) in certain cases, like the Array expressions. + * When you do sin(array1+array2), the object array1+array2 has a complicated expression type, all what you want to know + * is that it inherits ArrayBase. So we implement a partial specialization of sin_impl for ArrayBase. + * So we must make sure to use sin_impl > and not sin_impl, otherwise our partial specialization + * won't be used. How does sin know that? That's exactly what global_math_functions_filtering_base tells it. + * + * How it's implemented: + * SFINAE in the style of enable_if. Highly susceptible of breaking compilers. With GCC, it sure does work, but if you replace + * the typename dummy by an integer template parameter, it doesn't work anymore! + */ + +template +struct global_math_functions_filtering_base +{ + typedef T type; +}; + +template struct always_void { typedef void type; }; + +template +struct global_math_functions_filtering_base + ::type + > +{ + typedef typename T::Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl type; +}; + +#define EIGEN_MATHFUNC_IMPL(func, scalar) Eigen::internal::func##_impl::type> +#define EIGEN_MATHFUNC_RETVAL(func, scalar) typename Eigen::internal::func##_retval::type>::type + +/**************************************************************************** +* Implementation of real * +****************************************************************************/ + +template::IsComplex> +struct real_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return x; + } +}; + +template +struct real_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + using std::real; + return real(x); + } +}; + +template struct real_impl : real_default_impl {}; + +#ifdef __CUDA_ARCH__ +template +struct real_impl > +{ + typedef T RealScalar; + EIGEN_DEVICE_FUNC + static inline T run(const std::complex& x) + { + return x.real(); + } +}; +#endif + +template +struct real_retval +{ + typedef typename NumTraits::Real type; +}; + +/**************************************************************************** +* Implementation of imag * +****************************************************************************/ + +template::IsComplex> +struct imag_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar&) + { + return RealScalar(0); + } +}; + +template +struct imag_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + using std::imag; + return imag(x); + } +}; + +template struct imag_impl : imag_default_impl {}; + +#ifdef __CUDA_ARCH__ +template +struct imag_impl > +{ + typedef T RealScalar; + EIGEN_DEVICE_FUNC + static inline T run(const std::complex& x) + { + return x.imag(); + } +}; +#endif + +template +struct imag_retval +{ + typedef typename NumTraits::Real type; +}; + +/**************************************************************************** +* Implementation of real_ref * +****************************************************************************/ + +template +struct real_ref_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar& run(Scalar& x) + { + return reinterpret_cast(&x)[0]; + } + EIGEN_DEVICE_FUNC + static inline const RealScalar& run(const Scalar& x) + { + return reinterpret_cast(&x)[0]; + } +}; + +template +struct real_ref_retval +{ + typedef typename NumTraits::Real & type; +}; + +/**************************************************************************** +* Implementation of imag_ref * +****************************************************************************/ + +template +struct imag_ref_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar& run(Scalar& x) + { + return reinterpret_cast(&x)[1]; + } + EIGEN_DEVICE_FUNC + static inline const RealScalar& run(const Scalar& x) + { + return reinterpret_cast(&x)[1]; + } +}; + +template +struct imag_ref_default_impl +{ + EIGEN_DEVICE_FUNC + static inline Scalar run(Scalar&) + { + return Scalar(0); + } + EIGEN_DEVICE_FUNC + static inline const Scalar run(const Scalar&) + { + return Scalar(0); + } +}; + +template +struct imag_ref_impl : imag_ref_default_impl::IsComplex> {}; + +template +struct imag_ref_retval +{ + typedef typename NumTraits::Real & type; +}; + +/**************************************************************************** +* Implementation of conj * +****************************************************************************/ + +template::IsComplex> +struct conj_impl +{ + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) + { + return x; + } +}; + +template +struct conj_impl +{ + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) + { + using std::conj; + return conj(x); + } +}; + +template +struct conj_retval +{ + typedef Scalar type; +}; + +/**************************************************************************** +* Implementation of abs2 * +****************************************************************************/ + +template +struct abs2_impl_default +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return x*x; + } +}; + +template +struct abs2_impl_default // IsComplex +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return real(x)*real(x) + imag(x)*imag(x); + } +}; + +template +struct abs2_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return abs2_impl_default::IsComplex>::run(x); + } +}; + +template +struct abs2_retval +{ + typedef typename NumTraits::Real type; +}; + +/**************************************************************************** +* Implementation of norm1 * +****************************************************************************/ + +template +struct norm1_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + EIGEN_USING_STD_MATH(abs); + return abs(real(x)) + abs(imag(x)); + } +}; + +template +struct norm1_default_impl +{ + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) + { + EIGEN_USING_STD_MATH(abs); + return abs(x); + } +}; + +template +struct norm1_impl : norm1_default_impl::IsComplex> {}; + +template +struct norm1_retval +{ + typedef typename NumTraits::Real type; +}; + +/**************************************************************************** +* Implementation of hypot * +****************************************************************************/ + +template +struct hypot_impl +{ + typedef typename NumTraits::Real RealScalar; + static inline RealScalar run(const Scalar& x, const Scalar& y) + { + EIGEN_USING_STD_MATH(abs); + EIGEN_USING_STD_MATH(sqrt); + RealScalar _x = abs(x); + RealScalar _y = abs(y); + Scalar p, qp; + if(_x>_y) + { + p = _x; + qp = _y / p; + } + else + { + p = _y; + qp = _x / p; + } + if(p==RealScalar(0)) return RealScalar(0); + return p * sqrt(RealScalar(1) + qp*qp); + } +}; + +template +struct hypot_retval +{ + typedef typename NumTraits::Real type; +}; + +/**************************************************************************** +* Implementation of cast * +****************************************************************************/ + +template +struct cast_impl +{ + EIGEN_DEVICE_FUNC + static inline NewType run(const OldType& x) + { + return static_cast(x); + } +}; + +// here, for once, we're plainly returning NewType: we don't want cast to do weird things. + +template +EIGEN_DEVICE_FUNC +inline NewType cast(const OldType& x) +{ + return cast_impl::run(x); +} + +/**************************************************************************** +* Implementation of round * +****************************************************************************/ + +#if EIGEN_HAS_CXX11_MATH + template + struct round_impl { + static inline Scalar run(const Scalar& x) + { + EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) + using std::round; + return round(x); + } + }; +#else + template + struct round_impl + { + static inline Scalar run(const Scalar& x) + { + EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) + EIGEN_USING_STD_MATH(floor); + EIGEN_USING_STD_MATH(ceil); + return (x > Scalar(0)) ? floor(x + Scalar(0.5)) : ceil(x - Scalar(0.5)); + } + }; +#endif + +template +struct round_retval +{ + typedef Scalar type; +}; + +/**************************************************************************** +* Implementation of arg * +****************************************************************************/ + +#if EIGEN_HAS_CXX11_MATH + template + struct arg_impl { + static inline Scalar run(const Scalar& x) + { + EIGEN_USING_STD_MATH(arg); + return arg(x); + } + }; +#else + template::IsComplex> + struct arg_default_impl + { + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return (x < Scalar(0)) ? Scalar(EIGEN_PI) : Scalar(0); } + }; + + template + struct arg_default_impl + { + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + EIGEN_USING_STD_MATH(arg); + return arg(x); + } + }; + + template struct arg_impl : arg_default_impl {}; +#endif + +template +struct arg_retval +{ + typedef typename NumTraits::Real type; +}; + +/**************************************************************************** +* Implementation of log1p * +****************************************************************************/ + +namespace std_fallback { + // fallback log1p implementation in case there is no log1p(Scalar) function in namespace of Scalar, + // or that there is no suitable std::log1p function available + template + EIGEN_DEVICE_FUNC inline Scalar log1p(const Scalar& x) { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + typedef typename NumTraits::Real RealScalar; + EIGEN_USING_STD_MATH(log); + Scalar x1p = RealScalar(1) + x; + return ( x1p == Scalar(1) ) ? x : x * ( log(x1p) / (x1p - RealScalar(1)) ); + } +} + +template +struct log1p_impl { + static inline Scalar run(const Scalar& x) + { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + #if EIGEN_HAS_CXX11_MATH + using std::log1p; + #endif + using std_fallback::log1p; + return log1p(x); + } +}; + + +template +struct log1p_retval +{ + typedef Scalar type; +}; + +/**************************************************************************** +* Implementation of pow * +****************************************************************************/ + +template::IsInteger&&NumTraits::IsInteger> +struct pow_impl +{ + //typedef Scalar retval; + typedef typename ScalarBinaryOpTraits >::ReturnType result_type; + static EIGEN_DEVICE_FUNC inline result_type run(const ScalarX& x, const ScalarY& y) + { + EIGEN_USING_STD_MATH(pow); + return pow(x, y); + } +}; + +template +struct pow_impl +{ + typedef ScalarX result_type; + static EIGEN_DEVICE_FUNC inline ScalarX run(ScalarX x, ScalarY y) + { + ScalarX res(1); + eigen_assert(!NumTraits::IsSigned || y >= 0); + if(y & 1) res *= x; + y >>= 1; + while(y) + { + x *= x; + if(y&1) res *= x; + y >>= 1; + } + return res; + } +}; + +/**************************************************************************** +* Implementation of random * +****************************************************************************/ + +template +struct random_default_impl {}; + +template +struct random_impl : random_default_impl::IsComplex, NumTraits::IsInteger> {}; + +template +struct random_retval +{ + typedef Scalar type; +}; + +template inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(const Scalar& x, const Scalar& y); +template inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(); + +template +struct random_default_impl +{ + static inline Scalar run(const Scalar& x, const Scalar& y) + { + return x + (y-x) * Scalar(std::rand()) / Scalar(RAND_MAX); + } + static inline Scalar run() + { + return run(Scalar(NumTraits::IsSigned ? -1 : 0), Scalar(1)); + } +}; + +enum { + meta_floor_log2_terminate, + meta_floor_log2_move_up, + meta_floor_log2_move_down, + meta_floor_log2_bogus +}; + +template struct meta_floor_log2_selector +{ + enum { middle = (lower + upper) / 2, + value = (upper <= lower + 1) ? int(meta_floor_log2_terminate) + : (n < (1 << middle)) ? int(meta_floor_log2_move_down) + : (n==0) ? int(meta_floor_log2_bogus) + : int(meta_floor_log2_move_up) + }; +}; + +template::value> +struct meta_floor_log2 {}; + +template +struct meta_floor_log2 +{ + enum { value = meta_floor_log2::middle>::value }; +}; + +template +struct meta_floor_log2 +{ + enum { value = meta_floor_log2::middle, upper>::value }; +}; + +template +struct meta_floor_log2 +{ + enum { value = (n >= ((unsigned int)(1) << (lower+1))) ? lower+1 : lower }; +}; + +template +struct meta_floor_log2 +{ + // no value, error at compile time +}; + +template +struct random_default_impl +{ + static inline Scalar run(const Scalar& x, const Scalar& y) + { + typedef typename conditional::IsSigned,std::ptrdiff_t,std::size_t>::type ScalarX; + if(y=x the result converted to an unsigned long is still correct. + std::size_t range = ScalarX(y)-ScalarX(x); + std::size_t offset = 0; + // rejection sampling + std::size_t divisor = 1; + std::size_t multiplier = 1; + if(range range); + return Scalar(ScalarX(x) + offset); + } + + static inline Scalar run() + { +#ifdef EIGEN_MAKING_DOCS + return run(Scalar(NumTraits::IsSigned ? -10 : 0), Scalar(10)); +#else + enum { rand_bits = meta_floor_log2<(unsigned int)(RAND_MAX)+1>::value, + scalar_bits = sizeof(Scalar) * CHAR_BIT, + shift = EIGEN_PLAIN_ENUM_MAX(0, int(rand_bits) - int(scalar_bits)), + offset = NumTraits::IsSigned ? (1 << (EIGEN_PLAIN_ENUM_MIN(rand_bits,scalar_bits)-1)) : 0 + }; + return Scalar((std::rand() >> shift) - offset); +#endif + } +}; + +template +struct random_default_impl +{ + static inline Scalar run(const Scalar& x, const Scalar& y) + { + return Scalar(random(real(x), real(y)), + random(imag(x), imag(y))); + } + static inline Scalar run() + { + typedef typename NumTraits::Real RealScalar; + return Scalar(random(), random()); + } +}; + +template +inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random(const Scalar& x, const Scalar& y) +{ + return EIGEN_MATHFUNC_IMPL(random, Scalar)::run(x, y); +} + +template +inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random() +{ + return EIGEN_MATHFUNC_IMPL(random, Scalar)::run(); +} + +// Implementatin of is* functions + +// std::is* do not work with fast-math and gcc, std::is* are available on MSVC 2013 and newer, as well as in clang. +#if (EIGEN_HAS_CXX11_MATH && !(EIGEN_COMP_GNUC_STRICT && __FINITE_MATH_ONLY__)) || (EIGEN_COMP_MSVC>=1800) || (EIGEN_COMP_CLANG) +#define EIGEN_USE_STD_FPCLASSIFY 1 +#else +#define EIGEN_USE_STD_FPCLASSIFY 0 +#endif + +template +EIGEN_DEVICE_FUNC +typename internal::enable_if::value,bool>::type +isnan_impl(const T&) { return false; } + +template +EIGEN_DEVICE_FUNC +typename internal::enable_if::value,bool>::type +isinf_impl(const T&) { return false; } + +template +EIGEN_DEVICE_FUNC +typename internal::enable_if::value,bool>::type +isfinite_impl(const T&) { return true; } + +template +EIGEN_DEVICE_FUNC +typename internal::enable_if<(!internal::is_integral::value)&&(!NumTraits::IsComplex),bool>::type +isfinite_impl(const T& x) +{ + #ifdef __CUDA_ARCH__ + return (::isfinite)(x); + #elif EIGEN_USE_STD_FPCLASSIFY + using std::isfinite; + return isfinite EIGEN_NOT_A_MACRO (x); + #else + return x<=NumTraits::highest() && x>=NumTraits::lowest(); + #endif +} + +template +EIGEN_DEVICE_FUNC +typename internal::enable_if<(!internal::is_integral::value)&&(!NumTraits::IsComplex),bool>::type +isinf_impl(const T& x) +{ + #ifdef __CUDA_ARCH__ + return (::isinf)(x); + #elif EIGEN_USE_STD_FPCLASSIFY + using std::isinf; + return isinf EIGEN_NOT_A_MACRO (x); + #else + return x>NumTraits::highest() || x::lowest(); + #endif +} + +template +EIGEN_DEVICE_FUNC +typename internal::enable_if<(!internal::is_integral::value)&&(!NumTraits::IsComplex),bool>::type +isnan_impl(const T& x) +{ + #ifdef __CUDA_ARCH__ + return (::isnan)(x); + #elif EIGEN_USE_STD_FPCLASSIFY + using std::isnan; + return isnan EIGEN_NOT_A_MACRO (x); + #else + return x != x; + #endif +} + +#if (!EIGEN_USE_STD_FPCLASSIFY) + +#if EIGEN_COMP_MSVC + +template EIGEN_DEVICE_FUNC bool isinf_msvc_helper(T x) +{ + return _fpclass(x)==_FPCLASS_NINF || _fpclass(x)==_FPCLASS_PINF; +} + +//MSVC defines a _isnan builtin function, but for double only +EIGEN_DEVICE_FUNC inline bool isnan_impl(const long double& x) { return _isnan(x)!=0; } +EIGEN_DEVICE_FUNC inline bool isnan_impl(const double& x) { return _isnan(x)!=0; } +EIGEN_DEVICE_FUNC inline bool isnan_impl(const float& x) { return _isnan(x)!=0; } + +EIGEN_DEVICE_FUNC inline bool isinf_impl(const long double& x) { return isinf_msvc_helper(x); } +EIGEN_DEVICE_FUNC inline bool isinf_impl(const double& x) { return isinf_msvc_helper(x); } +EIGEN_DEVICE_FUNC inline bool isinf_impl(const float& x) { return isinf_msvc_helper(x); } + +#elif (defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ && EIGEN_COMP_GNUC) + +#if EIGEN_GNUC_AT_LEAST(5,0) + #define EIGEN_TMP_NOOPT_ATTRIB EIGEN_DEVICE_FUNC inline __attribute__((optimize("no-finite-math-only"))) +#else + // NOTE the inline qualifier and noinline attribute are both needed: the former is to avoid linking issue (duplicate symbol), + // while the second prevent too aggressive optimizations in fast-math mode: + #define EIGEN_TMP_NOOPT_ATTRIB EIGEN_DEVICE_FUNC inline __attribute__((noinline,optimize("no-finite-math-only"))) +#endif + +template<> EIGEN_TMP_NOOPT_ATTRIB bool isnan_impl(const long double& x) { return __builtin_isnan(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isnan_impl(const double& x) { return __builtin_isnan(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isnan_impl(const float& x) { return __builtin_isnan(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isinf_impl(const double& x) { return __builtin_isinf(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isinf_impl(const float& x) { return __builtin_isinf(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isinf_impl(const long double& x) { return __builtin_isinf(x); } + +#undef EIGEN_TMP_NOOPT_ATTRIB + +#endif + +#endif + +// The following overload are defined at the end of this file +template EIGEN_DEVICE_FUNC bool isfinite_impl(const std::complex& x); +template EIGEN_DEVICE_FUNC bool isnan_impl(const std::complex& x); +template EIGEN_DEVICE_FUNC bool isinf_impl(const std::complex& x); + +template T generic_fast_tanh_float(const T& a_x); + +} // end namespace internal + +/**************************************************************************** +* Generic math functions * +****************************************************************************/ + +namespace numext { + +#ifndef __CUDA_ARCH__ +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T mini(const T& x, const T& y) +{ + EIGEN_USING_STD_MATH(min); + return min EIGEN_NOT_A_MACRO (x,y); +} + +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T maxi(const T& x, const T& y) +{ + EIGEN_USING_STD_MATH(max); + return max EIGEN_NOT_A_MACRO (x,y); +} +#else +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T mini(const T& x, const T& y) +{ + return y < x ? y : x; +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE float mini(const float& x, const float& y) +{ + return fminf(x, y); +} +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T maxi(const T& x, const T& y) +{ + return x < y ? y : x; +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE float maxi(const float& x, const float& y) +{ + return fmaxf(x, y); +} +#endif + + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(real, Scalar) real(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(real, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline typename internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar& x) +{ + return internal::real_ref_impl::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) real_ref(Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(real_ref, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(imag, Scalar) imag(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(imag, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(arg, Scalar) arg(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(arg, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline typename internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) >::type imag_ref(const Scalar& x) +{ + return internal::imag_ref_impl::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) imag_ref(Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(imag_ref, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(conj, Scalar) conj(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(conj, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(abs2, Scalar) abs2(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(abs2, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(norm1, Scalar) norm1(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(norm1, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(hypot, Scalar) hypot(const Scalar& x, const Scalar& y) +{ + return EIGEN_MATHFUNC_IMPL(hypot, Scalar)::run(x, y); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(log1p, Scalar) log1p(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(log1p, Scalar)::run(x); +} + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float log1p(const float &x) { return ::log1pf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double log1p(const double &x) { return ::log1p(x); } +#endif + +template +EIGEN_DEVICE_FUNC +inline typename internal::pow_impl::result_type pow(const ScalarX& x, const ScalarY& y) +{ + return internal::pow_impl::run(x, y); +} + +template EIGEN_DEVICE_FUNC bool (isnan) (const T &x) { return internal::isnan_impl(x); } +template EIGEN_DEVICE_FUNC bool (isinf) (const T &x) { return internal::isinf_impl(x); } +template EIGEN_DEVICE_FUNC bool (isfinite)(const T &x) { return internal::isfinite_impl(x); } + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(round, Scalar) round(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(round, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +T (floor)(const T& x) +{ + EIGEN_USING_STD_MATH(floor); + return floor(x); +} + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float floor(const float &x) { return ::floorf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double floor(const double &x) { return ::floor(x); } +#endif + +template +EIGEN_DEVICE_FUNC +T (ceil)(const T& x) +{ + EIGEN_USING_STD_MATH(ceil); + return ceil(x); +} + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float ceil(const float &x) { return ::ceilf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double ceil(const double &x) { return ::ceil(x); } +#endif + + +/** Log base 2 for 32 bits positive integers. + * Conveniently returns 0 for x==0. */ +inline int log2(int x) +{ + eigen_assert(x>=0); + unsigned int v(x); + static const int table[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 }; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + return table[(v * 0x07C4ACDDU) >> 27]; +} + +/** \returns the square root of \a x. + * + * It is essentially equivalent to \code using std::sqrt; return sqrt(x); \endcode, + * but slightly faster for float/double and some compilers (e.g., gcc), thanks to + * specializations when SSE is enabled. + * + * It's usage is justified in performance critical functions, like norm/normalize. + */ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T sqrt(const T &x) +{ + EIGEN_USING_STD_MATH(sqrt); + return sqrt(x); +} + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T log(const T &x) { + EIGEN_USING_STD_MATH(log); + return log(x); +} + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float log(const float &x) { return ::logf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double log(const double &x) { return ::log(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +typename internal::enable_if::IsSigned || NumTraits::IsComplex,typename NumTraits::Real>::type +abs(const T &x) { + EIGEN_USING_STD_MATH(abs); + return abs(x); +} + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +typename internal::enable_if::IsSigned || NumTraits::IsComplex),typename NumTraits::Real>::type +abs(const T &x) { + return x; +} + +#if defined(__SYCL_DEVICE_ONLY__) +EIGEN_ALWAYS_INLINE float abs(float x) { return cl::sycl::fabs(x); } +EIGEN_ALWAYS_INLINE double abs(double x) { return cl::sycl::fabs(x); } +#endif // defined(__SYCL_DEVICE_ONLY__) + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float abs(const float &x) { return ::fabsf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double abs(const double &x) { return ::fabs(x); } + +template <> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float abs(const std::complex& x) { + return ::hypotf(x.real(), x.imag()); +} + +template <> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double abs(const std::complex& x) { + return ::hypot(x.real(), x.imag()); +} +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T exp(const T &x) { + EIGEN_USING_STD_MATH(exp); + return exp(x); +} + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float exp(const float &x) { return ::expf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double exp(const double &x) { return ::exp(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T cos(const T &x) { + EIGEN_USING_STD_MATH(cos); + return cos(x); +} + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float cos(const float &x) { return ::cosf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double cos(const double &x) { return ::cos(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T sin(const T &x) { + EIGEN_USING_STD_MATH(sin); + return sin(x); +} + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float sin(const float &x) { return ::sinf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double sin(const double &x) { return ::sin(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T tan(const T &x) { + EIGEN_USING_STD_MATH(tan); + return tan(x); +} + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float tan(const float &x) { return ::tanf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double tan(const double &x) { return ::tan(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T acos(const T &x) { + EIGEN_USING_STD_MATH(acos); + return acos(x); +} + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float acos(const float &x) { return ::acosf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double acos(const double &x) { return ::acos(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T asin(const T &x) { + EIGEN_USING_STD_MATH(asin); + return asin(x); +} + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float asin(const float &x) { return ::asinf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double asin(const double &x) { return ::asin(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T atan(const T &x) { + EIGEN_USING_STD_MATH(atan); + return atan(x); +} + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float atan(const float &x) { return ::atanf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double atan(const double &x) { return ::atan(x); } +#endif + + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T cosh(const T &x) { + EIGEN_USING_STD_MATH(cosh); + return cosh(x); +} + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float cosh(const float &x) { return ::coshf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double cosh(const double &x) { return ::cosh(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T sinh(const T &x) { + EIGEN_USING_STD_MATH(sinh); + return sinh(x); +} + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float sinh(const float &x) { return ::sinhf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double sinh(const double &x) { return ::sinh(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T tanh(const T &x) { + EIGEN_USING_STD_MATH(tanh); + return tanh(x); +} + +#if (!defined(__CUDACC__)) && EIGEN_FAST_MATH +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float tanh(float x) { return internal::generic_fast_tanh_float(x); } +#endif + +#ifdef __CUDACC__ +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float tanh(const float &x) { return ::tanhf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double tanh(const double &x) { return ::tanh(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T fmod(const T& a, const T& b) { + EIGEN_USING_STD_MATH(fmod); + return fmod(a, b); +} + +#ifdef __CUDACC__ +template <> +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float fmod(const float& a, const float& b) { + return ::fmodf(a, b); +} + +template <> +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double fmod(const double& a, const double& b) { + return ::fmod(a, b); +} +#endif + +} // end namespace numext + +namespace internal { + +template +EIGEN_DEVICE_FUNC bool isfinite_impl(const std::complex& x) +{ + return (numext::isfinite)(numext::real(x)) && (numext::isfinite)(numext::imag(x)); +} + +template +EIGEN_DEVICE_FUNC bool isnan_impl(const std::complex& x) +{ + return (numext::isnan)(numext::real(x)) || (numext::isnan)(numext::imag(x)); +} + +template +EIGEN_DEVICE_FUNC bool isinf_impl(const std::complex& x) +{ + return ((numext::isinf)(numext::real(x)) || (numext::isinf)(numext::imag(x))) && (!(numext::isnan)(x)); +} + +/**************************************************************************** +* Implementation of fuzzy comparisons * +****************************************************************************/ + +template +struct scalar_fuzzy_default_impl {}; + +template +struct scalar_fuzzy_default_impl +{ + typedef typename NumTraits::Real RealScalar; + template EIGEN_DEVICE_FUNC + static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec) + { + return numext::abs(x) <= numext::abs(y) * prec; + } + EIGEN_DEVICE_FUNC + static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec) + { + return numext::abs(x - y) <= numext::mini(numext::abs(x), numext::abs(y)) * prec; + } + EIGEN_DEVICE_FUNC + static inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, const RealScalar& prec) + { + return x <= y || isApprox(x, y, prec); + } +}; + +template +struct scalar_fuzzy_default_impl +{ + typedef typename NumTraits::Real RealScalar; + template EIGEN_DEVICE_FUNC + static inline bool isMuchSmallerThan(const Scalar& x, const Scalar&, const RealScalar&) + { + return x == Scalar(0); + } + EIGEN_DEVICE_FUNC + static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar&) + { + return x == y; + } + EIGEN_DEVICE_FUNC + static inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, const RealScalar&) + { + return x <= y; + } +}; + +template +struct scalar_fuzzy_default_impl +{ + typedef typename NumTraits::Real RealScalar; + template EIGEN_DEVICE_FUNC + static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec) + { + return numext::abs2(x) <= numext::abs2(y) * prec * prec; + } + EIGEN_DEVICE_FUNC + static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec) + { + return numext::abs2(x - y) <= numext::mini(numext::abs2(x), numext::abs2(y)) * prec * prec; + } +}; + +template +struct scalar_fuzzy_impl : scalar_fuzzy_default_impl::IsComplex, NumTraits::IsInteger> {}; + +template EIGEN_DEVICE_FUNC +inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, + const typename NumTraits::Real &precision = NumTraits::dummy_precision()) +{ + return scalar_fuzzy_impl::template isMuchSmallerThan(x, y, precision); +} + +template EIGEN_DEVICE_FUNC +inline bool isApprox(const Scalar& x, const Scalar& y, + const typename NumTraits::Real &precision = NumTraits::dummy_precision()) +{ + return scalar_fuzzy_impl::isApprox(x, y, precision); +} + +template EIGEN_DEVICE_FUNC +inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, + const typename NumTraits::Real &precision = NumTraits::dummy_precision()) +{ + return scalar_fuzzy_impl::isApproxOrLessThan(x, y, precision); +} + +/****************************************** +*** The special case of the bool type *** +******************************************/ + +template<> struct random_impl +{ + static inline bool run() + { + return random(0,1)==0 ? false : true; + } +}; + +template<> struct scalar_fuzzy_impl +{ + typedef bool RealScalar; + + template EIGEN_DEVICE_FUNC + static inline bool isMuchSmallerThan(const bool& x, const bool&, const bool&) + { + return !x; + } + + EIGEN_DEVICE_FUNC + static inline bool isApprox(bool x, bool y, bool) + { + return x == y; + } + + EIGEN_DEVICE_FUNC + static inline bool isApproxOrLessThan(const bool& x, const bool& y, const bool&) + { + return (!x) || y; + } + +}; + + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_MATHFUNCTIONS_H diff --git a/simulation/externals/eigen/Eigen/src/Core/MathFunctionsImpl.h b/simulation/externals/eigen/Eigen/src/Core/MathFunctionsImpl.h new file mode 100644 index 0000000..3c9ef22 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/MathFunctionsImpl.h @@ -0,0 +1,78 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2014 Pedro Gonnet (pedro.gonnet@gmail.com) +// Copyright (C) 2016 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MATHFUNCTIONSIMPL_H +#define EIGEN_MATHFUNCTIONSIMPL_H + +namespace Eigen { + +namespace internal { + +/** \internal \returns the hyperbolic tan of \a a (coeff-wise) + Doesn't do anything fancy, just a 13/6-degree rational interpolant which + is accurate up to a couple of ulp in the range [-9, 9], outside of which + the tanh(x) = +/-1. + + This implementation works on both scalars and packets. +*/ +template +T generic_fast_tanh_float(const T& a_x) +{ + // Clamp the inputs to the range [-9, 9] since anything outside + // this range is +/-1.0f in single-precision. + const T plus_9 = pset1(9.f); + const T minus_9 = pset1(-9.f); + // NOTE GCC prior to 6.3 might improperly optimize this max/min + // step such that if a_x is nan, x will be either 9 or -9, + // and tanh will return 1 or -1 instead of nan. + // This is supposed to be fixed in gcc6.3, + // see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72867 + const T x = pmax(minus_9,pmin(plus_9,a_x)); + // The monomial coefficients of the numerator polynomial (odd). + const T alpha_1 = pset1(4.89352455891786e-03f); + const T alpha_3 = pset1(6.37261928875436e-04f); + const T alpha_5 = pset1(1.48572235717979e-05f); + const T alpha_7 = pset1(5.12229709037114e-08f); + const T alpha_9 = pset1(-8.60467152213735e-11f); + const T alpha_11 = pset1(2.00018790482477e-13f); + const T alpha_13 = pset1(-2.76076847742355e-16f); + + // The monomial coefficients of the denominator polynomial (even). + const T beta_0 = pset1(4.89352518554385e-03f); + const T beta_2 = pset1(2.26843463243900e-03f); + const T beta_4 = pset1(1.18534705686654e-04f); + const T beta_6 = pset1(1.19825839466702e-06f); + + // Since the polynomials are odd/even, we need x^2. + const T x2 = pmul(x, x); + + // Evaluate the numerator polynomial p. + T p = pmadd(x2, alpha_13, alpha_11); + p = pmadd(x2, p, alpha_9); + p = pmadd(x2, p, alpha_7); + p = pmadd(x2, p, alpha_5); + p = pmadd(x2, p, alpha_3); + p = pmadd(x2, p, alpha_1); + p = pmul(x, p); + + // Evaluate the denominator polynomial p. + T q = pmadd(x2, beta_6, beta_4); + q = pmadd(x2, q, beta_2); + q = pmadd(x2, q, beta_0); + + // Divide the numerator by the denominator. + return pdiv(p, q); +} + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_MATHFUNCTIONSIMPL_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Matrix.h b/simulation/externals/eigen/Eigen/src/Core/Matrix.h new file mode 100644 index 0000000..90c336d --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Matrix.h @@ -0,0 +1,461 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// Copyright (C) 2008-2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MATRIX_H +#define EIGEN_MATRIX_H + +namespace Eigen { + +namespace internal { +template +struct traits > +{ +private: + enum { size = internal::size_at_compile_time<_Rows,_Cols>::ret }; + typedef typename find_best_packet<_Scalar,size>::type PacketScalar; + enum { + row_major_bit = _Options&RowMajor ? RowMajorBit : 0, + is_dynamic_size_storage = _MaxRows==Dynamic || _MaxCols==Dynamic, + max_size = is_dynamic_size_storage ? Dynamic : _MaxRows*_MaxCols, + default_alignment = compute_default_alignment<_Scalar,max_size>::value, + actual_alignment = ((_Options&DontAlign)==0) ? default_alignment : 0, + required_alignment = unpacket_traits::alignment, + packet_access_bit = (packet_traits<_Scalar>::Vectorizable && (EIGEN_UNALIGNED_VECTORIZE || (actual_alignment>=required_alignment))) ? PacketAccessBit : 0 + }; + +public: + typedef _Scalar Scalar; + typedef Dense StorageKind; + typedef Eigen::Index StorageIndex; + typedef MatrixXpr XprKind; + enum { + RowsAtCompileTime = _Rows, + ColsAtCompileTime = _Cols, + MaxRowsAtCompileTime = _MaxRows, + MaxColsAtCompileTime = _MaxCols, + Flags = compute_matrix_flags<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::ret, + Options = _Options, + InnerStrideAtCompileTime = 1, + OuterStrideAtCompileTime = (Options&RowMajor) ? ColsAtCompileTime : RowsAtCompileTime, + + // FIXME, the following flag in only used to define NeedsToAlign in PlainObjectBase + EvaluatorFlags = LinearAccessBit | DirectAccessBit | packet_access_bit | row_major_bit, + Alignment = actual_alignment + }; +}; +} + +/** \class Matrix + * \ingroup Core_Module + * + * \brief The matrix class, also used for vectors and row-vectors + * + * The %Matrix class is the work-horse for all \em dense (\ref dense "note") matrices and vectors within Eigen. + * Vectors are matrices with one column, and row-vectors are matrices with one row. + * + * The %Matrix class encompasses \em both fixed-size and dynamic-size objects (\ref fixedsize "note"). + * + * The first three template parameters are required: + * \tparam _Scalar Numeric type, e.g. float, double, int or std::complex. + * User defined scalar types are supported as well (see \ref user_defined_scalars "here"). + * \tparam _Rows Number of rows, or \b Dynamic + * \tparam _Cols Number of columns, or \b Dynamic + * + * The remaining template parameters are optional -- in most cases you don't have to worry about them. + * \tparam _Options A combination of either \b #RowMajor or \b #ColMajor, and of either + * \b #AutoAlign or \b #DontAlign. + * The former controls \ref TopicStorageOrders "storage order", and defaults to column-major. The latter controls alignment, which is required + * for vectorization. It defaults to aligning matrices except for fixed sizes that aren't a multiple of the packet size. + * \tparam _MaxRows Maximum number of rows. Defaults to \a _Rows (\ref maxrows "note"). + * \tparam _MaxCols Maximum number of columns. Defaults to \a _Cols (\ref maxrows "note"). + * + * Eigen provides a number of typedefs covering the usual cases. Here are some examples: + * + * \li \c Matrix2d is a 2x2 square matrix of doubles (\c Matrix) + * \li \c Vector4f is a vector of 4 floats (\c Matrix) + * \li \c RowVector3i is a row-vector of 3 ints (\c Matrix) + * + * \li \c MatrixXf is a dynamic-size matrix of floats (\c Matrix) + * \li \c VectorXf is a dynamic-size vector of floats (\c Matrix) + * + * \li \c Matrix2Xf is a partially fixed-size (dynamic-size) matrix of floats (\c Matrix) + * \li \c MatrixX3d is a partially dynamic-size (fixed-size) matrix of double (\c Matrix) + * + * See \link matrixtypedefs this page \endlink for a complete list of predefined \em %Matrix and \em Vector typedefs. + * + * You can access elements of vectors and matrices using normal subscripting: + * + * \code + * Eigen::VectorXd v(10); + * v[0] = 0.1; + * v[1] = 0.2; + * v(0) = 0.3; + * v(1) = 0.4; + * + * Eigen::MatrixXi m(10, 10); + * m(0, 1) = 1; + * m(0, 2) = 2; + * m(0, 3) = 3; + * \endcode + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_MATRIX_PLUGIN. + * + * Some notes: + * + *
+ *
\anchor dense Dense versus sparse:
+ *
This %Matrix class handles dense, not sparse matrices and vectors. For sparse matrices and vectors, see the Sparse module. + * + * Dense matrices and vectors are plain usual arrays of coefficients. All the coefficients are stored, in an ordinary contiguous array. + * This is unlike Sparse matrices and vectors where the coefficients are stored as a list of nonzero coefficients.
+ * + *
\anchor fixedsize Fixed-size versus dynamic-size:
+ *
Fixed-size means that the numbers of rows and columns are known are compile-time. In this case, Eigen allocates the array + * of coefficients as a fixed-size array, as a class member. This makes sense for very small matrices, typically up to 4x4, sometimes up + * to 16x16. Larger matrices should be declared as dynamic-size even if one happens to know their size at compile-time. + * + * Dynamic-size means that the numbers of rows or columns are not necessarily known at compile-time. In this case they are runtime + * variables, and the array of coefficients is allocated dynamically on the heap. + * + * Note that \em dense matrices, be they Fixed-size or Dynamic-size, do not expand dynamically in the sense of a std::map. + * If you want this behavior, see the Sparse module.
+ * + *
\anchor maxrows _MaxRows and _MaxCols:
+ *
In most cases, one just leaves these parameters to the default values. + * These parameters mean the maximum size of rows and columns that the matrix may have. They are useful in cases + * when the exact numbers of rows and columns are not known are compile-time, but it is known at compile-time that they cannot + * exceed a certain value. This happens when taking dynamic-size blocks inside fixed-size matrices: in this case _MaxRows and _MaxCols + * are the dimensions of the original matrix, while _Rows and _Cols are Dynamic.
+ *
+ * + * ABI and storage layout + * + * The table below summarizes the ABI of some possible Matrix instances which is fixed thorough the lifetime of Eigen 3. + * + * + * + * + * + * + *
Matrix typeEquivalent C structure
\code Matrix \endcode\code + * struct { + * T *data; // with (size_t(data)%EIGEN_MAX_ALIGN_BYTES)==0 + * Eigen::Index rows, cols; + * }; + * \endcode
\code + * Matrix + * Matrix \endcode\code + * struct { + * T *data; // with (size_t(data)%EIGEN_MAX_ALIGN_BYTES)==0 + * Eigen::Index size; + * }; + * \endcode
\code Matrix \endcode\code + * struct { + * T data[Rows*Cols]; // with (size_t(data)%A(Rows*Cols*sizeof(T)))==0 + * }; + * \endcode
\code Matrix \endcode\code + * struct { + * T data[MaxRows*MaxCols]; // with (size_t(data)%A(MaxRows*MaxCols*sizeof(T)))==0 + * Eigen::Index rows, cols; + * }; + * \endcode
+ * Note that in this table Rows, Cols, MaxRows and MaxCols are all positive integers. A(S) is defined to the largest possible power-of-two + * smaller to EIGEN_MAX_STATIC_ALIGN_BYTES. + * + * \see MatrixBase for the majority of the API methods for matrices, \ref TopicClassHierarchy, + * \ref TopicStorageOrders + */ + +template +class Matrix + : public PlainObjectBase > +{ + public: + + /** \brief Base class typedef. + * \sa PlainObjectBase + */ + typedef PlainObjectBase Base; + + enum { Options = _Options }; + + EIGEN_DENSE_PUBLIC_INTERFACE(Matrix) + + typedef typename Base::PlainObject PlainObject; + + using Base::base; + using Base::coeffRef; + + /** + * \brief Assigns matrices to each other. + * + * \note This is a special case of the templated operator=. Its purpose is + * to prevent a default operator= from hiding the templated operator=. + * + * \callgraph + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix& operator=(const Matrix& other) + { + return Base::_set(other); + } + + /** \internal + * \brief Copies the value of the expression \a other into \c *this with automatic resizing. + * + * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized), + * it will be initialized. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix& operator=(const DenseBase& other) + { + return Base::_set(other); + } + + /* Here, doxygen failed to copy the brief information when using \copydoc */ + + /** + * \brief Copies the generic expression \a other into *this. + * \copydetails DenseBase::operator=(const EigenBase &other) + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix& operator=(const EigenBase &other) + { + return Base::operator=(other); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix& operator=(const ReturnByValue& func) + { + return Base::operator=(func); + } + + /** \brief Default constructor. + * + * For fixed-size matrices, does nothing. + * + * For dynamic-size matrices, creates an empty matrix of size 0. Does not allocate any array. Such a matrix + * is called a null matrix. This constructor is the unique way to create null matrices: resizing + * a matrix to 0 is not supported. + * + * \sa resize(Index,Index) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix() : Base() + { + Base::_check_template_params(); + EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + } + + // FIXME is it still needed + EIGEN_DEVICE_FUNC + explicit Matrix(internal::constructor_without_unaligned_array_assert) + : Base(internal::constructor_without_unaligned_array_assert()) + { Base::_check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } + +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + Matrix(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible::value) + : Base(std::move(other)) + { + Base::_check_template_params(); + if (RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic) + Base::_set_noalias(other); + } + EIGEN_DEVICE_FUNC + Matrix& operator=(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable::value) + { + other.swap(*this); + return *this; + } +#endif + + #ifndef EIGEN_PARSED_BY_DOXYGEN + + // This constructor is for both 1x1 matrices and dynamic vectors + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE explicit Matrix(const T& x) + { + Base::_check_template_params(); + Base::template _init1(x); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix(const T0& x, const T1& y) + { + Base::_check_template_params(); + Base::template _init2(x, y); + } + #else + /** \brief Constructs a fixed-sized matrix initialized with coefficients starting at \a data */ + EIGEN_DEVICE_FUNC + explicit Matrix(const Scalar *data); + + /** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors + * + * This is useful for dynamic-size vectors. For fixed-size vectors, + * it is redundant to pass these parameters, so one should use the default constructor + * Matrix() instead. + * + * \warning This constructor is disabled for fixed-size \c 1x1 matrices. For instance, + * calling Matrix(1) will call the initialization constructor: Matrix(const Scalar&). + * For fixed-size \c 1x1 matrices it is therefore recommended to use the default + * constructor Matrix() instead, especially when using one of the non standard + * \c EIGEN_INITIALIZE_MATRICES_BY_{ZERO,\c NAN} macros (see \ref TopicPreprocessorDirectives). + */ + EIGEN_STRONG_INLINE explicit Matrix(Index dim); + /** \brief Constructs an initialized 1x1 matrix with the given coefficient */ + Matrix(const Scalar& x); + /** \brief Constructs an uninitialized matrix with \a rows rows and \a cols columns. + * + * This is useful for dynamic-size matrices. For fixed-size matrices, + * it is redundant to pass these parameters, so one should use the default constructor + * Matrix() instead. + * + * \warning This constructor is disabled for fixed-size \c 1x2 and \c 2x1 vectors. For instance, + * calling Matrix2f(2,1) will call the initialization constructor: Matrix(const Scalar& x, const Scalar& y). + * For fixed-size \c 1x2 or \c 2x1 vectors it is therefore recommended to use the default + * constructor Matrix() instead, especially when using one of the non standard + * \c EIGEN_INITIALIZE_MATRICES_BY_{ZERO,\c NAN} macros (see \ref TopicPreprocessorDirectives). + */ + EIGEN_DEVICE_FUNC + Matrix(Index rows, Index cols); + + /** \brief Constructs an initialized 2D vector with given coefficients */ + Matrix(const Scalar& x, const Scalar& y); + #endif + + /** \brief Constructs an initialized 3D vector with given coefficients */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z) + { + Base::_check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 3) + m_storage.data()[0] = x; + m_storage.data()[1] = y; + m_storage.data()[2] = z; + } + /** \brief Constructs an initialized 4D vector with given coefficients */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w) + { + Base::_check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(Matrix, 4) + m_storage.data()[0] = x; + m_storage.data()[1] = y; + m_storage.data()[2] = z; + m_storage.data()[3] = w; + } + + + /** \brief Copy constructor */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix(const Matrix& other) : Base(other) + { } + + /** \brief Copy constructor for generic expressions. + * \sa MatrixBase::operator=(const EigenBase&) + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix(const EigenBase &other) + : Base(other.derived()) + { } + + EIGEN_DEVICE_FUNC inline Index innerStride() const { return 1; } + EIGEN_DEVICE_FUNC inline Index outerStride() const { return this->innerSize(); } + + /////////// Geometry module /////////// + + template + EIGEN_DEVICE_FUNC + explicit Matrix(const RotationBase& r); + template + EIGEN_DEVICE_FUNC + Matrix& operator=(const RotationBase& r); + + // allow to extend Matrix outside Eigen + #ifdef EIGEN_MATRIX_PLUGIN + #include EIGEN_MATRIX_PLUGIN + #endif + + protected: + template + friend struct internal::conservative_resize_like_impl; + + using Base::m_storage; +}; + +/** \defgroup matrixtypedefs Global matrix typedefs + * + * \ingroup Core_Module + * + * Eigen defines several typedef shortcuts for most common matrix and vector types. + * + * The general patterns are the following: + * + * \c MatrixSizeType where \c Size can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size, + * and where \c Type can be \c i for integer, \c f for float, \c d for double, \c cf for complex float, \c cd + * for complex double. + * + * For example, \c Matrix3d is a fixed-size 3x3 matrix type of doubles, and \c MatrixXf is a dynamic-size matrix of floats. + * + * There are also \c VectorSizeType and \c RowVectorSizeType which are self-explanatory. For example, \c Vector4cf is + * a fixed-size vector of 4 complex floats. + * + * \sa class Matrix + */ + +#define EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Size, SizeSuffix) \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix Matrix##SizeSuffix##TypeSuffix; \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix Vector##SizeSuffix##TypeSuffix; \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix RowVector##SizeSuffix##TypeSuffix; + +#define EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, Size) \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix Matrix##Size##X##TypeSuffix; \ +/** \ingroup matrixtypedefs */ \ +typedef Matrix Matrix##X##Size##TypeSuffix; + +#define EIGEN_MAKE_TYPEDEFS_ALL_SIZES(Type, TypeSuffix) \ +EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 2, 2) \ +EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 3, 3) \ +EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, 4, 4) \ +EIGEN_MAKE_TYPEDEFS(Type, TypeSuffix, Dynamic, X) \ +EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 2) \ +EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 3) \ +EIGEN_MAKE_FIXED_TYPEDEFS(Type, TypeSuffix, 4) + +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(int, i) +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(float, f) +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(double, d) +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex, cf) +EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex, cd) + +#undef EIGEN_MAKE_TYPEDEFS_ALL_SIZES +#undef EIGEN_MAKE_TYPEDEFS +#undef EIGEN_MAKE_FIXED_TYPEDEFS + +} // end namespace Eigen + +#endif // EIGEN_MATRIX_H diff --git a/simulation/externals/eigen/Eigen/src/Core/MatrixBase.h b/simulation/externals/eigen/Eigen/src/Core/MatrixBase.h new file mode 100644 index 0000000..ce41218 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/MatrixBase.h @@ -0,0 +1,530 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2009 Benoit Jacob +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MATRIXBASE_H +#define EIGEN_MATRIXBASE_H + +namespace Eigen { + +/** \class MatrixBase + * \ingroup Core_Module + * + * \brief Base class for all dense matrices, vectors, and expressions + * + * This class is the base that is inherited by all matrix, vector, and related expression + * types. Most of the Eigen API is contained in this class, and its base classes. Other important + * classes for the Eigen API are Matrix, and VectorwiseOp. + * + * Note that some methods are defined in other modules such as the \ref LU_Module LU module + * for all functions related to matrix inversions. + * + * \tparam Derived is the derived type, e.g. a matrix type, or an expression, etc. + * + * When writing a function taking Eigen objects as argument, if you want your function + * to take as argument any matrix, vector, or expression, just let it take a + * MatrixBase argument. As an example, here is a function printFirstRow which, given + * a matrix, vector, or expression \a x, prints the first row of \a x. + * + * \code + template + void printFirstRow(const Eigen::MatrixBase& x) + { + cout << x.row(0) << endl; + } + * \endcode + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_MATRIXBASE_PLUGIN. + * + * \sa \blank \ref TopicClassHierarchy + */ +template class MatrixBase + : public DenseBase +{ + public: +#ifndef EIGEN_PARSED_BY_DOXYGEN + typedef MatrixBase StorageBaseType; + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::StorageIndex StorageIndex; + typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + + typedef DenseBase Base; + using Base::RowsAtCompileTime; + using Base::ColsAtCompileTime; + using Base::SizeAtCompileTime; + using Base::MaxRowsAtCompileTime; + using Base::MaxColsAtCompileTime; + using Base::MaxSizeAtCompileTime; + using Base::IsVectorAtCompileTime; + using Base::Flags; + + using Base::derived; + using Base::const_cast_derived; + using Base::rows; + using Base::cols; + using Base::size; + using Base::coeff; + using Base::coeffRef; + using Base::lazyAssign; + using Base::eval; + using Base::operator+=; + using Base::operator-=; + using Base::operator*=; + using Base::operator/=; + + typedef typename Base::CoeffReturnType CoeffReturnType; + typedef typename Base::ConstTransposeReturnType ConstTransposeReturnType; + typedef typename Base::RowXpr RowXpr; + typedef typename Base::ColXpr ColXpr; +#endif // not EIGEN_PARSED_BY_DOXYGEN + + + +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** type of the equivalent square matrix */ + typedef Matrix SquareMatrixType; +#endif // not EIGEN_PARSED_BY_DOXYGEN + + /** \returns the size of the main diagonal, which is min(rows(),cols()). + * \sa rows(), cols(), SizeAtCompileTime. */ + EIGEN_DEVICE_FUNC + inline Index diagonalSize() const { return (numext::mini)(rows(),cols()); } + + typedef typename Base::PlainObject PlainObject; + +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal Represents a matrix with all coefficients equal to one another*/ + typedef CwiseNullaryOp,PlainObject> ConstantReturnType; + /** \internal the return type of MatrixBase::adjoint() */ + typedef typename internal::conditional::IsComplex, + CwiseUnaryOp, ConstTransposeReturnType>, + ConstTransposeReturnType + >::type AdjointReturnType; + /** \internal Return type of eigenvalues() */ + typedef Matrix, internal::traits::ColsAtCompileTime, 1, ColMajor> EigenvaluesReturnType; + /** \internal the return type of identity */ + typedef CwiseNullaryOp,PlainObject> IdentityReturnType; + /** \internal the return type of unit vectors */ + typedef Block, SquareMatrixType>, + internal::traits::RowsAtCompileTime, + internal::traits::ColsAtCompileTime> BasisReturnType; +#endif // not EIGEN_PARSED_BY_DOXYGEN + +#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::MatrixBase +#define EIGEN_DOC_UNARY_ADDONS(X,Y) +# include "../plugins/CommonCwiseUnaryOps.h" +# include "../plugins/CommonCwiseBinaryOps.h" +# include "../plugins/MatrixCwiseUnaryOps.h" +# include "../plugins/MatrixCwiseBinaryOps.h" +# ifdef EIGEN_MATRIXBASE_PLUGIN +# include EIGEN_MATRIXBASE_PLUGIN +# endif +#undef EIGEN_CURRENT_STORAGE_BASE_CLASS +#undef EIGEN_DOC_UNARY_ADDONS + + /** Special case of the template operator=, in order to prevent the compiler + * from generating a default operator= (issue hit with g++ 4.1) + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator=(const MatrixBase& other); + + // We cannot inherit here via Base::operator= since it is causing + // trouble with MSVC. + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator=(const DenseBase& other); + + template + EIGEN_DEVICE_FUNC + Derived& operator=(const EigenBase& other); + + template + EIGEN_DEVICE_FUNC + Derived& operator=(const ReturnByValue& other); + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator+=(const MatrixBase& other); + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator-=(const MatrixBase& other); + +#ifdef __CUDACC__ + template + EIGEN_DEVICE_FUNC + const Product + operator*(const MatrixBase &other) const + { return this->lazyProduct(other); } +#else + + template + const Product + operator*(const MatrixBase &other) const; + +#endif + + template + EIGEN_DEVICE_FUNC + const Product + lazyProduct(const MatrixBase &other) const; + + template + Derived& operator*=(const EigenBase& other); + + template + void applyOnTheLeft(const EigenBase& other); + + template + void applyOnTheRight(const EigenBase& other); + + template + EIGEN_DEVICE_FUNC + const Product + operator*(const DiagonalBase &diagonal) const; + + template + EIGEN_DEVICE_FUNC + typename ScalarBinaryOpTraits::Scalar,typename internal::traits::Scalar>::ReturnType + dot(const MatrixBase& other) const; + + EIGEN_DEVICE_FUNC RealScalar squaredNorm() const; + EIGEN_DEVICE_FUNC RealScalar norm() const; + RealScalar stableNorm() const; + RealScalar blueNorm() const; + RealScalar hypotNorm() const; + EIGEN_DEVICE_FUNC const PlainObject normalized() const; + EIGEN_DEVICE_FUNC const PlainObject stableNormalized() const; + EIGEN_DEVICE_FUNC void normalize(); + EIGEN_DEVICE_FUNC void stableNormalize(); + + EIGEN_DEVICE_FUNC const AdjointReturnType adjoint() const; + EIGEN_DEVICE_FUNC void adjointInPlace(); + + typedef Diagonal DiagonalReturnType; + EIGEN_DEVICE_FUNC + DiagonalReturnType diagonal(); + + typedef typename internal::add_const >::type ConstDiagonalReturnType; + EIGEN_DEVICE_FUNC + ConstDiagonalReturnType diagonal() const; + + template struct DiagonalIndexReturnType { typedef Diagonal Type; }; + template struct ConstDiagonalIndexReturnType { typedef const Diagonal Type; }; + + template + EIGEN_DEVICE_FUNC + typename DiagonalIndexReturnType::Type diagonal(); + + template + EIGEN_DEVICE_FUNC + typename ConstDiagonalIndexReturnType::Type diagonal() const; + + typedef Diagonal DiagonalDynamicIndexReturnType; + typedef typename internal::add_const >::type ConstDiagonalDynamicIndexReturnType; + + EIGEN_DEVICE_FUNC + DiagonalDynamicIndexReturnType diagonal(Index index); + EIGEN_DEVICE_FUNC + ConstDiagonalDynamicIndexReturnType diagonal(Index index) const; + + template struct TriangularViewReturnType { typedef TriangularView Type; }; + template struct ConstTriangularViewReturnType { typedef const TriangularView Type; }; + + template + EIGEN_DEVICE_FUNC + typename TriangularViewReturnType::Type triangularView(); + template + EIGEN_DEVICE_FUNC + typename ConstTriangularViewReturnType::Type triangularView() const; + + template struct SelfAdjointViewReturnType { typedef SelfAdjointView Type; }; + template struct ConstSelfAdjointViewReturnType { typedef const SelfAdjointView Type; }; + + template + EIGEN_DEVICE_FUNC + typename SelfAdjointViewReturnType::Type selfadjointView(); + template + EIGEN_DEVICE_FUNC + typename ConstSelfAdjointViewReturnType::Type selfadjointView() const; + + const SparseView sparseView(const Scalar& m_reference = Scalar(0), + const typename NumTraits::Real& m_epsilon = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC static const IdentityReturnType Identity(); + EIGEN_DEVICE_FUNC static const IdentityReturnType Identity(Index rows, Index cols); + EIGEN_DEVICE_FUNC static const BasisReturnType Unit(Index size, Index i); + EIGEN_DEVICE_FUNC static const BasisReturnType Unit(Index i); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitX(); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitY(); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitZ(); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitW(); + + EIGEN_DEVICE_FUNC + const DiagonalWrapper asDiagonal() const; + const PermutationWrapper asPermutation() const; + + EIGEN_DEVICE_FUNC + Derived& setIdentity(); + EIGEN_DEVICE_FUNC + Derived& setIdentity(Index rows, Index cols); + + bool isIdentity(const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isDiagonal(const RealScalar& prec = NumTraits::dummy_precision()) const; + + bool isUpperTriangular(const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isLowerTriangular(const RealScalar& prec = NumTraits::dummy_precision()) const; + + template + bool isOrthogonal(const MatrixBase& other, + const RealScalar& prec = NumTraits::dummy_precision()) const; + bool isUnitary(const RealScalar& prec = NumTraits::dummy_precision()) const; + + /** \returns true if each coefficients of \c *this and \a other are all exactly equal. + * \warning When using floating point scalar values you probably should rather use a + * fuzzy comparison such as isApprox() + * \sa isApprox(), operator!= */ + template + EIGEN_DEVICE_FUNC inline bool operator==(const MatrixBase& other) const + { return cwiseEqual(other).all(); } + + /** \returns true if at least one pair of coefficients of \c *this and \a other are not exactly equal to each other. + * \warning When using floating point scalar values you probably should rather use a + * fuzzy comparison such as isApprox() + * \sa isApprox(), operator== */ + template + EIGEN_DEVICE_FUNC inline bool operator!=(const MatrixBase& other) const + { return cwiseNotEqual(other).any(); } + + NoAlias noalias(); + + // TODO forceAlignedAccess is temporarily disabled + // Need to find a nicer workaround. + inline const Derived& forceAlignedAccess() const { return derived(); } + inline Derived& forceAlignedAccess() { return derived(); } + template inline const Derived& forceAlignedAccessIf() const { return derived(); } + template inline Derived& forceAlignedAccessIf() { return derived(); } + + EIGEN_DEVICE_FUNC Scalar trace() const; + + template EIGEN_DEVICE_FUNC RealScalar lpNorm() const; + + EIGEN_DEVICE_FUNC MatrixBase& matrix() { return *this; } + EIGEN_DEVICE_FUNC const MatrixBase& matrix() const { return *this; } + + /** \returns an \link Eigen::ArrayBase Array \endlink expression of this matrix + * \sa ArrayBase::matrix() */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ArrayWrapper array() { return ArrayWrapper(derived()); } + /** \returns a const \link Eigen::ArrayBase Array \endlink expression of this matrix + * \sa ArrayBase::matrix() */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArrayWrapper array() const { return ArrayWrapper(derived()); } + +/////////// LU module /////////// + + inline const FullPivLU fullPivLu() const; + inline const PartialPivLU partialPivLu() const; + + inline const PartialPivLU lu() const; + + inline const Inverse inverse() const; + + template + inline void computeInverseAndDetWithCheck( + ResultType& inverse, + typename ResultType::Scalar& determinant, + bool& invertible, + const RealScalar& absDeterminantThreshold = NumTraits::dummy_precision() + ) const; + template + inline void computeInverseWithCheck( + ResultType& inverse, + bool& invertible, + const RealScalar& absDeterminantThreshold = NumTraits::dummy_precision() + ) const; + Scalar determinant() const; + +/////////// Cholesky module /////////// + + inline const LLT llt() const; + inline const LDLT ldlt() const; + +/////////// QR module /////////// + + inline const HouseholderQR householderQr() const; + inline const ColPivHouseholderQR colPivHouseholderQr() const; + inline const FullPivHouseholderQR fullPivHouseholderQr() const; + inline const CompleteOrthogonalDecomposition completeOrthogonalDecomposition() const; + +/////////// Eigenvalues module /////////// + + inline EigenvaluesReturnType eigenvalues() const; + inline RealScalar operatorNorm() const; + +/////////// SVD module /////////// + + inline JacobiSVD jacobiSvd(unsigned int computationOptions = 0) const; + inline BDCSVD bdcSvd(unsigned int computationOptions = 0) const; + +/////////// Geometry module /////////// + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /// \internal helper struct to form the return type of the cross product + template struct cross_product_return_type { + typedef typename ScalarBinaryOpTraits::Scalar,typename internal::traits::Scalar>::ReturnType Scalar; + typedef Matrix type; + }; + #endif // EIGEN_PARSED_BY_DOXYGEN + template + EIGEN_DEVICE_FUNC +#ifndef EIGEN_PARSED_BY_DOXYGEN + inline typename cross_product_return_type::type +#else + inline PlainObject +#endif + cross(const MatrixBase& other) const; + + template + EIGEN_DEVICE_FUNC + inline PlainObject cross3(const MatrixBase& other) const; + + EIGEN_DEVICE_FUNC + inline PlainObject unitOrthogonal(void) const; + + EIGEN_DEVICE_FUNC + inline Matrix eulerAngles(Index a0, Index a1, Index a2) const; + + // put this as separate enum value to work around possible GCC 4.3 bug (?) + enum { HomogeneousReturnTypeDirection = ColsAtCompileTime==1&&RowsAtCompileTime==1 ? ((internal::traits::Flags&RowMajorBit)==RowMajorBit ? Horizontal : Vertical) + : ColsAtCompileTime==1 ? Vertical : Horizontal }; + typedef Homogeneous HomogeneousReturnType; + EIGEN_DEVICE_FUNC + inline HomogeneousReturnType homogeneous() const; + + enum { + SizeMinusOne = SizeAtCompileTime==Dynamic ? Dynamic : SizeAtCompileTime-1 + }; + typedef Block::ColsAtCompileTime==1 ? SizeMinusOne : 1, + internal::traits::ColsAtCompileTime==1 ? 1 : SizeMinusOne> ConstStartMinusOne; + typedef EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(ConstStartMinusOne,Scalar,quotient) HNormalizedReturnType; + EIGEN_DEVICE_FUNC + inline const HNormalizedReturnType hnormalized() const; + +////////// Householder module /////////// + + void makeHouseholderInPlace(Scalar& tau, RealScalar& beta); + template + void makeHouseholder(EssentialPart& essential, + Scalar& tau, RealScalar& beta) const; + template + void applyHouseholderOnTheLeft(const EssentialPart& essential, + const Scalar& tau, + Scalar* workspace); + template + void applyHouseholderOnTheRight(const EssentialPart& essential, + const Scalar& tau, + Scalar* workspace); + +///////// Jacobi module ///////// + + template + void applyOnTheLeft(Index p, Index q, const JacobiRotation& j); + template + void applyOnTheRight(Index p, Index q, const JacobiRotation& j); + +///////// SparseCore module ///////// + + template + EIGEN_STRONG_INLINE const typename SparseMatrixBase::template CwiseProductDenseReturnType::Type + cwiseProduct(const SparseMatrixBase &other) const + { + return other.cwiseProduct(derived()); + } + +///////// MatrixFunctions module ///////// + + typedef typename internal::stem_function::type StemFunction; + const MatrixExponentialReturnValue exp() const; + const MatrixFunctionReturnValue matrixFunction(StemFunction f) const; + const MatrixFunctionReturnValue cosh() const; + const MatrixFunctionReturnValue sinh() const; + const MatrixFunctionReturnValue cos() const; + const MatrixFunctionReturnValue sin() const; + const MatrixSquareRootReturnValue sqrt() const; + const MatrixLogarithmReturnValue log() const; + const MatrixPowerReturnValue pow(const RealScalar& p) const; + const MatrixComplexPowerReturnValue pow(const std::complex& p) const; + + protected: + EIGEN_DEVICE_FUNC MatrixBase() : Base() {} + + private: + EIGEN_DEVICE_FUNC explicit MatrixBase(int); + EIGEN_DEVICE_FUNC MatrixBase(int,int); + template EIGEN_DEVICE_FUNC explicit MatrixBase(const MatrixBase&); + protected: + // mixing arrays and matrices is not legal + template Derived& operator+=(const ArrayBase& ) + {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;} + // mixing arrays and matrices is not legal + template Derived& operator-=(const ArrayBase& ) + {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;} +}; + + +/*************************************************************************** +* Implementation of matrix base methods +***************************************************************************/ + +/** replaces \c *this by \c *this * \a other. + * + * \returns a reference to \c *this + * + * Example: \include MatrixBase_applyOnTheRight.cpp + * Output: \verbinclude MatrixBase_applyOnTheRight.out + */ +template +template +inline Derived& +MatrixBase::operator*=(const EigenBase &other) +{ + other.derived().applyThisOnTheRight(derived()); + return derived(); +} + +/** replaces \c *this by \c *this * \a other. It is equivalent to MatrixBase::operator*=(). + * + * Example: \include MatrixBase_applyOnTheRight.cpp + * Output: \verbinclude MatrixBase_applyOnTheRight.out + */ +template +template +inline void MatrixBase::applyOnTheRight(const EigenBase &other) +{ + other.derived().applyThisOnTheRight(derived()); +} + +/** replaces \c *this by \a other * \c *this. + * + * Example: \include MatrixBase_applyOnTheLeft.cpp + * Output: \verbinclude MatrixBase_applyOnTheLeft.out + */ +template +template +inline void MatrixBase::applyOnTheLeft(const EigenBase &other) +{ + other.derived().applyThisOnTheLeft(derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_MATRIXBASE_H diff --git a/simulation/externals/eigen/Eigen/src/Core/NestByValue.h b/simulation/externals/eigen/Eigen/src/Core/NestByValue.h new file mode 100644 index 0000000..13adf07 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/NestByValue.h @@ -0,0 +1,110 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_NESTBYVALUE_H +#define EIGEN_NESTBYVALUE_H + +namespace Eigen { + +namespace internal { +template +struct traits > : public traits +{}; +} + +/** \class NestByValue + * \ingroup Core_Module + * + * \brief Expression which must be nested by value + * + * \tparam ExpressionType the type of the object of which we are requiring nesting-by-value + * + * This class is the return type of MatrixBase::nestByValue() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::nestByValue() + */ +template class NestByValue + : public internal::dense_xpr_base< NestByValue >::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue) + + EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} + + EIGEN_DEVICE_FUNC inline Index rows() const { return m_expression.rows(); } + EIGEN_DEVICE_FUNC inline Index cols() const { return m_expression.cols(); } + EIGEN_DEVICE_FUNC inline Index outerStride() const { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC inline Index innerStride() const { return m_expression.innerStride(); } + + EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index row, Index col) const + { + return m_expression.coeff(row, col); + } + + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index col) + { + return m_expression.const_cast_derived().coeffRef(row, col); + } + + EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index index) const + { + return m_expression.coeff(index); + } + + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index) + { + return m_expression.const_cast_derived().coeffRef(index); + } + + template + inline const PacketScalar packet(Index row, Index col) const + { + return m_expression.template packet(row, col); + } + + template + inline void writePacket(Index row, Index col, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacket(row, col, x); + } + + template + inline const PacketScalar packet(Index index) const + { + return m_expression.template packet(index); + } + + template + inline void writePacket(Index index, const PacketScalar& x) + { + m_expression.const_cast_derived().template writePacket(index, x); + } + + EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; } + + protected: + const ExpressionType m_expression; +}; + +/** \returns an expression of the temporary version of *this. + */ +template +inline const NestByValue +DenseBase::nestByValue() const +{ + return NestByValue(derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_NESTBYVALUE_H diff --git a/simulation/externals/eigen/Eigen/src/Core/NoAlias.h b/simulation/externals/eigen/Eigen/src/Core/NoAlias.h new file mode 100644 index 0000000..3390801 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/NoAlias.h @@ -0,0 +1,108 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_NOALIAS_H +#define EIGEN_NOALIAS_H + +namespace Eigen { + +/** \class NoAlias + * \ingroup Core_Module + * + * \brief Pseudo expression providing an operator = assuming no aliasing + * + * \tparam ExpressionType the type of the object on which to do the lazy assignment + * + * This class represents an expression with special assignment operators + * assuming no aliasing between the target expression and the source expression. + * More precisely it alloas to bypass the EvalBeforeAssignBit flag of the source expression. + * It is the return type of MatrixBase::noalias() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::noalias() + */ +template class StorageBase> +class NoAlias +{ + public: + typedef typename ExpressionType::Scalar Scalar; + + explicit NoAlias(ExpressionType& expression) : m_expression(expression) {} + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase& other) + { + call_assignment_no_alias(m_expression, other.derived(), internal::assign_op()); + return m_expression; + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase& other) + { + call_assignment_no_alias(m_expression, other.derived(), internal::add_assign_op()); + return m_expression; + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase& other) + { + call_assignment_no_alias(m_expression, other.derived(), internal::sub_assign_op()); + return m_expression; + } + + EIGEN_DEVICE_FUNC + ExpressionType& expression() const + { + return m_expression; + } + + protected: + ExpressionType& m_expression; +}; + +/** \returns a pseudo expression of \c *this with an operator= assuming + * no aliasing between \c *this and the source expression. + * + * More precisely, noalias() allows to bypass the EvalBeforeAssignBit flag. + * Currently, even though several expressions may alias, only product + * expressions have this flag. Therefore, noalias() is only usefull when + * the source expression contains a matrix product. + * + * Here are some examples where noalias is usefull: + * \code + * D.noalias() = A * B; + * D.noalias() += A.transpose() * B; + * D.noalias() -= 2 * A * B.adjoint(); + * \endcode + * + * On the other hand the following example will lead to a \b wrong result: + * \code + * A.noalias() = A * B; + * \endcode + * because the result matrix A is also an operand of the matrix product. Therefore, + * there is no alternative than evaluating A * B in a temporary, that is the default + * behavior when you write: + * \code + * A = A * B; + * \endcode + * + * \sa class NoAlias + */ +template +NoAlias MatrixBase::noalias() +{ + return NoAlias(derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_NOALIAS_H diff --git a/simulation/externals/eigen/Eigen/src/Core/NumTraits.h b/simulation/externals/eigen/Eigen/src/Core/NumTraits.h new file mode 100644 index 0000000..daf4898 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/NumTraits.h @@ -0,0 +1,248 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_NUMTRAITS_H +#define EIGEN_NUMTRAITS_H + +namespace Eigen { + +namespace internal { + +// default implementation of digits10(), based on numeric_limits if specialized, +// 0 for integer types, and log10(epsilon()) otherwise. +template< typename T, + bool use_numeric_limits = std::numeric_limits::is_specialized, + bool is_integer = NumTraits::IsInteger> +struct default_digits10_impl +{ + static int run() { return std::numeric_limits::digits10; } +}; + +template +struct default_digits10_impl // Floating point +{ + static int run() { + using std::log10; + using std::ceil; + typedef typename NumTraits::Real Real; + return int(ceil(-log10(NumTraits::epsilon()))); + } +}; + +template +struct default_digits10_impl // Integer +{ + static int run() { return 0; } +}; + +} // end namespace internal + +/** \class NumTraits + * \ingroup Core_Module + * + * \brief Holds information about the various numeric (i.e. scalar) types allowed by Eigen. + * + * \tparam T the numeric type at hand + * + * This class stores enums, typedefs and static methods giving information about a numeric type. + * + * The provided data consists of: + * \li A typedef \c Real, giving the "real part" type of \a T. If \a T is already real, + * then \c Real is just a typedef to \a T. If \a T is \c std::complex then \c Real + * is a typedef to \a U. + * \li A typedef \c NonInteger, giving the type that should be used for operations producing non-integral values, + * such as quotients, square roots, etc. If \a T is a floating-point type, then this typedef just gives + * \a T again. Note however that many Eigen functions such as internal::sqrt simply refuse to + * take integers. Outside of a few cases, Eigen doesn't do automatic type promotion. Thus, this typedef is + * only intended as a helper for code that needs to explicitly promote types. + * \li A typedef \c Literal giving the type to use for numeric literals such as "2" or "0.5". For instance, for \c std::complex, Literal is defined as \c U. + * Of course, this type must be fully compatible with \a T. In doubt, just use \a T here. + * \li A typedef \a Nested giving the type to use to nest a value inside of the expression tree. If you don't know what + * this means, just use \a T here. + * \li An enum value \a IsComplex. It is equal to 1 if \a T is a \c std::complex + * type, and to 0 otherwise. + * \li An enum value \a IsInteger. It is equal to \c 1 if \a T is an integer type such as \c int, + * and to \c 0 otherwise. + * \li Enum values ReadCost, AddCost and MulCost representing a rough estimate of the number of CPU cycles needed + * to by move / add / mul instructions respectively, assuming the data is already stored in CPU registers. + * Stay vague here. No need to do architecture-specific stuff. + * \li An enum value \a IsSigned. It is equal to \c 1 if \a T is a signed type and to 0 if \a T is unsigned. + * \li An enum value \a RequireInitialization. It is equal to \c 1 if the constructor of the numeric type \a T must + * be called, and to 0 if it is safe not to call it. Default is 0 if \a T is an arithmetic type, and 1 otherwise. + * \li An epsilon() function which, unlike std::numeric_limits::epsilon(), + * it returns a \a Real instead of a \a T. + * \li A dummy_precision() function returning a weak epsilon value. It is mainly used as a default + * value by the fuzzy comparison operators. + * \li highest() and lowest() functions returning the highest and lowest possible values respectively. + * \li digits10() function returning the number of decimal digits that can be represented without change. This is + * the analogue of std::numeric_limits::digits10 + * which is used as the default implementation if specialized. + */ + +template struct GenericNumTraits +{ + enum { + IsInteger = std::numeric_limits::is_integer, + IsSigned = std::numeric_limits::is_signed, + IsComplex = 0, + RequireInitialization = internal::is_arithmetic::value ? 0 : 1, + ReadCost = 1, + AddCost = 1, + MulCost = 1 + }; + + typedef T Real; + typedef typename internal::conditional< + IsInteger, + typename internal::conditional::type, + T + >::type NonInteger; + typedef T Nested; + typedef T Literal; + + EIGEN_DEVICE_FUNC + static inline Real epsilon() + { + return numext::numeric_limits::epsilon(); + } + + EIGEN_DEVICE_FUNC + static inline int digits10() + { + return internal::default_digits10_impl::run(); + } + + EIGEN_DEVICE_FUNC + static inline Real dummy_precision() + { + // make sure to override this for floating-point types + return Real(0); + } + + + EIGEN_DEVICE_FUNC + static inline T highest() { + return (numext::numeric_limits::max)(); + } + + EIGEN_DEVICE_FUNC + static inline T lowest() { + return IsInteger ? (numext::numeric_limits::min)() : (-(numext::numeric_limits::max)()); + } + + EIGEN_DEVICE_FUNC + static inline T infinity() { + return numext::numeric_limits::infinity(); + } + + EIGEN_DEVICE_FUNC + static inline T quiet_NaN() { + return numext::numeric_limits::quiet_NaN(); + } +}; + +template struct NumTraits : GenericNumTraits +{}; + +template<> struct NumTraits + : GenericNumTraits +{ + EIGEN_DEVICE_FUNC + static inline float dummy_precision() { return 1e-5f; } +}; + +template<> struct NumTraits : GenericNumTraits +{ + EIGEN_DEVICE_FUNC + static inline double dummy_precision() { return 1e-12; } +}; + +template<> struct NumTraits + : GenericNumTraits +{ + static inline long double dummy_precision() { return 1e-15l; } +}; + +template struct NumTraits > + : GenericNumTraits > +{ + typedef _Real Real; + typedef typename NumTraits<_Real>::Literal Literal; + enum { + IsComplex = 1, + RequireInitialization = NumTraits<_Real>::RequireInitialization, + ReadCost = 2 * NumTraits<_Real>::ReadCost, + AddCost = 2 * NumTraits::AddCost, + MulCost = 4 * NumTraits::MulCost + 2 * NumTraits::AddCost + }; + + EIGEN_DEVICE_FUNC + static inline Real epsilon() { return NumTraits::epsilon(); } + EIGEN_DEVICE_FUNC + static inline Real dummy_precision() { return NumTraits::dummy_precision(); } + EIGEN_DEVICE_FUNC + static inline int digits10() { return NumTraits::digits10(); } +}; + +template +struct NumTraits > +{ + typedef Array ArrayType; + typedef typename NumTraits::Real RealScalar; + typedef Array Real; + typedef typename NumTraits::NonInteger NonIntegerScalar; + typedef Array NonInteger; + typedef ArrayType & Nested; + typedef typename NumTraits::Literal Literal; + + enum { + IsComplex = NumTraits::IsComplex, + IsInteger = NumTraits::IsInteger, + IsSigned = NumTraits::IsSigned, + RequireInitialization = 1, + ReadCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * NumTraits::ReadCost, + AddCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * NumTraits::AddCost, + MulCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * NumTraits::MulCost + }; + + EIGEN_DEVICE_FUNC + static inline RealScalar epsilon() { return NumTraits::epsilon(); } + EIGEN_DEVICE_FUNC + static inline RealScalar dummy_precision() { return NumTraits::dummy_precision(); } + + static inline int digits10() { return NumTraits::digits10(); } +}; + +template<> struct NumTraits + : GenericNumTraits +{ + enum { + RequireInitialization = 1, + ReadCost = HugeCost, + AddCost = HugeCost, + MulCost = HugeCost + }; + + static inline int digits10() { return 0; } + +private: + static inline std::string epsilon(); + static inline std::string dummy_precision(); + static inline std::string lowest(); + static inline std::string highest(); + static inline std::string infinity(); + static inline std::string quiet_NaN(); +}; + +// Empty specialization for void to allow template specialization based on NumTraits::Real with T==void and SFINAE. +template<> struct NumTraits {}; + +} // end namespace Eigen + +#endif // EIGEN_NUMTRAITS_H diff --git a/simulation/externals/eigen/Eigen/src/Core/PermutationMatrix.h b/simulation/externals/eigen/Eigen/src/Core/PermutationMatrix.h new file mode 100644 index 0000000..b1fb455 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/PermutationMatrix.h @@ -0,0 +1,633 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Benoit Jacob +// Copyright (C) 2009-2015 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_PERMUTATIONMATRIX_H +#define EIGEN_PERMUTATIONMATRIX_H + +namespace Eigen { + +namespace internal { + +enum PermPermProduct_t {PermPermProduct}; + +} // end namespace internal + +/** \class PermutationBase + * \ingroup Core_Module + * + * \brief Base class for permutations + * + * \tparam Derived the derived class + * + * This class is the base class for all expressions representing a permutation matrix, + * internally stored as a vector of integers. + * The convention followed here is that if \f$ \sigma \f$ is a permutation, the corresponding permutation matrix + * \f$ P_\sigma \f$ is such that if \f$ (e_1,\ldots,e_p) \f$ is the canonical basis, we have: + * \f[ P_\sigma(e_i) = e_{\sigma(i)}. \f] + * This convention ensures that for any two permutations \f$ \sigma, \tau \f$, we have: + * \f[ P_{\sigma\circ\tau} = P_\sigma P_\tau. \f] + * + * Permutation matrices are square and invertible. + * + * Notice that in addition to the member functions and operators listed here, there also are non-member + * operator* to multiply any kind of permutation object with any kind of matrix expression (MatrixBase) + * on either side. + * + * \sa class PermutationMatrix, class PermutationWrapper + */ +template +class PermutationBase : public EigenBase +{ + typedef internal::traits Traits; + typedef EigenBase Base; + public: + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename Traits::IndicesType IndicesType; + enum { + Flags = Traits::Flags, + RowsAtCompileTime = Traits::RowsAtCompileTime, + ColsAtCompileTime = Traits::ColsAtCompileTime, + MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = Traits::MaxColsAtCompileTime + }; + typedef typename Traits::StorageIndex StorageIndex; + typedef Matrix + DenseMatrixType; + typedef PermutationMatrix + PlainPermutationType; + typedef PlainPermutationType PlainObject; + using Base::derived; + typedef Inverse InverseReturnType; + typedef void Scalar; + #endif + + /** Copies the other permutation into *this */ + template + Derived& operator=(const PermutationBase& other) + { + indices() = other.indices(); + return derived(); + } + + /** Assignment from the Transpositions \a tr */ + template + Derived& operator=(const TranspositionsBase& tr) + { + setIdentity(tr.size()); + for(Index k=size()-1; k>=0; --k) + applyTranspositionOnTheRight(k,tr.coeff(k)); + return derived(); + } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + Derived& operator=(const PermutationBase& other) + { + indices() = other.indices(); + return derived(); + } + #endif + + /** \returns the number of rows */ + inline Index rows() const { return Index(indices().size()); } + + /** \returns the number of columns */ + inline Index cols() const { return Index(indices().size()); } + + /** \returns the size of a side of the respective square matrix, i.e., the number of indices */ + inline Index size() const { return Index(indices().size()); } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + void evalTo(MatrixBase& other) const + { + other.setZero(); + for (Index i=0; i=0 && j>=0 && i=0 && j>=0 && i + void assignTranspose(const PermutationBase& other) + { + for (Index i=0; i + void assignProduct(const Lhs& lhs, const Rhs& rhs) + { + eigen_assert(lhs.cols() == rhs.rows()); + for (Index i=0; i + inline PlainPermutationType operator*(const PermutationBase& other) const + { return PlainPermutationType(internal::PermPermProduct, derived(), other.derived()); } + + /** \returns the product of a permutation with another inverse permutation. + * + * \note \blank \note_try_to_help_rvo + */ + template + inline PlainPermutationType operator*(const InverseImpl& other) const + { return PlainPermutationType(internal::PermPermProduct, *this, other.eval()); } + + /** \returns the product of an inverse permutation with another permutation. + * + * \note \blank \note_try_to_help_rvo + */ + template friend + inline PlainPermutationType operator*(const InverseImpl& other, const PermutationBase& perm) + { return PlainPermutationType(internal::PermPermProduct, other.eval(), perm); } + + /** \returns the determinant of the permutation matrix, which is either 1 or -1 depending on the parity of the permutation. + * + * This function is O(\c n) procedure allocating a buffer of \c n booleans. + */ + Index determinant() const + { + Index res = 1; + Index n = size(); + Matrix mask(n); + mask.fill(false); + Index r = 0; + while(r < n) + { + // search for the next seed + while(r=n) + break; + // we got one, let's follow it until we are back to the seed + Index k0 = r++; + mask.coeffRef(k0) = true; + for(Index k=indices().coeff(k0); k!=k0; k=indices().coeff(k)) + { + mask.coeffRef(k) = true; + res = -res; + } + } + return res; + } + + protected: + +}; + +namespace internal { +template +struct traits > + : traits > +{ + typedef PermutationStorage StorageKind; + typedef Matrix<_StorageIndex, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1> IndicesType; + typedef _StorageIndex StorageIndex; + typedef void Scalar; +}; +} + +/** \class PermutationMatrix + * \ingroup Core_Module + * + * \brief Permutation matrix + * + * \tparam SizeAtCompileTime the number of rows/cols, or Dynamic + * \tparam MaxSizeAtCompileTime the maximum number of rows/cols, or Dynamic. This optional parameter defaults to SizeAtCompileTime. Most of the time, you should not have to specify it. + * \tparam _StorageIndex the integer type of the indices + * + * This class represents a permutation matrix, internally stored as a vector of integers. + * + * \sa class PermutationBase, class PermutationWrapper, class DiagonalMatrix + */ +template +class PermutationMatrix : public PermutationBase > +{ + typedef PermutationBase Base; + typedef internal::traits Traits; + public: + + typedef const PermutationMatrix& Nested; + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename Traits::IndicesType IndicesType; + typedef typename Traits::StorageIndex StorageIndex; + #endif + + inline PermutationMatrix() + {} + + /** Constructs an uninitialized permutation matrix of given size. + */ + explicit inline PermutationMatrix(Index size) : m_indices(size) + { + eigen_internal_assert(size <= NumTraits::highest()); + } + + /** Copy constructor. */ + template + inline PermutationMatrix(const PermutationBase& other) + : m_indices(other.indices()) {} + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** Standard copy constructor. Defined only to prevent a default copy constructor + * from hiding the other templated constructor */ + inline PermutationMatrix(const PermutationMatrix& other) : m_indices(other.indices()) {} + #endif + + /** Generic constructor from expression of the indices. The indices + * array has the meaning that the permutations sends each integer i to indices[i]. + * + * \warning It is your responsibility to check that the indices array that you passes actually + * describes a permutation, i.e., each value between 0 and n-1 occurs exactly once, where n is the + * array's size. + */ + template + explicit inline PermutationMatrix(const MatrixBase& indices) : m_indices(indices) + {} + + /** Convert the Transpositions \a tr to a permutation matrix */ + template + explicit PermutationMatrix(const TranspositionsBase& tr) + : m_indices(tr.size()) + { + *this = tr; + } + + /** Copies the other permutation into *this */ + template + PermutationMatrix& operator=(const PermutationBase& other) + { + m_indices = other.indices(); + return *this; + } + + /** Assignment from the Transpositions \a tr */ + template + PermutationMatrix& operator=(const TranspositionsBase& tr) + { + return Base::operator=(tr.derived()); + } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + PermutationMatrix& operator=(const PermutationMatrix& other) + { + m_indices = other.m_indices; + return *this; + } + #endif + + /** const version of indices(). */ + const IndicesType& indices() const { return m_indices; } + /** \returns a reference to the stored array representing the permutation. */ + IndicesType& indices() { return m_indices; } + + + /**** multiplication helpers to hopefully get RVO ****/ + +#ifndef EIGEN_PARSED_BY_DOXYGEN + template + PermutationMatrix(const InverseImpl& other) + : m_indices(other.derived().nestedExpression().size()) + { + eigen_internal_assert(m_indices.size() <= NumTraits::highest()); + StorageIndex end = StorageIndex(m_indices.size()); + for (StorageIndex i=0; i + PermutationMatrix(internal::PermPermProduct_t, const Lhs& lhs, const Rhs& rhs) + : m_indices(lhs.indices().size()) + { + Base::assignProduct(lhs,rhs); + } +#endif + + protected: + + IndicesType m_indices; +}; + + +namespace internal { +template +struct traits,_PacketAccess> > + : traits > +{ + typedef PermutationStorage StorageKind; + typedef Map, _PacketAccess> IndicesType; + typedef _StorageIndex StorageIndex; + typedef void Scalar; +}; +} + +template +class Map,_PacketAccess> + : public PermutationBase,_PacketAccess> > +{ + typedef PermutationBase Base; + typedef internal::traits Traits; + public: + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename Traits::IndicesType IndicesType; + typedef typename IndicesType::Scalar StorageIndex; + #endif + + inline Map(const StorageIndex* indicesPtr) + : m_indices(indicesPtr) + {} + + inline Map(const StorageIndex* indicesPtr, Index size) + : m_indices(indicesPtr,size) + {} + + /** Copies the other permutation into *this */ + template + Map& operator=(const PermutationBase& other) + { return Base::operator=(other.derived()); } + + /** Assignment from the Transpositions \a tr */ + template + Map& operator=(const TranspositionsBase& tr) + { return Base::operator=(tr.derived()); } + + #ifndef EIGEN_PARSED_BY_DOXYGEN + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + Map& operator=(const Map& other) + { + m_indices = other.m_indices; + return *this; + } + #endif + + /** const version of indices(). */ + const IndicesType& indices() const { return m_indices; } + /** \returns a reference to the stored array representing the permutation. */ + IndicesType& indices() { return m_indices; } + + protected: + + IndicesType m_indices; +}; + +template class TranspositionsWrapper; +namespace internal { +template +struct traits > +{ + typedef PermutationStorage StorageKind; + typedef void Scalar; + typedef typename _IndicesType::Scalar StorageIndex; + typedef _IndicesType IndicesType; + enum { + RowsAtCompileTime = _IndicesType::SizeAtCompileTime, + ColsAtCompileTime = _IndicesType::SizeAtCompileTime, + MaxRowsAtCompileTime = IndicesType::MaxSizeAtCompileTime, + MaxColsAtCompileTime = IndicesType::MaxSizeAtCompileTime, + Flags = 0 + }; +}; +} + +/** \class PermutationWrapper + * \ingroup Core_Module + * + * \brief Class to view a vector of integers as a permutation matrix + * + * \tparam _IndicesType the type of the vector of integer (can be any compatible expression) + * + * This class allows to view any vector expression of integers as a permutation matrix. + * + * \sa class PermutationBase, class PermutationMatrix + */ +template +class PermutationWrapper : public PermutationBase > +{ + typedef PermutationBase Base; + typedef internal::traits Traits; + public: + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename Traits::IndicesType IndicesType; + #endif + + inline PermutationWrapper(const IndicesType& indices) + : m_indices(indices) + {} + + /** const version of indices(). */ + const typename internal::remove_all::type& + indices() const { return m_indices; } + + protected: + + typename IndicesType::Nested m_indices; +}; + + +/** \returns the matrix with the permutation applied to the columns. + */ +template +EIGEN_DEVICE_FUNC +const Product +operator*(const MatrixBase &matrix, + const PermutationBase& permutation) +{ + return Product + (matrix.derived(), permutation.derived()); +} + +/** \returns the matrix with the permutation applied to the rows. + */ +template +EIGEN_DEVICE_FUNC +const Product +operator*(const PermutationBase &permutation, + const MatrixBase& matrix) +{ + return Product + (permutation.derived(), matrix.derived()); +} + + +template +class InverseImpl + : public EigenBase > +{ + typedef typename PermutationType::PlainPermutationType PlainPermutationType; + typedef internal::traits PermTraits; + protected: + InverseImpl() {} + public: + typedef Inverse InverseType; + using EigenBase >::derived; + + #ifndef EIGEN_PARSED_BY_DOXYGEN + typedef typename PermutationType::DenseMatrixType DenseMatrixType; + enum { + RowsAtCompileTime = PermTraits::RowsAtCompileTime, + ColsAtCompileTime = PermTraits::ColsAtCompileTime, + MaxRowsAtCompileTime = PermTraits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = PermTraits::MaxColsAtCompileTime + }; + #endif + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + void evalTo(MatrixBase& other) const + { + other.setZero(); + for (Index i=0; i friend + const Product + operator*(const MatrixBase& matrix, const InverseType& trPerm) + { + return Product(matrix.derived(), trPerm.derived()); + } + + /** \returns the matrix with the inverse permutation applied to the rows. + */ + template + const Product + operator*(const MatrixBase& matrix) const + { + return Product(derived(), matrix.derived()); + } +}; + +template +const PermutationWrapper MatrixBase::asPermutation() const +{ + return derived(); +} + +namespace internal { + +template<> struct AssignmentKind { typedef EigenBase2EigenBase Kind; }; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_PERMUTATIONMATRIX_H diff --git a/simulation/externals/eigen/Eigen/src/Core/PlainObjectBase.h b/simulation/externals/eigen/Eigen/src/Core/PlainObjectBase.h new file mode 100644 index 0000000..77f4f60 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/PlainObjectBase.h @@ -0,0 +1,1031 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2009 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_DENSESTORAGEBASE_H +#define EIGEN_DENSESTORAGEBASE_H + +#if defined(EIGEN_INITIALIZE_MATRICES_BY_ZERO) +# define EIGEN_INITIALIZE_COEFFS +# define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED for(int i=0;i::quiet_NaN(); +#else +# undef EIGEN_INITIALIZE_COEFFS +# define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED +#endif + +namespace Eigen { + +namespace internal { + +template struct check_rows_cols_for_overflow { + template + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE void run(Index, Index) + { + } +}; + +template<> struct check_rows_cols_for_overflow { + template + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE void run(Index rows, Index cols) + { + // http://hg.mozilla.org/mozilla-central/file/6c8a909977d3/xpcom/ds/CheckedInt.h#l242 + // we assume Index is signed + Index max_index = (std::size_t(1) << (8 * sizeof(Index) - 1)) - 1; // assume Index is signed + bool error = (rows == 0 || cols == 0) ? false + : (rows > max_index / cols); + if (error) + throw_std_bad_alloc(); + } +}; + +template +struct conservative_resize_like_impl; + +template struct matrix_swap_impl; + +} // end namespace internal + +#ifdef EIGEN_PARSED_BY_DOXYGEN +namespace doxygen { + +// This is a workaround to doxygen not being able to understand the inheritance logic +// when it is hidden by the dense_xpr_base helper struct. +// Moreover, doxygen fails to include members that are not documented in the declaration body of +// MatrixBase if we inherits MatrixBase >, +// this is why we simply inherits MatrixBase, though this does not make sense. + +/** This class is just a workaround for Doxygen and it does not not actually exist. */ +template struct dense_xpr_base_dispatcher; +/** This class is just a workaround for Doxygen and it does not not actually exist. */ +template +struct dense_xpr_base_dispatcher > + : public MatrixBase {}; +/** This class is just a workaround for Doxygen and it does not not actually exist. */ +template +struct dense_xpr_base_dispatcher > + : public ArrayBase {}; + +} // namespace doxygen + +/** \class PlainObjectBase + * \ingroup Core_Module + * \brief %Dense storage base class for matrices and arrays. + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_PLAINOBJECTBASE_PLUGIN. + * + * \tparam Derived is the derived type, e.g., a Matrix or Array + * + * \sa \ref TopicClassHierarchy + */ +template +class PlainObjectBase : public doxygen::dense_xpr_base_dispatcher +#else +template +class PlainObjectBase : public internal::dense_xpr_base::type +#endif +{ + public: + enum { Options = internal::traits::Options }; + typedef typename internal::dense_xpr_base::type Base; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::Scalar Scalar; + + typedef typename internal::packet_traits::type PacketScalar; + typedef typename NumTraits::Real RealScalar; + typedef Derived DenseType; + + using Base::RowsAtCompileTime; + using Base::ColsAtCompileTime; + using Base::SizeAtCompileTime; + using Base::MaxRowsAtCompileTime; + using Base::MaxColsAtCompileTime; + using Base::MaxSizeAtCompileTime; + using Base::IsVectorAtCompileTime; + using Base::Flags; + + template friend class Eigen::Map; + friend class Eigen::Map; + typedef Eigen::Map MapType; + friend class Eigen::Map; + typedef const Eigen::Map ConstMapType; +#if EIGEN_MAX_ALIGN_BYTES>0 + // for EIGEN_MAX_ALIGN_BYTES==0, AlignedMax==Unaligned, and many compilers generate warnings for friend-ing a class twice. + friend class Eigen::Map; + friend class Eigen::Map; +#endif + typedef Eigen::Map AlignedMapType; + typedef const Eigen::Map ConstAlignedMapType; + template struct StridedMapType { typedef Eigen::Map type; }; + template struct StridedConstMapType { typedef Eigen::Map type; }; + template struct StridedAlignedMapType { typedef Eigen::Map type; }; + template struct StridedConstAlignedMapType { typedef Eigen::Map type; }; + + protected: + DenseStorage m_storage; + + public: + enum { NeedsToAlign = (SizeAtCompileTime != Dynamic) && (internal::traits::Alignment>0) }; + EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) + + EIGEN_DEVICE_FUNC + Base& base() { return *static_cast(this); } + EIGEN_DEVICE_FUNC + const Base& base() const { return *static_cast(this); } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index rows() const { return m_storage.rows(); } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index cols() const { return m_storage.cols(); } + + /** This is an overloaded version of DenseCoeffsBase::coeff(Index,Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeff(Index) const for details. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const Scalar& coeff(Index rowId, Index colId) const + { + if(Flags & RowMajorBit) + return m_storage.data()[colId + rowId * m_storage.cols()]; + else // column-major + return m_storage.data()[rowId + colId * m_storage.rows()]; + } + + /** This is an overloaded version of DenseCoeffsBase::coeff(Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeff(Index) const for details. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const Scalar& coeff(Index index) const + { + return m_storage.data()[index]; + } + + /** This is an overloaded version of DenseCoeffsBase::coeffRef(Index,Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeffRef(Index,Index) const for details. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& coeffRef(Index rowId, Index colId) + { + if(Flags & RowMajorBit) + return m_storage.data()[colId + rowId * m_storage.cols()]; + else // column-major + return m_storage.data()[rowId + colId * m_storage.rows()]; + } + + /** This is an overloaded version of DenseCoeffsBase::coeffRef(Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeffRef(Index) const for details. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) + { + return m_storage.data()[index]; + } + + /** This is the const version of coeffRef(Index,Index) which is thus synonym of coeff(Index,Index). + * It is provided for convenience. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const Scalar& coeffRef(Index rowId, Index colId) const + { + if(Flags & RowMajorBit) + return m_storage.data()[colId + rowId * m_storage.cols()]; + else // column-major + return m_storage.data()[rowId + colId * m_storage.rows()]; + } + + /** This is the const version of coeffRef(Index) which is thus synonym of coeff(Index). + * It is provided for convenience. */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const Scalar& coeffRef(Index index) const + { + return m_storage.data()[index]; + } + + /** \internal */ + template + EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const + { + return internal::ploadt + (m_storage.data() + (Flags & RowMajorBit + ? colId + rowId * m_storage.cols() + : rowId + colId * m_storage.rows())); + } + + /** \internal */ + template + EIGEN_STRONG_INLINE PacketScalar packet(Index index) const + { + return internal::ploadt(m_storage.data() + index); + } + + /** \internal */ + template + EIGEN_STRONG_INLINE void writePacket(Index rowId, Index colId, const PacketScalar& val) + { + internal::pstoret + (m_storage.data() + (Flags & RowMajorBit + ? colId + rowId * m_storage.cols() + : rowId + colId * m_storage.rows()), val); + } + + /** \internal */ + template + EIGEN_STRONG_INLINE void writePacket(Index index, const PacketScalar& val) + { + internal::pstoret(m_storage.data() + index, val); + } + + /** \returns a const pointer to the data array of this matrix */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar *data() const + { return m_storage.data(); } + + /** \returns a pointer to the data array of this matrix */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar *data() + { return m_storage.data(); } + + /** Resizes \c *this to a \a rows x \a cols matrix. + * + * This method is intended for dynamic-size matrices, although it is legal to call it on any + * matrix as long as fixed dimensions are left unchanged. If you only want to change the number + * of rows and/or of columns, you can use resize(NoChange_t, Index), resize(Index, NoChange_t). + * + * If the current number of coefficients of \c *this exactly matches the + * product \a rows * \a cols, then no memory allocation is performed and + * the current values are left unchanged. In all other cases, including + * shrinking, the data is reallocated and all previous values are lost. + * + * Example: \include Matrix_resize_int_int.cpp + * Output: \verbinclude Matrix_resize_int_int.out + * + * \sa resize(Index) for vectors, resize(NoChange_t, Index), resize(Index, NoChange_t) + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void resize(Index rows, Index cols) + { + eigen_assert( EIGEN_IMPLIES(RowsAtCompileTime!=Dynamic,rows==RowsAtCompileTime) + && EIGEN_IMPLIES(ColsAtCompileTime!=Dynamic,cols==ColsAtCompileTime) + && EIGEN_IMPLIES(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic,rows<=MaxRowsAtCompileTime) + && EIGEN_IMPLIES(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic,cols<=MaxColsAtCompileTime) + && rows>=0 && cols>=0 && "Invalid sizes when resizing a matrix or array."); + internal::check_rows_cols_for_overflow::run(rows, cols); + #ifdef EIGEN_INITIALIZE_COEFFS + Index size = rows*cols; + bool size_changed = size != this->size(); + m_storage.resize(size, rows, cols); + if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + #else + m_storage.resize(rows*cols, rows, cols); + #endif + } + + /** Resizes \c *this to a vector of length \a size + * + * \only_for_vectors. This method does not work for + * partially dynamic matrices when the static dimension is anything other + * than 1. For example it will not work with Matrix. + * + * Example: \include Matrix_resize_int.cpp + * Output: \verbinclude Matrix_resize_int.out + * + * \sa resize(Index,Index), resize(NoChange_t, Index), resize(Index, NoChange_t) + */ + EIGEN_DEVICE_FUNC + inline void resize(Index size) + { + EIGEN_STATIC_ASSERT_VECTOR_ONLY(PlainObjectBase) + eigen_assert(((SizeAtCompileTime == Dynamic && (MaxSizeAtCompileTime==Dynamic || size<=MaxSizeAtCompileTime)) || SizeAtCompileTime == size) && size>=0); + #ifdef EIGEN_INITIALIZE_COEFFS + bool size_changed = size != this->size(); + #endif + if(RowsAtCompileTime == 1) + m_storage.resize(size, 1, size); + else + m_storage.resize(size, size, 1); + #ifdef EIGEN_INITIALIZE_COEFFS + if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + #endif + } + + /** Resizes the matrix, changing only the number of columns. For the parameter of type NoChange_t, just pass the special value \c NoChange + * as in the example below. + * + * Example: \include Matrix_resize_NoChange_int.cpp + * Output: \verbinclude Matrix_resize_NoChange_int.out + * + * \sa resize(Index,Index) + */ + EIGEN_DEVICE_FUNC + inline void resize(NoChange_t, Index cols) + { + resize(rows(), cols); + } + + /** Resizes the matrix, changing only the number of rows. For the parameter of type NoChange_t, just pass the special value \c NoChange + * as in the example below. + * + * Example: \include Matrix_resize_int_NoChange.cpp + * Output: \verbinclude Matrix_resize_int_NoChange.out + * + * \sa resize(Index,Index) + */ + EIGEN_DEVICE_FUNC + inline void resize(Index rows, NoChange_t) + { + resize(rows, cols()); + } + + /** Resizes \c *this to have the same dimensions as \a other. + * Takes care of doing all the checking that's needed. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void resizeLike(const EigenBase& _other) + { + const OtherDerived& other = _other.derived(); + internal::check_rows_cols_for_overflow::run(other.rows(), other.cols()); + const Index othersize = other.rows()*other.cols(); + if(RowsAtCompileTime == 1) + { + eigen_assert(other.rows() == 1 || other.cols() == 1); + resize(1, othersize); + } + else if(ColsAtCompileTime == 1) + { + eigen_assert(other.rows() == 1 || other.cols() == 1); + resize(othersize, 1); + } + else resize(other.rows(), other.cols()); + } + + /** Resizes the matrix to \a rows x \a cols while leaving old values untouched. + * + * The method is intended for matrices of dynamic size. If you only want to change the number + * of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or + * conservativeResize(Index, NoChange_t). + * + * Matrices are resized relative to the top-left element. In case values need to be + * appended to the matrix they will be uninitialized. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void conservativeResize(Index rows, Index cols) + { + internal::conservative_resize_like_impl::run(*this, rows, cols); + } + + /** Resizes the matrix to \a rows x \a cols while leaving old values untouched. + * + * As opposed to conservativeResize(Index rows, Index cols), this version leaves + * the number of columns unchanged. + * + * In case the matrix is growing, new rows will be uninitialized. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void conservativeResize(Index rows, NoChange_t) + { + // Note: see the comment in conservativeResize(Index,Index) + conservativeResize(rows, cols()); + } + + /** Resizes the matrix to \a rows x \a cols while leaving old values untouched. + * + * As opposed to conservativeResize(Index rows, Index cols), this version leaves + * the number of rows unchanged. + * + * In case the matrix is growing, new columns will be uninitialized. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void conservativeResize(NoChange_t, Index cols) + { + // Note: see the comment in conservativeResize(Index,Index) + conservativeResize(rows(), cols); + } + + /** Resizes the vector to \a size while retaining old values. + * + * \only_for_vectors. This method does not work for + * partially dynamic matrices when the static dimension is anything other + * than 1. For example it will not work with Matrix. + * + * When values are appended, they will be uninitialized. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void conservativeResize(Index size) + { + internal::conservative_resize_like_impl::run(*this, size); + } + + /** Resizes the matrix to \a rows x \a cols of \c other, while leaving old values untouched. + * + * The method is intended for matrices of dynamic size. If you only want to change the number + * of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or + * conservativeResize(Index, NoChange_t). + * + * Matrices are resized relative to the top-left element. In case values need to be + * appended to the matrix they will copied from \c other. + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void conservativeResizeLike(const DenseBase& other) + { + internal::conservative_resize_like_impl::run(*this, other); + } + + /** This is a special case of the templated operator=. Its purpose is to + * prevent a default operator= from hiding the templated operator=. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Derived& operator=(const PlainObjectBase& other) + { + return _set(other); + } + + /** \sa MatrixBase::lazyAssign() */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Derived& lazyAssign(const DenseBase& other) + { + _resize_to_match(other); + return Base::lazyAssign(other.derived()); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Derived& operator=(const ReturnByValue& func) + { + resize(func.rows(), func.cols()); + return Base::operator=(func); + } + + // Prevent user from trying to instantiate PlainObjectBase objects + // by making all its constructor protected. See bug 1074. + protected: + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase() : m_storage() + { +// _check_template_params(); +// EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + } + +#ifndef EIGEN_PARSED_BY_DOXYGEN + // FIXME is it still needed ? + /** \internal */ + EIGEN_DEVICE_FUNC + explicit PlainObjectBase(internal::constructor_without_unaligned_array_assert) + : m_storage(internal::constructor_without_unaligned_array_assert()) + { +// _check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + } +#endif + +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + PlainObjectBase(PlainObjectBase&& other) EIGEN_NOEXCEPT + : m_storage( std::move(other.m_storage) ) + { + } + + EIGEN_DEVICE_FUNC + PlainObjectBase& operator=(PlainObjectBase&& other) EIGEN_NOEXCEPT + { + using std::swap; + swap(m_storage, other.m_storage); + return *this; + } +#endif + + /** Copy constructor */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(const PlainObjectBase& other) + : Base(), m_storage(other.m_storage) { } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols) + : m_storage(size, rows, cols) + { +// _check_template_params(); +// EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + } + + /** \sa PlainObjectBase::operator=(const EigenBase&) */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(const DenseBase &other) + : m_storage() + { + _check_template_params(); + resizeLike(other); + _set_noalias(other); + } + + /** \sa PlainObjectBase::operator=(const EigenBase&) */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(const EigenBase &other) + : m_storage() + { + _check_template_params(); + resizeLike(other); + *this = other.derived(); + } + /** \brief Copy constructor with in-place evaluation */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(const ReturnByValue& other) + { + _check_template_params(); + // FIXME this does not automatically transpose vectors if necessary + resize(other.rows(), other.cols()); + other.evalTo(this->derived()); + } + + public: + + /** \brief Copies the generic expression \a other into *this. + * \copydetails DenseBase::operator=(const EigenBase &other) + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Derived& operator=(const EigenBase &other) + { + _resize_to_match(other); + Base::operator=(other.derived()); + return this->derived(); + } + + /** \name Map + * These are convenience functions returning Map objects. The Map() static functions return unaligned Map objects, + * while the AlignedMap() functions return aligned Map objects and thus should be called only with 16-byte-aligned + * \a data pointers. + * + * \see class Map + */ + //@{ + static inline ConstMapType Map(const Scalar* data) + { return ConstMapType(data); } + static inline MapType Map(Scalar* data) + { return MapType(data); } + static inline ConstMapType Map(const Scalar* data, Index size) + { return ConstMapType(data, size); } + static inline MapType Map(Scalar* data, Index size) + { return MapType(data, size); } + static inline ConstMapType Map(const Scalar* data, Index rows, Index cols) + { return ConstMapType(data, rows, cols); } + static inline MapType Map(Scalar* data, Index rows, Index cols) + { return MapType(data, rows, cols); } + + static inline ConstAlignedMapType MapAligned(const Scalar* data) + { return ConstAlignedMapType(data); } + static inline AlignedMapType MapAligned(Scalar* data) + { return AlignedMapType(data); } + static inline ConstAlignedMapType MapAligned(const Scalar* data, Index size) + { return ConstAlignedMapType(data, size); } + static inline AlignedMapType MapAligned(Scalar* data, Index size) + { return AlignedMapType(data, size); } + static inline ConstAlignedMapType MapAligned(const Scalar* data, Index rows, Index cols) + { return ConstAlignedMapType(data, rows, cols); } + static inline AlignedMapType MapAligned(Scalar* data, Index rows, Index cols) + { return AlignedMapType(data, rows, cols); } + + template + static inline typename StridedConstMapType >::type Map(const Scalar* data, const Stride& stride) + { return typename StridedConstMapType >::type(data, stride); } + template + static inline typename StridedMapType >::type Map(Scalar* data, const Stride& stride) + { return typename StridedMapType >::type(data, stride); } + template + static inline typename StridedConstMapType >::type Map(const Scalar* data, Index size, const Stride& stride) + { return typename StridedConstMapType >::type(data, size, stride); } + template + static inline typename StridedMapType >::type Map(Scalar* data, Index size, const Stride& stride) + { return typename StridedMapType >::type(data, size, stride); } + template + static inline typename StridedConstMapType >::type Map(const Scalar* data, Index rows, Index cols, const Stride& stride) + { return typename StridedConstMapType >::type(data, rows, cols, stride); } + template + static inline typename StridedMapType >::type Map(Scalar* data, Index rows, Index cols, const Stride& stride) + { return typename StridedMapType >::type(data, rows, cols, stride); } + + template + static inline typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, const Stride& stride) + { return typename StridedConstAlignedMapType >::type(data, stride); } + template + static inline typename StridedAlignedMapType >::type MapAligned(Scalar* data, const Stride& stride) + { return typename StridedAlignedMapType >::type(data, stride); } + template + static inline typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, Index size, const Stride& stride) + { return typename StridedConstAlignedMapType >::type(data, size, stride); } + template + static inline typename StridedAlignedMapType >::type MapAligned(Scalar* data, Index size, const Stride& stride) + { return typename StridedAlignedMapType >::type(data, size, stride); } + template + static inline typename StridedConstAlignedMapType >::type MapAligned(const Scalar* data, Index rows, Index cols, const Stride& stride) + { return typename StridedConstAlignedMapType >::type(data, rows, cols, stride); } + template + static inline typename StridedAlignedMapType >::type MapAligned(Scalar* data, Index rows, Index cols, const Stride& stride) + { return typename StridedAlignedMapType >::type(data, rows, cols, stride); } + //@} + + using Base::setConstant; + EIGEN_DEVICE_FUNC Derived& setConstant(Index size, const Scalar& val); + EIGEN_DEVICE_FUNC Derived& setConstant(Index rows, Index cols, const Scalar& val); + + using Base::setZero; + EIGEN_DEVICE_FUNC Derived& setZero(Index size); + EIGEN_DEVICE_FUNC Derived& setZero(Index rows, Index cols); + + using Base::setOnes; + EIGEN_DEVICE_FUNC Derived& setOnes(Index size); + EIGEN_DEVICE_FUNC Derived& setOnes(Index rows, Index cols); + + using Base::setRandom; + Derived& setRandom(Index size); + Derived& setRandom(Index rows, Index cols); + + #ifdef EIGEN_PLAINOBJECTBASE_PLUGIN + #include EIGEN_PLAINOBJECTBASE_PLUGIN + #endif + + protected: + /** \internal Resizes *this in preparation for assigning \a other to it. + * Takes care of doing all the checking that's needed. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _resize_to_match(const EigenBase& other) + { + #ifdef EIGEN_NO_AUTOMATIC_RESIZING + eigen_assert((this->size()==0 || (IsVectorAtCompileTime ? (this->size() == other.size()) + : (rows() == other.rows() && cols() == other.cols()))) + && "Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined"); + EIGEN_ONLY_USED_FOR_DEBUG(other); + #else + resizeLike(other); + #endif + } + + /** + * \brief Copies the value of the expression \a other into \c *this with automatic resizing. + * + * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized), + * it will be initialized. + * + * Note that copying a row-vector into a vector (and conversely) is allowed. + * The resizing, if any, is then done in the appropriate way so that row-vectors + * remain row-vectors and vectors remain vectors. + * + * \sa operator=(const MatrixBase&), _set_noalias() + * + * \internal + */ + // aliasing is dealt once in internall::call_assignment + // so at this stage we have to assume aliasing... and resising has to be done later. + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Derived& _set(const DenseBase& other) + { + internal::call_assignment(this->derived(), other.derived()); + return this->derived(); + } + + /** \internal Like _set() but additionally makes the assumption that no aliasing effect can happen (which + * is the case when creating a new matrix) so one can enforce lazy evaluation. + * + * \sa operator=(const MatrixBase&), _set() + */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Derived& _set_noalias(const DenseBase& other) + { + // I don't think we need this resize call since the lazyAssign will anyways resize + // and lazyAssign will be called by the assign selector. + //_resize_to_match(other); + // the 'false' below means to enforce lazy evaluation. We don't use lazyAssign() because + // it wouldn't allow to copy a row-vector into a column-vector. + internal::call_assignment_no_alias(this->derived(), other.derived(), internal::assign_op()); + return this->derived(); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename internal::enable_if::type* = 0) + { + EIGEN_STATIC_ASSERT(bool(NumTraits::IsInteger) && + bool(NumTraits::IsInteger), + FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED) + resize(rows,cols); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init2(const T0& val0, const T1& val1, typename internal::enable_if::type* = 0) + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2) + m_storage.data()[0] = Scalar(val0); + m_storage.data()[1] = Scalar(val1); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init2(const Index& val0, const Index& val1, + typename internal::enable_if< (!internal::is_same::value) + && (internal::is_same::value) + && (internal::is_same::value) + && Base::SizeAtCompileTime==2,T1>::type* = 0) + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2) + m_storage.data()[0] = Scalar(val0); + m_storage.data()[1] = Scalar(val1); + } + + // The argument is convertible to the Index type and we either have a non 1x1 Matrix, or a dynamic-sized Array, + // then the argument is meant to be the size of the object. + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(Index size, typename internal::enable_if< (Base::SizeAtCompileTime!=1 || !internal::is_convertible::value) + && ((!internal::is_same::XprKind,ArrayXpr>::value || Base::SizeAtCompileTime==Dynamic)),T>::type* = 0) + { + // NOTE MSVC 2008 complains if we directly put bool(NumTraits::IsInteger) as the EIGEN_STATIC_ASSERT argument. + const bool is_integer = NumTraits::IsInteger; + EIGEN_UNUSED_VARIABLE(is_integer); + EIGEN_STATIC_ASSERT(is_integer, + FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED) + resize(size); + } + + // We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar type can be implicitely converted) + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Scalar& val0, typename internal::enable_if::value,T>::type* = 0) + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1) + m_storage.data()[0] = val0; + } + + // We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar type match the index type) + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Index& val0, + typename internal::enable_if< (!internal::is_same::value) + && (internal::is_same::value) + && Base::SizeAtCompileTime==1 + && internal::is_convertible::value,T*>::type* = 0) + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1) + m_storage.data()[0] = Scalar(val0); + } + + // Initialize a fixed size matrix from a pointer to raw data + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Scalar* data){ + this->_set_noalias(ConstMapType(data)); + } + + // Initialize an arbitrary matrix from a dense expression + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const DenseBase& other){ + this->_set_noalias(other); + } + + // Initialize an arbitrary matrix from an object convertible to the Derived type. + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Derived& other){ + this->_set_noalias(other); + } + + // Initialize an arbitrary matrix from a generic Eigen expression + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const EigenBase& other){ + this->derived() = other; + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const ReturnByValue& other) + { + resize(other.rows(), other.cols()); + other.evalTo(this->derived()); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const RotationBase& r) + { + this->derived() = r; + } + + // For fixed-size Array + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Scalar& val0, + typename internal::enable_if< Base::SizeAtCompileTime!=Dynamic + && Base::SizeAtCompileTime!=1 + && internal::is_convertible::value + && internal::is_same::XprKind,ArrayXpr>::value,T>::type* = 0) + { + Base::setConstant(val0); + } + + // For fixed-size Array + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Index& val0, + typename internal::enable_if< (!internal::is_same::value) + && (internal::is_same::value) + && Base::SizeAtCompileTime!=Dynamic + && Base::SizeAtCompileTime!=1 + && internal::is_convertible::value + && internal::is_same::XprKind,ArrayXpr>::value,T*>::type* = 0) + { + Base::setConstant(val0); + } + + template + friend struct internal::matrix_swap_impl; + + public: + +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal + * \brief Override DenseBase::swap() since for dynamic-sized matrices + * of same type it is enough to swap the data pointers. + */ + template + EIGEN_DEVICE_FUNC + void swap(DenseBase & other) + { + enum { SwapPointers = internal::is_same::value && Base::SizeAtCompileTime==Dynamic }; + internal::matrix_swap_impl::run(this->derived(), other.derived()); + } + + /** \internal + * \brief const version forwarded to DenseBase::swap + */ + template + EIGEN_DEVICE_FUNC + void swap(DenseBase const & other) + { Base::swap(other.derived()); } + + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void _check_template_params() + { + EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (Options&RowMajor)==RowMajor) + && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (Options&RowMajor)==0) + && ((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0)) + && ((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0)) + && ((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0)) + && ((MaxColsAtCompileTime == Dynamic) || (MaxColsAtCompileTime >= 0)) + && (MaxRowsAtCompileTime == RowsAtCompileTime || RowsAtCompileTime==Dynamic) + && (MaxColsAtCompileTime == ColsAtCompileTime || ColsAtCompileTime==Dynamic) + && (Options & (DontAlign|RowMajor)) == Options), + INVALID_MATRIX_TEMPLATE_PARAMETERS) + } + + enum { IsPlainObjectBase = 1 }; +#endif +}; + +namespace internal { + +template +struct conservative_resize_like_impl +{ + static void run(DenseBase& _this, Index rows, Index cols) + { + if (_this.rows() == rows && _this.cols() == cols) return; + EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived) + + if ( ( Derived::IsRowMajor && _this.cols() == cols) || // row-major and we change only the number of rows + (!Derived::IsRowMajor && _this.rows() == rows) ) // column-major and we change only the number of columns + { + internal::check_rows_cols_for_overflow::run(rows, cols); + _this.derived().m_storage.conservativeResize(rows*cols,rows,cols); + } + else + { + // The storage order does not allow us to use reallocation. + typename Derived::PlainObject tmp(rows,cols); + const Index common_rows = numext::mini(rows, _this.rows()); + const Index common_cols = numext::mini(cols, _this.cols()); + tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols); + _this.derived().swap(tmp); + } + } + + static void run(DenseBase& _this, const DenseBase& other) + { + if (_this.rows() == other.rows() && _this.cols() == other.cols()) return; + + // Note: Here is space for improvement. Basically, for conservativeResize(Index,Index), + // neither RowsAtCompileTime or ColsAtCompileTime must be Dynamic. If only one of the + // dimensions is dynamic, one could use either conservativeResize(Index rows, NoChange_t) or + // conservativeResize(NoChange_t, Index cols). For these methods new static asserts like + // EIGEN_STATIC_ASSERT_DYNAMIC_ROWS and EIGEN_STATIC_ASSERT_DYNAMIC_COLS would be good. + EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived) + EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(OtherDerived) + + if ( ( Derived::IsRowMajor && _this.cols() == other.cols()) || // row-major and we change only the number of rows + (!Derived::IsRowMajor && _this.rows() == other.rows()) ) // column-major and we change only the number of columns + { + const Index new_rows = other.rows() - _this.rows(); + const Index new_cols = other.cols() - _this.cols(); + _this.derived().m_storage.conservativeResize(other.size(),other.rows(),other.cols()); + if (new_rows>0) + _this.bottomRightCorner(new_rows, other.cols()) = other.bottomRows(new_rows); + else if (new_cols>0) + _this.bottomRightCorner(other.rows(), new_cols) = other.rightCols(new_cols); + } + else + { + // The storage order does not allow us to use reallocation. + typename Derived::PlainObject tmp(other); + const Index common_rows = numext::mini(tmp.rows(), _this.rows()); + const Index common_cols = numext::mini(tmp.cols(), _this.cols()); + tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols); + _this.derived().swap(tmp); + } + } +}; + +// Here, the specialization for vectors inherits from the general matrix case +// to allow calling .conservativeResize(rows,cols) on vectors. +template +struct conservative_resize_like_impl + : conservative_resize_like_impl +{ + using conservative_resize_like_impl::run; + + static void run(DenseBase& _this, Index size) + { + const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : size; + const Index new_cols = Derived::RowsAtCompileTime==1 ? size : 1; + _this.derived().m_storage.conservativeResize(size,new_rows,new_cols); + } + + static void run(DenseBase& _this, const DenseBase& other) + { + if (_this.rows() == other.rows() && _this.cols() == other.cols()) return; + + const Index num_new_elements = other.size() - _this.size(); + + const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : other.rows(); + const Index new_cols = Derived::RowsAtCompileTime==1 ? other.cols() : 1; + _this.derived().m_storage.conservativeResize(other.size(),new_rows,new_cols); + + if (num_new_elements > 0) + _this.tail(num_new_elements) = other.tail(num_new_elements); + } +}; + +template +struct matrix_swap_impl +{ + EIGEN_DEVICE_FUNC + static inline void run(MatrixTypeA& a, MatrixTypeB& b) + { + a.base().swap(b); + } +}; + +template +struct matrix_swap_impl +{ + EIGEN_DEVICE_FUNC + static inline void run(MatrixTypeA& a, MatrixTypeB& b) + { + static_cast(a).m_storage.swap(static_cast(b).m_storage); + } +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_DENSESTORAGEBASE_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Product.h b/simulation/externals/eigen/Eigen/src/Core/Product.h new file mode 100644 index 0000000..ae0c94b --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Product.h @@ -0,0 +1,186 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_PRODUCT_H +#define EIGEN_PRODUCT_H + +namespace Eigen { + +template class ProductImpl; + +namespace internal { + +template +struct traits > +{ + typedef typename remove_all::type LhsCleaned; + typedef typename remove_all::type RhsCleaned; + typedef traits LhsTraits; + typedef traits RhsTraits; + + typedef MatrixXpr XprKind; + + typedef typename ScalarBinaryOpTraits::Scalar, typename traits::Scalar>::ReturnType Scalar; + typedef typename product_promote_storage_type::ret>::ret StorageKind; + typedef typename promote_index_type::type StorageIndex; + + enum { + RowsAtCompileTime = LhsTraits::RowsAtCompileTime, + ColsAtCompileTime = RhsTraits::ColsAtCompileTime, + MaxRowsAtCompileTime = LhsTraits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = RhsTraits::MaxColsAtCompileTime, + + // FIXME: only needed by GeneralMatrixMatrixTriangular + InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(LhsTraits::ColsAtCompileTime, RhsTraits::RowsAtCompileTime), + + // The storage order is somewhat arbitrary here. The correct one will be determined through the evaluator. + Flags = (MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1) ? RowMajorBit + : (MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1) ? 0 + : ( ((LhsTraits::Flags&NoPreferredStorageOrderBit) && (RhsTraits::Flags&RowMajorBit)) + || ((RhsTraits::Flags&NoPreferredStorageOrderBit) && (LhsTraits::Flags&RowMajorBit)) ) ? RowMajorBit + : NoPreferredStorageOrderBit + }; +}; + +} // end namespace internal + +/** \class Product + * \ingroup Core_Module + * + * \brief Expression of the product of two arbitrary matrices or vectors + * + * \tparam _Lhs the type of the left-hand side expression + * \tparam _Rhs the type of the right-hand side expression + * + * This class represents an expression of the product of two arbitrary matrices. + * + * The other template parameters are: + * \tparam Option can be DefaultProduct, AliasFreeProduct, or LazyProduct + * + */ +template +class Product : public ProductImpl<_Lhs,_Rhs,Option, + typename internal::product_promote_storage_type::StorageKind, + typename internal::traits<_Rhs>::StorageKind, + internal::product_type<_Lhs,_Rhs>::ret>::ret> +{ + public: + + typedef _Lhs Lhs; + typedef _Rhs Rhs; + + typedef typename ProductImpl< + Lhs, Rhs, Option, + typename internal::product_promote_storage_type::StorageKind, + typename internal::traits::StorageKind, + internal::product_type::ret>::ret>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(Product) + + typedef typename internal::ref_selector::type LhsNested; + typedef typename internal::ref_selector::type RhsNested; + typedef typename internal::remove_all::type LhsNestedCleaned; + typedef typename internal::remove_all::type RhsNestedCleaned; + + EIGEN_DEVICE_FUNC Product(const Lhs& lhs, const Rhs& rhs) : m_lhs(lhs), m_rhs(rhs) + { + eigen_assert(lhs.cols() == rhs.rows() + && "invalid matrix product" + && "if you wanted a coeff-wise or a dot product use the respective explicit functions"); + } + + EIGEN_DEVICE_FUNC inline Index rows() const { return m_lhs.rows(); } + EIGEN_DEVICE_FUNC inline Index cols() const { return m_rhs.cols(); } + + EIGEN_DEVICE_FUNC const LhsNestedCleaned& lhs() const { return m_lhs; } + EIGEN_DEVICE_FUNC const RhsNestedCleaned& rhs() const { return m_rhs; } + + protected: + + LhsNested m_lhs; + RhsNested m_rhs; +}; + +namespace internal { + +template::ret> +class dense_product_base + : public internal::dense_xpr_base >::type +{}; + +/** Convertion to scalar for inner-products */ +template +class dense_product_base + : public internal::dense_xpr_base >::type +{ + typedef Product ProductXpr; + typedef typename internal::dense_xpr_base::type Base; +public: + using Base::derived; + typedef typename Base::Scalar Scalar; + + operator const Scalar() const + { + return internal::evaluator(derived()).coeff(0,0); + } +}; + +} // namespace internal + +// Generic API dispatcher +template +class ProductImpl : public internal::generic_xpr_base, MatrixXpr, StorageKind>::type +{ + public: + typedef typename internal::generic_xpr_base, MatrixXpr, StorageKind>::type Base; +}; + +template +class ProductImpl + : public internal::dense_product_base +{ + typedef Product Derived; + + public: + + typedef typename internal::dense_product_base Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Derived) + protected: + enum { + IsOneByOne = (RowsAtCompileTime == 1 || RowsAtCompileTime == Dynamic) && + (ColsAtCompileTime == 1 || ColsAtCompileTime == Dynamic), + EnableCoeff = IsOneByOne || Option==LazyProduct + }; + + public: + + EIGEN_DEVICE_FUNC Scalar coeff(Index row, Index col) const + { + EIGEN_STATIC_ASSERT(EnableCoeff, THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS); + eigen_assert( (Option==LazyProduct) || (this->rows() == 1 && this->cols() == 1) ); + + return internal::evaluator(derived()).coeff(row,col); + } + + EIGEN_DEVICE_FUNC Scalar coeff(Index i) const + { + EIGEN_STATIC_ASSERT(EnableCoeff, THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS); + eigen_assert( (Option==LazyProduct) || (this->rows() == 1 && this->cols() == 1) ); + + return internal::evaluator(derived()).coeff(i); + } + + +}; + +} // end namespace Eigen + +#endif // EIGEN_PRODUCT_H diff --git a/simulation/externals/eigen/Eigen/src/Core/ProductEvaluators.h b/simulation/externals/eigen/Eigen/src/Core/ProductEvaluators.h new file mode 100644 index 0000000..c42725d --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/ProductEvaluators.h @@ -0,0 +1,1105 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008-2010 Gael Guennebaud +// Copyright (C) 2011 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +#ifndef EIGEN_PRODUCTEVALUATORS_H +#define EIGEN_PRODUCTEVALUATORS_H + +namespace Eigen { + +namespace internal { + +/** \internal + * Evaluator of a product expression. + * Since products require special treatments to handle all possible cases, + * we simply deffer the evaluation logic to a product_evaluator class + * which offers more partial specialization possibilities. + * + * \sa class product_evaluator + */ +template +struct evaluator > + : public product_evaluator > +{ + typedef Product XprType; + typedef product_evaluator Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : Base(xpr) {} +}; + +// Catch "scalar * ( A * B )" and transform it to "(A*scalar) * B" +// TODO we should apply that rule only if that's really helpful +template +struct evaluator_assume_aliasing, + const CwiseNullaryOp, Plain1>, + const Product > > +{ + static const bool value = true; +}; +template +struct evaluator, + const CwiseNullaryOp, Plain1>, + const Product > > + : public evaluator > +{ + typedef CwiseBinaryOp, + const CwiseNullaryOp, Plain1>, + const Product > XprType; + typedef evaluator > Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) + : Base(xpr.lhs().functor().m_other * xpr.rhs().lhs() * xpr.rhs().rhs()) + {} +}; + + +template +struct evaluator, DiagIndex> > + : public evaluator, DiagIndex> > +{ + typedef Diagonal, DiagIndex> XprType; + typedef evaluator, DiagIndex> > Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) + : Base(Diagonal, DiagIndex>( + Product(xpr.nestedExpression().lhs(), xpr.nestedExpression().rhs()), + xpr.index() )) + {} +}; + + +// Helper class to perform a matrix product with the destination at hand. +// Depending on the sizes of the factors, there are different evaluation strategies +// as controlled by internal::product_type. +template< typename Lhs, typename Rhs, + typename LhsShape = typename evaluator_traits::Shape, + typename RhsShape = typename evaluator_traits::Shape, + int ProductType = internal::product_type::value> +struct generic_product_impl; + +template +struct evaluator_assume_aliasing > { + static const bool value = true; +}; + +// This is the default evaluator implementation for products: +// It creates a temporary and call generic_product_impl +template +struct product_evaluator, ProductTag, LhsShape, RhsShape> + : public evaluator::PlainObject> +{ + typedef Product XprType; + typedef typename XprType::PlainObject PlainObject; + typedef evaluator Base; + enum { + Flags = Base::Flags | EvalBeforeNestingBit + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit product_evaluator(const XprType& xpr) + : m_result(xpr.rows(), xpr.cols()) + { + ::new (static_cast(this)) Base(m_result); + +// FIXME shall we handle nested_eval here?, +// if so, then we must take care at removing the call to nested_eval in the specializations (e.g., in permutation_matrix_product, transposition_matrix_product, etc.) +// typedef typename internal::nested_eval::type LhsNested; +// typedef typename internal::nested_eval::type RhsNested; +// typedef typename internal::remove_all::type LhsNestedCleaned; +// typedef typename internal::remove_all::type RhsNestedCleaned; +// +// const LhsNested lhs(xpr.lhs()); +// const RhsNested rhs(xpr.rhs()); +// +// generic_product_impl::evalTo(m_result, lhs, rhs); + + generic_product_impl::evalTo(m_result, xpr.lhs(), xpr.rhs()); + } + +protected: + PlainObject m_result; +}; + +// The following three shortcuts are enabled only if the scalar types match excatly. +// TODO: we could enable them for different scalar types when the product is not vectorized. + +// Dense = Product +template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar> +struct Assignment, internal::assign_op, Dense2Dense, + typename enable_if<(Options==DefaultProduct || Options==AliasFreeProduct)>::type> +{ + typedef Product SrcXprType; + static EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + // FIXME shall we handle nested_eval here? + generic_product_impl::evalTo(dst, src.lhs(), src.rhs()); + } +}; + +// Dense += Product +template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar> +struct Assignment, internal::add_assign_op, Dense2Dense, + typename enable_if<(Options==DefaultProduct || Options==AliasFreeProduct)>::type> +{ + typedef Product SrcXprType; + static EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op &) + { + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + // FIXME shall we handle nested_eval here? + generic_product_impl::addTo(dst, src.lhs(), src.rhs()); + } +}; + +// Dense -= Product +template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar> +struct Assignment, internal::sub_assign_op, Dense2Dense, + typename enable_if<(Options==DefaultProduct || Options==AliasFreeProduct)>::type> +{ + typedef Product SrcXprType; + static EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op &) + { + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + // FIXME shall we handle nested_eval here? + generic_product_impl::subTo(dst, src.lhs(), src.rhs()); + } +}; + + +// Dense ?= scalar * Product +// TODO we should apply that rule if that's really helpful +// for instance, this is not good for inner products +template< typename DstXprType, typename Lhs, typename Rhs, typename AssignFunc, typename Scalar, typename ScalarBis, typename Plain> +struct Assignment, const CwiseNullaryOp,Plain>, + const Product >, AssignFunc, Dense2Dense> +{ + typedef CwiseBinaryOp, + const CwiseNullaryOp,Plain>, + const Product > SrcXprType; + static EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const AssignFunc& func) + { + call_assignment_no_alias(dst, (src.lhs().functor().m_other * src.rhs().lhs())*src.rhs().rhs(), func); + } +}; + +//---------------------------------------- +// Catch "Dense ?= xpr + Product<>" expression to save one temporary +// FIXME we could probably enable these rules for any product, i.e., not only Dense and DefaultProduct + +template +struct evaluator_assume_aliasing::Scalar>, const OtherXpr, + const Product >, DenseShape > { + static const bool value = true; +}; + +template +struct evaluator_assume_aliasing::Scalar>, const OtherXpr, + const Product >, DenseShape > { + static const bool value = true; +}; + +template +struct assignment_from_xpr_op_product +{ + template + static EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const InitialFunc& /*func*/) + { + call_assignment_no_alias(dst, src.lhs(), Func1()); + call_assignment_no_alias(dst, src.rhs(), Func2()); + } +}; + +#define EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(ASSIGN_OP,BINOP,ASSIGN_OP2) \ + template< typename DstXprType, typename OtherXpr, typename Lhs, typename Rhs, typename DstScalar, typename SrcScalar, typename OtherScalar,typename ProdScalar> \ + struct Assignment, const OtherXpr, \ + const Product >, internal::ASSIGN_OP, Dense2Dense> \ + : assignment_from_xpr_op_product, internal::ASSIGN_OP, internal::ASSIGN_OP2 > \ + {} + +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(assign_op, scalar_sum_op,add_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(add_assign_op,scalar_sum_op,add_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(sub_assign_op,scalar_sum_op,sub_assign_op); + +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(assign_op, scalar_difference_op,sub_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(add_assign_op,scalar_difference_op,sub_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(sub_assign_op,scalar_difference_op,add_assign_op); + +//---------------------------------------- + +template +struct generic_product_impl +{ + template + static inline void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + dst.coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum(); + } + + template + static inline void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + dst.coeffRef(0,0) += (lhs.transpose().cwiseProduct(rhs)).sum(); + } + + template + static void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { dst.coeffRef(0,0) -= (lhs.transpose().cwiseProduct(rhs)).sum(); } +}; + + +/*********************************************************************** +* Implementation of outer dense * dense vector product +***********************************************************************/ + +// Column major result +template +void outer_product_selector_run(Dst& dst, const Lhs &lhs, const Rhs &rhs, const Func& func, const false_type&) +{ + evaluator rhsEval(rhs); + typename nested_eval::type actual_lhs(lhs); + // FIXME if cols is large enough, then it might be useful to make sure that lhs is sequentially stored + // FIXME not very good if rhs is real and lhs complex while alpha is real too + const Index cols = dst.cols(); + for (Index j=0; j +void outer_product_selector_run(Dst& dst, const Lhs &lhs, const Rhs &rhs, const Func& func, const true_type&) +{ + evaluator lhsEval(lhs); + typename nested_eval::type actual_rhs(rhs); + // FIXME if rows is large enough, then it might be useful to make sure that rhs is sequentially stored + // FIXME not very good if lhs is real and rhs complex while alpha is real too + const Index rows = dst.rows(); + for (Index i=0; i +struct generic_product_impl +{ + template struct is_row_major : internal::conditional<(int(T::Flags)&RowMajorBit), internal::true_type, internal::false_type>::type {}; + typedef typename Product::Scalar Scalar; + + // TODO it would be nice to be able to exploit our *_assign_op functors for that purpose + struct set { template void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() = src; } }; + struct add { template void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() += src; } }; + struct sub { template void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() -= src; } }; + struct adds { + Scalar m_scale; + explicit adds(const Scalar& s) : m_scale(s) {} + template void operator()(const Dst& dst, const Src& src) const { + dst.const_cast_derived() += m_scale * src; + } + }; + + template + static inline void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + internal::outer_product_selector_run(dst, lhs, rhs, set(), is_row_major()); + } + + template + static inline void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + internal::outer_product_selector_run(dst, lhs, rhs, add(), is_row_major()); + } + + template + static inline void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + internal::outer_product_selector_run(dst, lhs, rhs, sub(), is_row_major()); + } + + template + static inline void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + internal::outer_product_selector_run(dst, lhs, rhs, adds(alpha), is_row_major()); + } + +}; + + +// This base class provides default implementations for evalTo, addTo, subTo, in terms of scaleAndAddTo +template +struct generic_product_impl_base +{ + typedef typename Product::Scalar Scalar; + + template + static EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { dst.setZero(); scaleAndAddTo(dst, lhs, rhs, Scalar(1)); } + + template + static EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { scaleAndAddTo(dst,lhs, rhs, Scalar(1)); } + + template + static EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { scaleAndAddTo(dst, lhs, rhs, Scalar(-1)); } + + template + static EIGEN_STRONG_INLINE void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { Derived::scaleAndAddTo(dst,lhs,rhs,alpha); } + +}; + +template +struct generic_product_impl + : generic_product_impl_base > +{ + typedef typename nested_eval::type LhsNested; + typedef typename nested_eval::type RhsNested; + typedef typename Product::Scalar Scalar; + enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight }; + typedef typename internal::remove_all::type>::type MatrixType; + + template + static EIGEN_STRONG_INLINE void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + LhsNested actual_lhs(lhs); + RhsNested actual_rhs(rhs); + internal::gemv_dense_selector::HasUsableDirectAccess) + >::run(actual_lhs, actual_rhs, dst, alpha); + } +}; + +template +struct generic_product_impl +{ + typedef typename Product::Scalar Scalar; + + template + static EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + // Same as: dst.noalias() = lhs.lazyProduct(rhs); + // but easier on the compiler side + call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::assign_op()); + } + + template + static EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + // dst.noalias() += lhs.lazyProduct(rhs); + call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::add_assign_op()); + } + + template + static EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + // dst.noalias() -= lhs.lazyProduct(rhs); + call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::sub_assign_op()); + } + +// template +// static inline void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) +// { dst.noalias() += alpha * lhs.lazyProduct(rhs); } +}; + +// This specialization enforces the use of a coefficient-based evaluation strategy +template +struct generic_product_impl + : generic_product_impl {}; + +// Case 2: Evaluate coeff by coeff +// +// This is mostly taken from CoeffBasedProduct.h +// The main difference is that we add an extra argument to the etor_product_*_impl::run() function +// for the inner dimension of the product, because evaluator object do not know their size. + +template +struct etor_product_coeff_impl; + +template +struct etor_product_packet_impl; + +template +struct product_evaluator, ProductTag, DenseShape, DenseShape> + : evaluator_base > +{ + typedef Product XprType; + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit product_evaluator(const XprType& xpr) + : m_lhs(xpr.lhs()), + m_rhs(xpr.rhs()), + m_lhsImpl(m_lhs), // FIXME the creation of the evaluator objects should result in a no-op, but check that! + m_rhsImpl(m_rhs), // Moreover, they are only useful for the packet path, so we could completely disable them when not needed, + // or perhaps declare them on the fly on the packet method... We have experiment to check what's best. + m_innerDim(xpr.lhs().cols()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits::MulCost); + EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits::AddCost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); +#if 0 + std::cerr << "LhsOuterStrideBytes= " << LhsOuterStrideBytes << "\n"; + std::cerr << "RhsOuterStrideBytes= " << RhsOuterStrideBytes << "\n"; + std::cerr << "LhsAlignment= " << LhsAlignment << "\n"; + std::cerr << "RhsAlignment= " << RhsAlignment << "\n"; + std::cerr << "CanVectorizeLhs= " << CanVectorizeLhs << "\n"; + std::cerr << "CanVectorizeRhs= " << CanVectorizeRhs << "\n"; + std::cerr << "CanVectorizeInner= " << CanVectorizeInner << "\n"; + std::cerr << "EvalToRowMajor= " << EvalToRowMajor << "\n"; + std::cerr << "Alignment= " << Alignment << "\n"; + std::cerr << "Flags= " << Flags << "\n"; +#endif + } + + // Everything below here is taken from CoeffBasedProduct.h + + typedef typename internal::nested_eval::type LhsNested; + typedef typename internal::nested_eval::type RhsNested; + + typedef typename internal::remove_all::type LhsNestedCleaned; + typedef typename internal::remove_all::type RhsNestedCleaned; + + typedef evaluator LhsEtorType; + typedef evaluator RhsEtorType; + + enum { + RowsAtCompileTime = LhsNestedCleaned::RowsAtCompileTime, + ColsAtCompileTime = RhsNestedCleaned::ColsAtCompileTime, + InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(LhsNestedCleaned::ColsAtCompileTime, RhsNestedCleaned::RowsAtCompileTime), + MaxRowsAtCompileTime = LhsNestedCleaned::MaxRowsAtCompileTime, + MaxColsAtCompileTime = RhsNestedCleaned::MaxColsAtCompileTime + }; + + typedef typename find_best_packet::type LhsVecPacketType; + typedef typename find_best_packet::type RhsVecPacketType; + + enum { + + LhsCoeffReadCost = LhsEtorType::CoeffReadCost, + RhsCoeffReadCost = RhsEtorType::CoeffReadCost, + CoeffReadCost = InnerSize==0 ? NumTraits::ReadCost + : InnerSize == Dynamic ? HugeCost + : InnerSize * (NumTraits::MulCost + LhsCoeffReadCost + RhsCoeffReadCost) + + (InnerSize - 1) * NumTraits::AddCost, + + Unroll = CoeffReadCost <= EIGEN_UNROLLING_LIMIT, + + LhsFlags = LhsEtorType::Flags, + RhsFlags = RhsEtorType::Flags, + + LhsRowMajor = LhsFlags & RowMajorBit, + RhsRowMajor = RhsFlags & RowMajorBit, + + LhsVecPacketSize = unpacket_traits::size, + RhsVecPacketSize = unpacket_traits::size, + + // Here, we don't care about alignment larger than the usable packet size. + LhsAlignment = EIGEN_PLAIN_ENUM_MIN(LhsEtorType::Alignment,LhsVecPacketSize*int(sizeof(typename LhsNestedCleaned::Scalar))), + RhsAlignment = EIGEN_PLAIN_ENUM_MIN(RhsEtorType::Alignment,RhsVecPacketSize*int(sizeof(typename RhsNestedCleaned::Scalar))), + + SameType = is_same::value, + + CanVectorizeRhs = bool(RhsRowMajor) && (RhsFlags & PacketAccessBit) && (ColsAtCompileTime!=1), + CanVectorizeLhs = (!LhsRowMajor) && (LhsFlags & PacketAccessBit) && (RowsAtCompileTime!=1), + + EvalToRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 + : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0 + : (bool(RhsRowMajor) && !CanVectorizeLhs), + + Flags = ((unsigned int)(LhsFlags | RhsFlags) & HereditaryBits & ~RowMajorBit) + | (EvalToRowMajor ? RowMajorBit : 0) + // TODO enable vectorization for mixed types + | (SameType && (CanVectorizeLhs || CanVectorizeRhs) ? PacketAccessBit : 0) + | (XprType::IsVectorAtCompileTime ? LinearAccessBit : 0), + + LhsOuterStrideBytes = int(LhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename LhsNestedCleaned::Scalar)), + RhsOuterStrideBytes = int(RhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename RhsNestedCleaned::Scalar)), + + Alignment = bool(CanVectorizeLhs) ? (LhsOuterStrideBytes<=0 || (int(LhsOuterStrideBytes) % EIGEN_PLAIN_ENUM_MAX(1,LhsAlignment))!=0 ? 0 : LhsAlignment) + : bool(CanVectorizeRhs) ? (RhsOuterStrideBytes<=0 || (int(RhsOuterStrideBytes) % EIGEN_PLAIN_ENUM_MAX(1,RhsAlignment))!=0 ? 0 : RhsAlignment) + : 0, + + /* CanVectorizeInner deserves special explanation. It does not affect the product flags. It is not used outside + * of Product. If the Product itself is not a packet-access expression, there is still a chance that the inner + * loop of the product might be vectorized. This is the meaning of CanVectorizeInner. Since it doesn't affect + * the Flags, it is safe to make this value depend on ActualPacketAccessBit, that doesn't affect the ABI. + */ + CanVectorizeInner = SameType + && LhsRowMajor + && (!RhsRowMajor) + && (LhsFlags & RhsFlags & ActualPacketAccessBit) + && (InnerSize % packet_traits::size == 0) + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index row, Index col) const + { + return (m_lhs.row(row).transpose().cwiseProduct( m_rhs.col(col) )).sum(); + } + + /* Allow index-based non-packet access. It is impossible though to allow index-based packed access, + * which is why we don't set the LinearAccessBit. + * TODO: this seems possible when the result is a vector + */ + EIGEN_DEVICE_FUNC const CoeffReturnType coeff(Index index) const + { + const Index row = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? 0 : index; + const Index col = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? index : 0; + return (m_lhs.row(row).transpose().cwiseProduct( m_rhs.col(col) )).sum(); + } + + template + const PacketType packet(Index row, Index col) const + { + PacketType res; + typedef etor_product_packet_impl PacketImpl; + PacketImpl::run(row, col, m_lhsImpl, m_rhsImpl, m_innerDim, res); + return res; + } + + template + const PacketType packet(Index index) const + { + const Index row = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? 0 : index; + const Index col = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? index : 0; + return packet(row,col); + } + +protected: + typename internal::add_const_on_value_type::type m_lhs; + typename internal::add_const_on_value_type::type m_rhs; + + LhsEtorType m_lhsImpl; + RhsEtorType m_rhsImpl; + + // TODO: Get rid of m_innerDim if known at compile time + Index m_innerDim; +}; + +template +struct product_evaluator, LazyCoeffBasedProductMode, DenseShape, DenseShape> + : product_evaluator, CoeffBasedProductMode, DenseShape, DenseShape> +{ + typedef Product XprType; + typedef Product BaseProduct; + typedef product_evaluator Base; + enum { + Flags = Base::Flags | EvalBeforeNestingBit + }; + EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) + : Base(BaseProduct(xpr.lhs(),xpr.rhs())) + {} +}; + +/**************************************** +*** Coeff based product, Packet path *** +****************************************/ + +template +struct etor_product_packet_impl +{ + static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet &res) + { + etor_product_packet_impl::run(row, col, lhs, rhs, innerDim, res); + res = pmadd(pset1(lhs.coeff(row, Index(UnrollingIndex-1))), rhs.template packet(Index(UnrollingIndex-1), col), res); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet &res) + { + etor_product_packet_impl::run(row, col, lhs, rhs, innerDim, res); + res = pmadd(lhs.template packet(row, Index(UnrollingIndex-1)), pset1(rhs.coeff(Index(UnrollingIndex-1), col)), res); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index /*innerDim*/, Packet &res) + { + res = pmul(pset1(lhs.coeff(row, Index(0))),rhs.template packet(Index(0), col)); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index /*innerDim*/, Packet &res) + { + res = pmul(lhs.template packet(row, Index(0)), pset1(rhs.coeff(Index(0), col))); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/, const Rhs& /*rhs*/, Index /*innerDim*/, Packet &res) + { + res = pset1(typename unpacket_traits::type(0)); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/, const Rhs& /*rhs*/, Index /*innerDim*/, Packet &res) + { + res = pset1(typename unpacket_traits::type(0)); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet& res) + { + res = pset1(typename unpacket_traits::type(0)); + for(Index i = 0; i < innerDim; ++i) + res = pmadd(pset1(lhs.coeff(row, i)), rhs.template packet(i, col), res); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet& res) + { + res = pset1(typename unpacket_traits::type(0)); + for(Index i = 0; i < innerDim; ++i) + res = pmadd(lhs.template packet(row, i), pset1(rhs.coeff(i, col)), res); + } +}; + + +/*************************************************************************** +* Triangular products +***************************************************************************/ +template +struct triangular_product_impl; + +template +struct generic_product_impl + : generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + triangular_product_impl + ::run(dst, lhs.nestedExpression(), rhs, alpha); + } +}; + +template +struct generic_product_impl +: generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + triangular_product_impl::run(dst, lhs, rhs.nestedExpression(), alpha); + } +}; + + +/*************************************************************************** +* SelfAdjoint products +***************************************************************************/ +template +struct selfadjoint_product_impl; + +template +struct generic_product_impl + : generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + selfadjoint_product_impl::run(dst, lhs.nestedExpression(), rhs, alpha); + } +}; + +template +struct generic_product_impl +: generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + selfadjoint_product_impl::run(dst, lhs, rhs.nestedExpression(), alpha); + } +}; + + +/*************************************************************************** +* Diagonal products +***************************************************************************/ + +template +struct diagonal_product_evaluator_base + : evaluator_base +{ + typedef typename ScalarBinaryOpTraits::ReturnType Scalar; +public: + enum { + CoeffReadCost = NumTraits::MulCost + evaluator::CoeffReadCost + evaluator::CoeffReadCost, + + MatrixFlags = evaluator::Flags, + DiagFlags = evaluator::Flags, + _StorageOrder = MatrixFlags & RowMajorBit ? RowMajor : ColMajor, + _ScalarAccessOnDiag = !((int(_StorageOrder) == ColMajor && int(ProductOrder) == OnTheLeft) + ||(int(_StorageOrder) == RowMajor && int(ProductOrder) == OnTheRight)), + _SameTypes = is_same::value, + // FIXME currently we need same types, but in the future the next rule should be the one + //_Vectorizable = bool(int(MatrixFlags)&PacketAccessBit) && ((!_PacketOnDiag) || (_SameTypes && bool(int(DiagFlags)&PacketAccessBit))), + _Vectorizable = bool(int(MatrixFlags)&PacketAccessBit) && _SameTypes && (_ScalarAccessOnDiag || (bool(int(DiagFlags)&PacketAccessBit))), + _LinearAccessMask = (MatrixType::RowsAtCompileTime==1 || MatrixType::ColsAtCompileTime==1) ? LinearAccessBit : 0, + Flags = ((HereditaryBits|_LinearAccessMask) & (unsigned int)(MatrixFlags)) | (_Vectorizable ? PacketAccessBit : 0), + Alignment = evaluator::Alignment + }; + + diagonal_product_evaluator_base(const MatrixType &mat, const DiagonalType &diag) + : m_diagImpl(diag), m_matImpl(mat) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits::MulCost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index idx) const + { + return m_diagImpl.coeff(idx) * m_matImpl.coeff(idx); + } + +protected: + template + EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::true_type) const + { + return internal::pmul(m_matImpl.template packet(row, col), + internal::pset1(m_diagImpl.coeff(id))); + } + + template + EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::false_type) const + { + enum { + InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime, + DiagonalPacketLoadMode = EIGEN_PLAIN_ENUM_MIN(LoadMode,((InnerSize%16) == 0) ? int(Aligned16) : int(evaluator::Alignment)) // FIXME hardcoded 16!! + }; + return internal::pmul(m_matImpl.template packet(row, col), + m_diagImpl.template packet(id)); + } + + evaluator m_diagImpl; + evaluator m_matImpl; +}; + +// diagonal * dense +template +struct product_evaluator, ProductTag, DiagonalShape, DenseShape> + : diagonal_product_evaluator_base, OnTheLeft> +{ + typedef diagonal_product_evaluator_base, OnTheLeft> Base; + using Base::m_diagImpl; + using Base::m_matImpl; + using Base::coeff; + typedef typename Base::Scalar Scalar; + + typedef Product XprType; + typedef typename XprType::PlainObject PlainObject; + + enum { + StorageOrder = int(Rhs::Flags) & RowMajorBit ? RowMajor : ColMajor + }; + + EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) + : Base(xpr.rhs(), xpr.lhs().diagonal()) + { + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const + { + return m_diagImpl.coeff(row) * m_matImpl.coeff(row, col); + } + +#ifndef __CUDACC__ + template + EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const + { + // FIXME: NVCC used to complain about the template keyword, but we have to check whether this is still the case. + // See also similar calls below. + return this->template packet_impl(row,col, row, + typename internal::conditional::type()); + } + + template + EIGEN_STRONG_INLINE PacketType packet(Index idx) const + { + return packet(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx); + } +#endif +}; + +// dense * diagonal +template +struct product_evaluator, ProductTag, DenseShape, DiagonalShape> + : diagonal_product_evaluator_base, OnTheRight> +{ + typedef diagonal_product_evaluator_base, OnTheRight> Base; + using Base::m_diagImpl; + using Base::m_matImpl; + using Base::coeff; + typedef typename Base::Scalar Scalar; + + typedef Product XprType; + typedef typename XprType::PlainObject PlainObject; + + enum { StorageOrder = int(Lhs::Flags) & RowMajorBit ? RowMajor : ColMajor }; + + EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) + : Base(xpr.lhs(), xpr.rhs().diagonal()) + { + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const + { + return m_matImpl.coeff(row, col) * m_diagImpl.coeff(col); + } + +#ifndef __CUDACC__ + template + EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const + { + return this->template packet_impl(row,col, col, + typename internal::conditional::type()); + } + + template + EIGEN_STRONG_INLINE PacketType packet(Index idx) const + { + return packet(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx); + } +#endif +}; + +/*************************************************************************** +* Products with permutation matrices +***************************************************************************/ + +/** \internal + * \class permutation_matrix_product + * Internal helper class implementing the product between a permutation matrix and a matrix. + * This class is specialized for DenseShape below and for SparseShape in SparseCore/SparsePermutation.h + */ +template +struct permutation_matrix_product; + +template +struct permutation_matrix_product +{ + typedef typename nested_eval::type MatrixType; + typedef typename remove_all::type MatrixTypeCleaned; + + template + static inline void run(Dest& dst, const PermutationType& perm, const ExpressionType& xpr) + { + MatrixType mat(xpr); + const Index n = Side==OnTheLeft ? mat.rows() : mat.cols(); + // FIXME we need an is_same for expression that is not sensitive to constness. For instance + // is_same_xpr, Block >::value should be true. + //if(is_same::value && extract_data(dst) == extract_data(mat)) + if(is_same_dense(dst, mat)) + { + // apply the permutation inplace + Matrix mask(perm.size()); + mask.fill(false); + Index r = 0; + while(r < perm.size()) + { + // search for the next seed + while(r=perm.size()) + break; + // we got one, let's follow it until we are back to the seed + Index k0 = r++; + Index kPrev = k0; + mask.coeffRef(k0) = true; + for(Index k=perm.indices().coeff(k0); k!=k0; k=perm.indices().coeff(k)) + { + Block(dst, k) + .swap(Block + (dst,((Side==OnTheLeft) ^ Transposed) ? k0 : kPrev)); + + mask.coeffRef(k) = true; + kPrev = k; + } + } + } + else + { + for(Index i = 0; i < n; ++i) + { + Block + (dst, ((Side==OnTheLeft) ^ Transposed) ? perm.indices().coeff(i) : i) + + = + + Block + (mat, ((Side==OnTheRight) ^ Transposed) ? perm.indices().coeff(i) : i); + } + } + } +}; + +template +struct generic_product_impl +{ + template + static void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + permutation_matrix_product::run(dst, lhs, rhs); + } +}; + +template +struct generic_product_impl +{ + template + static void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + permutation_matrix_product::run(dst, rhs, lhs); + } +}; + +template +struct generic_product_impl, Rhs, PermutationShape, MatrixShape, ProductTag> +{ + template + static void evalTo(Dest& dst, const Inverse& lhs, const Rhs& rhs) + { + permutation_matrix_product::run(dst, lhs.nestedExpression(), rhs); + } +}; + +template +struct generic_product_impl, MatrixShape, PermutationShape, ProductTag> +{ + template + static void evalTo(Dest& dst, const Lhs& lhs, const Inverse& rhs) + { + permutation_matrix_product::run(dst, rhs.nestedExpression(), lhs); + } +}; + + +/*************************************************************************** +* Products with transpositions matrices +***************************************************************************/ + +// FIXME could we unify Transpositions and Permutation into a single "shape"?? + +/** \internal + * \class transposition_matrix_product + * Internal helper class implementing the product between a permutation matrix and a matrix. + */ +template +struct transposition_matrix_product +{ + typedef typename nested_eval::type MatrixType; + typedef typename remove_all::type MatrixTypeCleaned; + + template + static inline void run(Dest& dst, const TranspositionType& tr, const ExpressionType& xpr) + { + MatrixType mat(xpr); + typedef typename TranspositionType::StorageIndex StorageIndex; + const Index size = tr.size(); + StorageIndex j = 0; + + if(!is_same_dense(dst,mat)) + dst = mat; + + for(Index k=(Transposed?size-1:0) ; Transposed?k>=0:k +struct generic_product_impl +{ + template + static void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + transposition_matrix_product::run(dst, lhs, rhs); + } +}; + +template +struct generic_product_impl +{ + template + static void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + transposition_matrix_product::run(dst, rhs, lhs); + } +}; + + +template +struct generic_product_impl, Rhs, TranspositionsShape, MatrixShape, ProductTag> +{ + template + static void evalTo(Dest& dst, const Transpose& lhs, const Rhs& rhs) + { + transposition_matrix_product::run(dst, lhs.nestedExpression(), rhs); + } +}; + +template +struct generic_product_impl, MatrixShape, TranspositionsShape, ProductTag> +{ + template + static void evalTo(Dest& dst, const Lhs& lhs, const Transpose& rhs) + { + transposition_matrix_product::run(dst, rhs.nestedExpression(), lhs); + } +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_PRODUCT_EVALUATORS_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Random.h b/simulation/externals/eigen/Eigen/src/Core/Random.h new file mode 100644 index 0000000..6faf789 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Random.h @@ -0,0 +1,182 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_RANDOM_H +#define EIGEN_RANDOM_H + +namespace Eigen { + +namespace internal { + +template struct scalar_random_op { + EIGEN_EMPTY_STRUCT_CTOR(scalar_random_op) + inline const Scalar operator() () const { return random(); } +}; + +template +struct functor_traits > +{ enum { Cost = 5 * NumTraits::MulCost, PacketAccess = false, IsRepeatable = false }; }; + +} // end namespace internal + +/** \returns a random matrix expression + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * The parameters \a rows and \a cols are the number of rows and of columns of + * the returned matrix. Must be compatible with this MatrixBase type. + * + * \not_reentrant + * + * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, + * it is redundant to pass \a rows and \a cols as arguments, so Random() should be used + * instead. + * + * + * Example: \include MatrixBase_random_int_int.cpp + * Output: \verbinclude MatrixBase_random_int_int.out + * + * This expression has the "evaluate before nesting" flag so that it will be evaluated into + * a temporary matrix whenever it is nested in a larger expression. This prevents unexpected + * behavior with expressions involving random matrices. + * + * See DenseBase::NullaryExpr(Index, const CustomNullaryOp&) for an example using C++11 random generators. + * + * \sa DenseBase::setRandom(), DenseBase::Random(Index), DenseBase::Random() + */ +template +inline const typename DenseBase::RandomReturnType +DenseBase::Random(Index rows, Index cols) +{ + return NullaryExpr(rows, cols, internal::scalar_random_op()); +} + +/** \returns a random vector expression + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * The parameter \a size is the size of the returned vector. + * Must be compatible with this MatrixBase type. + * + * \only_for_vectors + * \not_reentrant + * + * This variant is meant to be used for dynamic-size vector types. For fixed-size types, + * it is redundant to pass \a size as argument, so Random() should be used + * instead. + * + * Example: \include MatrixBase_random_int.cpp + * Output: \verbinclude MatrixBase_random_int.out + * + * This expression has the "evaluate before nesting" flag so that it will be evaluated into + * a temporary vector whenever it is nested in a larger expression. This prevents unexpected + * behavior with expressions involving random matrices. + * + * \sa DenseBase::setRandom(), DenseBase::Random(Index,Index), DenseBase::Random() + */ +template +inline const typename DenseBase::RandomReturnType +DenseBase::Random(Index size) +{ + return NullaryExpr(size, internal::scalar_random_op()); +} + +/** \returns a fixed-size random matrix or vector expression + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you + * need to use the variants taking size arguments. + * + * Example: \include MatrixBase_random.cpp + * Output: \verbinclude MatrixBase_random.out + * + * This expression has the "evaluate before nesting" flag so that it will be evaluated into + * a temporary matrix whenever it is nested in a larger expression. This prevents unexpected + * behavior with expressions involving random matrices. + * + * \not_reentrant + * + * \sa DenseBase::setRandom(), DenseBase::Random(Index,Index), DenseBase::Random(Index) + */ +template +inline const typename DenseBase::RandomReturnType +DenseBase::Random() +{ + return NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_random_op()); +} + +/** Sets all coefficients in this expression to random values. + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * + * Example: \include MatrixBase_setRandom.cpp + * Output: \verbinclude MatrixBase_setRandom.out + * + * \sa class CwiseNullaryOp, setRandom(Index), setRandom(Index,Index) + */ +template +inline Derived& DenseBase::setRandom() +{ + return *this = Random(rows(), cols()); +} + +/** Resizes to the given \a newSize, and sets all coefficients in this expression to random values. + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \only_for_vectors + * \not_reentrant + * + * Example: \include Matrix_setRandom_int.cpp + * Output: \verbinclude Matrix_setRandom_int.out + * + * \sa DenseBase::setRandom(), setRandom(Index,Index), class CwiseNullaryOp, DenseBase::Random() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setRandom(Index newSize) +{ + resize(newSize); + return setRandom(); +} + +/** Resizes to the given size, and sets all coefficients in this expression to random values. + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * + * \param rows the new number of rows + * \param cols the new number of columns + * + * Example: \include Matrix_setRandom_int_int.cpp + * Output: \verbinclude Matrix_setRandom_int_int.out + * + * \sa DenseBase::setRandom(), setRandom(Index), class CwiseNullaryOp, DenseBase::Random() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setRandom(Index rows, Index cols) +{ + resize(rows, cols); + return setRandom(); +} + +} // end namespace Eigen + +#endif // EIGEN_RANDOM_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Redux.h b/simulation/externals/eigen/Eigen/src/Core/Redux.h new file mode 100644 index 0000000..b6e8f88 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Redux.h @@ -0,0 +1,505 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008 Gael Guennebaud +// Copyright (C) 2006-2008 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_REDUX_H +#define EIGEN_REDUX_H + +namespace Eigen { + +namespace internal { + +// TODO +// * implement other kind of vectorization +// * factorize code + +/*************************************************************************** +* Part 1 : the logic deciding a strategy for vectorization and unrolling +***************************************************************************/ + +template +struct redux_traits +{ +public: + typedef typename find_best_packet::type PacketType; + enum { + PacketSize = unpacket_traits::size, + InnerMaxSize = int(Derived::IsRowMajor) + ? Derived::MaxColsAtCompileTime + : Derived::MaxRowsAtCompileTime + }; + + enum { + MightVectorize = (int(Derived::Flags)&ActualPacketAccessBit) + && (functor_traits::PacketAccess), + MayLinearVectorize = bool(MightVectorize) && (int(Derived::Flags)&LinearAccessBit), + MaySliceVectorize = bool(MightVectorize) && int(InnerMaxSize)>=3*PacketSize + }; + +public: + enum { + Traversal = int(MayLinearVectorize) ? int(LinearVectorizedTraversal) + : int(MaySliceVectorize) ? int(SliceVectorizedTraversal) + : int(DefaultTraversal) + }; + +public: + enum { + Cost = Derived::SizeAtCompileTime == Dynamic ? HugeCost + : Derived::SizeAtCompileTime * Derived::CoeffReadCost + (Derived::SizeAtCompileTime-1) * functor_traits::Cost, + UnrollingLimit = EIGEN_UNROLLING_LIMIT * (int(Traversal) == int(DefaultTraversal) ? 1 : int(PacketSize)) + }; + +public: + enum { + Unrolling = Cost <= UnrollingLimit ? CompleteUnrolling : NoUnrolling + }; + +#ifdef EIGEN_DEBUG_ASSIGN + static void debug() + { + std::cerr << "Xpr: " << typeid(typename Derived::XprType).name() << std::endl; + std::cerr.setf(std::ios::hex, std::ios::basefield); + EIGEN_DEBUG_VAR(Derived::Flags) + std::cerr.unsetf(std::ios::hex); + EIGEN_DEBUG_VAR(InnerMaxSize) + EIGEN_DEBUG_VAR(PacketSize) + EIGEN_DEBUG_VAR(MightVectorize) + EIGEN_DEBUG_VAR(MayLinearVectorize) + EIGEN_DEBUG_VAR(MaySliceVectorize) + EIGEN_DEBUG_VAR(Traversal) + EIGEN_DEBUG_VAR(UnrollingLimit) + EIGEN_DEBUG_VAR(Unrolling) + std::cerr << std::endl; + } +#endif +}; + +/*************************************************************************** +* Part 2 : unrollers +***************************************************************************/ + +/*** no vectorization ***/ + +template +struct redux_novec_unroller +{ + enum { + HalfLength = Length/2 + }; + + typedef typename Derived::Scalar Scalar; + + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Scalar run(const Derived &mat, const Func& func) + { + return func(redux_novec_unroller::run(mat,func), + redux_novec_unroller::run(mat,func)); + } +}; + +template +struct redux_novec_unroller +{ + enum { + outer = Start / Derived::InnerSizeAtCompileTime, + inner = Start % Derived::InnerSizeAtCompileTime + }; + + typedef typename Derived::Scalar Scalar; + + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Scalar run(const Derived &mat, const Func&) + { + return mat.coeffByOuterInner(outer, inner); + } +}; + +// This is actually dead code and will never be called. It is required +// to prevent false warnings regarding failed inlining though +// for 0 length run() will never be called at all. +template +struct redux_novec_unroller +{ + typedef typename Derived::Scalar Scalar; + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Scalar run(const Derived&, const Func&) { return Scalar(); } +}; + +/*** vectorization ***/ + +template +struct redux_vec_unroller +{ + enum { + PacketSize = redux_traits::PacketSize, + HalfLength = Length/2 + }; + + typedef typename Derived::Scalar Scalar; + typedef typename redux_traits::PacketType PacketScalar; + + static EIGEN_STRONG_INLINE PacketScalar run(const Derived &mat, const Func& func) + { + return func.packetOp( + redux_vec_unroller::run(mat,func), + redux_vec_unroller::run(mat,func) ); + } +}; + +template +struct redux_vec_unroller +{ + enum { + index = Start * redux_traits::PacketSize, + outer = index / int(Derived::InnerSizeAtCompileTime), + inner = index % int(Derived::InnerSizeAtCompileTime), + alignment = Derived::Alignment + }; + + typedef typename Derived::Scalar Scalar; + typedef typename redux_traits::PacketType PacketScalar; + + static EIGEN_STRONG_INLINE PacketScalar run(const Derived &mat, const Func&) + { + return mat.template packetByOuterInner(outer, inner); + } +}; + +/*************************************************************************** +* Part 3 : implementation of all cases +***************************************************************************/ + +template::Traversal, + int Unrolling = redux_traits::Unrolling +> +struct redux_impl; + +template +struct redux_impl +{ + typedef typename Derived::Scalar Scalar; + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Scalar run(const Derived &mat, const Func& func) + { + eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix"); + Scalar res; + res = mat.coeffByOuterInner(0, 0); + for(Index i = 1; i < mat.innerSize(); ++i) + res = func(res, mat.coeffByOuterInner(0, i)); + for(Index i = 1; i < mat.outerSize(); ++i) + for(Index j = 0; j < mat.innerSize(); ++j) + res = func(res, mat.coeffByOuterInner(i, j)); + return res; + } +}; + +template +struct redux_impl + : public redux_novec_unroller +{}; + +template +struct redux_impl +{ + typedef typename Derived::Scalar Scalar; + typedef typename redux_traits::PacketType PacketScalar; + + static Scalar run(const Derived &mat, const Func& func) + { + const Index size = mat.size(); + + const Index packetSize = redux_traits::PacketSize; + const int packetAlignment = unpacket_traits::alignment; + enum { + alignment0 = (bool(Derived::Flags & DirectAccessBit) && bool(packet_traits::AlignedOnScalar)) ? int(packetAlignment) : int(Unaligned), + alignment = EIGEN_PLAIN_ENUM_MAX(alignment0, Derived::Alignment) + }; + const Index alignedStart = internal::first_default_aligned(mat.nestedExpression()); + const Index alignedSize2 = ((size-alignedStart)/(2*packetSize))*(2*packetSize); + const Index alignedSize = ((size-alignedStart)/(packetSize))*(packetSize); + const Index alignedEnd2 = alignedStart + alignedSize2; + const Index alignedEnd = alignedStart + alignedSize; + Scalar res; + if(alignedSize) + { + PacketScalar packet_res0 = mat.template packet(alignedStart); + if(alignedSize>packetSize) // we have at least two packets to partly unroll the loop + { + PacketScalar packet_res1 = mat.template packet(alignedStart+packetSize); + for(Index index = alignedStart + 2*packetSize; index < alignedEnd2; index += 2*packetSize) + { + packet_res0 = func.packetOp(packet_res0, mat.template packet(index)); + packet_res1 = func.packetOp(packet_res1, mat.template packet(index+packetSize)); + } + + packet_res0 = func.packetOp(packet_res0,packet_res1); + if(alignedEnd>alignedEnd2) + packet_res0 = func.packetOp(packet_res0, mat.template packet(alignedEnd2)); + } + res = func.predux(packet_res0); + + for(Index index = 0; index < alignedStart; ++index) + res = func(res,mat.coeff(index)); + + for(Index index = alignedEnd; index < size; ++index) + res = func(res,mat.coeff(index)); + } + else // too small to vectorize anything. + // since this is dynamic-size hence inefficient anyway for such small sizes, don't try to optimize. + { + res = mat.coeff(0); + for(Index index = 1; index < size; ++index) + res = func(res,mat.coeff(index)); + } + + return res; + } +}; + +// NOTE: for SliceVectorizedTraversal we simply bypass unrolling +template +struct redux_impl +{ + typedef typename Derived::Scalar Scalar; + typedef typename redux_traits::PacketType PacketType; + + EIGEN_DEVICE_FUNC static Scalar run(const Derived &mat, const Func& func) + { + eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix"); + const Index innerSize = mat.innerSize(); + const Index outerSize = mat.outerSize(); + enum { + packetSize = redux_traits::PacketSize + }; + const Index packetedInnerSize = ((innerSize)/packetSize)*packetSize; + Scalar res; + if(packetedInnerSize) + { + PacketType packet_res = mat.template packet(0,0); + for(Index j=0; j(j,i)); + + res = func.predux(packet_res); + for(Index j=0; j::run(mat, func); + } + + return res; + } +}; + +template +struct redux_impl +{ + typedef typename Derived::Scalar Scalar; + + typedef typename redux_traits::PacketType PacketScalar; + enum { + PacketSize = redux_traits::PacketSize, + Size = Derived::SizeAtCompileTime, + VectorizedSize = (Size / PacketSize) * PacketSize + }; + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Scalar run(const Derived &mat, const Func& func) + { + eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix"); + if (VectorizedSize > 0) { + Scalar res = func.predux(redux_vec_unroller::run(mat,func)); + if (VectorizedSize != Size) + res = func(res,redux_novec_unroller::run(mat,func)); + return res; + } + else { + return redux_novec_unroller::run(mat,func); + } + } +}; + +// evaluator adaptor +template +class redux_evaluator +{ +public: + typedef _XprType XprType; + EIGEN_DEVICE_FUNC explicit redux_evaluator(const XprType &xpr) : m_evaluator(xpr), m_xpr(xpr) {} + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + typedef typename XprType::PacketScalar PacketScalar; + typedef typename XprType::PacketReturnType PacketReturnType; + + enum { + MaxRowsAtCompileTime = XprType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = XprType::MaxColsAtCompileTime, + // TODO we should not remove DirectAccessBit and rather find an elegant way to query the alignment offset at runtime from the evaluator + Flags = evaluator::Flags & ~DirectAccessBit, + IsRowMajor = XprType::IsRowMajor, + SizeAtCompileTime = XprType::SizeAtCompileTime, + InnerSizeAtCompileTime = XprType::InnerSizeAtCompileTime, + CoeffReadCost = evaluator::CoeffReadCost, + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC Index rows() const { return m_xpr.rows(); } + EIGEN_DEVICE_FUNC Index cols() const { return m_xpr.cols(); } + EIGEN_DEVICE_FUNC Index size() const { return m_xpr.size(); } + EIGEN_DEVICE_FUNC Index innerSize() const { return m_xpr.innerSize(); } + EIGEN_DEVICE_FUNC Index outerSize() const { return m_xpr.outerSize(); } + + EIGEN_DEVICE_FUNC + CoeffReturnType coeff(Index row, Index col) const + { return m_evaluator.coeff(row, col); } + + EIGEN_DEVICE_FUNC + CoeffReturnType coeff(Index index) const + { return m_evaluator.coeff(index); } + + template + PacketType packet(Index row, Index col) const + { return m_evaluator.template packet(row, col); } + + template + PacketType packet(Index index) const + { return m_evaluator.template packet(index); } + + EIGEN_DEVICE_FUNC + CoeffReturnType coeffByOuterInner(Index outer, Index inner) const + { return m_evaluator.coeff(IsRowMajor ? outer : inner, IsRowMajor ? inner : outer); } + + template + PacketType packetByOuterInner(Index outer, Index inner) const + { return m_evaluator.template packet(IsRowMajor ? outer : inner, IsRowMajor ? inner : outer); } + + const XprType & nestedExpression() const { return m_xpr; } + +protected: + internal::evaluator m_evaluator; + const XprType &m_xpr; +}; + +} // end namespace internal + +/*************************************************************************** +* Part 4 : public API +***************************************************************************/ + + +/** \returns the result of a full redux operation on the whole matrix or vector using \a func + * + * The template parameter \a BinaryOp is the type of the functor \a func which must be + * an associative operator. Both current C++98 and C++11 functor styles are handled. + * + * \sa DenseBase::sum(), DenseBase::minCoeff(), DenseBase::maxCoeff(), MatrixBase::colwise(), MatrixBase::rowwise() + */ +template +template +typename internal::traits::Scalar +DenseBase::redux(const Func& func) const +{ + eigen_assert(this->rows()>0 && this->cols()>0 && "you are using an empty matrix"); + + typedef typename internal::redux_evaluator ThisEvaluator; + ThisEvaluator thisEval(derived()); + + return internal::redux_impl::run(thisEval, func); +} + +/** \returns the minimum of all coefficients of \c *this. + * \warning the result is undefined if \c *this contains NaN. + */ +template +EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::minCoeff() const +{ + return derived().redux(Eigen::internal::scalar_min_op()); +} + +/** \returns the maximum of all coefficients of \c *this. + * \warning the result is undefined if \c *this contains NaN. + */ +template +EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::maxCoeff() const +{ + return derived().redux(Eigen::internal::scalar_max_op()); +} + +/** \returns the sum of all coefficients of \c *this + * + * If \c *this is empty, then the value 0 is returned. + * + * \sa trace(), prod(), mean() + */ +template +EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::sum() const +{ + if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0)) + return Scalar(0); + return derived().redux(Eigen::internal::scalar_sum_op()); +} + +/** \returns the mean of all coefficients of *this +* +* \sa trace(), prod(), sum() +*/ +template +EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::mean() const +{ +#ifdef __INTEL_COMPILER + #pragma warning push + #pragma warning ( disable : 2259 ) +#endif + return Scalar(derived().redux(Eigen::internal::scalar_sum_op())) / Scalar(this->size()); +#ifdef __INTEL_COMPILER + #pragma warning pop +#endif +} + +/** \returns the product of all coefficients of *this + * + * Example: \include MatrixBase_prod.cpp + * Output: \verbinclude MatrixBase_prod.out + * + * \sa sum(), mean(), trace() + */ +template +EIGEN_STRONG_INLINE typename internal::traits::Scalar +DenseBase::prod() const +{ + if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0)) + return Scalar(1); + return derived().redux(Eigen::internal::scalar_product_op()); +} + +/** \returns the trace of \c *this, i.e. the sum of the coefficients on the main diagonal. + * + * \c *this can be any matrix, not necessarily square. + * + * \sa diagonal(), sum() + */ +template +EIGEN_STRONG_INLINE typename internal::traits::Scalar +MatrixBase::trace() const +{ + return derived().diagonal().sum(); +} + +} // end namespace Eigen + +#endif // EIGEN_REDUX_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Ref.h b/simulation/externals/eigen/Eigen/src/Core/Ref.h new file mode 100644 index 0000000..bdf24f5 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Ref.h @@ -0,0 +1,281 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2012 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_REF_H +#define EIGEN_REF_H + +namespace Eigen { + +namespace internal { + +template +struct traits > + : public traits > +{ + typedef _PlainObjectType PlainObjectType; + typedef _StrideType StrideType; + enum { + Options = _Options, + Flags = traits >::Flags | NestByRefBit, + Alignment = traits >::Alignment + }; + + template struct match { + enum { + HasDirectAccess = internal::has_direct_access::ret, + StorageOrderMatch = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime || ((PlainObjectType::Flags&RowMajorBit)==(Derived::Flags&RowMajorBit)), + InnerStrideMatch = int(StrideType::InnerStrideAtCompileTime)==int(Dynamic) + || int(StrideType::InnerStrideAtCompileTime)==int(Derived::InnerStrideAtCompileTime) + || (int(StrideType::InnerStrideAtCompileTime)==0 && int(Derived::InnerStrideAtCompileTime)==1), + OuterStrideMatch = Derived::IsVectorAtCompileTime + || int(StrideType::OuterStrideAtCompileTime)==int(Dynamic) || int(StrideType::OuterStrideAtCompileTime)==int(Derived::OuterStrideAtCompileTime), + // NOTE, this indirection of evaluator::Alignment is needed + // to workaround a very strange bug in MSVC related to the instantiation + // of has_*ary_operator in evaluator. + // This line is surprisingly very sensitive. For instance, simply adding parenthesis + // as "DerivedAlignment = (int(evaluator::Alignment))," will make MSVC fail... + DerivedAlignment = int(evaluator::Alignment), + AlignmentMatch = (int(traits::Alignment)==int(Unaligned)) || (DerivedAlignment >= int(Alignment)), // FIXME the first condition is not very clear, it should be replaced by the required alignment + ScalarTypeMatch = internal::is_same::value, + MatchAtCompileTime = HasDirectAccess && StorageOrderMatch && InnerStrideMatch && OuterStrideMatch && AlignmentMatch && ScalarTypeMatch + }; + typedef typename internal::conditional::type type; + }; + +}; + +template +struct traits > : public traits {}; + +} + +template class RefBase + : public MapBase +{ + typedef typename internal::traits::PlainObjectType PlainObjectType; + typedef typename internal::traits::StrideType StrideType; + +public: + + typedef MapBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(RefBase) + + EIGEN_DEVICE_FUNC inline Index innerStride() const + { + return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1; + } + + EIGEN_DEVICE_FUNC inline Index outerStride() const + { + return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer() + : IsVectorAtCompileTime ? this->size() + : int(Flags)&RowMajorBit ? this->cols() + : this->rows(); + } + + EIGEN_DEVICE_FUNC RefBase() + : Base(0,RowsAtCompileTime==Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==Dynamic?0:ColsAtCompileTime), + // Stride<> does not allow default ctor for Dynamic strides, so let' initialize it with dummy values: + m_stride(StrideType::OuterStrideAtCompileTime==Dynamic?0:StrideType::OuterStrideAtCompileTime, + StrideType::InnerStrideAtCompileTime==Dynamic?0:StrideType::InnerStrideAtCompileTime) + {} + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(RefBase) + +protected: + + typedef Stride StrideBase; + + template + EIGEN_DEVICE_FUNC void construct(Expression& expr) + { + if(PlainObjectType::RowsAtCompileTime==1) + { + eigen_assert(expr.rows()==1 || expr.cols()==1); + ::new (static_cast(this)) Base(expr.data(), 1, expr.size()); + } + else if(PlainObjectType::ColsAtCompileTime==1) + { + eigen_assert(expr.rows()==1 || expr.cols()==1); + ::new (static_cast(this)) Base(expr.data(), expr.size(), 1); + } + else + ::new (static_cast(this)) Base(expr.data(), expr.rows(), expr.cols()); + + if(Expression::IsVectorAtCompileTime && (!PlainObjectType::IsVectorAtCompileTime) && ((Expression::Flags&RowMajorBit)!=(PlainObjectType::Flags&RowMajorBit))) + ::new (&m_stride) StrideBase(expr.innerStride(), StrideType::InnerStrideAtCompileTime==0?0:1); + else + ::new (&m_stride) StrideBase(StrideType::OuterStrideAtCompileTime==0?0:expr.outerStride(), + StrideType::InnerStrideAtCompileTime==0?0:expr.innerStride()); + } + + StrideBase m_stride; +}; + +/** \class Ref + * \ingroup Core_Module + * + * \brief A matrix or vector expression mapping an existing expression + * + * \tparam PlainObjectType the equivalent matrix type of the mapped data + * \tparam Options specifies the pointer alignment in bytes. It can be: \c #Aligned128, , \c #Aligned64, \c #Aligned32, \c #Aligned16, \c #Aligned8 or \c #Unaligned. + * The default is \c #Unaligned. + * \tparam StrideType optionally specifies strides. By default, Ref implies a contiguous storage along the inner dimension (inner stride==1), + * but accepts a variable outer stride (leading dimension). + * This can be overridden by specifying strides. + * The type passed here must be a specialization of the Stride template, see examples below. + * + * This class provides a way to write non-template functions taking Eigen objects as parameters while limiting the number of copies. + * A Ref<> object can represent either a const expression or a l-value: + * \code + * // in-out argument: + * void foo1(Ref x); + * + * // read-only const argument: + * void foo2(const Ref& x); + * \endcode + * + * In the in-out case, the input argument must satisfy the constraints of the actual Ref<> type, otherwise a compilation issue will be triggered. + * By default, a Ref can reference any dense vector expression of float having a contiguous memory layout. + * Likewise, a Ref can reference any column-major dense matrix expression of float whose column's elements are contiguously stored with + * the possibility to have a constant space in-between each column, i.e. the inner stride must be equal to 1, but the outer stride (or leading dimension) + * can be greater than the number of rows. + * + * In the const case, if the input expression does not match the above requirement, then it is evaluated into a temporary before being passed to the function. + * Here are some examples: + * \code + * MatrixXf A; + * VectorXf a; + * foo1(a.head()); // OK + * foo1(A.col()); // OK + * foo1(A.row()); // Compilation error because here innerstride!=1 + * foo2(A.row()); // Compilation error because A.row() is a 1xN object while foo2 is expecting a Nx1 object + * foo2(A.row().transpose()); // The row is copied into a contiguous temporary + * foo2(2*a); // The expression is evaluated into a temporary + * foo2(A.col().segment(2,4)); // No temporary + * \endcode + * + * The range of inputs that can be referenced without temporary can be enlarged using the last two template parameters. + * Here is an example accepting an innerstride!=1: + * \code + * // in-out argument: + * void foo3(Ref > x); + * foo3(A.row()); // OK + * \endcode + * The downside here is that the function foo3 might be significantly slower than foo1 because it won't be able to exploit vectorization, and will involve more + * expensive address computations even if the input is contiguously stored in memory. To overcome this issue, one might propose to overload internally calling a + * template function, e.g.: + * \code + * // in the .h: + * void foo(const Ref& A); + * void foo(const Ref >& A); + * + * // in the .cpp: + * template void foo_impl(const TypeOfA& A) { + * ... // crazy code goes here + * } + * void foo(const Ref& A) { foo_impl(A); } + * void foo(const Ref >& A) { foo_impl(A); } + * \endcode + * + * + * \sa PlainObjectBase::Map(), \ref TopicStorageOrders + */ +template class Ref + : public RefBase > +{ + private: + typedef internal::traits Traits; + template + EIGEN_DEVICE_FUNC inline Ref(const PlainObjectBase& expr, + typename internal::enable_if::MatchAtCompileTime),Derived>::type* = 0); + public: + + typedef RefBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Ref) + + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + EIGEN_DEVICE_FUNC inline Ref(PlainObjectBase& expr, + typename internal::enable_if::MatchAtCompileTime),Derived>::type* = 0) + { + EIGEN_STATIC_ASSERT(bool(Traits::template match::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); + Base::construct(expr.derived()); + } + template + EIGEN_DEVICE_FUNC inline Ref(const DenseBase& expr, + typename internal::enable_if::MatchAtCompileTime),Derived>::type* = 0) + #else + /** Implicit constructor from any dense expression */ + template + inline Ref(DenseBase& expr) + #endif + { + EIGEN_STATIC_ASSERT(bool(internal::is_lvalue::value), THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); + EIGEN_STATIC_ASSERT(bool(Traits::template match::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); + EIGEN_STATIC_ASSERT(!Derived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); + Base::construct(expr.const_cast_derived()); + } + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Ref) + +}; + +// this is the const ref version +template class Ref + : public RefBase > +{ + typedef internal::traits Traits; + public: + + typedef RefBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Ref) + + template + EIGEN_DEVICE_FUNC inline Ref(const DenseBase& expr, + typename internal::enable_if::ScalarTypeMatch),Derived>::type* = 0) + { +// std::cout << match_helper::HasDirectAccess << "," << match_helper::OuterStrideMatch << "," << match_helper::InnerStrideMatch << "\n"; +// std::cout << int(StrideType::OuterStrideAtCompileTime) << " - " << int(Derived::OuterStrideAtCompileTime) << "\n"; +// std::cout << int(StrideType::InnerStrideAtCompileTime) << " - " << int(Derived::InnerStrideAtCompileTime) << "\n"; + construct(expr.derived(), typename Traits::template match::type()); + } + + EIGEN_DEVICE_FUNC inline Ref(const Ref& other) : Base(other) { + // copy constructor shall not copy the m_object, to avoid unnecessary malloc and copy + } + + template + EIGEN_DEVICE_FUNC inline Ref(const RefBase& other) { + construct(other.derived(), typename Traits::template match::type()); + } + + protected: + + template + EIGEN_DEVICE_FUNC void construct(const Expression& expr,internal::true_type) + { + Base::construct(expr); + } + + template + EIGEN_DEVICE_FUNC void construct(const Expression& expr, internal::false_type) + { + internal::call_assignment_no_alias(m_object,expr,internal::assign_op()); + Base::construct(m_object); + } + + protected: + TPlainObjectType m_object; +}; + +} // end namespace Eigen + +#endif // EIGEN_REF_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Replicate.h b/simulation/externals/eigen/Eigen/src/Core/Replicate.h new file mode 100644 index 0000000..9960ef8 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Replicate.h @@ -0,0 +1,142 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_REPLICATE_H +#define EIGEN_REPLICATE_H + +namespace Eigen { + +namespace internal { +template +struct traits > + : traits +{ + typedef typename MatrixType::Scalar Scalar; + typedef typename traits::StorageKind StorageKind; + typedef typename traits::XprKind XprKind; + typedef typename ref_selector::type MatrixTypeNested; + typedef typename remove_reference::type _MatrixTypeNested; + enum { + RowsAtCompileTime = RowFactor==Dynamic || int(MatrixType::RowsAtCompileTime)==Dynamic + ? Dynamic + : RowFactor * MatrixType::RowsAtCompileTime, + ColsAtCompileTime = ColFactor==Dynamic || int(MatrixType::ColsAtCompileTime)==Dynamic + ? Dynamic + : ColFactor * MatrixType::ColsAtCompileTime, + //FIXME we don't propagate the max sizes !!! + MaxRowsAtCompileTime = RowsAtCompileTime, + MaxColsAtCompileTime = ColsAtCompileTime, + IsRowMajor = MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1 ? 1 + : MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1 ? 0 + : (MatrixType::Flags & RowMajorBit) ? 1 : 0, + + // FIXME enable DirectAccess with negative strides? + Flags = IsRowMajor ? RowMajorBit : 0 + }; +}; +} + +/** + * \class Replicate + * \ingroup Core_Module + * + * \brief Expression of the multiple replication of a matrix or vector + * + * \tparam MatrixType the type of the object we are replicating + * \tparam RowFactor number of repetitions at compile time along the vertical direction, can be Dynamic. + * \tparam ColFactor number of repetitions at compile time along the horizontal direction, can be Dynamic. + * + * This class represents an expression of the multiple replication of a matrix or vector. + * It is the return type of DenseBase::replicate() and most of the time + * this is the only way it is used. + * + * \sa DenseBase::replicate() + */ +template class Replicate + : public internal::dense_xpr_base< Replicate >::type +{ + typedef typename internal::traits::MatrixTypeNested MatrixTypeNested; + typedef typename internal::traits::_MatrixTypeNested _MatrixTypeNested; + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Replicate) + typedef typename internal::remove_all::type NestedExpression; + + template + EIGEN_DEVICE_FUNC + inline explicit Replicate(const OriginalMatrixType& matrix) + : m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor) + { + EIGEN_STATIC_ASSERT((internal::is_same::type,OriginalMatrixType>::value), + THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) + eigen_assert(RowFactor!=Dynamic && ColFactor!=Dynamic); + } + + template + EIGEN_DEVICE_FUNC + inline Replicate(const OriginalMatrixType& matrix, Index rowFactor, Index colFactor) + : m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor) + { + EIGEN_STATIC_ASSERT((internal::is_same::type,OriginalMatrixType>::value), + THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) + } + + EIGEN_DEVICE_FUNC + inline Index rows() const { return m_matrix.rows() * m_rowFactor.value(); } + EIGEN_DEVICE_FUNC + inline Index cols() const { return m_matrix.cols() * m_colFactor.value(); } + + EIGEN_DEVICE_FUNC + const _MatrixTypeNested& nestedExpression() const + { + return m_matrix; + } + + protected: + MatrixTypeNested m_matrix; + const internal::variable_if_dynamic m_rowFactor; + const internal::variable_if_dynamic m_colFactor; +}; + +/** + * \return an expression of the replication of \c *this + * + * Example: \include MatrixBase_replicate.cpp + * Output: \verbinclude MatrixBase_replicate.out + * + * \sa VectorwiseOp::replicate(), DenseBase::replicate(Index,Index), class Replicate + */ +template +template +const Replicate +DenseBase::replicate() const +{ + return Replicate(derived()); +} + +/** + * \return an expression of the replication of each column (or row) of \c *this + * + * Example: \include DirectionWise_replicate_int.cpp + * Output: \verbinclude DirectionWise_replicate_int.out + * + * \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate + */ +template +const typename VectorwiseOp::ReplicateReturnType +VectorwiseOp::replicate(Index factor) const +{ + return typename VectorwiseOp::ReplicateReturnType + (_expression(),Direction==Vertical?factor:1,Direction==Horizontal?factor:1); +} + +} // end namespace Eigen + +#endif // EIGEN_REPLICATE_H diff --git a/simulation/externals/eigen/Eigen/src/Core/ReturnByValue.h b/simulation/externals/eigen/Eigen/src/Core/ReturnByValue.h new file mode 100644 index 0000000..c44b767 --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/ReturnByValue.h @@ -0,0 +1,117 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009-2010 Gael Guennebaud +// Copyright (C) 2009-2010 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_RETURNBYVALUE_H +#define EIGEN_RETURNBYVALUE_H + +namespace Eigen { + +namespace internal { + +template +struct traits > + : public traits::ReturnType> +{ + enum { + // We're disabling the DirectAccess because e.g. the constructor of + // the Block-with-DirectAccess expression requires to have a coeffRef method. + // Also, we don't want to have to implement the stride stuff. + Flags = (traits::ReturnType>::Flags + | EvalBeforeNestingBit) & ~DirectAccessBit + }; +}; + +/* The ReturnByValue object doesn't even have a coeff() method. + * So the only way that nesting it in an expression can work, is by evaluating it into a plain matrix. + * So internal::nested always gives the plain return matrix type. + * + * FIXME: I don't understand why we need this specialization: isn't this taken care of by the EvalBeforeNestingBit ?? + * Answer: EvalBeforeNestingBit should be deprecated since we have the evaluators + */ +template +struct nested_eval, n, PlainObject> +{ + typedef typename traits::ReturnType type; +}; + +} // end namespace internal + +/** \class ReturnByValue + * \ingroup Core_Module + * + */ +template class ReturnByValue + : public internal::dense_xpr_base< ReturnByValue >::type, internal::no_assignment_operator +{ + public: + typedef typename internal::traits::ReturnType ReturnType; + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue) + + template + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& dst) const + { static_cast(this)->evalTo(dst); } + EIGEN_DEVICE_FUNC inline Index rows() const { return static_cast(this)->rows(); } + EIGEN_DEVICE_FUNC inline Index cols() const { return static_cast(this)->cols(); } + +#ifndef EIGEN_PARSED_BY_DOXYGEN +#define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT + class Unusable{ + Unusable(const Unusable&) {} + Unusable& operator=(const Unusable&) {return *this;} + }; + const Unusable& coeff(Index) const { return *reinterpret_cast(this); } + const Unusable& coeff(Index,Index) const { return *reinterpret_cast(this); } + Unusable& coeffRef(Index) { return *reinterpret_cast(this); } + Unusable& coeffRef(Index,Index) { return *reinterpret_cast(this); } +#undef Unusable +#endif +}; + +template +template +Derived& DenseBase::operator=(const ReturnByValue& other) +{ + other.evalTo(derived()); + return derived(); +} + +namespace internal { + +// Expression is evaluated in a temporary; default implementation of Assignment is bypassed so that +// when a ReturnByValue expression is assigned, the evaluator is not constructed. +// TODO: Finalize port to new regime; ReturnByValue should not exist in the expression world + +template +struct evaluator > + : public evaluator::ReturnType> +{ + typedef ReturnByValue XprType; + typedef typename internal::traits::ReturnType PlainObject; + typedef evaluator Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) + : m_result(xpr.rows(), xpr.cols()) + { + ::new (static_cast(this)) Base(m_result); + xpr.evalTo(m_result); + } + +protected: + PlainObject m_result; +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_RETURNBYVALUE_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Reverse.h b/simulation/externals/eigen/Eigen/src/Core/Reverse.h new file mode 100644 index 0000000..0640cda --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Reverse.h @@ -0,0 +1,211 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2009 Ricard Marxer +// Copyright (C) 2009-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_REVERSE_H +#define EIGEN_REVERSE_H + +namespace Eigen { + +namespace internal { + +template +struct traits > + : traits +{ + typedef typename MatrixType::Scalar Scalar; + typedef typename traits::StorageKind StorageKind; + typedef typename traits::XprKind XprKind; + typedef typename ref_selector::type MatrixTypeNested; + typedef typename remove_reference::type _MatrixTypeNested; + enum { + RowsAtCompileTime = MatrixType::RowsAtCompileTime, + ColsAtCompileTime = MatrixType::ColsAtCompileTime, + MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, + Flags = _MatrixTypeNested::Flags & (RowMajorBit | LvalueBit) + }; +}; + +template struct reverse_packet_cond +{ + static inline PacketType run(const PacketType& x) { return preverse(x); } +}; + +template struct reverse_packet_cond +{ + static inline PacketType run(const PacketType& x) { return x; } +}; + +} // end namespace internal + +/** \class Reverse + * \ingroup Core_Module + * + * \brief Expression of the reverse of a vector or matrix + * + * \tparam MatrixType the type of the object of which we are taking the reverse + * \tparam Direction defines the direction of the reverse operation, can be Vertical, Horizontal, or BothDirections + * + * This class represents an expression of the reverse of a vector. + * It is the return type of MatrixBase::reverse() and VectorwiseOp::reverse() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::reverse(), VectorwiseOp::reverse() + */ +template class Reverse + : public internal::dense_xpr_base< Reverse >::type +{ + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Reverse) + typedef typename internal::remove_all::type NestedExpression; + using Base::IsRowMajor; + + protected: + enum { + PacketSize = internal::packet_traits::size, + IsColMajor = !IsRowMajor, + ReverseRow = (Direction == Vertical) || (Direction == BothDirections), + ReverseCol = (Direction == Horizontal) || (Direction == BothDirections), + OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1, + OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1, + ReversePacket = (Direction == BothDirections) + || ((Direction == Vertical) && IsColMajor) + || ((Direction == Horizontal) && IsRowMajor) + }; + typedef internal::reverse_packet_cond reverse_packet; + public: + + EIGEN_DEVICE_FUNC explicit inline Reverse(const MatrixType& matrix) : m_matrix(matrix) { } + + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Reverse) + + EIGEN_DEVICE_FUNC inline Index rows() const { return m_matrix.rows(); } + EIGEN_DEVICE_FUNC inline Index cols() const { return m_matrix.cols(); } + + EIGEN_DEVICE_FUNC inline Index innerStride() const + { + return -m_matrix.innerStride(); + } + + EIGEN_DEVICE_FUNC const typename internal::remove_all::type& + nestedExpression() const + { + return m_matrix; + } + + protected: + typename MatrixType::Nested m_matrix; +}; + +/** \returns an expression of the reverse of *this. + * + * Example: \include MatrixBase_reverse.cpp + * Output: \verbinclude MatrixBase_reverse.out + * + */ +template +inline typename DenseBase::ReverseReturnType +DenseBase::reverse() +{ + return ReverseReturnType(derived()); +} + + +//reverse const overload moved DenseBase.h due to a CUDA compiler bug + +/** This is the "in place" version of reverse: it reverses \c *this. + * + * In most cases it is probably better to simply use the reversed expression + * of a matrix. However, when reversing the matrix data itself is really needed, + * then this "in-place" version is probably the right choice because it provides + * the following additional benefits: + * - less error prone: doing the same operation with .reverse() requires special care: + * \code m = m.reverse().eval(); \endcode + * - this API enables reverse operations without the need for a temporary + * - it allows future optimizations (cache friendliness, etc.) + * + * \sa VectorwiseOp::reverseInPlace(), reverse() */ +template +inline void DenseBase::reverseInPlace() +{ + if(cols()>rows()) + { + Index half = cols()/2; + leftCols(half).swap(rightCols(half).reverse()); + if((cols()%2)==1) + { + Index half2 = rows()/2; + col(half).head(half2).swap(col(half).tail(half2).reverse()); + } + } + else + { + Index half = rows()/2; + topRows(half).swap(bottomRows(half).reverse()); + if((rows()%2)==1) + { + Index half2 = cols()/2; + row(half).head(half2).swap(row(half).tail(half2).reverse()); + } + } +} + +namespace internal { + +template +struct vectorwise_reverse_inplace_impl; + +template<> +struct vectorwise_reverse_inplace_impl +{ + template + static void run(ExpressionType &xpr) + { + Index half = xpr.rows()/2; + xpr.topRows(half).swap(xpr.bottomRows(half).colwise().reverse()); + } +}; + +template<> +struct vectorwise_reverse_inplace_impl +{ + template + static void run(ExpressionType &xpr) + { + Index half = xpr.cols()/2; + xpr.leftCols(half).swap(xpr.rightCols(half).rowwise().reverse()); + } +}; + +} // end namespace internal + +/** This is the "in place" version of VectorwiseOp::reverse: it reverses each column or row of \c *this. + * + * In most cases it is probably better to simply use the reversed expression + * of a matrix. However, when reversing the matrix data itself is really needed, + * then this "in-place" version is probably the right choice because it provides + * the following additional benefits: + * - less error prone: doing the same operation with .reverse() requires special care: + * \code m = m.reverse().eval(); \endcode + * - this API enables reverse operations without the need for a temporary + * + * \sa DenseBase::reverseInPlace(), reverse() */ +template +void VectorwiseOp::reverseInPlace() +{ + internal::vectorwise_reverse_inplace_impl::run(_expression().const_cast_derived()); +} + +} // end namespace Eigen + +#endif // EIGEN_REVERSE_H diff --git a/simulation/externals/eigen/Eigen/src/Core/Select.h b/simulation/externals/eigen/Eigen/src/Core/Select.h new file mode 100644 index 0000000..79eec1b --- /dev/null +++ b/simulation/externals/eigen/Eigen/src/Core/Select.h @@ -0,0 +1,162 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_SELECT_H +#define EIGEN_SELECT_H + +namespace Eigen { + +/** \class Select + * \ingroup Core_Module + * + * \brief Expression of a coefficient wise version of the C++ ternary operator ?: + * + * \param ConditionMatrixType the type of the \em condition expression which must be a boolean matrix + * \param ThenMatrixType the type of the \em then expression + * \param ElseMatrixType the type of the \em else expression + * + * This class represents an expression of a coefficient wise version of the C++ ternary operator ?:. + * It is the return type of DenseBase::select() and most of the time this is the only way it is used. + * + * \sa DenseBase::select(const DenseBase&, const DenseBase&) const + */ + +namespace internal { +template +struct traits > + : traits +{ + typedef typename traits::Scalar Scalar; + typedef Dense StorageKind; + typedef typename traits::XprKind XprKind; + typedef typename ConditionMatrixType::Nested ConditionMatrixNested; + typedef typename ThenMatrixType::Nested ThenMatrixNested; + typedef typename ElseMatrixType::Nested ElseMatrixNested; + enum { + RowsAtCompileTime = ConditionMatrixType::RowsAtCompileTime, + ColsAtCompileTime = ConditionMatrixType::ColsAtCompileTime, + MaxRowsAtCompileTime = ConditionMatrixType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = ConditionMatrixType::MaxColsAtCompileTime, + Flags = (unsigned int)ThenMatrixType::Flags & ElseMatrixType::Flags & RowMajorBit + }; +}; +} + +template +class Select : public internal::dense_xpr_base< Select >::type, + internal::no_assignment_operator +{ + public: + + typedef typename internal::dense_xpr_base" << endl; + cerr << "available actions:" << endl; + for (auto it = available_actions.begin(); it != available_actions.end(); ++it) { + cerr << " " << (*it)->invokation_name() << endl; + } + cerr << "the input files should each contain an output of benchmark-blocking-sizes" << endl; + exit(1); +} + +int main(int argc, char* argv[]) +{ + cout.precision(default_precision); + cerr.precision(default_precision); + + vector> available_actions; + available_actions.emplace_back(new partition_action_t); + available_actions.emplace_back(new evaluate_defaults_action_t); + + vector input_filenames; + + action_t* action = nullptr; + + if (argc < 2) { + show_usage_and_exit(argc, argv, available_actions); + } + for (int i = 1; i < argc; i++) { + bool arg_handled = false; + // Step 1. Try to match action invokation names. + for (auto it = available_actions.begin(); it != available_actions.end(); ++it) { + if (!strcmp(argv[i], (*it)->invokation_name())) { + if (!action) { + action = it->get(); + arg_handled = true; + break; + } else { + cerr << "can't specify more than one action!" << endl; + show_usage_and_exit(argc, argv, available_actions); + } + } + } + if (arg_handled) { + continue; + } + // Step 2. Try to match option names. + if (argv[i][0] == '-') { + if (!strcmp(argv[i], "--only-cubic-sizes")) { + only_cubic_sizes = true; + arg_handled = true; + } + if (!strcmp(argv[i], "--dump-tables")) { + dump_tables = true; + arg_handled = true; + } + if (!arg_handled) { + cerr << "Unrecognized option: " << argv[i] << endl; + show_usage_and_exit(argc, argv, available_actions); + } + } + if (arg_handled) { + continue; + } + // Step 3. Default to interpreting args as input filenames. + input_filenames.emplace_back(argv[i]); + } + + if (dump_tables && only_cubic_sizes) { + cerr << "Incompatible options: --only-cubic-sizes and --dump-tables." << endl; + show_usage_and_exit(argc, argv, available_actions); + } + + if (!action) { + show_usage_and_exit(argc, argv, available_actions); + } + + action->run(input_filenames); +} diff --git a/simulation/externals/eigen/bench/basicbench.cxxlist b/simulation/externals/eigen/bench/basicbench.cxxlist new file mode 100644 index 0000000..a8ab34e --- /dev/null +++ b/simulation/externals/eigen/bench/basicbench.cxxlist @@ -0,0 +1,28 @@ +#!/bin/bash + +# CLIST[((g++))]="g++-3.4 -O3 -DNDEBUG" +# CLIST[((g++))]="g++-3.4 -O3 -DNDEBUG -finline-limit=20000" + +# CLIST[((g++))]="g++-4.1 -O3 -DNDEBUG" +#CLIST[((g++))]="g++-4.1 -O3 -DNDEBUG -finline-limit=20000" + +# CLIST[((g++))]="g++-4.2 -O3 -DNDEBUG" +#CLIST[((g++))]="g++-4.2 -O3 -DNDEBUG -finline-limit=20000" +# CLIST[((g++))]="g++-4.2 -O3 -DNDEBUG -finline-limit=20000 -fprofile-generate" +# CLIST[((g++))]="g++-4.2 -O3 -DNDEBUG -finline-limit=20000 -fprofile-use" + +# CLIST[((g++))]="g++-4.3 -O3 -DNDEBUG" +#CLIST[((g++))]="g++-4.3 -O3 -DNDEBUG -finline-limit=20000" +# CLIST[((g++))]="g++-4.3 -O3 -DNDEBUG -finline-limit=20000 -fprofile-generate" +# CLIST[((g++))]="g++-4.3 -O3 -DNDEBUG -finline-limit=20000 -fprofile-use" + +# CLIST[((g++))]="icpc -fast -DNDEBUG -fno-exceptions -no-inline-max-size -prof-genx" +# CLIST[((g++))]="icpc -fast -DNDEBUG -fno-exceptions -no-inline-max-size -prof-use" + +#CLIST[((g++))]="/opt/intel/Compiler/11.1/072/bin/intel64/icpc -fast -DNDEBUG -fno-exceptions -no-inline-max-size -lrt" +CLIST[((g++))]="/home/orzel/svn/llvm/Release/bin/clang++ -O3 -DNDEBUG -DEIGEN_DONT_VECTORIZE -lrt" +CLIST[((g++))]="/home/orzel/svn/llvm/Release/bin/clang++ -O3 -DNDEBUG -lrt" +CLIST[((g++))]="g++-4.4.4 -O3 -DNDEBUG -DEIGEN_DONT_VECTORIZE -lrt" +CLIST[((g++))]="g++-4.4.4 -O3 -DNDEBUG -lrt" +CLIST[((g++))]="g++-4.5.0 -O3 -DNDEBUG -DEIGEN_DONT_VECTORIZE -lrt" +CLIST[((g++))]="g++-4.5.0 -O3 -DNDEBUG -lrt" diff --git a/simulation/externals/eigen/bench/basicbenchmark.cpp b/simulation/externals/eigen/bench/basicbenchmark.cpp new file mode 100644 index 0000000..a26ea85 --- /dev/null +++ b/simulation/externals/eigen/bench/basicbenchmark.cpp @@ -0,0 +1,35 @@ + +#include +#include "BenchUtil.h" +#include "basicbenchmark.h" + +int main(int argc, char *argv[]) +{ + DISABLE_SSE_EXCEPTIONS(); + + // this is the list of matrix type and size we want to bench: + // ((suffix) (matrix size) (number of iterations)) + #define MODES ((3d)(3)(4000000)) ((4d)(4)(1000000)) ((Xd)(4)(1000000)) ((Xd)(20)(10000)) +// #define MODES ((Xd)(20)(10000)) + + #define _GENERATE_HEADER(R,ARG,EL) << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_HEAD(EL)) << "-" \ + << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(1,EL)) << "x" \ + << BOOST_PP_STRINGIZE(BOOST_PP_SEQ_ELEM(1,EL)) << " / " + + std::cout BOOST_PP_SEQ_FOR_EACH(_GENERATE_HEADER, ~, MODES ) << endl; + + const int tries = 10; + + #define _RUN_BENCH(R,ARG,EL) \ + std::cout << ARG( \ + BOOST_PP_CAT(Matrix, BOOST_PP_SEQ_HEAD(EL)) (\ + BOOST_PP_SEQ_ELEM(1,EL),BOOST_PP_SEQ_ELEM(1,EL)), BOOST_PP_SEQ_ELEM(2,EL), tries) \ + << " "; + + BOOST_PP_SEQ_FOR_EACH(_RUN_BENCH, benchBasic, MODES ); + std::cout << endl; + BOOST_PP_SEQ_FOR_EACH(_RUN_BENCH, benchBasic, MODES ); + std::cout << endl; + + return 0; +} diff --git a/simulation/externals/eigen/bench/basicbenchmark.h b/simulation/externals/eigen/bench/basicbenchmark.h new file mode 100644 index 0000000..3fdc357 --- /dev/null +++ b/simulation/externals/eigen/bench/basicbenchmark.h @@ -0,0 +1,63 @@ + +#ifndef EIGEN_BENCH_BASICBENCH_H +#define EIGEN_BENCH_BASICBENCH_H + +enum {LazyEval, EarlyEval, OmpEval}; + +template +void benchBasic_loop(const MatrixType& I, MatrixType& m, int iterations) __attribute__((noinline)); + +template +void benchBasic_loop(const MatrixType& I, MatrixType& m, int iterations) +{ + for(int a = 0; a < iterations; a++) + { + if (Mode==LazyEval) + { + asm("#begin_bench_loop LazyEval"); + if (MatrixType::SizeAtCompileTime!=Eigen::Dynamic) asm("#fixedsize"); + m = (I + 0.00005 * (m + m.lazy() * m)).eval(); + } + else if (Mode==OmpEval) + { + asm("#begin_bench_loop OmpEval"); + if (MatrixType::SizeAtCompileTime!=Eigen::Dynamic) asm("#fixedsize"); + m = (I + 0.00005 * (m + m.lazy() * m)).evalOMP(); + } + else + { + asm("#begin_bench_loop EarlyEval"); + if (MatrixType::SizeAtCompileTime!=Eigen::Dynamic) asm("#fixedsize"); + m = I + 0.00005 * (m + m * m); + } + asm("#end_bench_loop"); + } +} + +template +double benchBasic(const MatrixType& mat, int size, int tries) __attribute__((noinline)); + +template +double benchBasic(const MatrixType& mat, int iterations, int tries) +{ + const int rows = mat.rows(); + const int cols = mat.cols(); + + MatrixType I(rows,cols); + MatrixType m(rows,cols); + + initMatrix_identity(I); + + Eigen::BenchTimer timer; + for(uint t=0; t(I, m, iterations); + timer.stop(); + cerr << m; + } + return timer.value(); +}; + +#endif // EIGEN_BENCH_BASICBENCH_H diff --git a/simulation/externals/eigen/bench/benchBlasGemm.cpp b/simulation/externals/eigen/bench/benchBlasGemm.cpp new file mode 100644 index 0000000..cb086a5 --- /dev/null +++ b/simulation/externals/eigen/bench/benchBlasGemm.cpp @@ -0,0 +1,219 @@ +// g++ -O3 -DNDEBUG -I.. -L /usr/lib64/atlas/ benchBlasGemm.cpp -o benchBlasGemm -lrt -lcblas +// possible options: +// -DEIGEN_DONT_VECTORIZE +// -msse2 + +// #define EIGEN_DEFAULT_TO_ROW_MAJOR +#define _FLOAT + +#include + +#include +#include "BenchTimer.h" + +// include the BLAS headers +extern "C" { +#include +} +#include + +#ifdef _FLOAT +typedef float Scalar; +#define CBLAS_GEMM cblas_sgemm +#else +typedef double Scalar; +#define CBLAS_GEMM cblas_dgemm +#endif + + +typedef Eigen::Matrix MyMatrix; +void bench_eigengemm(MyMatrix& mc, const MyMatrix& ma, const MyMatrix& mb, int nbloops); +void check_product(int M, int N, int K); +void check_product(void); + +int main(int argc, char *argv[]) +{ + // disable SSE exceptions + #ifdef __GNUC__ + { + int aux; + asm( + "stmxcsr %[aux] \n\t" + "orl $32832, %[aux] \n\t" + "ldmxcsr %[aux] \n\t" + : : [aux] "m" (aux)); + } + #endif + + int nbtries=1, nbloops=1, M, N, K; + + if (argc==2) + { + if (std::string(argv[1])=="check") + check_product(); + else + M = N = K = atoi(argv[1]); + } + else if ((argc==3) && (std::string(argv[1])=="auto")) + { + M = N = K = atoi(argv[2]); + nbloops = 1000000000/(M*M*M); + if (nbloops<1) + nbloops = 1; + nbtries = 6; + } + else if (argc==4) + { + M = N = K = atoi(argv[1]); + nbloops = atoi(argv[2]); + nbtries = atoi(argv[3]); + } + else if (argc==6) + { + M = atoi(argv[1]); + N = atoi(argv[2]); + K = atoi(argv[3]); + nbloops = atoi(argv[4]); + nbtries = atoi(argv[5]); + } + else + { + std::cout << "Usage: " << argv[0] << " size \n"; + std::cout << "Usage: " << argv[0] << " auto size\n"; + std::cout << "Usage: " << argv[0] << " size nbloops nbtries\n"; + std::cout << "Usage: " << argv[0] << " M N K nbloops nbtries\n"; + std::cout << "Usage: " << argv[0] << " check\n"; + std::cout << "Options:\n"; + std::cout << " size unique size of the 2 matrices (integer)\n"; + std::cout << " auto automatically set the number of repetitions and tries\n"; + std::cout << " nbloops number of times the GEMM routines is executed\n"; + std::cout << " nbtries number of times the loop is benched (return the best try)\n"; + std::cout << " M N K sizes of the matrices: MxN = MxK * KxN (integers)\n"; + std::cout << " check check eigen product using cblas as a reference\n"; + exit(1); + } + + double nbmad = double(M) * double(N) * double(K) * double(nbloops); + + if (!(std::string(argv[1])=="auto")) + std::cout << M << " x " << N << " x " << K << "\n"; + + Scalar alpha, beta; + MyMatrix ma(M,K), mb(K,N), mc(M,N); + ma = MyMatrix::Random(M,K); + mb = MyMatrix::Random(K,N); + mc = MyMatrix::Random(M,N); + + Eigen::BenchTimer timer; + + // we simply compute c += a*b, so: + alpha = 1; + beta = 1; + + // bench cblas + // ROWS_A, COLS_B, COLS_A, 1.0, A, COLS_A, B, COLS_B, 0.0, C, COLS_B); + if (!(std::string(argv[1])=="auto")) + { + timer.reset(); + for (uint k=0 ; k(1,64); + N = internal::random(1,768); + K = internal::random(1,768); + M = (0 + M) * 1; + std::cout << M << " x " << N << " x " << K << "\n"; + check_product(M, N, K); + } +} + diff --git a/simulation/externals/eigen/bench/benchCholesky.cpp b/simulation/externals/eigen/bench/benchCholesky.cpp new file mode 100644 index 0000000..9a8e7cf --- /dev/null +++ b/simulation/externals/eigen/bench/benchCholesky.cpp @@ -0,0 +1,142 @@ + +// g++ -DNDEBUG -O3 -I.. benchLLT.cpp -o benchLLT && ./benchLLT +// options: +// -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3 +// -DEIGEN_DONT_VECTORIZE +// -msse2 +// -DREPEAT=100 +// -DTRIES=10 +// -DSCALAR=double + +#include + +#include +#include +#include +using namespace Eigen; + +#ifndef REPEAT +#define REPEAT 10000 +#endif + +#ifndef TRIES +#define TRIES 10 +#endif + +typedef float Scalar; + +template +__attribute__ ((noinline)) void benchLLT(const MatrixType& m) +{ + int rows = m.rows(); + int cols = m.cols(); + + double cost = 0; + for (int j=0; j SquareMatrixType; + + MatrixType a = MatrixType::Random(rows,cols); + SquareMatrixType covMat = a * a.adjoint(); + + BenchTimer timerNoSqrt, timerSqrt; + + Scalar acc = 0; + int r = internal::random(0,covMat.rows()-1); + int c = internal::random(0,covMat.cols()-1); + for (int t=0; t cholnosqrt(covMat); + acc += cholnosqrt.matrixL().coeff(r,c); + } + timerNoSqrt.stop(); + } + + for (int t=0; t chol(covMat); + acc += chol.matrixL().coeff(r,c); + } + timerSqrt.stop(); + } + + if (MatrixType::RowsAtCompileTime==Dynamic) + std::cout << "dyn "; + else + std::cout << "fixed "; + std::cout << covMat.rows() << " \t" + << (timerNoSqrt.best()) / repeats << "s " + << "(" << 1e-9 * cost*repeats/timerNoSqrt.best() << " GFLOPS)\t" + << (timerSqrt.best()) / repeats << "s " + << "(" << 1e-9 * cost*repeats/timerSqrt.best() << " GFLOPS)\n"; + + + #ifdef BENCH_GSL + if (MatrixType::RowsAtCompileTime==Dynamic) + { + timerSqrt.reset(); + + gsl_matrix* gslCovMat = gsl_matrix_alloc(covMat.rows(),covMat.cols()); + gsl_matrix* gslCopy = gsl_matrix_alloc(covMat.rows(),covMat.cols()); + + eiToGsl(covMat, &gslCovMat); + for (int t=0; t0; ++i) + benchLLT(Matrix(dynsizes[i],dynsizes[i])); + + benchLLT(Matrix()); + benchLLT(Matrix()); + benchLLT(Matrix()); + benchLLT(Matrix()); + benchLLT(Matrix()); + benchLLT(Matrix()); + benchLLT(Matrix()); + benchLLT(Matrix()); + benchLLT(Matrix()); + return 0; +} + diff --git a/simulation/externals/eigen/bench/benchEigenSolver.cpp b/simulation/externals/eigen/bench/benchEigenSolver.cpp new file mode 100644 index 0000000..dd78c7e --- /dev/null +++ b/simulation/externals/eigen/bench/benchEigenSolver.cpp @@ -0,0 +1,212 @@ + +// g++ -DNDEBUG -O3 -I.. benchEigenSolver.cpp -o benchEigenSolver && ./benchEigenSolver +// options: +// -DBENCH_GMM +// -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3 +// -DEIGEN_DONT_VECTORIZE +// -msse2 +// -DREPEAT=100 +// -DTRIES=10 +// -DSCALAR=double + +#include + +#include +#include +#include +using namespace Eigen; + +#ifndef REPEAT +#define REPEAT 1000 +#endif + +#ifndef TRIES +#define TRIES 4 +#endif + +#ifndef SCALAR +#define SCALAR float +#endif + +typedef SCALAR Scalar; + +template +__attribute__ ((noinline)) void benchEigenSolver(const MatrixType& m) +{ + int rows = m.rows(); + int cols = m.cols(); + + int stdRepeats = std::max(1,int((REPEAT*1000)/(rows*rows*sqrt(rows)))); + int saRepeats = stdRepeats * 4; + + typedef typename MatrixType::Scalar Scalar; + typedef Matrix SquareMatrixType; + + MatrixType a = MatrixType::Random(rows,cols); + SquareMatrixType covMat = a * a.adjoint(); + + BenchTimer timerSa, timerStd; + + Scalar acc = 0; + int r = internal::random(0,covMat.rows()-1); + int c = internal::random(0,covMat.cols()-1); + { + SelfAdjointEigenSolver ei(covMat); + for (int t=0; t ei(covMat); + for (int t=0; t gmmCovMat(covMat.rows(),covMat.cols()); + gmm::dense_matrix eigvect(covMat.rows(),covMat.cols()); + std::vector eigval(covMat.rows()); + eiToGmm(covMat, gmmCovMat); + for (int t=0; t0; ++i) + benchEigenSolver(Matrix(dynsizes[i],dynsizes[i])); + + benchEigenSolver(Matrix()); + benchEigenSolver(Matrix()); + benchEigenSolver(Matrix()); + benchEigenSolver(Matrix()); + benchEigenSolver(Matrix()); + benchEigenSolver(Matrix()); + benchEigenSolver(Matrix()); + return 0; +} + diff --git a/simulation/externals/eigen/bench/benchFFT.cpp b/simulation/externals/eigen/bench/benchFFT.cpp new file mode 100644 index 0000000..3eb1a1a --- /dev/null +++ b/simulation/externals/eigen/bench/benchFFT.cpp @@ -0,0 +1,115 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2009 Mark Borgerding mark a borgerding net +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include + +#include +#include +#include +#include + +#include + +using namespace Eigen; +using namespace std; + + +template +string nameof(); + +template <> string nameof() {return "float";} +template <> string nameof() {return "double";} +template <> string nameof() {return "long double";} + +#ifndef TYPE +#define TYPE float +#endif + +#ifndef NFFT +#define NFFT 1024 +#endif +#ifndef NDATA +#define NDATA 1000000 +#endif + +using namespace Eigen; + +template +void bench(int nfft,bool fwd,bool unscaled=false, bool halfspec=false) +{ + typedef typename NumTraits::Real Scalar; + typedef typename std::complex Complex; + int nits = NDATA/nfft; + vector inbuf(nfft); + vector outbuf(nfft); + FFT< Scalar > fft; + + if (unscaled) { + fft.SetFlag(fft.Unscaled); + cout << "unscaled "; + } + if (halfspec) { + fft.SetFlag(fft.HalfSpectrum); + cout << "halfspec "; + } + + + std::fill(inbuf.begin(),inbuf.end(),0); + fft.fwd( outbuf , inbuf); + + BenchTimer timer; + timer.reset(); + for (int k=0;k<8;++k) { + timer.start(); + if (fwd) + for(int i = 0; i < nits; i++) + fft.fwd( outbuf , inbuf); + else + for(int i = 0; i < nits; i++) + fft.inv(inbuf,outbuf); + timer.stop(); + } + + cout << nameof() << " "; + double mflops = 5.*nfft*log2((double)nfft) / (1e6 * timer.value() / (double)nits ); + if ( NumTraits::IsComplex ) { + cout << "complex"; + }else{ + cout << "real "; + mflops /= 2; + } + + + if (fwd) + cout << " fwd"; + else + cout << " inv"; + + cout << " NFFT=" << nfft << " " << (double(1e-6*nfft*nits)/timer.value()) << " MS/s " << mflops << "MFLOPS\n"; +} + +int main(int argc,char ** argv) +{ + bench >(NFFT,true); + bench >(NFFT,false); + bench(NFFT,true); + bench(NFFT,false); + bench(NFFT,false,true); + bench(NFFT,false,true,true); + + bench >(NFFT,true); + bench >(NFFT,false); + bench(NFFT,true); + bench(NFFT,false); + bench >(NFFT,true); + bench >(NFFT,false); + bench(NFFT,true); + bench(NFFT,false); + return 0; +} diff --git a/simulation/externals/eigen/bench/benchGeometry.cpp b/simulation/externals/eigen/bench/benchGeometry.cpp new file mode 100644 index 0000000..6e16c03 --- /dev/null +++ b/simulation/externals/eigen/bench/benchGeometry.cpp @@ -0,0 +1,134 @@ +#include +#include +#include +#include +#include + +using namespace Eigen; +using namespace std; + +#ifndef REPEAT +#define REPEAT 1000000 +#endif + +enum func_opt +{ + TV, + TMATV, + TMATVMAT, +}; + + +template +struct func; + +template +struct func +{ + static EIGEN_DONT_INLINE res run( arg1& a1, arg2& a2 ) + { + asm (""); + return a1 * a2; + } +}; + +template +struct func +{ + static EIGEN_DONT_INLINE res run( arg1& a1, arg2& a2 ) + { + asm (""); + return a1.matrix() * a2; + } +}; + +template +struct func +{ + static EIGEN_DONT_INLINE res run( arg1& a1, arg2& a2 ) + { + asm (""); + return res(a1.matrix() * a2.matrix()); + } +}; + +template +struct test_transform +{ + static void run() + { + arg1 a1; + a1.setIdentity(); + arg2 a2; + a2.setIdentity(); + + BenchTimer timer; + timer.reset(); + for (int k=0; k<10; ++k) + { + timer.start(); + for (int k=0; k Trans;\ + typedef Matrix Vec;\ + typedef func Func;\ + test_transform< Func, Trans, Vec >::run();\ + } + +#define run_trans( op, scalar, mode, option ) \ + std::cout << #scalar << "\t " << #mode << "\t " << #option << " "; \ + {\ + typedef Transform Trans;\ + typedef func Func;\ + test_transform< Func, Trans, Trans >::run();\ + } + +int main(int argc, char* argv[]) +{ + cout << "vec = trans * vec" << endl; + run_vec(TV, float, Isometry, AutoAlign, 3); + run_vec(TV, float, Isometry, DontAlign, 3); + run_vec(TV, float, Isometry, AutoAlign, 4); + run_vec(TV, float, Isometry, DontAlign, 4); + run_vec(TV, float, Projective, AutoAlign, 4); + run_vec(TV, float, Projective, DontAlign, 4); + run_vec(TV, double, Isometry, AutoAlign, 3); + run_vec(TV, double, Isometry, DontAlign, 3); + run_vec(TV, double, Isometry, AutoAlign, 4); + run_vec(TV, double, Isometry, DontAlign, 4); + run_vec(TV, double, Projective, AutoAlign, 4); + run_vec(TV, double, Projective, DontAlign, 4); + + cout << "vec = trans.matrix() * vec" << endl; + run_vec(TMATV, float, Isometry, AutoAlign, 4); + run_vec(TMATV, float, Isometry, DontAlign, 4); + run_vec(TMATV, double, Isometry, AutoAlign, 4); + run_vec(TMATV, double, Isometry, DontAlign, 4); + + cout << "trans = trans1 * trans" << endl; + run_trans(TV, float, Isometry, AutoAlign); + run_trans(TV, float, Isometry, DontAlign); + run_trans(TV, double, Isometry, AutoAlign); + run_trans(TV, double, Isometry, DontAlign); + run_trans(TV, float, Projective, AutoAlign); + run_trans(TV, float, Projective, DontAlign); + run_trans(TV, double, Projective, AutoAlign); + run_trans(TV, double, Projective, DontAlign); + + cout << "trans = trans1.matrix() * trans.matrix()" << endl; + run_trans(TMATVMAT, float, Isometry, AutoAlign); + run_trans(TMATVMAT, float, Isometry, DontAlign); + run_trans(TMATVMAT, double, Isometry, AutoAlign); + run_trans(TMATVMAT, double, Isometry, DontAlign); +} + diff --git a/simulation/externals/eigen/bench/benchVecAdd.cpp b/simulation/externals/eigen/bench/benchVecAdd.cpp new file mode 100644 index 0000000..ce8e1e9 --- /dev/null +++ b/simulation/externals/eigen/bench/benchVecAdd.cpp @@ -0,0 +1,135 @@ + +#include +#include +#include +using namespace Eigen; + +#ifndef SIZE +#define SIZE 50 +#endif + +#ifndef REPEAT +#define REPEAT 10000 +#endif + +typedef float Scalar; + +__attribute__ ((noinline)) void benchVec(Scalar* a, Scalar* b, Scalar* c, int size); +__attribute__ ((noinline)) void benchVec(MatrixXf& a, MatrixXf& b, MatrixXf& c); +__attribute__ ((noinline)) void benchVec(VectorXf& a, VectorXf& b, VectorXf& c); + +int main(int argc, char* argv[]) +{ + int size = SIZE * 8; + int size2 = size * size; + Scalar* a = internal::aligned_new(size2); + Scalar* b = internal::aligned_new(size2+4)+1; + Scalar* c = internal::aligned_new(size2); + + for (int i=0; i2 ; --innersize) + { + if (size2%innersize==0) + { + int outersize = size2/innersize; + MatrixXf ma = Map(a, innersize, outersize ); + MatrixXf mb = Map(b, innersize, outersize ); + MatrixXf mc = Map(c, innersize, outersize ); + timer.reset(); + for (int k=0; k<3; ++k) + { + timer.start(); + benchVec(ma, mb, mc); + timer.stop(); + } + std::cout << innersize << " x " << outersize << " " << timer.value() << "s " << (double(size2*REPEAT)/timer.value())/(1024.*1024.*1024.) << " GFlops\n"; + } + } + + VectorXf va = Map(a, size2); + VectorXf vb = Map(b, size2); + VectorXf vc = Map(c, size2); + timer.reset(); + for (int k=0; k<3; ++k) + { + timer.start(); + benchVec(va, vb, vc); + timer.stop(); + } + std::cout << timer.value() << "s " << (double(size2*REPEAT)/timer.value())/(1024.*1024.*1024.) << " GFlops\n"; + + return 0; +} + +void benchVec(MatrixXf& a, MatrixXf& b, MatrixXf& c) +{ + for (int k=0; k::type PacketScalar; + const int PacketSize = internal::packet_traits::size; + PacketScalar a0, a1, a2, a3, b0, b1, b2, b3; + for (int k=0; k +// -DSCALARA=double or -DSCALARB=double +// -DHAVE_BLAS +// -DDECOUPLED +// + +#include +#include +#include + +using namespace std; +using namespace Eigen; + +#ifndef SCALAR +// #define SCALAR std::complex +#define SCALAR float +#endif + +#ifndef SCALARA +#define SCALARA SCALAR +#endif + +#ifndef SCALARB +#define SCALARB SCALAR +#endif + +typedef SCALAR Scalar; +typedef NumTraits::Real RealScalar; +typedef Matrix A; +typedef Matrix B; +typedef Matrix C; +typedef Matrix M; + +#ifdef HAVE_BLAS + +extern "C" { + #include +} + +static float fone = 1; +static float fzero = 0; +static double done = 1; +static double szero = 0; +static std::complex cfone = 1; +static std::complex cfzero = 0; +static std::complex cdone = 1; +static std::complex cdzero = 0; +static char notrans = 'N'; +static char trans = 'T'; +static char nonunit = 'N'; +static char lower = 'L'; +static char right = 'R'; +static int intone = 1; + +void blas_gemm(const MatrixXf& a, const MatrixXf& b, MatrixXf& c) +{ + int M = c.rows(); int N = c.cols(); int K = a.cols(); + int lda = a.rows(); int ldb = b.rows(); int ldc = c.rows(); + + sgemm_(¬rans,¬rans,&M,&N,&K,&fone, + const_cast(a.data()),&lda, + const_cast(b.data()),&ldb,&fone, + c.data(),&ldc); +} + +EIGEN_DONT_INLINE void blas_gemm(const MatrixXd& a, const MatrixXd& b, MatrixXd& c) +{ + int M = c.rows(); int N = c.cols(); int K = a.cols(); + int lda = a.rows(); int ldb = b.rows(); int ldc = c.rows(); + + dgemm_(¬rans,¬rans,&M,&N,&K,&done, + const_cast(a.data()),&lda, + const_cast(b.data()),&ldb,&done, + c.data(),&ldc); +} + +void blas_gemm(const MatrixXcf& a, const MatrixXcf& b, MatrixXcf& c) +{ + int M = c.rows(); int N = c.cols(); int K = a.cols(); + int lda = a.rows(); int ldb = b.rows(); int ldc = c.rows(); + + cgemm_(¬rans,¬rans,&M,&N,&K,(float*)&cfone, + const_cast((const float*)a.data()),&lda, + const_cast((const float*)b.data()),&ldb,(float*)&cfone, + (float*)c.data(),&ldc); +} + +void blas_gemm(const MatrixXcd& a, const MatrixXcd& b, MatrixXcd& c) +{ + int M = c.rows(); int N = c.cols(); int K = a.cols(); + int lda = a.rows(); int ldb = b.rows(); int ldc = c.rows(); + + zgemm_(¬rans,¬rans,&M,&N,&K,(double*)&cdone, + const_cast((const double*)a.data()),&lda, + const_cast((const double*)b.data()),&ldb,(double*)&cdone, + (double*)c.data(),&ldc); +} + + + +#endif + +void matlab_cplx_cplx(const M& ar, const M& ai, const M& br, const M& bi, M& cr, M& ci) +{ + cr.noalias() += ar * br; + cr.noalias() -= ai * bi; + ci.noalias() += ar * bi; + ci.noalias() += ai * br; +} + +void matlab_real_cplx(const M& a, const M& br, const M& bi, M& cr, M& ci) +{ + cr.noalias() += a * br; + ci.noalias() += a * bi; +} + +void matlab_cplx_real(const M& ar, const M& ai, const M& b, M& cr, M& ci) +{ + cr.noalias() += ar * b; + ci.noalias() += ai * b; +} + +template +EIGEN_DONT_INLINE void gemm(const A& a, const B& b, C& c) +{ + c.noalias() += a * b; +} + +int main(int argc, char ** argv) +{ + std::ptrdiff_t l1 = internal::queryL1CacheSize(); + std::ptrdiff_t l2 = internal::queryTopLevelCacheSize(); + std::cout << "L1 cache size = " << (l1>0 ? l1/1024 : -1) << " KB\n"; + std::cout << "L2/L3 cache size = " << (l2>0 ? l2/1024 : -1) << " KB\n"; + typedef internal::gebp_traits Traits; + std::cout << "Register blocking = " << Traits::mr << " x " << Traits::nr << "\n"; + + int rep = 1; // number of repetitions per try + int tries = 2; // number of tries, we keep the best + + int s = 2048; + int m = s; + int n = s; + int p = s; + int cache_size1=-1, cache_size2=l2, cache_size3 = 0; + + bool need_help = false; + for (int i=1; i -c -t -p \n"; + std::cout << " : size\n"; + std::cout << " : rows columns depth\n"; + return 1; + } + +#if EIGEN_VERSION_AT_LEAST(3,2,90) + if(cache_size1>0) + setCpuCacheSizes(cache_size1,cache_size2,cache_size3); +#endif + + A a(m,p); a.setRandom(); + B b(p,n); b.setRandom(); + C c(m,n); c.setOnes(); + C rc = c; + + std::cout << "Matrix sizes = " << m << "x" << p << " * " << p << "x" << n << "\n"; + std::ptrdiff_t mc(m), nc(n), kc(p); + internal::computeProductBlockingSizes(kc, mc, nc); + std::cout << "blocking size (mc x kc) = " << mc << " x " << kc << "\n"; + + C r = c; + + // check the parallel product is correct + #if defined EIGEN_HAS_OPENMP + Eigen::initParallel(); + int procs = omp_get_max_threads(); + if(procs>1) + { + #ifdef HAVE_BLAS + blas_gemm(a,b,r); + #else + omp_set_num_threads(1); + r.noalias() += a * b; + omp_set_num_threads(procs); + #endif + c.noalias() += a * b; + if(!r.isApprox(c)) std::cerr << "Warning, your parallel product is crap!\n\n"; + } + #elif defined HAVE_BLAS + blas_gemm(a,b,r); + c.noalias() += a * b; + if(!r.isApprox(c)) { + std::cout << r - c << "\n"; + std::cerr << "Warning, your product is crap!\n\n"; + } + #else + if(1.*m*n*p<2000.*2000*2000) + { + gemm(a,b,c); + r.noalias() += a.cast() .lazyProduct( b.cast() ); + if(!r.isApprox(c)) { + std::cout << r - c << "\n"; + std::cerr << "Warning, your product is crap!\n\n"; + } + } + #endif + + #ifdef HAVE_BLAS + BenchTimer tblas; + c = rc; + BENCH(tblas, tries, rep, blas_gemm(a,b,c)); + std::cout << "blas cpu " << tblas.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tblas.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << tblas.total(CPU_TIMER) << "s)\n"; + std::cout << "blas real " << tblas.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tblas.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << tblas.total(REAL_TIMER) << "s)\n"; + #endif + + BenchTimer tmt; + c = rc; + BENCH(tmt, tries, rep, gemm(a,b,c)); + std::cout << "eigen cpu " << tmt.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmt.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << tmt.total(CPU_TIMER) << "s)\n"; + std::cout << "eigen real " << tmt.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmt.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << tmt.total(REAL_TIMER) << "s)\n"; + + #ifdef EIGEN_HAS_OPENMP + if(procs>1) + { + BenchTimer tmono; + omp_set_num_threads(1); + Eigen::setNbThreads(1); + c = rc; + BENCH(tmono, tries, rep, gemm(a,b,c)); + std::cout << "eigen mono cpu " << tmono.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmono.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << tmono.total(CPU_TIMER) << "s)\n"; + std::cout << "eigen mono real " << tmono.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmono.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << tmono.total(REAL_TIMER) << "s)\n"; + std::cout << "mt speed up x" << tmono.best(CPU_TIMER) / tmt.best(REAL_TIMER) << " => " << (100.0*tmono.best(CPU_TIMER) / tmt.best(REAL_TIMER))/procs << "%\n"; + } + #endif + + if(1.*m*n*p<30*30*30) + { + BenchTimer tmt; + c = rc; + BENCH(tmt, tries, rep, c.noalias()+=a.lazyProduct(b)); + std::cout << "lazy cpu " << tmt.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmt.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << tmt.total(CPU_TIMER) << "s)\n"; + std::cout << "lazy real " << tmt.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/tmt.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << tmt.total(REAL_TIMER) << "s)\n"; + } + + #ifdef DECOUPLED + if((NumTraits::IsComplex) && (NumTraits::IsComplex)) + { + M ar(m,p); ar.setRandom(); + M ai(m,p); ai.setRandom(); + M br(p,n); br.setRandom(); + M bi(p,n); bi.setRandom(); + M cr(m,n); cr.setRandom(); + M ci(m,n); ci.setRandom(); + + BenchTimer t; + BENCH(t, tries, rep, matlab_cplx_cplx(ar,ai,br,bi,cr,ci)); + std::cout << "\"matlab\" cpu " << t.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << t.total(CPU_TIMER) << "s)\n"; + std::cout << "\"matlab\" real " << t.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << t.total(REAL_TIMER) << "s)\n"; + } + if((!NumTraits::IsComplex) && (NumTraits::IsComplex)) + { + M a(m,p); a.setRandom(); + M br(p,n); br.setRandom(); + M bi(p,n); bi.setRandom(); + M cr(m,n); cr.setRandom(); + M ci(m,n); ci.setRandom(); + + BenchTimer t; + BENCH(t, tries, rep, matlab_real_cplx(a,br,bi,cr,ci)); + std::cout << "\"matlab\" cpu " << t.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << t.total(CPU_TIMER) << "s)\n"; + std::cout << "\"matlab\" real " << t.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << t.total(REAL_TIMER) << "s)\n"; + } + if((NumTraits::IsComplex) && (!NumTraits::IsComplex)) + { + M ar(m,p); ar.setRandom(); + M ai(m,p); ai.setRandom(); + M b(p,n); b.setRandom(); + M cr(m,n); cr.setRandom(); + M ci(m,n); ci.setRandom(); + + BenchTimer t; + BENCH(t, tries, rep, matlab_cplx_real(ar,ai,b,cr,ci)); + std::cout << "\"matlab\" cpu " << t.best(CPU_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(CPU_TIMER))*1e-9 << " GFLOPS \t(" << t.total(CPU_TIMER) << "s)\n"; + std::cout << "\"matlab\" real " << t.best(REAL_TIMER)/rep << "s \t" << (double(m)*n*p*rep*2/t.best(REAL_TIMER))*1e-9 << " GFLOPS \t(" << t.total(REAL_TIMER) << "s)\n"; + } + #endif + + return 0; +} + diff --git a/simulation/externals/eigen/bench/bench_multi_compilers.sh b/simulation/externals/eigen/bench/bench_multi_compilers.sh new file mode 100644 index 0000000..27e91f1 --- /dev/null +++ b/simulation/externals/eigen/bench/bench_multi_compilers.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +if (($# < 2)); then + echo "Usage: $0 compilerlist.txt benchfile.cpp" +else + +compilerlist=$1 +benchfile=$2 + +g=0 +source $compilerlist + +# for each compiler, compile benchfile and run the benchmark +for (( i=0 ; i /dev/null + echo "" + else + echo "compiler not found: $compiler" + fi +done + +fi diff --git a/simulation/externals/eigen/bench/bench_norm.cpp b/simulation/externals/eigen/bench/bench_norm.cpp new file mode 100644 index 0000000..129afcf --- /dev/null +++ b/simulation/externals/eigen/bench/bench_norm.cpp @@ -0,0 +1,360 @@ +#include +#include +#include +#include "BenchTimer.h" +using namespace Eigen; +using namespace std; + +template +EIGEN_DONT_INLINE typename T::Scalar sqsumNorm(T& v) +{ + return v.norm(); +} + +template +EIGEN_DONT_INLINE typename T::Scalar stableNorm(T& v) +{ + return v.stableNorm(); +} + +template +EIGEN_DONT_INLINE typename T::Scalar hypotNorm(T& v) +{ + return v.hypotNorm(); +} + +template +EIGEN_DONT_INLINE typename T::Scalar blueNorm(T& v) +{ + return v.blueNorm(); +} + +template +EIGEN_DONT_INLINE typename T::Scalar lapackNorm(T& v) +{ + typedef typename T::Scalar Scalar; + int n = v.size(); + Scalar scale = 0; + Scalar ssq = 1; + for (int i=0;i= ax) + { + ssq += numext::abs2(ax/scale); + } + else + { + ssq = Scalar(1) + ssq * numext::abs2(scale/ax); + scale = ax; + } + } + return scale * std::sqrt(ssq); +} + +template +EIGEN_DONT_INLINE typename T::Scalar twopassNorm(T& v) +{ + typedef typename T::Scalar Scalar; + Scalar s = v.array().abs().maxCoeff(); + return s*(v/s).norm(); +} + +template +EIGEN_DONT_INLINE typename T::Scalar bl2passNorm(T& v) +{ + return v.stableNorm(); +} + +template +EIGEN_DONT_INLINE typename T::Scalar divacNorm(T& v) +{ + int n =v.size() / 2; + for (int i=0;i0) + { + for (int i=0;i +EIGEN_DONT_INLINE typename T::Scalar pblueNorm(const T& v) +{ + #ifndef EIGEN_VECTORIZE + return v.blueNorm(); + #else + typedef typename T::Scalar Scalar; + + static int nmax = 0; + static Scalar b1, b2, s1m, s2m, overfl, rbig, relerr; + int n; + + if(nmax <= 0) + { + int nbig, ibeta, it, iemin, iemax, iexp; + Scalar abig, eps; + + nbig = std::numeric_limits::max(); // largest integer + ibeta = std::numeric_limits::radix; //NumTraits::Base; // base for floating-point numbers + it = std::numeric_limits::digits; //NumTraits::Mantissa; // number of base-beta digits in mantissa + iemin = std::numeric_limits::min_exponent; // minimum exponent + iemax = std::numeric_limits::max_exponent; // maximum exponent + rbig = std::numeric_limits::max(); // largest floating-point number + + // Check the basic machine-dependent constants. + if(iemin > 1 - 2*it || 1+it>iemax || (it==2 && ibeta<5) + || (it<=4 && ibeta <= 3 ) || it<2) + { + eigen_assert(false && "the algorithm cannot be guaranteed on this computer"); + } + iexp = -((1-iemin)/2); + b1 = std::pow(ibeta, iexp); // lower boundary of midrange + iexp = (iemax + 1 - it)/2; + b2 = std::pow(ibeta,iexp); // upper boundary of midrange + + iexp = (2-iemin)/2; + s1m = std::pow(ibeta,iexp); // scaling factor for lower range + iexp = - ((iemax+it)/2); + s2m = std::pow(ibeta,iexp); // scaling factor for upper range + + overfl = rbig*s2m; // overfow boundary for abig + eps = std::pow(ibeta, 1-it); + relerr = std::sqrt(eps); // tolerance for neglecting asml + abig = 1.0/eps - 1.0; + if (Scalar(nbig)>abig) nmax = abig; // largest safe n + else nmax = nbig; + } + + typedef typename internal::packet_traits::type Packet; + const int ps = internal::packet_traits::size; + Packet pasml = internal::pset1(Scalar(0)); + Packet pamed = internal::pset1(Scalar(0)); + Packet pabig = internal::pset1(Scalar(0)); + Packet ps2m = internal::pset1(s2m); + Packet ps1m = internal::pset1(s1m); + Packet pb2 = internal::pset1(b2); + Packet pb1 = internal::pset1(b1); + for(int j=0; j(j)); + Packet ax_s2m = internal::pmul(ax,ps2m); + Packet ax_s1m = internal::pmul(ax,ps1m); + Packet maskBig = internal::plt(pb2,ax); + Packet maskSml = internal::plt(ax,pb1); + +// Packet maskMed = internal::pand(maskSml,maskBig); +// Packet scale = internal::pset1(Scalar(0)); +// scale = internal::por(scale, internal::pand(maskBig,ps2m)); +// scale = internal::por(scale, internal::pand(maskSml,ps1m)); +// scale = internal::por(scale, internal::pandnot(internal::pset1(Scalar(1)),maskMed)); +// ax = internal::pmul(ax,scale); +// ax = internal::pmul(ax,ax); +// pabig = internal::padd(pabig, internal::pand(maskBig, ax)); +// pasml = internal::padd(pasml, internal::pand(maskSml, ax)); +// pamed = internal::padd(pamed, internal::pandnot(ax,maskMed)); + + + pabig = internal::padd(pabig, internal::pand(maskBig, internal::pmul(ax_s2m,ax_s2m))); + pasml = internal::padd(pasml, internal::pand(maskSml, internal::pmul(ax_s1m,ax_s1m))); + pamed = internal::padd(pamed, internal::pandnot(internal::pmul(ax,ax),internal::pand(maskSml,maskBig))); + } + Scalar abig = internal::predux(pabig); + Scalar asml = internal::predux(pasml); + Scalar amed = internal::predux(pamed); + if(abig > Scalar(0)) + { + abig = std::sqrt(abig); + if(abig > overfl) + { + eigen_assert(false && "overflow"); + return rbig; + } + if(amed > Scalar(0)) + { + abig = abig/s2m; + amed = std::sqrt(amed); + } + else + { + return abig/s2m; + } + + } + else if(asml > Scalar(0)) + { + if (amed > Scalar(0)) + { + abig = std::sqrt(amed); + amed = std::sqrt(asml) / s1m; + } + else + { + return std::sqrt(asml)/s1m; + } + } + else + { + return std::sqrt(amed); + } + asml = std::min(abig, amed); + abig = std::max(abig, amed); + if(asml <= abig*relerr) + return abig; + else + return abig * std::sqrt(Scalar(1) + numext::abs2(asml/abig)); + #endif +} + +#define BENCH_PERF(NRM) { \ + float af = 0; double ad = 0; std::complex ac = 0; \ + Eigen::BenchTimer tf, td, tcf; tf.reset(); td.reset(); tcf.reset();\ + for (int k=0; k()); + double yd = based * std::abs(internal::random()); + VectorXf vf = VectorXf::Ones(s) * yf; + VectorXd vd = VectorXd::Ones(s) * yd; + + std::cout << "reference\t" << std::sqrt(double(s))*yf << "\t" << std::sqrt(double(s))*yd << "\n"; + std::cout << "sqsumNorm\t" << sqsumNorm(vf) << "\t" << sqsumNorm(vd) << "\n"; + std::cout << "hypotNorm\t" << hypotNorm(vf) << "\t" << hypotNorm(vd) << "\n"; + std::cout << "blueNorm\t" << blueNorm(vf) << "\t" << blueNorm(vd) << "\n"; + std::cout << "pblueNorm\t" << pblueNorm(vf) << "\t" << pblueNorm(vd) << "\n"; + std::cout << "lapackNorm\t" << lapackNorm(vf) << "\t" << lapackNorm(vd) << "\n"; + std::cout << "twopassNorm\t" << twopassNorm(vf) << "\t" << twopassNorm(vd) << "\n"; + std::cout << "bl2passNorm\t" << bl2passNorm(vf) << "\t" << bl2passNorm(vd) << "\n"; +} + +void check_accuracy_var(int ef0, int ef1, int ed0, int ed1, int s) +{ + VectorXf vf(s); + VectorXd vd(s); + for (int i=0; i()) * std::pow(double(10), internal::random(ef0,ef1)); + vd[i] = std::abs(internal::random()) * std::pow(double(10), internal::random(ed0,ed1)); + } + + //std::cout << "reference\t" << internal::sqrt(double(s))*yf << "\t" << internal::sqrt(double(s))*yd << "\n"; + std::cout << "sqsumNorm\t" << sqsumNorm(vf) << "\t" << sqsumNorm(vd) << "\t" << sqsumNorm(vf.cast()) << "\t" << sqsumNorm(vd.cast()) << "\n"; + std::cout << "hypotNorm\t" << hypotNorm(vf) << "\t" << hypotNorm(vd) << "\t" << hypotNorm(vf.cast()) << "\t" << hypotNorm(vd.cast()) << "\n"; + std::cout << "blueNorm\t" << blueNorm(vf) << "\t" << blueNorm(vd) << "\t" << blueNorm(vf.cast()) << "\t" << blueNorm(vd.cast()) << "\n"; + std::cout << "pblueNorm\t" << pblueNorm(vf) << "\t" << pblueNorm(vd) << "\t" << blueNorm(vf.cast()) << "\t" << blueNorm(vd.cast()) << "\n"; + std::cout << "lapackNorm\t" << lapackNorm(vf) << "\t" << lapackNorm(vd) << "\t" << lapackNorm(vf.cast()) << "\t" << lapackNorm(vd.cast()) << "\n"; + std::cout << "twopassNorm\t" << twopassNorm(vf) << "\t" << twopassNorm(vd) << "\t" << twopassNorm(vf.cast()) << "\t" << twopassNorm(vd.cast()) << "\n"; +// std::cout << "bl2passNorm\t" << bl2passNorm(vf) << "\t" << bl2passNorm(vd) << "\t" << bl2passNorm(vf.cast()) << "\t" << bl2passNorm(vd.cast()) << "\n"; +} + +int main(int argc, char** argv) +{ + int tries = 10; + int iters = 100000; + double y = 1.1345743233455785456788e12 * internal::random(); + VectorXf v = VectorXf::Ones(1024) * y; + +// return 0; + int s = 10000; + double basef_ok = 1.1345743233455785456788e15; + double based_ok = 1.1345743233455785456788e95; + + double basef_under = 1.1345743233455785456788e-27; + double based_under = 1.1345743233455785456788e-303; + + double basef_over = 1.1345743233455785456788e+27; + double based_over = 1.1345743233455785456788e+302; + + std::cout.precision(20); + + std::cerr << "\nNo under/overflow:\n"; + check_accuracy(basef_ok, based_ok, s); + + std::cerr << "\nUnderflow:\n"; + check_accuracy(basef_under, based_under, s); + + std::cerr << "\nOverflow:\n"; + check_accuracy(basef_over, based_over, s); + + std::cerr << "\nVarying (over):\n"; + for (int k=0; k<1; ++k) + { + check_accuracy_var(20,27,190,302,s); + std::cout << "\n"; + } + + std::cerr << "\nVarying (under):\n"; + for (int k=0; k<1; ++k) + { + check_accuracy_var(-27,20,-302,-190,s); + std::cout << "\n"; + } + + y = 1; + std::cout.precision(4); + int s1 = 1024*1024*32; + std::cerr << "Performance (out of cache, " << s1 << "):\n"; + { + int iters = 1; + VectorXf vf = VectorXf::Random(s1) * y; + VectorXd vd = VectorXd::Random(s1) * y; + VectorXcf vcf = VectorXcf::Random(s1) * y; + BENCH_PERF(sqsumNorm); + BENCH_PERF(stableNorm); + BENCH_PERF(blueNorm); + BENCH_PERF(pblueNorm); + BENCH_PERF(lapackNorm); + BENCH_PERF(hypotNorm); + BENCH_PERF(twopassNorm); + BENCH_PERF(bl2passNorm); + } + + std::cerr << "\nPerformance (in cache, " << 512 << "):\n"; + { + int iters = 100000; + VectorXf vf = VectorXf::Random(512) * y; + VectorXd vd = VectorXd::Random(512) * y; + VectorXcf vcf = VectorXcf::Random(512) * y; + BENCH_PERF(sqsumNorm); + BENCH_PERF(stableNorm); + BENCH_PERF(blueNorm); + BENCH_PERF(pblueNorm); + BENCH_PERF(lapackNorm); + BENCH_PERF(hypotNorm); + BENCH_PERF(twopassNorm); + BENCH_PERF(bl2passNorm); + } +} diff --git a/simulation/externals/eigen/bench/bench_reverse.cpp b/simulation/externals/eigen/bench/bench_reverse.cpp new file mode 100644 index 0000000..1e69ca1 --- /dev/null +++ b/simulation/externals/eigen/bench/bench_reverse.cpp @@ -0,0 +1,84 @@ + +#include +#include +#include +using namespace Eigen; + +#ifndef REPEAT +#define REPEAT 100000 +#endif + +#ifndef TRIES +#define TRIES 20 +#endif + +typedef double Scalar; + +template +__attribute__ ((noinline)) void bench_reverse(const MatrixType& m) +{ + int rows = m.rows(); + int cols = m.cols(); + int size = m.size(); + + int repeats = (REPEAT*1000)/size; + MatrixType a = MatrixType::Random(rows,cols); + MatrixType b = MatrixType::Random(rows,cols); + + BenchTimer timerB, timerH, timerV; + + Scalar acc = 0; + int r = internal::random(0,rows-1); + int c = internal::random(0,cols-1); + for (int t=0; t0; ++i) + { + bench_reverse(Matrix(dynsizes[i],dynsizes[i])); + bench_reverse(Matrix(dynsizes[i]*dynsizes[i])); + } +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); +// bench_reverse(Matrix()); + return 0; +} + diff --git a/simulation/externals/eigen/bench/bench_sum.cpp b/simulation/externals/eigen/bench/bench_sum.cpp new file mode 100644 index 0000000..a3d925e --- /dev/null +++ b/simulation/externals/eigen/bench/bench_sum.cpp @@ -0,0 +1,18 @@ +#include +#include +using namespace Eigen; +using namespace std; + +int main() +{ + typedef Matrix Vec; + Vec v(SIZE); + v.setZero(); + v[0] = 1; + v[1] = 2; + for(int i = 0; i < 1000000; i++) + { + v.coeffRef(0) += v.sum() * SCALAR(1e-20); + } + cout << v.sum() << endl; +} diff --git a/simulation/externals/eigen/bench/bench_unrolling b/simulation/externals/eigen/bench/bench_unrolling new file mode 100644 index 0000000..8264438 --- /dev/null +++ b/simulation/externals/eigen/bench/bench_unrolling @@ -0,0 +1,12 @@ +#!/bin/bash + +# gcc : CXX="g++ -finline-limit=10000 -ftemplate-depth-2000 --param max-inline-recursive-depth=2000" +# icc : CXX="icpc -fast -no-inline-max-size -fno-exceptions" +CXX=${CXX-g++ -finline-limit=10000 -ftemplate-depth-2000 --param max-inline-recursive-depth=2000} # default value + +for ((i=1; i<16; ++i)); do + echo "Matrix size: $i x $i :" + $CXX -O3 -I.. -DNDEBUG benchmark.cpp -DMATSIZE=$i -DEIGEN_UNROLLING_LIMIT=400 -o benchmark && time ./benchmark >/dev/null + $CXX -O3 -I.. -DNDEBUG -finline-limit=10000 benchmark.cpp -DMATSIZE=$i -DEIGEN_DONT_USE_UNROLLED_LOOPS=1 -o benchmark && time ./benchmark >/dev/null + echo " " +done diff --git a/simulation/externals/eigen/bench/benchmark-blocking-sizes.cpp b/simulation/externals/eigen/bench/benchmark-blocking-sizes.cpp new file mode 100644 index 0000000..827be28 --- /dev/null +++ b/simulation/externals/eigen/bench/benchmark-blocking-sizes.cpp @@ -0,0 +1,677 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2015 Benoit Jacob +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include +#include +#include +#include +#include +#include +#include + +bool eigen_use_specific_block_size; +int eigen_block_size_k, eigen_block_size_m, eigen_block_size_n; +#define EIGEN_TEST_SPECIFIC_BLOCKING_SIZES eigen_use_specific_block_size +#define EIGEN_TEST_SPECIFIC_BLOCKING_SIZE_K eigen_block_size_k +#define EIGEN_TEST_SPECIFIC_BLOCKING_SIZE_M eigen_block_size_m +#define EIGEN_TEST_SPECIFIC_BLOCKING_SIZE_N eigen_block_size_n +#include + +#include + +using namespace Eigen; +using namespace std; + +static BenchTimer timer; + +// how many times we repeat each measurement. +// measurements are randomly shuffled - we're not doing +// all N identical measurements in a row. +const int measurement_repetitions = 3; + +// Timings below this value are too short to be accurate, +// we'll repeat measurements with more iterations until +// we get a timing above that threshold. +const float min_accurate_time = 1e-2f; + +// See --min-working-set-size command line parameter. +size_t min_working_set_size = 0; + +float max_clock_speed = 0.0f; + +// range of sizes that we will benchmark (in all 3 K,M,N dimensions) +const size_t maxsize = 2048; +const size_t minsize = 16; + +typedef MatrixXf MatrixType; +typedef MatrixType::Scalar Scalar; +typedef internal::packet_traits::type Packet; + +static_assert((maxsize & (maxsize - 1)) == 0, "maxsize must be a power of two"); +static_assert((minsize & (minsize - 1)) == 0, "minsize must be a power of two"); +static_assert(maxsize > minsize, "maxsize must be larger than minsize"); +static_assert(maxsize < (minsize << 16), "maxsize must be less than (minsize<<16)"); + +// just a helper to store a triple of K,M,N sizes for matrix product +struct size_triple_t +{ + size_t k, m, n; + size_triple_t() : k(0), m(0), n(0) {} + size_triple_t(size_t _k, size_t _m, size_t _n) : k(_k), m(_m), n(_n) {} + size_triple_t(const size_triple_t& o) : k(o.k), m(o.m), n(o.n) {} + size_triple_t(uint16_t compact) + { + k = 1 << ((compact & 0xf00) >> 8); + m = 1 << ((compact & 0x0f0) >> 4); + n = 1 << ((compact & 0x00f) >> 0); + } +}; + +uint8_t log2_pot(size_t x) { + size_t l = 0; + while (x >>= 1) l++; + return l; +} + +// Convert between size tripes and a compact form fitting in 12 bits +// where each size, which must be a POT, is encoded as its log2, on 4 bits +// so the largest representable size is 2^15 == 32k ... big enough. +uint16_t compact_size_triple(size_t k, size_t m, size_t n) +{ + return (log2_pot(k) << 8) | (log2_pot(m) << 4) | log2_pot(n); +} + +uint16_t compact_size_triple(const size_triple_t& t) +{ + return compact_size_triple(t.k, t.m, t.n); +} + +// A single benchmark. Initially only contains benchmark params. +// Then call run(), which stores the result in the gflops field. +struct benchmark_t +{ + uint16_t compact_product_size; + uint16_t compact_block_size; + bool use_default_block_size; + float gflops; + benchmark_t() + : compact_product_size(0) + , compact_block_size(0) + , use_default_block_size(false) + , gflops(0) + { + } + benchmark_t(size_t pk, size_t pm, size_t pn, + size_t bk, size_t bm, size_t bn) + : compact_product_size(compact_size_triple(pk, pm, pn)) + , compact_block_size(compact_size_triple(bk, bm, bn)) + , use_default_block_size(false) + , gflops(0) + {} + benchmark_t(size_t pk, size_t pm, size_t pn) + : compact_product_size(compact_size_triple(pk, pm, pn)) + , compact_block_size(0) + , use_default_block_size(true) + , gflops(0) + {} + + void run(); +}; + +ostream& operator<<(ostream& s, const benchmark_t& b) +{ + s << hex << b.compact_product_size << dec; + if (b.use_default_block_size) { + size_triple_t t(b.compact_product_size); + Index k = t.k, m = t.m, n = t.n; + internal::computeProductBlockingSizes(k, m, n); + s << " default(" << k << ", " << m << ", " << n << ")"; + } else { + s << " " << hex << b.compact_block_size << dec; + } + s << " " << b.gflops; + return s; +} + +// We sort first by increasing benchmark parameters, +// then by decreasing performance. +bool operator<(const benchmark_t& b1, const benchmark_t& b2) +{ + return b1.compact_product_size < b2.compact_product_size || + (b1.compact_product_size == b2.compact_product_size && ( + (b1.compact_block_size < b2.compact_block_size || ( + b1.compact_block_size == b2.compact_block_size && + b1.gflops > b2.gflops)))); +} + +void benchmark_t::run() +{ + size_triple_t productsizes(compact_product_size); + + if (use_default_block_size) { + eigen_use_specific_block_size = false; + } else { + // feed eigen with our custom blocking params + eigen_use_specific_block_size = true; + size_triple_t blocksizes(compact_block_size); + eigen_block_size_k = blocksizes.k; + eigen_block_size_m = blocksizes.m; + eigen_block_size_n = blocksizes.n; + } + + // set up the matrix pool + + const size_t combined_three_matrices_sizes = + sizeof(Scalar) * + (productsizes.k * productsizes.m + + productsizes.k * productsizes.n + + productsizes.m * productsizes.n); + + // 64 M is large enough that nobody has a cache bigger than that, + // while still being small enough that everybody has this much RAM, + // so conveniently we don't need to special-case platforms here. + const size_t unlikely_large_cache_size = 64 << 20; + + const size_t working_set_size = + min_working_set_size ? min_working_set_size : unlikely_large_cache_size; + + const size_t matrix_pool_size = + 1 + working_set_size / combined_three_matrices_sizes; + + MatrixType *lhs = new MatrixType[matrix_pool_size]; + MatrixType *rhs = new MatrixType[matrix_pool_size]; + MatrixType *dst = new MatrixType[matrix_pool_size]; + + for (size_t i = 0; i < matrix_pool_size; i++) { + lhs[i] = MatrixType::Zero(productsizes.m, productsizes.k); + rhs[i] = MatrixType::Zero(productsizes.k, productsizes.n); + dst[i] = MatrixType::Zero(productsizes.m, productsizes.n); + } + + // main benchmark loop + + int iters_at_a_time = 1; + float time_per_iter = 0.0f; + size_t matrix_index = 0; + while (true) { + + double starttime = timer.getCpuTime(); + for (int i = 0; i < iters_at_a_time; i++) { + dst[matrix_index].noalias() = lhs[matrix_index] * rhs[matrix_index]; + matrix_index++; + if (matrix_index == matrix_pool_size) { + matrix_index = 0; + } + } + double endtime = timer.getCpuTime(); + + const float timing = float(endtime - starttime); + + if (timing >= min_accurate_time) { + time_per_iter = timing / iters_at_a_time; + break; + } + + iters_at_a_time *= 2; + } + + delete[] lhs; + delete[] rhs; + delete[] dst; + + gflops = 2e-9 * productsizes.k * productsizes.m * productsizes.n / time_per_iter; +} + +void print_cpuinfo() +{ +#ifdef __linux__ + cout << "contents of /proc/cpuinfo:" << endl; + string line; + ifstream cpuinfo("/proc/cpuinfo"); + if (cpuinfo.is_open()) { + while (getline(cpuinfo, line)) { + cout << line << endl; + } + cpuinfo.close(); + } + cout << endl; +#elif defined __APPLE__ + cout << "output of sysctl hw:" << endl; + system("sysctl hw"); + cout << endl; +#endif +} + +template +string type_name() +{ + return "unknown"; +} + +template<> +string type_name() +{ + return "float"; +} + +template<> +string type_name() +{ + return "double"; +} + +struct action_t +{ + virtual const char* invokation_name() const { abort(); return nullptr; } + virtual void run() const { abort(); } + virtual ~action_t() {} +}; + +void show_usage_and_exit(int /*argc*/, char* argv[], + const vector>& available_actions) +{ + cerr << "usage: " << argv[0] << " [options...]" << endl << endl; + cerr << "available actions:" << endl << endl; + for (auto it = available_actions.begin(); it != available_actions.end(); ++it) { + cerr << " " << (*it)->invokation_name() << endl; + } + cerr << endl; + cerr << "options:" << endl << endl; + cerr << " --min-working-set-size=N:" << endl; + cerr << " Set the minimum working set size to N bytes." << endl; + cerr << " This is rounded up as needed to a multiple of matrix size." << endl; + cerr << " A larger working set lowers the chance of a warm cache." << endl; + cerr << " The default value 0 means use a large enough working" << endl; + cerr << " set to likely outsize caches." << endl; + cerr << " A value of 1 (that is, 1 byte) would mean don't do anything to" << endl; + cerr << " avoid warm caches." << endl; + exit(1); +} + +float measure_clock_speed() +{ + cerr << "Measuring clock speed... \r" << flush; + + vector all_gflops; + for (int i = 0; i < 8; i++) { + benchmark_t b(1024, 1024, 1024); + b.run(); + all_gflops.push_back(b.gflops); + } + + sort(all_gflops.begin(), all_gflops.end()); + float stable_estimate = all_gflops[2] + all_gflops[3] + all_gflops[4] + all_gflops[5]; + + // multiply by an arbitrary constant to discourage trying doing anything with the + // returned values besides just comparing them with each other. + float result = stable_estimate * 123.456f; + + return result; +} + +struct human_duration_t +{ + int seconds; + human_duration_t(int s) : seconds(s) {} +}; + +ostream& operator<<(ostream& s, const human_duration_t& d) +{ + int remainder = d.seconds; + if (remainder > 3600) { + int hours = remainder / 3600; + s << hours << " h "; + remainder -= hours * 3600; + } + if (remainder > 60) { + int minutes = remainder / 60; + s << minutes << " min "; + remainder -= minutes * 60; + } + if (d.seconds < 600) { + s << remainder << " s"; + } + return s; +} + +const char session_filename[] = "/data/local/tmp/benchmark-blocking-sizes-session.data"; + +void serialize_benchmarks(const char* filename, const vector& benchmarks, size_t first_benchmark_to_run) +{ + FILE* file = fopen(filename, "w"); + if (!file) { + cerr << "Could not open file " << filename << " for writing." << endl; + cerr << "Do you have write permissions on the current working directory?" << endl; + exit(1); + } + size_t benchmarks_vector_size = benchmarks.size(); + fwrite(&max_clock_speed, sizeof(max_clock_speed), 1, file); + fwrite(&benchmarks_vector_size, sizeof(benchmarks_vector_size), 1, file); + fwrite(&first_benchmark_to_run, sizeof(first_benchmark_to_run), 1, file); + fwrite(benchmarks.data(), sizeof(benchmark_t), benchmarks.size(), file); + fclose(file); +} + +bool deserialize_benchmarks(const char* filename, vector& benchmarks, size_t& first_benchmark_to_run) +{ + FILE* file = fopen(filename, "r"); + if (!file) { + return false; + } + if (1 != fread(&max_clock_speed, sizeof(max_clock_speed), 1, file)) { + return false; + } + size_t benchmarks_vector_size = 0; + if (1 != fread(&benchmarks_vector_size, sizeof(benchmarks_vector_size), 1, file)) { + return false; + } + if (1 != fread(&first_benchmark_to_run, sizeof(first_benchmark_to_run), 1, file)) { + return false; + } + benchmarks.resize(benchmarks_vector_size); + if (benchmarks.size() != fread(benchmarks.data(), sizeof(benchmark_t), benchmarks.size(), file)) { + return false; + } + unlink(filename); + return true; +} + +void try_run_some_benchmarks( + vector& benchmarks, + double time_start, + size_t& first_benchmark_to_run) +{ + if (first_benchmark_to_run == benchmarks.size()) { + return; + } + + double time_last_progress_update = 0; + double time_last_clock_speed_measurement = 0; + double time_now = 0; + + size_t benchmark_index = first_benchmark_to_run; + + while (true) { + float ratio_done = float(benchmark_index) / benchmarks.size(); + time_now = timer.getRealTime(); + + // We check clock speed every minute and at the end. + if (benchmark_index == benchmarks.size() || + time_now > time_last_clock_speed_measurement + 60.0f) + { + time_last_clock_speed_measurement = time_now; + + // Ensure that clock speed is as expected + float current_clock_speed = measure_clock_speed(); + + // The tolerance needs to be smaller than the relative difference between + // clock speeds that a device could operate under. + // It seems unlikely that a device would be throttling clock speeds by + // amounts smaller than 2%. + // With a value of 1%, I was getting within noise on a Sandy Bridge. + const float clock_speed_tolerance = 0.02f; + + if (current_clock_speed > (1 + clock_speed_tolerance) * max_clock_speed) { + // Clock speed is now higher than we previously measured. + // Either our initial measurement was inaccurate, which won't happen + // too many times as we are keeping the best clock speed value and + // and allowing some tolerance; or something really weird happened, + // which invalidates all benchmark results collected so far. + // Either way, we better restart all over again now. + if (benchmark_index) { + cerr << "Restarting at " << 100.0f * ratio_done + << " % because clock speed increased. " << endl; + } + max_clock_speed = current_clock_speed; + first_benchmark_to_run = 0; + return; + } + + bool rerun_last_tests = false; + + if (current_clock_speed < (1 - clock_speed_tolerance) * max_clock_speed) { + cerr << "Measurements completed so far: " + << 100.0f * ratio_done + << " % " << endl; + cerr << "Clock speed seems to be only " + << current_clock_speed/max_clock_speed + << " times what it used to be." << endl; + + unsigned int seconds_to_sleep_if_lower_clock_speed = 1; + + while (current_clock_speed < (1 - clock_speed_tolerance) * max_clock_speed) { + if (seconds_to_sleep_if_lower_clock_speed > 32) { + cerr << "Sleeping longer probably won't make a difference." << endl; + cerr << "Serializing benchmarks to " << session_filename << endl; + serialize_benchmarks(session_filename, benchmarks, first_benchmark_to_run); + cerr << "Now restart this benchmark, and it should pick up where we left." << endl; + exit(2); + } + rerun_last_tests = true; + cerr << "Sleeping " + << seconds_to_sleep_if_lower_clock_speed + << " s... \r" << endl; + sleep(seconds_to_sleep_if_lower_clock_speed); + current_clock_speed = measure_clock_speed(); + seconds_to_sleep_if_lower_clock_speed *= 2; + } + } + + if (rerun_last_tests) { + cerr << "Redoing the last " + << 100.0f * float(benchmark_index - first_benchmark_to_run) / benchmarks.size() + << " % because clock speed had been low. " << endl; + return; + } + + // nothing wrong with the clock speed so far, so there won't be a need to rerun + // benchmarks run so far in case we later encounter a lower clock speed. + first_benchmark_to_run = benchmark_index; + } + + if (benchmark_index == benchmarks.size()) { + // We're done! + first_benchmark_to_run = benchmarks.size(); + // Erase progress info + cerr << " " << endl; + return; + } + + // Display progress info on stderr + if (time_now > time_last_progress_update + 1.0f) { + time_last_progress_update = time_now; + cerr << "Measurements... " << 100.0f * ratio_done + << " %, ETA " + << human_duration_t(float(time_now - time_start) * (1.0f - ratio_done) / ratio_done) + << " \r" << flush; + } + + // This is where we actually run a benchmark! + benchmarks[benchmark_index].run(); + benchmark_index++; + } +} + +void run_benchmarks(vector& benchmarks) +{ + size_t first_benchmark_to_run; + vector deserialized_benchmarks; + bool use_deserialized_benchmarks = false; + if (deserialize_benchmarks(session_filename, deserialized_benchmarks, first_benchmark_to_run)) { + cerr << "Found serialized session with " + << 100.0f * first_benchmark_to_run / deserialized_benchmarks.size() + << " % already done" << endl; + if (deserialized_benchmarks.size() == benchmarks.size() && + first_benchmark_to_run > 0 && + first_benchmark_to_run < benchmarks.size()) + { + use_deserialized_benchmarks = true; + } + } + + if (use_deserialized_benchmarks) { + benchmarks = deserialized_benchmarks; + } else { + // not using deserialized benchmarks, starting from scratch + first_benchmark_to_run = 0; + + // Randomly shuffling benchmarks allows us to get accurate enough progress info, + // as now the cheap/expensive benchmarks are randomly mixed so they average out. + // It also means that if data is corrupted for some time span, the odds are that + // not all repetitions of a given benchmark will be corrupted. + random_shuffle(benchmarks.begin(), benchmarks.end()); + } + + for (int i = 0; i < 4; i++) { + max_clock_speed = max(max_clock_speed, measure_clock_speed()); + } + + double time_start = 0.0; + while (first_benchmark_to_run < benchmarks.size()) { + if (first_benchmark_to_run == 0) { + time_start = timer.getRealTime(); + } + try_run_some_benchmarks(benchmarks, + time_start, + first_benchmark_to_run); + } + + // Sort timings by increasing benchmark parameters, and decreasing gflops. + // The latter is very important. It means that we can ignore all but the first + // benchmark with given parameters. + sort(benchmarks.begin(), benchmarks.end()); + + // Collect best (i.e. now first) results for each parameter values. + vector best_benchmarks; + for (auto it = benchmarks.begin(); it != benchmarks.end(); ++it) { + if (best_benchmarks.empty() || + best_benchmarks.back().compact_product_size != it->compact_product_size || + best_benchmarks.back().compact_block_size != it->compact_block_size) + { + best_benchmarks.push_back(*it); + } + } + + // keep and return only the best benchmarks + benchmarks = best_benchmarks; +} + +struct measure_all_pot_sizes_action_t : action_t +{ + virtual const char* invokation_name() const { return "all-pot-sizes"; } + virtual void run() const + { + vector benchmarks; + for (int repetition = 0; repetition < measurement_repetitions; repetition++) { + for (size_t ksize = minsize; ksize <= maxsize; ksize *= 2) { + for (size_t msize = minsize; msize <= maxsize; msize *= 2) { + for (size_t nsize = minsize; nsize <= maxsize; nsize *= 2) { + for (size_t kblock = minsize; kblock <= ksize; kblock *= 2) { + for (size_t mblock = minsize; mblock <= msize; mblock *= 2) { + for (size_t nblock = minsize; nblock <= nsize; nblock *= 2) { + benchmarks.emplace_back(ksize, msize, nsize, kblock, mblock, nblock); + } + } + } + } + } + } + } + + run_benchmarks(benchmarks); + + cout << "BEGIN MEASUREMENTS ALL POT SIZES" << endl; + for (auto it = benchmarks.begin(); it != benchmarks.end(); ++it) { + cout << *it << endl; + } + } +}; + +struct measure_default_sizes_action_t : action_t +{ + virtual const char* invokation_name() const { return "default-sizes"; } + virtual void run() const + { + vector benchmarks; + for (int repetition = 0; repetition < measurement_repetitions; repetition++) { + for (size_t ksize = minsize; ksize <= maxsize; ksize *= 2) { + for (size_t msize = minsize; msize <= maxsize; msize *= 2) { + for (size_t nsize = minsize; nsize <= maxsize; nsize *= 2) { + benchmarks.emplace_back(ksize, msize, nsize); + } + } + } + } + + run_benchmarks(benchmarks); + + cout << "BEGIN MEASUREMENTS DEFAULT SIZES" << endl; + for (auto it = benchmarks.begin(); it != benchmarks.end(); ++it) { + cout << *it << endl; + } + } +}; + +int main(int argc, char* argv[]) +{ + double time_start = timer.getRealTime(); + cout.precision(4); + cerr.precision(4); + + vector> available_actions; + available_actions.emplace_back(new measure_all_pot_sizes_action_t); + available_actions.emplace_back(new measure_default_sizes_action_t); + + auto action = available_actions.end(); + + if (argc <= 1) { + show_usage_and_exit(argc, argv, available_actions); + } + for (auto it = available_actions.begin(); it != available_actions.end(); ++it) { + if (!strcmp(argv[1], (*it)->invokation_name())) { + action = it; + break; + } + } + + if (action == available_actions.end()) { + show_usage_and_exit(argc, argv, available_actions); + } + + for (int i = 2; i < argc; i++) { + if (argv[i] == strstr(argv[i], "--min-working-set-size=")) { + const char* equals_sign = strchr(argv[i], '='); + min_working_set_size = strtoul(equals_sign+1, nullptr, 10); + } else { + cerr << "unrecognized option: " << argv[i] << endl << endl; + show_usage_and_exit(argc, argv, available_actions); + } + } + + print_cpuinfo(); + + cout << "benchmark parameters:" << endl; + cout << "pointer size: " << 8*sizeof(void*) << " bits" << endl; + cout << "scalar type: " << type_name() << endl; + cout << "packet size: " << internal::packet_traits::size << endl; + cout << "minsize = " << minsize << endl; + cout << "maxsize = " << maxsize << endl; + cout << "measurement_repetitions = " << measurement_repetitions << endl; + cout << "min_accurate_time = " << min_accurate_time << endl; + cout << "min_working_set_size = " << min_working_set_size; + if (min_working_set_size == 0) { + cout << " (try to outsize caches)"; + } + cout << endl << endl; + + (*action)->run(); + + double time_end = timer.getRealTime(); + cerr << "Finished in " << human_duration_t(time_end - time_start) << endl; +} diff --git a/simulation/externals/eigen/bench/benchmark.cpp b/simulation/externals/eigen/bench/benchmark.cpp new file mode 100644 index 0000000..c721b90 --- /dev/null +++ b/simulation/externals/eigen/bench/benchmark.cpp @@ -0,0 +1,39 @@ +// g++ -O3 -DNDEBUG -DMATSIZE= benchmark.cpp -o benchmark && time ./benchmark + +#include + +#include + +#ifndef MATSIZE +#define MATSIZE 3 +#endif + +using namespace std; +using namespace Eigen; + +#ifndef REPEAT +#define REPEAT 40000000 +#endif + +#ifndef SCALAR +#define SCALAR double +#endif + +int main(int argc, char *argv[]) +{ + Matrix I = Matrix::Ones(); + Matrix m; + for(int i = 0; i < MATSIZE; i++) + for(int j = 0; j < MATSIZE; j++) + { + m(i,j) = (i+MATSIZE*j); + } + asm("#begin"); + for(int a = 0; a < REPEAT; a++) + { + m = Matrix::Ones() + 0.00005 * (m + (m*m)); + } + asm("#end"); + cout << m << endl; + return 0; +} diff --git a/simulation/externals/eigen/bench/benchmarkSlice.cpp b/simulation/externals/eigen/bench/benchmarkSlice.cpp new file mode 100644 index 0000000..c5b89c5 --- /dev/null +++ b/simulation/externals/eigen/bench/benchmarkSlice.cpp @@ -0,0 +1,38 @@ +// g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX + +#include + +#include + +using namespace std; +using namespace Eigen; + +#ifndef REPEAT +#define REPEAT 10000 +#endif + +#ifndef SCALAR +#define SCALAR float +#endif + +int main(int argc, char *argv[]) +{ + typedef Matrix Mat; + Mat m(100, 100); + m.setRandom(); + + for(int a = 0; a < REPEAT; a++) + { + int r, c, nr, nc; + r = Eigen::internal::random(0,10); + c = Eigen::internal::random(0,10); + nr = Eigen::internal::random(50,80); + nc = Eigen::internal::random(50,80); + m.block(r,c,nr,nc) += Mat::Ones(nr,nc); + m.block(r,c,nr,nc) *= SCALAR(10); + m.block(r,c,nr,nc) -= Mat::constant(nr,nc,10); + m.block(r,c,nr,nc) /= SCALAR(10); + } + cout << m[0] << endl; + return 0; +} diff --git a/simulation/externals/eigen/bench/benchmarkX.cpp b/simulation/externals/eigen/bench/benchmarkX.cpp new file mode 100644 index 0000000..8e4b60c --- /dev/null +++ b/simulation/externals/eigen/bench/benchmarkX.cpp @@ -0,0 +1,36 @@ +// g++ -fopenmp -I .. -O3 -DNDEBUG -finline-limit=1000 benchmarkX.cpp -o b && time ./b + +#include + +#include + +using namespace std; +using namespace Eigen; + +#ifndef MATTYPE +#define MATTYPE MatrixXLd +#endif + +#ifndef MATSIZE +#define MATSIZE 400 +#endif + +#ifndef REPEAT +#define REPEAT 100 +#endif + +int main(int argc, char *argv[]) +{ + MATTYPE I = MATTYPE::Ones(MATSIZE,MATSIZE); + MATTYPE m(MATSIZE,MATSIZE); + for(int i = 0; i < MATSIZE; i++) for(int j = 0; j < MATSIZE; j++) + { + m(i,j) = (i+j+1)/(MATSIZE*MATSIZE); + } + for(int a = 0; a < REPEAT; a++) + { + m = I + 0.0001 * (m + m*m); + } + cout << m(0,0) << endl; + return 0; +} diff --git a/simulation/externals/eigen/bench/benchmarkXcwise.cpp b/simulation/externals/eigen/bench/benchmarkXcwise.cpp new file mode 100644 index 0000000..6243743 --- /dev/null +++ b/simulation/externals/eigen/bench/benchmarkXcwise.cpp @@ -0,0 +1,35 @@ +// g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX + +#include +#include + +using namespace std; +using namespace Eigen; + +#ifndef VECTYPE +#define VECTYPE VectorXLd +#endif + +#ifndef VECSIZE +#define VECSIZE 1000000 +#endif + +#ifndef REPEAT +#define REPEAT 1000 +#endif + +int main(int argc, char *argv[]) +{ + VECTYPE I = VECTYPE::Ones(VECSIZE); + VECTYPE m(VECSIZE,1); + for(int i = 0; i < VECSIZE; i++) + { + m[i] = 0.1 * i/VECSIZE; + } + for(int a = 0; a < REPEAT; a++) + { + m = VECTYPE::Ones(VECSIZE) + 0.00005 * (m.cwise().square() + m/4); + } + cout << m[0] << endl; + return 0; +} diff --git a/simulation/externals/eigen/bench/benchmark_suite b/simulation/externals/eigen/bench/benchmark_suite new file mode 100644 index 0000000..3f21d36 --- /dev/null +++ b/simulation/externals/eigen/bench/benchmark_suite @@ -0,0 +1,18 @@ +#!/bin/bash +CXX=${CXX-g++} # default value unless caller has defined CXX +echo "Fixed size 3x3, column-major, -DNDEBUG" +$CXX -O3 -I .. -DNDEBUG benchmark.cpp -o benchmark && time ./benchmark >/dev/null +echo "Fixed size 3x3, column-major, with asserts" +$CXX -O3 -I .. benchmark.cpp -o benchmark && time ./benchmark >/dev/null +echo "Fixed size 3x3, row-major, -DNDEBUG" +$CXX -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR -DNDEBUG benchmark.cpp -o benchmark && time ./benchmark >/dev/null +echo "Fixed size 3x3, row-major, with asserts" +$CXX -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR benchmark.cpp -o benchmark && time ./benchmark >/dev/null +echo "Dynamic size 20x20, column-major, -DNDEBUG" +$CXX -O3 -I .. -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null +echo "Dynamic size 20x20, column-major, with asserts" +$CXX -O3 -I .. benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null +echo "Dynamic size 20x20, row-major, -DNDEBUG" +$CXX -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null +echo "Dynamic size 20x20, row-major, with asserts" +$CXX -O3 -I .. -DEIGEN_DEFAULT_TO_ROW_MAJOR benchmarkX.cpp -o benchmarkX && time ./benchmarkX >/dev/null diff --git a/simulation/externals/eigen/bench/btl/CMakeLists.txt b/simulation/externals/eigen/bench/btl/CMakeLists.txt new file mode 100644 index 0000000..38ff9f4 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/CMakeLists.txt @@ -0,0 +1,107 @@ +PROJECT(BTL) + +CMAKE_MINIMUM_REQUIRED(VERSION 2.6.2) + +set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${Eigen_SOURCE_DIR}/cmake) +include(MacroOptionalAddSubdirectory) + +OPTION(BTL_NOVEC "Disable SSE/Altivec optimizations when possible" OFF) + +SET(CMAKE_INCLUDE_CURRENT_DIR ON) + +string(REGEX MATCH icpc IS_ICPC ${CMAKE_CXX_COMPILER}) +IF(CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC) + SET(CMAKE_CXX_FLAGS "-g0 -O3 -DNDEBUG ${CMAKE_CXX_FLAGS}") + SET(CMAKE_Fortran_FLAGS "-g0 -O3 -DNDEBUG ${CMAKE_Fortran_FLAGS}") + IF(BTL_NOVEC) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_VECTORIZE") + ENDIF(BTL_NOVEC) +ENDIF(CMAKE_COMPILER_IS_GNUCXX OR IS_ICPC) + +IF(MSVC) + SET(CMAKE_CXX_FLAGS " /O2 /Ot /GL /fp:fast -DNDEBUG") +# SET(CMAKE_Fortran_FLAGS "-g0 -O3 -DNDEBUG") + IF(BTL_NOVEC) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEIGEN_DONT_VECTORIZE") + ENDIF(BTL_NOVEC) +ENDIF(MSVC) + +if(IS_ICPC) + set(CMAKE_CXX_FLAGS "-fast ${CMAKE_CXX_FLAGS}") + set(CMAKE_Fortran_FLAGS "-fast ${CMAKE_Fortran_FLAGS}") +endif(IS_ICPC) + +include_directories( + ${PROJECT_SOURCE_DIR}/actions + ${PROJECT_SOURCE_DIR}/generic_bench + ${PROJECT_SOURCE_DIR}/generic_bench/utils + ${PROJECT_SOURCE_DIR}/libs/STL) + +# find_package(MKL) +# if (MKL_FOUND) +# add_definitions(-DHAVE_MKL) +# set(DEFAULT_LIBRARIES ${MKL_LIBRARIES}) +# endif (MKL_FOUND) + +find_library(EIGEN_BTL_RT_LIBRARY rt) +# if we cannot find it easily, then we don't need it! +if(NOT EIGEN_BTL_RT_LIBRARY) + set(EIGEN_BTL_RT_LIBRARY "") +endif() + +MACRO(BTL_ADD_BENCH targetname) + + foreach(_current_var ${ARGN}) + set(_last_var ${_current_var}) + endforeach(_current_var) + + set(_sources ${ARGN}) + list(LENGTH _sources _argn_length) + + list(REMOVE_ITEM _sources ON OFF TRUE FALSE) + + list(LENGTH _sources _src_length) + + if (${_argn_length} EQUAL ${_src_length}) + set(_last_var ON) + endif (${_argn_length} EQUAL ${_src_length}) + + OPTION(BUILD_${targetname} "Build benchmark ${targetname}" ${_last_var}) + + IF(BUILD_${targetname}) + ADD_EXECUTABLE(${targetname} ${_sources}) + ADD_TEST(${targetname} "${targetname}") + target_link_libraries(${targetname} ${DEFAULT_LIBRARIES} ${EIGEN_BTL_RT_LIBRARY}) + ENDIF(BUILD_${targetname}) + +ENDMACRO(BTL_ADD_BENCH) + +macro(btl_add_target_property target prop value) + + if(BUILD_${target}) + get_target_property(previous ${target} ${prop}) + if(NOT previous) + set(previous "") + endif() + set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}") + endif() + +endmacro(btl_add_target_property) + +ENABLE_TESTING() + +add_subdirectory(libs/eigen3) +add_subdirectory(libs/eigen2) +add_subdirectory(libs/tensors) +add_subdirectory(libs/BLAS) +add_subdirectory(libs/ublas) +add_subdirectory(libs/gmm) +add_subdirectory(libs/mtl4) +add_subdirectory(libs/blitz) +add_subdirectory(libs/tvmet) +add_subdirectory(libs/STL) +add_subdirectory(libs/blaze) + +add_subdirectory(data) + + diff --git a/simulation/externals/eigen/bench/btl/COPYING b/simulation/externals/eigen/bench/btl/COPYING new file mode 100644 index 0000000..486449c --- /dev/null +++ b/simulation/externals/eigen/bench/btl/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/simulation/externals/eigen/bench/btl/README b/simulation/externals/eigen/bench/btl/README new file mode 100644 index 0000000..f3f5fb3 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/README @@ -0,0 +1,154 @@ +Bench Template Library + +**************************************** +Introduction : + +The aim of this project is to compare the performance +of available numerical libraries. The code is designed +as generic and modular as possible. Thus, adding new +numerical libraries or new numerical tests should +require minimal effort. + + +***************************************** + +Installation : + +BTL uses cmake / ctest: + +1 - create a build directory: + + $ mkdir build + $ cd build + +2 - configure: + + $ ccmake .. + +3 - run the bench using ctest: + + $ ctest -V + +You can run the benchmarks only on libraries matching a given regular expression: + ctest -V -R +For instance: + ctest -V -R eigen2 + +You can also select a given set of actions defining the environment variable BTL_CONFIG this way: + BTL_CONFIG="-a action1{:action2}*" ctest -V +An exemple: + BTL_CONFIG="-a axpy:vector_matrix:trisolve:ata" ctest -V -R eigen2 + +Finally, if bench results already exist (the bench*.dat files) then they merges by keeping the best for each matrix size. If you want to overwrite the previous ones you can simply add the "--overwrite" option: + BTL_CONFIG="-a axpy:vector_matrix:trisolve:ata --overwrite" ctest -V -R eigen2 + +4 : Analyze the result. different data files (.dat) are produced in each libs directories. + If gnuplot is available, choose a directory name in the data directory to store the results and type: + $ cd data + $ mkdir my_directory + $ cp ../libs/*/*.dat my_directory + Build the data utilities in this (data) directory + make + Then you can look the raw data, + go_mean my_directory + or smooth the data first : + smooth_all.sh my_directory + go_mean my_directory_smooth + + +************************************************* + +Files and directories : + + generic_bench : all the bench sources common to all libraries + + actions : sources for different action wrappers (axpy, matrix-matrix product) to be tested. + + libs/* : bench sources specific to each tested libraries. + + machine_dep : directory used to store machine specific Makefile.in + + data : directory used to store gnuplot scripts and data analysis utilities + +************************************************** + +Principles : the code modularity is achieved by defining two concepts : + + ****** Action concept : This is a class defining which kind + of test must be performed (e.g. a matrix_vector_product). + An Action should define the following methods : + + *** Ctor using the size of the problem (matrix or vector size) as an argument + Action action(size); + *** initialize : this method initialize the calculation (e.g. initialize the matrices and vectors arguments) + action.initialize(); + *** calculate : this method actually launch the calculation to be benchmarked + action.calculate; + *** nb_op_base() : this method returns the complexity of the calculate method (allowing the mflops evaluation) + *** name() : this method returns the name of the action (std::string) + + ****** Interface concept : This is a class or namespace defining how to use a given library and + its specific containers (matrix and vector). Up to now an interface should following types + + *** real_type : kind of float to be used (float or double) + *** stl_vector : must correspond to std::vector + *** stl_matrix : must correspond to std::vector + *** gene_vector : the vector type for this interface --> e.g. (real_type *) for the C_interface + *** gene_matrix : the matrix type for this interface --> e.g. (gene_vector *) for the C_interface + + + the following common methods + + *** free_matrix(gene_matrix & A, int N) dealocation of a N sized gene_matrix A + *** free_vector(gene_vector & B) dealocation of a N sized gene_vector B + *** matrix_from_stl(gene_matrix & A, stl_matrix & A_stl) copy the content of an stl_matrix A_stl into a gene_matrix A. + The allocation of A is done in this function. + *** vector_to_stl(gene_vector & B, stl_vector & B_stl) copy the content of an stl_vector B_stl into a gene_vector B. + The allocation of B is done in this function. + *** matrix_to_stl(gene_matrix & A, stl_matrix & A_stl) copy the content of an gene_matrix A into an stl_matrix A_stl. + The size of A_STL must corresponds to the size of A. + *** vector_to_stl(gene_vector & A, stl_vector & A_stl) copy the content of an gene_vector A into an stl_vector A_stl. + The size of B_STL must corresponds to the size of B. + *** copy_matrix(gene_matrix & source, gene_matrix & cible, int N) : copy the content of source in cible. Both source + and cible must be sized NxN. + *** copy_vector(gene_vector & source, gene_vector & cible, int N) : copy the content of source in cible. Both source + and cible must be sized N. + + and the following method corresponding to the action one wants to be benchmarked : + + *** matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int N) + *** matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N) + *** ata_product(const gene_matrix & A, gene_matrix & X, int N) + *** aat_product(const gene_matrix & A, gene_matrix & X, int N) + *** axpy(real coef, const gene_vector & X, gene_vector & Y, int N) + + The bench algorithm (generic_bench/bench.hh) is templated with an action itself templated with + an interface. A typical main.cpp source stored in a given library directory libs/A_LIB + looks like : + + bench< AN_ACTION < AN_INTERFACE > >( 10 , 1000 , 50 ) ; + + this function will produce XY data file containing measured mflops as a function of the size for 50 + sizes between 10 and 10000. + + This algorithm can be adapted by providing a given Perf_Analyzer object which determines how the time + measurements must be done. For example, the X86_Perf_Analyzer use the asm rdtsc function and provides + a very fast and accurate (but less portable) timing method. The default is the Portable_Perf_Analyzer + so + + bench< AN_ACTION < AN_INTERFACE > >( 10 , 1000 , 50 ) ; + + is equivalent to + + bench< Portable_Perf_Analyzer,AN_ACTION < AN_INTERFACE > >( 10 , 1000 , 50 ) ; + + If your system supports it we suggest to use a mixed implementation (X86_perf_Analyzer+Portable_Perf_Analyzer). + replace + bench(size_min,size_max,nb_point); + with + bench(size_min,size_max,nb_point); + in generic/bench.hh + +. + + + diff --git a/simulation/externals/eigen/bench/btl/actions/action_aat_product.hh b/simulation/externals/eigen/bench/btl/actions/action_aat_product.hh new file mode 100644 index 0000000..aa5b35c --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_aat_product.hh @@ -0,0 +1,145 @@ +//===================================================== +// File : action_aat_product.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_AAT_PRODUCT +#define ACTION_AAT_PRODUCT +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_aat_product { + +public : + + // Ctor + + Action_aat_product( int size ):_size(size) + { + MESSAGE("Action_aat_product Ctor"); + + // STL matrix and vector initialization + + init_matrix(A_stl,_size); + init_matrix(X_stl,_size); + init_matrix(resu_stl,_size); + + // generic matrix and vector initialization + + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(X_ref,X_stl); + + Interface::matrix_from_stl(A,A_stl); + Interface::matrix_from_stl(X,X_stl); + + } + + // invalidate copy ctor + + Action_aat_product( const Action_aat_product & ) + { + INFOS("illegal call to Action_aat_product Copy Ctor"); + exit(0); + } + + // Dtor + + ~Action_aat_product( void ){ + + MESSAGE("Action_aat_product Dtor"); + + // deallocation + + Interface::free_matrix(A,_size); + Interface::free_matrix(X,_size); + + Interface::free_matrix(A_ref,_size); + Interface::free_matrix(X_ref,_size); + + } + + // action name + + static inline std::string name( void ) + { + return "aat_"+Interface::name(); + } + + double nb_op_base( void ){ + return double(_size)*double(_size)*double(_size); + } + + inline void initialize( void ){ + + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_matrix(X_ref,X,_size); + + } + + inline void calculate( void ) { + + Interface::aat_product(A,X,_size); + + } + + void check_result( void ){ + if (_size>128) return; + // calculation check + + Interface::matrix_to_stl(X,resu_stl); + + STL_interface::aat_product(A_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-6){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(1); + } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_matrix X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_matrix X; + + + int _size; + +}; + + +#endif + + + diff --git a/simulation/externals/eigen/bench/btl/actions/action_ata_product.hh b/simulation/externals/eigen/bench/btl/actions/action_ata_product.hh new file mode 100644 index 0000000..04364fe --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_ata_product.hh @@ -0,0 +1,145 @@ +//===================================================== +// File : action_ata_product.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_ATA_PRODUCT +#define ACTION_ATA_PRODUCT +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_ata_product { + +public : + + // Ctor + + Action_ata_product( int size ):_size(size) + { + MESSAGE("Action_ata_product Ctor"); + + // STL matrix and vector initialization + + init_matrix(A_stl,_size); + init_matrix(X_stl,_size); + init_matrix(resu_stl,_size); + + // generic matrix and vector initialization + + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(X_ref,X_stl); + + Interface::matrix_from_stl(A,A_stl); + Interface::matrix_from_stl(X,X_stl); + + } + + // invalidate copy ctor + + Action_ata_product( const Action_ata_product & ) + { + INFOS("illegal call to Action_ata_product Copy Ctor"); + exit(0); + } + + // Dtor + + ~Action_ata_product( void ){ + + MESSAGE("Action_ata_product Dtor"); + + // deallocation + + Interface::free_matrix(A,_size); + Interface::free_matrix(X,_size); + + Interface::free_matrix(A_ref,_size); + Interface::free_matrix(X_ref,_size); + + } + + // action name + + static inline std::string name( void ) + { + return "ata_"+Interface::name(); + } + + double nb_op_base( void ){ + return 2.0*_size*_size*_size; + } + + inline void initialize( void ){ + + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_matrix(X_ref,X,_size); + + } + + inline void calculate( void ) { + + Interface::ata_product(A,X,_size); + + } + + void check_result( void ){ + if (_size>128) return; + // calculation check + + Interface::matrix_to_stl(X,resu_stl); + + STL_interface::ata_product(A_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-6){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(1); + } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_matrix X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_matrix X; + + + int _size; + +}; + + +#endif + + + diff --git a/simulation/externals/eigen/bench/btl/actions/action_atv_product.hh b/simulation/externals/eigen/bench/btl/actions/action_atv_product.hh new file mode 100644 index 0000000..a823451 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_atv_product.hh @@ -0,0 +1,134 @@ +//===================================================== +// File : action_atv_product.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_ATV_PRODUCT +#define ACTION_ATV_PRODUCT +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_atv_product { + +public : + + Action_atv_product( int size ) : _size(size) + { + MESSAGE("Action_atv_product Ctor"); + + // STL matrix and vector initialization + + init_matrix(A_stl,_size); + init_vector(B_stl,_size); + init_vector(X_stl,_size); + init_vector(resu_stl,_size); + + // generic matrix and vector initialization + + Interface::matrix_from_stl(A_ref,A_stl); + Interface::vector_from_stl(B_ref,B_stl); + Interface::vector_from_stl(X_ref,X_stl); + + Interface::matrix_from_stl(A,A_stl); + Interface::vector_from_stl(B,B_stl); + Interface::vector_from_stl(X,X_stl); + } + + // invalidate copy ctor + Action_atv_product( const Action_atv_product & ) + { + INFOS("illegal call to Action_atv_product Copy Ctor"); + exit(1); + } + + ~Action_atv_product( void ) + { + MESSAGE("Action_atv_product Dtor"); + + Interface::free_matrix(A,_size); + Interface::free_vector(B); + Interface::free_vector(X); + + Interface::free_matrix(A_ref,_size); + Interface::free_vector(B_ref); + Interface::free_vector(X_ref); + } + + static inline std::string name() { return "atv_" + Interface::name(); } + + double nb_op_base( void ) { return 2.0*_size*_size; } + + inline void initialize( void ){ + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_vector(B_ref,B,_size); + Interface::copy_vector(X_ref,X,_size); + } + + BTL_DONT_INLINE void calculate( void ) { + BTL_ASM_COMMENT("begin atv"); + Interface::atv_product(A,B,X,_size); + BTL_ASM_COMMENT("end atv"); + } + + void check_result( void ) + { + if (_size>128) return; + Interface::vector_to_stl(X,resu_stl); + + STL_interface::atv_product(A_stl,B_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-6){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(1); + } + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_vector B_stl; + typename Interface::stl_vector X_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_vector B_ref; + typename Interface::gene_vector X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_vector B; + typename Interface::gene_vector X; + + + int _size; + +}; + + +#endif + + + diff --git a/simulation/externals/eigen/bench/btl/actions/action_axpby.hh b/simulation/externals/eigen/bench/btl/actions/action_axpby.hh new file mode 100644 index 0000000..dadd0cc --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_axpby.hh @@ -0,0 +1,127 @@ +//===================================================== +// File : action_axpby.hh +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_AXPBY +#define ACTION_AXPBY +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_axpby { + +public : + + // Ctor + Action_axpby( int size ):_alpha(0.5),_beta(0.95),_size(size) + { + MESSAGE("Action_axpby Ctor"); + + // STL vector initialization + init_vector(X_stl,_size); + init_vector(Y_stl,_size); + init_vector(resu_stl,_size); + + // generic matrix and vector initialization + Interface::vector_from_stl(X_ref,X_stl); + Interface::vector_from_stl(Y_ref,Y_stl); + + Interface::vector_from_stl(X,X_stl); + Interface::vector_from_stl(Y,Y_stl); + } + + // invalidate copy ctor + Action_axpby( const Action_axpby & ) + { + INFOS("illegal call to Action_axpby Copy Ctor"); + exit(1); + } + + // Dtor + ~Action_axpby( void ){ + MESSAGE("Action_axpby Dtor"); + + // deallocation + Interface::free_vector(X_ref); + Interface::free_vector(Y_ref); + + Interface::free_vector(X); + Interface::free_vector(Y); + } + + // action name + static inline std::string name( void ) + { + return "axpby_"+Interface::name(); + } + + double nb_op_base( void ){ + return 3.0*_size; + } + + inline void initialize( void ){ + Interface::copy_vector(X_ref,X,_size); + Interface::copy_vector(Y_ref,Y,_size); + } + + inline void calculate( void ) { + BTL_ASM_COMMENT("mybegin axpby"); + Interface::axpby(_alpha,X,_beta,Y,_size); + BTL_ASM_COMMENT("myend axpby"); + } + + void check_result( void ){ + if (_size>128) return; + // calculation check + Interface::vector_to_stl(Y,resu_stl); + + STL_interface::axpby(_alpha,X_stl,_beta,Y_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(Y_stl,resu_stl); + + if (error>1.e-6){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(2); + } + } + +private : + + typename Interface::stl_vector X_stl; + typename Interface::stl_vector Y_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_vector X_ref; + typename Interface::gene_vector Y_ref; + + typename Interface::gene_vector X; + typename Interface::gene_vector Y; + + typename Interface::real_type _alpha; + typename Interface::real_type _beta; + + int _size; +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/actions/action_axpy.hh b/simulation/externals/eigen/bench/btl/actions/action_axpy.hh new file mode 100644 index 0000000..261be4c --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_axpy.hh @@ -0,0 +1,139 @@ +//===================================================== +// File : action_axpy.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_AXPY +#define ACTION_AXPY +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_axpy { + +public : + + // Ctor + + Action_axpy( int size ):_coef(1.0),_size(size) + { + MESSAGE("Action_axpy Ctor"); + + // STL vector initialization + + init_vector(X_stl,_size); + init_vector(Y_stl,_size); + init_vector(resu_stl,_size); + + // generic matrix and vector initialization + + Interface::vector_from_stl(X_ref,X_stl); + Interface::vector_from_stl(Y_ref,Y_stl); + + Interface::vector_from_stl(X,X_stl); + Interface::vector_from_stl(Y,Y_stl); + + + } + + // invalidate copy ctor + + Action_axpy( const Action_axpy & ) + { + INFOS("illegal call to Action_axpy Copy Ctor"); + exit(1); + } + + // Dtor + + ~Action_axpy( void ){ + + MESSAGE("Action_axpy Dtor"); + + // deallocation + + Interface::free_vector(X_ref); + Interface::free_vector(Y_ref); + + Interface::free_vector(X); + Interface::free_vector(Y); + } + + // action name + + static inline std::string name( void ) + { + return "axpy_"+Interface::name(); + } + + double nb_op_base( void ){ + return 2.0*_size; + } + + inline void initialize( void ){ + Interface::copy_vector(X_ref,X,_size); + Interface::copy_vector(Y_ref,Y,_size); + } + + inline void calculate( void ) { + BTL_ASM_COMMENT("mybegin axpy"); + Interface::axpy(_coef,X,Y,_size); + BTL_ASM_COMMENT("myend axpy"); + } + + void check_result( void ){ + if (_size>128) return; + // calculation check + + Interface::vector_to_stl(Y,resu_stl); + + STL_interface::axpy(_coef,X_stl,Y_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(Y_stl,resu_stl); + + if (error>1.e-6){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(0); + } + + } + +private : + + typename Interface::stl_vector X_stl; + typename Interface::stl_vector Y_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_vector X_ref; + typename Interface::gene_vector Y_ref; + + typename Interface::gene_vector X; + typename Interface::gene_vector Y; + + typename Interface::real_type _coef; + + int _size; +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/actions/action_cholesky.hh b/simulation/externals/eigen/bench/btl/actions/action_cholesky.hh new file mode 100644 index 0000000..5f66d11 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_cholesky.hh @@ -0,0 +1,128 @@ +//===================================================== +// File : action_cholesky.hh +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_CHOLESKY +#define ACTION_CHOLESKY +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_cholesky { + +public : + + // Ctor + + Action_cholesky( int size ):_size(size) + { + MESSAGE("Action_cholesky Ctor"); + + // STL mat/vec initialization + init_matrix_symm(X_stl,_size); + init_matrix(C_stl,_size); + + // make sure X is invertible + for (int i=0; i<_size; ++i) + X_stl[i][i] = std::abs(X_stl[i][i]) * 1e2 + 100; + + // generic matrix and vector initialization + Interface::matrix_from_stl(X_ref,X_stl); + Interface::matrix_from_stl(X,X_stl); + Interface::matrix_from_stl(C,C_stl); + + _cost = 0; + for (int j=0; j<_size; ++j) + { + double r = std::max(_size - j -1,0); + _cost += 2*(r*j+r+j); + } + } + + // invalidate copy ctor + + Action_cholesky( const Action_cholesky & ) + { + INFOS("illegal call to Action_cholesky Copy Ctor"); + exit(1); + } + + // Dtor + + ~Action_cholesky( void ){ + + MESSAGE("Action_cholesky Dtor"); + + // deallocation + Interface::free_matrix(X_ref,_size); + Interface::free_matrix(X,_size); + Interface::free_matrix(C,_size); + } + + // action name + + static inline std::string name( void ) + { + return "cholesky_"+Interface::name(); + } + + double nb_op_base( void ){ + return _cost; + } + + inline void initialize( void ){ + Interface::copy_matrix(X_ref,X,_size); + } + + inline void calculate( void ) { + Interface::cholesky(X,C,_size); + } + + void check_result( void ){ + // calculation check +// STL_interface::cholesky(X_stl,C_stl,_size); +// +// typename Interface::real_type error= +// STL_interface::norm_diff(C_stl,resu_stl); +// +// if (error>1.e-6){ +// INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); +// } + + } + +private : + + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix C_stl; + + typename Interface::gene_matrix X_ref; + typename Interface::gene_matrix X; + typename Interface::gene_matrix C; + + int _size; + double _cost; +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/actions/action_ger.hh b/simulation/externals/eigen/bench/btl/actions/action_ger.hh new file mode 100644 index 0000000..dc766ef --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_ger.hh @@ -0,0 +1,128 @@ + +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_GER +#define ACTION_GER +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_ger { + +public : + + // Ctor + BTL_DONT_INLINE Action_ger( int size ):_size(size) + { + MESSAGE("Action_ger Ctor"); + + // STL matrix and vector initialization + typename Interface::stl_matrix tmp; + init_matrix(A_stl,_size); + init_vector(B_stl,_size); + init_vector(X_stl,_size); + init_vector(resu_stl,_size); + + // generic matrix and vector initialization + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(A,A_stl); + Interface::vector_from_stl(B_ref,B_stl); + Interface::vector_from_stl(B,B_stl); + Interface::vector_from_stl(X_ref,X_stl); + Interface::vector_from_stl(X,X_stl); + } + + // invalidate copy ctor + Action_ger( const Action_ger & ) + { + INFOS("illegal call to Action_ger Copy Ctor"); + exit(1); + } + + // Dtor + BTL_DONT_INLINE ~Action_ger( void ){ + MESSAGE("Action_ger Dtor"); + Interface::free_matrix(A,_size); + Interface::free_vector(B); + Interface::free_vector(X); + Interface::free_matrix(A_ref,_size); + Interface::free_vector(B_ref); + Interface::free_vector(X_ref); + + } + + // action name + static inline std::string name( void ) + { + return "ger_" + Interface::name(); + } + + double nb_op_base( void ){ + return 2.0*_size*_size; + } + + BTL_DONT_INLINE void initialize( void ){ + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_vector(B_ref,B,_size); + Interface::copy_vector(X_ref,X,_size); + } + + BTL_DONT_INLINE void calculate( void ) { + BTL_ASM_COMMENT("#begin ger"); + Interface::ger(A,B,X,_size); + BTL_ASM_COMMENT("end ger"); + } + + BTL_DONT_INLINE void check_result( void ){ + // calculation check + Interface::vector_to_stl(X,resu_stl); + + STL_interface::ger(A_stl,B_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-3){ + INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); + } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_vector B_stl; + typename Interface::stl_vector X_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_vector B_ref; + typename Interface::gene_vector X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_vector B; + typename Interface::gene_vector X; + + int _size; +}; + + +#endif diff --git a/simulation/externals/eigen/bench/btl/actions/action_hessenberg.hh b/simulation/externals/eigen/bench/btl/actions/action_hessenberg.hh new file mode 100644 index 0000000..2100ebd --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_hessenberg.hh @@ -0,0 +1,233 @@ +//===================================================== +// File : action_hessenberg.hh +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_HESSENBERG +#define ACTION_HESSENBERG +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_hessenberg { + +public : + + // Ctor + + Action_hessenberg( int size ):_size(size) + { + MESSAGE("Action_hessenberg Ctor"); + + // STL vector initialization + init_matrix(X_stl,_size); + + init_matrix(C_stl,_size); + init_matrix(resu_stl,_size); + + // generic matrix and vector initialization + Interface::matrix_from_stl(X_ref,X_stl); + Interface::matrix_from_stl(X,X_stl); + Interface::matrix_from_stl(C,C_stl); + + _cost = 0; + for (int j=0; j<_size-2; ++j) + { + double r = std::max(0,_size-j-1); + double b = std::max(0,_size-j-2); + _cost += 6 + 3*b + r*r*4 + r*_size*4; + } + } + + // invalidate copy ctor + + Action_hessenberg( const Action_hessenberg & ) + { + INFOS("illegal call to Action_hessenberg Copy Ctor"); + exit(1); + } + + // Dtor + + ~Action_hessenberg( void ){ + + MESSAGE("Action_hessenberg Dtor"); + + // deallocation + Interface::free_matrix(X_ref,_size); + Interface::free_matrix(X,_size); + Interface::free_matrix(C,_size); + } + + // action name + + static inline std::string name( void ) + { + return "hessenberg_"+Interface::name(); + } + + double nb_op_base( void ){ + return _cost; + } + + inline void initialize( void ){ + Interface::copy_matrix(X_ref,X,_size); + } + + inline void calculate( void ) { + Interface::hessenberg(X,C,_size); + } + + void check_result( void ){ + // calculation check + Interface::matrix_to_stl(C,resu_stl); + +// STL_interface::hessenberg(X_stl,C_stl,_size); +// +// typename Interface::real_type error= +// STL_interface::norm_diff(C_stl,resu_stl); +// +// if (error>1.e-6){ +// INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); +// } + + } + +private : + + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix C_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix X_ref; + typename Interface::gene_matrix X; + typename Interface::gene_matrix C; + + int _size; + double _cost; +}; + +template +class Action_tridiagonalization { + +public : + + // Ctor + + Action_tridiagonalization( int size ):_size(size) + { + MESSAGE("Action_tridiagonalization Ctor"); + + // STL vector initialization + init_matrix(X_stl,_size); + + for(int i=0; i<_size; ++i) + { + for(int j=0; j(C_stl,_size); + init_matrix(resu_stl,_size); + + // generic matrix and vector initialization + Interface::matrix_from_stl(X_ref,X_stl); + Interface::matrix_from_stl(X,X_stl); + Interface::matrix_from_stl(C,C_stl); + + _cost = 0; + for (int j=0; j<_size-2; ++j) + { + double r = std::max(0,_size-j-1); + double b = std::max(0,_size-j-2); + _cost += 6. + 3.*b + r*r*8.; + } + } + + // invalidate copy ctor + + Action_tridiagonalization( const Action_tridiagonalization & ) + { + INFOS("illegal call to Action_tridiagonalization Copy Ctor"); + exit(1); + } + + // Dtor + + ~Action_tridiagonalization( void ){ + + MESSAGE("Action_tridiagonalization Dtor"); + + // deallocation + Interface::free_matrix(X_ref,_size); + Interface::free_matrix(X,_size); + Interface::free_matrix(C,_size); + } + + // action name + + static inline std::string name( void ) { return "tridiagonalization_"+Interface::name(); } + + double nb_op_base( void ){ + return _cost; + } + + inline void initialize( void ){ + Interface::copy_matrix(X_ref,X,_size); + } + + inline void calculate( void ) { + Interface::tridiagonalization(X,C,_size); + } + + void check_result( void ){ + // calculation check + Interface::matrix_to_stl(C,resu_stl); + +// STL_interface::tridiagonalization(X_stl,C_stl,_size); +// +// typename Interface::real_type error= +// STL_interface::norm_diff(C_stl,resu_stl); +// +// if (error>1.e-6){ +// INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); +// } + + } + +private : + + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix C_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix X_ref; + typename Interface::gene_matrix X; + typename Interface::gene_matrix C; + + int _size; + double _cost; +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/actions/action_lu_decomp.hh b/simulation/externals/eigen/bench/btl/actions/action_lu_decomp.hh new file mode 100644 index 0000000..2448e82 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_lu_decomp.hh @@ -0,0 +1,124 @@ +//===================================================== +// File : action_lu_decomp.hh +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_LU_DECOMP +#define ACTION_LU_DECOMP +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_lu_decomp { + +public : + + // Ctor + + Action_lu_decomp( int size ):_size(size) + { + MESSAGE("Action_lu_decomp Ctor"); + + // STL vector initialization + init_matrix(X_stl,_size); + + init_matrix(C_stl,_size); + init_matrix(resu_stl,_size); + + // generic matrix and vector initialization + Interface::matrix_from_stl(X_ref,X_stl); + Interface::matrix_from_stl(X,X_stl); + Interface::matrix_from_stl(C,C_stl); + + _cost = 2.0*size*size*size/3.0 + size*size; + } + + // invalidate copy ctor + + Action_lu_decomp( const Action_lu_decomp & ) + { + INFOS("illegal call to Action_lu_decomp Copy Ctor"); + exit(1); + } + + // Dtor + + ~Action_lu_decomp( void ){ + + MESSAGE("Action_lu_decomp Dtor"); + + // deallocation + Interface::free_matrix(X_ref,_size); + Interface::free_matrix(X,_size); + Interface::free_matrix(C,_size); + } + + // action name + + static inline std::string name( void ) + { + return "complete_lu_decomp_"+Interface::name(); + } + + double nb_op_base( void ){ + return _cost; + } + + inline void initialize( void ){ + Interface::copy_matrix(X_ref,X,_size); + } + + inline void calculate( void ) { + Interface::lu_decomp(X,C,_size); + } + + void check_result( void ){ + // calculation check + Interface::matrix_to_stl(C,resu_stl); + +// STL_interface::lu_decomp(X_stl,C_stl,_size); +// +// typename Interface::real_type error= +// STL_interface::norm_diff(C_stl,resu_stl); +// +// if (error>1.e-6){ +// INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); +// } + + } + +private : + + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix C_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix X_ref; + typename Interface::gene_matrix X; + typename Interface::gene_matrix C; + + int _size; + double _cost; +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/actions/action_lu_solve.hh b/simulation/externals/eigen/bench/btl/actions/action_lu_solve.hh new file mode 100644 index 0000000..5a81e63 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_lu_solve.hh @@ -0,0 +1,136 @@ +//===================================================== +// File : action_lu_solve.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_LU_SOLVE +#define ACTION_LU_SOLVE +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_lu_solve +{ + +public : + + static inline std::string name( void ) + { + return "lu_solve_"+Interface::name(); + } + + static double nb_op_base(int size){ + return 2.0*size*size*size/3.0; // questionable but not really important + } + + + static double calculate( int nb_calc, int size ) { + + // STL matrix and vector initialization + + typename Interface::stl_matrix A_stl; + typename Interface::stl_vector B_stl; + typename Interface::stl_vector X_stl; + + init_matrix(A_stl,size); + init_vector(B_stl,size); + init_vector(X_stl,size); + + // generic matrix and vector initialization + + typename Interface::gene_matrix A; + typename Interface::gene_vector B; + typename Interface::gene_vector X; + + typename Interface::gene_matrix LU; + + Interface::matrix_from_stl(A,A_stl); + Interface::vector_from_stl(B,B_stl); + Interface::vector_from_stl(X,X_stl); + Interface::matrix_from_stl(LU,A_stl); + + // local variable : + + typename Interface::Pivot_Vector pivot; // pivot vector + Interface::new_Pivot_Vector(pivot,size); + + // timer utilities + + Portable_Timer chronos; + + // time measurement + + chronos.start(); + + for (int ii=0;ii::matrix_vector_product(A_stl,X_stl,B_new_stl,size); + + typename Interface::real_type error= + STL_interface::norm_diff(B_stl,B_new_stl); + + if (error>1.e-5){ + INFOS("WRONG CALCULATION...residual=" << error); + STL_interface::display_vector(B_stl); + STL_interface::display_vector(B_new_stl); + exit(0); + } + + // deallocation and return time + + Interface::free_matrix(A,size); + Interface::free_vector(B); + Interface::free_vector(X); + Interface::free_Pivot_Vector(pivot); + + return time; + } + +}; + + +#endif + + + diff --git a/simulation/externals/eigen/bench/btl/actions/action_matrix_matrix_product.hh b/simulation/externals/eigen/bench/btl/actions/action_matrix_matrix_product.hh new file mode 100644 index 0000000..f65ee05 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_matrix_matrix_product.hh @@ -0,0 +1,150 @@ +//===================================================== +// File : action_matrix_matrix_product.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_MATRIX_MATRIX_PRODUCT +#define ACTION_MATRIX_MATRIX_PRODUCT +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_matrix_matrix_product { + +public : + + // Ctor + + Action_matrix_matrix_product( int size ):_size(size) + { + MESSAGE("Action_matrix_matrix_product Ctor"); + + // STL matrix and vector initialization + + init_matrix(A_stl,_size); + init_matrix(B_stl,_size); + init_matrix(X_stl,_size); + init_matrix(resu_stl,_size); + + // generic matrix and vector initialization + + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(B_ref,B_stl); + Interface::matrix_from_stl(X_ref,X_stl); + + Interface::matrix_from_stl(A,A_stl); + Interface::matrix_from_stl(B,B_stl); + Interface::matrix_from_stl(X,X_stl); + + } + + // invalidate copy ctor + + Action_matrix_matrix_product( const Action_matrix_matrix_product & ) + { + INFOS("illegal call to Action_matrix_matrix_product Copy Ctor"); + exit(0); + } + + // Dtor + + ~Action_matrix_matrix_product( void ){ + + MESSAGE("Action_matrix_matrix_product Dtor"); + + // deallocation + + Interface::free_matrix(A,_size); + Interface::free_matrix(B,_size); + Interface::free_matrix(X,_size); + + Interface::free_matrix(A_ref,_size); + Interface::free_matrix(B_ref,_size); + Interface::free_matrix(X_ref,_size); + + } + + // action name + + static inline std::string name( void ) + { + return "matrix_matrix_"+Interface::name(); + } + + double nb_op_base( void ){ + return 2.0*_size*_size*_size; + } + + inline void initialize( void ){ + + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_matrix(B_ref,B,_size); + Interface::copy_matrix(X_ref,X,_size); + + } + + inline void calculate( void ) { + Interface::matrix_matrix_product(A,B,X,_size); + } + + void check_result( void ){ + + // calculation check + if (_size<200) + { + Interface::matrix_to_stl(X,resu_stl); + STL_interface::matrix_matrix_product(A_stl,B_stl,X_stl,_size); + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + if (error>1.e-6){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(1); + } + } + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_matrix B_stl; + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_matrix B_ref; + typename Interface::gene_matrix X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_matrix B; + typename Interface::gene_matrix X; + + + int _size; + +}; + + +#endif + + + diff --git a/simulation/externals/eigen/bench/btl/actions/action_matrix_matrix_product_bis.hh b/simulation/externals/eigen/bench/btl/actions/action_matrix_matrix_product_bis.hh new file mode 100644 index 0000000..29c10a6 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_matrix_matrix_product_bis.hh @@ -0,0 +1,152 @@ +//===================================================== +// File : action_matrix_matrix_product_bis.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_MATRIX_MATRIX_PRODUCT_BIS +#define ACTION_MATRIX_MATRIX_PRODUCT_BIS +#include "utilities.h" +#include "STL_interface.hh" +#include "STL_timer.hh" +#include +#include "init_function.hh" +#include "init_vector.hh" +#include "init_matrix.hh" + +using namespace std; + +template +class Action_matrix_matrix_product_bis { + +public : + + static inline std::string name( void ) + { + return "matrix_matrix_"+Interface::name(); + } + + static double nb_op_base(int size){ + return 2.0*size*size*size; + } + + static double calculate( int nb_calc, int size ) { + + // STL matrix and vector initialization + + typename Interface::stl_matrix A_stl; + typename Interface::stl_matrix B_stl; + typename Interface::stl_matrix X_stl; + + init_matrix(A_stl,size); + init_matrix(B_stl,size); + init_matrix(X_stl,size); + + // generic matrix and vector initialization + + typename Interface::gene_matrix A_ref; + typename Interface::gene_matrix B_ref; + typename Interface::gene_matrix X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_matrix B; + typename Interface::gene_matrix X; + + + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(B_ref,B_stl); + Interface::matrix_from_stl(X_ref,X_stl); + + Interface::matrix_from_stl(A,A_stl); + Interface::matrix_from_stl(B,B_stl); + Interface::matrix_from_stl(X,X_stl); + + + // STL_timer utilities + + STL_timer chronos; + + // Baseline evaluation + + chronos.start_baseline(nb_calc); + + do { + + Interface::copy_matrix(A_ref,A,size); + Interface::copy_matrix(B_ref,B,size); + Interface::copy_matrix(X_ref,X,size); + + + // Interface::matrix_matrix_product(A,B,X,size); This line must be commented !!!! + } + while(chronos.check()); + + chronos.report(true); + + // Time measurement + + chronos.start(nb_calc); + + do { + + Interface::copy_matrix(A_ref,A,size); + Interface::copy_matrix(B_ref,B,size); + Interface::copy_matrix(X_ref,X,size); + + Interface::matrix_matrix_product(A,B,X,size); // here it is not commented !!!! + } + while(chronos.check()); + + chronos.report(true); + + double time=chronos.calculated_time/2000.0; + + // calculation check + + typename Interface::stl_matrix resu_stl(size); + + Interface::matrix_to_stl(X,resu_stl); + + STL_interface::matrix_matrix_product(A_stl,B_stl,X_stl,size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-6){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(1); + } + + // deallocation and return time + + Interface::free_matrix(A,size); + Interface::free_matrix(B,size); + Interface::free_matrix(X,size); + + Interface::free_matrix(A_ref,size); + Interface::free_matrix(B_ref,size); + Interface::free_matrix(X_ref,size); + + return time; + } + +}; + + +#endif + + + diff --git a/simulation/externals/eigen/bench/btl/actions/action_matrix_vector_product.hh b/simulation/externals/eigen/bench/btl/actions/action_matrix_vector_product.hh new file mode 100644 index 0000000..8bab79d --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_matrix_vector_product.hh @@ -0,0 +1,153 @@ +//===================================================== +// File : action_matrix_vector_product.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_MATRIX_VECTOR_PRODUCT +#define ACTION_MATRIX_VECTOR_PRODUCT +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_matrix_vector_product { + +public : + + // Ctor + + BTL_DONT_INLINE Action_matrix_vector_product( int size ):_size(size) + { + MESSAGE("Action_matrix_vector_product Ctor"); + + // STL matrix and vector initialization + + init_matrix(A_stl,_size); + init_vector(B_stl,_size); + init_vector(X_stl,_size); + init_vector(resu_stl,_size); + + // generic matrix and vector initialization + + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(A,A_stl); + Interface::vector_from_stl(B_ref,B_stl); + Interface::vector_from_stl(B,B_stl); + Interface::vector_from_stl(X_ref,X_stl); + Interface::vector_from_stl(X,X_stl); + + } + + // invalidate copy ctor + + Action_matrix_vector_product( const Action_matrix_vector_product & ) + { + INFOS("illegal call to Action_matrix_vector_product Copy Ctor"); + exit(1); + } + + // Dtor + + BTL_DONT_INLINE ~Action_matrix_vector_product( void ){ + + MESSAGE("Action_matrix_vector_product Dtor"); + + // deallocation + + Interface::free_matrix(A,_size); + Interface::free_vector(B); + Interface::free_vector(X); + + Interface::free_matrix(A_ref,_size); + Interface::free_vector(B_ref); + Interface::free_vector(X_ref); + + } + + // action name + + static inline std::string name( void ) + { + return "matrix_vector_" + Interface::name(); + } + + double nb_op_base( void ){ + return 2.0*_size*_size; + } + + BTL_DONT_INLINE void initialize( void ){ + + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_vector(B_ref,B,_size); + Interface::copy_vector(X_ref,X,_size); + + } + + BTL_DONT_INLINE void calculate( void ) { + BTL_ASM_COMMENT("#begin matrix_vector_product"); + Interface::matrix_vector_product(A,B,X,_size); + BTL_ASM_COMMENT("end matrix_vector_product"); + } + + BTL_DONT_INLINE void check_result( void ){ + + // calculation check + + Interface::vector_to_stl(X,resu_stl); + + STL_interface::matrix_vector_product(A_stl,B_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-5){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(0); + } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_vector B_stl; + typename Interface::stl_vector X_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_vector B_ref; + typename Interface::gene_vector X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_vector B; + typename Interface::gene_vector X; + + + int _size; + +}; + + +#endif + + + diff --git a/simulation/externals/eigen/bench/btl/actions/action_partial_lu.hh b/simulation/externals/eigen/bench/btl/actions/action_partial_lu.hh new file mode 100644 index 0000000..770ea1d --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_partial_lu.hh @@ -0,0 +1,125 @@ +//===================================================== +// File : action_lu_decomp.hh +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_PARTIAL_LU +#define ACTION_PARTIAL_LU +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_partial_lu { + +public : + + // Ctor + + Action_partial_lu( int size ):_size(size) + { + MESSAGE("Action_partial_lu Ctor"); + + // STL vector initialization + init_matrix(X_stl,_size); + init_matrix(C_stl,_size); + + // make sure X is invertible + for (int i=0; i<_size; ++i) + X_stl[i][i] = X_stl[i][i] * 1e2 + 1; + + // generic matrix and vector initialization + Interface::matrix_from_stl(X_ref,X_stl); + Interface::matrix_from_stl(X,X_stl); + Interface::matrix_from_stl(C,C_stl); + + _cost = 2.0*size*size*size/3.0 + size*size; + } + + // invalidate copy ctor + + Action_partial_lu( const Action_partial_lu & ) + { + INFOS("illegal call to Action_partial_lu Copy Ctor"); + exit(1); + } + + // Dtor + + ~Action_partial_lu( void ){ + + MESSAGE("Action_partial_lu Dtor"); + + // deallocation + Interface::free_matrix(X_ref,_size); + Interface::free_matrix(X,_size); + Interface::free_matrix(C,_size); + } + + // action name + + static inline std::string name( void ) + { + return "partial_lu_decomp_"+Interface::name(); + } + + double nb_op_base( void ){ + return _cost; + } + + inline void initialize( void ){ + Interface::copy_matrix(X_ref,X,_size); + } + + inline void calculate( void ) { + Interface::partial_lu_decomp(X,C,_size); + } + + void check_result( void ){ + // calculation check +// Interface::matrix_to_stl(C,resu_stl); + +// STL_interface::lu_decomp(X_stl,C_stl,_size); +// +// typename Interface::real_type error= +// STL_interface::norm_diff(C_stl,resu_stl); +// +// if (error>1.e-6){ +// INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); +// } + + } + +private : + + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix C_stl; + + typename Interface::gene_matrix X_ref; + typename Interface::gene_matrix X; + typename Interface::gene_matrix C; + + int _size; + double _cost; +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/actions/action_rot.hh b/simulation/externals/eigen/bench/btl/actions/action_rot.hh new file mode 100644 index 0000000..df822a6 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_rot.hh @@ -0,0 +1,116 @@ + +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_ROT +#define ACTION_ROT +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_rot { + +public : + + // Ctor + BTL_DONT_INLINE Action_rot( int size ):_size(size) + { + MESSAGE("Action_rot Ctor"); + + // STL matrix and vector initialization + typename Interface::stl_matrix tmp; + init_vector(A_stl,_size); + init_vector(B_stl,_size); + + // generic matrix and vector initialization + Interface::vector_from_stl(A_ref,A_stl); + Interface::vector_from_stl(A,A_stl); + Interface::vector_from_stl(B_ref,B_stl); + Interface::vector_from_stl(B,B_stl); + } + + // invalidate copy ctor + Action_rot( const Action_rot & ) + { + INFOS("illegal call to Action_rot Copy Ctor"); + exit(1); + } + + // Dtor + BTL_DONT_INLINE ~Action_rot( void ){ + MESSAGE("Action_rot Dtor"); + Interface::free_vector(A); + Interface::free_vector(B); + Interface::free_vector(A_ref); + Interface::free_vector(B_ref); + } + + // action name + static inline std::string name( void ) + { + return "rot_" + Interface::name(); + } + + double nb_op_base( void ){ + return 6.0*_size; + } + + BTL_DONT_INLINE void initialize( void ){ + Interface::copy_vector(A_ref,A,_size); + Interface::copy_vector(B_ref,B,_size); + } + + BTL_DONT_INLINE void calculate( void ) { + BTL_ASM_COMMENT("#begin rot"); + Interface::rot(A,B,0.5,0.6,_size); + BTL_ASM_COMMENT("end rot"); + } + + BTL_DONT_INLINE void check_result( void ){ + // calculation check +// Interface::vector_to_stl(X,resu_stl); + +// STL_interface::rot(A_stl,B_stl,X_stl,_size); + +// typename Interface::real_type error= +// STL_interface::norm_diff(X_stl,resu_stl); + +// if (error>1.e-3){ +// INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); +// } + + } + +private : + + typename Interface::stl_vector A_stl; + typename Interface::stl_vector B_stl; + + typename Interface::gene_vector A_ref; + typename Interface::gene_vector B_ref; + + typename Interface::gene_vector A; + typename Interface::gene_vector B; + + int _size; +}; + + +#endif diff --git a/simulation/externals/eigen/bench/btl/actions/action_symv.hh b/simulation/externals/eigen/bench/btl/actions/action_symv.hh new file mode 100644 index 0000000..a32b9df --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_symv.hh @@ -0,0 +1,139 @@ +//===================================================== +// File : action_symv.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_SYMV +#define ACTION_SYMV +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_symv { + +public : + + // Ctor + + BTL_DONT_INLINE Action_symv( int size ):_size(size) + { + MESSAGE("Action_symv Ctor"); + + // STL matrix and vector initialization + init_matrix_symm(A_stl,_size); + init_vector(B_stl,_size); + init_vector(X_stl,_size); + init_vector(resu_stl,_size); + + // generic matrix and vector initialization + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(A,A_stl); + Interface::vector_from_stl(B_ref,B_stl); + Interface::vector_from_stl(B,B_stl); + Interface::vector_from_stl(X_ref,X_stl); + Interface::vector_from_stl(X,X_stl); + + } + + // invalidate copy ctor + + Action_symv( const Action_symv & ) + { + INFOS("illegal call to Action_symv Copy Ctor"); + exit(1); + } + + // Dtor + BTL_DONT_INLINE ~Action_symv( void ){ + Interface::free_matrix(A,_size); + Interface::free_vector(B); + Interface::free_vector(X); + Interface::free_matrix(A_ref,_size); + Interface::free_vector(B_ref); + Interface::free_vector(X_ref); + } + + // action name + + static inline std::string name( void ) + { + return "symv_" + Interface::name(); + } + + double nb_op_base( void ){ + return 2.0*_size*_size; + } + + BTL_DONT_INLINE void initialize( void ){ + + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_vector(B_ref,B,_size); + Interface::copy_vector(X_ref,X,_size); + + } + + BTL_DONT_INLINE void calculate( void ) { + BTL_ASM_COMMENT("#begin symv"); + Interface::symv(A,B,X,_size); + BTL_ASM_COMMENT("end symv"); + } + + BTL_DONT_INLINE void check_result( void ){ + if (_size>128) return; + // calculation check + Interface::vector_to_stl(X,resu_stl); + + STL_interface::symv(A_stl,B_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-5){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(0); + } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_vector B_stl; + typename Interface::stl_vector X_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_vector B_ref; + typename Interface::gene_vector X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_vector B; + typename Interface::gene_vector X; + + + int _size; + +}; + + +#endif diff --git a/simulation/externals/eigen/bench/btl/actions/action_syr2.hh b/simulation/externals/eigen/bench/btl/actions/action_syr2.hh new file mode 100644 index 0000000..7c6712b --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_syr2.hh @@ -0,0 +1,133 @@ +//===================================================== +// File : action_syr2.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_SYR2 +#define ACTION_SYR2 +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_syr2 { + +public : + + // Ctor + + BTL_DONT_INLINE Action_syr2( int size ):_size(size) + { + // STL matrix and vector initialization + typename Interface::stl_matrix tmp; + init_matrix(A_stl,_size); + init_vector(B_stl,_size); + init_vector(X_stl,_size); + init_vector(resu_stl,_size); + + // generic matrix and vector initialization + Interface::matrix_from_stl(A_ref,A_stl); + Interface::matrix_from_stl(A,A_stl); + Interface::vector_from_stl(B_ref,B_stl); + Interface::vector_from_stl(B,B_stl); + Interface::vector_from_stl(X_ref,X_stl); + Interface::vector_from_stl(X,X_stl); + } + + // invalidate copy ctor + Action_syr2( const Action_syr2 & ) + { + INFOS("illegal call to Action_syr2 Copy Ctor"); + exit(1); + } + + // Dtor + BTL_DONT_INLINE ~Action_syr2( void ){ + Interface::free_matrix(A,_size); + Interface::free_vector(B); + Interface::free_vector(X); + Interface::free_matrix(A_ref,_size); + Interface::free_vector(B_ref); + Interface::free_vector(X_ref); + } + + // action name + + static inline std::string name( void ) + { + return "syr2_" + Interface::name(); + } + + double nb_op_base( void ){ + return 2.0*_size*_size; + } + + BTL_DONT_INLINE void initialize( void ){ + Interface::copy_matrix(A_ref,A,_size); + Interface::copy_vector(B_ref,B,_size); + Interface::copy_vector(X_ref,X,_size); + } + + BTL_DONT_INLINE void calculate( void ) { + BTL_ASM_COMMENT("#begin syr2"); + Interface::syr2(A,B,X,_size); + BTL_ASM_COMMENT("end syr2"); + } + + BTL_DONT_INLINE void check_result( void ){ + // calculation check + Interface::vector_to_stl(X,resu_stl); + + STL_interface::syr2(A_stl,B_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-3){ + INFOS("WRONG CALCULATION...residual=" << error); +// exit(0); + } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_vector B_stl; + typename Interface::stl_vector X_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_vector B_ref; + typename Interface::gene_vector X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_vector B; + typename Interface::gene_vector X; + + + int _size; + +}; + + +#endif diff --git a/simulation/externals/eigen/bench/btl/actions/action_trisolve.hh b/simulation/externals/eigen/bench/btl/actions/action_trisolve.hh new file mode 100644 index 0000000..d6f0b47 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_trisolve.hh @@ -0,0 +1,137 @@ +//===================================================== +// File : action_trisolve.hh +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_TRISOLVE +#define ACTION_TRISOLVE +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_trisolve { + +public : + + // Ctor + + Action_trisolve( int size ):_size(size) + { + MESSAGE("Action_trisolve Ctor"); + + // STL vector initialization + init_matrix(L_stl,_size); + init_vector(B_stl,_size); + init_vector(X_stl,_size); + for (int j=0; j<_size; ++j) + { + for (int i=0; i(resu_stl,_size); + + // generic matrix and vector initialization + Interface::matrix_from_stl(L,L_stl); + Interface::vector_from_stl(X,X_stl); + Interface::vector_from_stl(B,B_stl); + + _cost = 0; + for (int j=0; j<_size; ++j) + { + _cost += 2*j + 1; + } + } + + // invalidate copy ctor + + Action_trisolve( const Action_trisolve & ) + { + INFOS("illegal call to Action_trisolve Copy Ctor"); + exit(1); + } + + // Dtor + + ~Action_trisolve( void ){ + + MESSAGE("Action_trisolve Dtor"); + + // deallocation + Interface::free_matrix(L,_size); + Interface::free_vector(B); + Interface::free_vector(X); + } + + // action name + + static inline std::string name( void ) + { + return "trisolve_vector_"+Interface::name(); + } + + double nb_op_base( void ){ + return _cost; + } + + inline void initialize( void ){ + //Interface::copy_vector(X_ref,X,_size); + } + + inline void calculate( void ) { + Interface::trisolve_lower(L,B,X,_size); + } + + void check_result(){ + if (_size>128) return; + // calculation check + Interface::vector_to_stl(X,resu_stl); + + STL_interface::trisolve_lower(L_stl,B_stl,X_stl,_size); + + typename Interface::real_type error= + STL_interface::norm_diff(X_stl,resu_stl); + + if (error>1.e-4){ + INFOS("WRONG CALCULATION...residual=" << error); + exit(2); + } //else INFOS("CALCULATION OK...residual=" << error); + + } + +private : + + typename Interface::stl_matrix L_stl; + typename Interface::stl_vector X_stl; + typename Interface::stl_vector B_stl; + typename Interface::stl_vector resu_stl; + + typename Interface::gene_matrix L; + typename Interface::gene_vector X; + typename Interface::gene_vector B; + + int _size; + double _cost; +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/actions/action_trisolve_matrix.hh b/simulation/externals/eigen/bench/btl/actions/action_trisolve_matrix.hh new file mode 100644 index 0000000..0fc2bb9 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_trisolve_matrix.hh @@ -0,0 +1,165 @@ +//===================================================== +// File : action_matrix_matrix_product.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_TRISOLVE_MATRIX_PRODUCT +#define ACTION_TRISOLVE_MATRIX_PRODUCT +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_trisolve_matrix { + +public : + + // Ctor + + Action_trisolve_matrix( int size ):_size(size) + { + MESSAGE("Action_trisolve_matrix Ctor"); + + // STL matrix and vector initialization + + init_matrix(A_stl,_size); + init_matrix(B_stl,_size); + init_matrix(X_stl,_size); + init_matrix(resu_stl,_size); + + for (int j=0; j<_size; ++j) + { + for (int i=0; i::matrix_matrix_product(A_stl,B_stl,X_stl,_size); +// +// typename Interface::real_type error= +// STL_interface::norm_diff(X_stl,resu_stl); +// +// if (error>1.e-6){ +// INFOS("WRONG CALCULATION...residual=" << error); +// // exit(1); +// } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_matrix B_stl; + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_matrix B_ref; + typename Interface::gene_matrix X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_matrix B; + typename Interface::gene_matrix X; + + int _size; + double _cost; + +}; + + +#endif + + + diff --git a/simulation/externals/eigen/bench/btl/actions/action_trmm.hh b/simulation/externals/eigen/bench/btl/actions/action_trmm.hh new file mode 100644 index 0000000..8f78138 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/action_trmm.hh @@ -0,0 +1,165 @@ +//===================================================== +// File : action_matrix_matrix_product.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef ACTION_TRMM +#define ACTION_TRMM +#include "utilities.h" +#include "STL_interface.hh" +#include +#include "init/init_function.hh" +#include "init/init_vector.hh" +#include "init/init_matrix.hh" + +using namespace std; + +template +class Action_trmm { + +public : + + // Ctor + + Action_trmm( int size ):_size(size) + { + MESSAGE("Action_trmm Ctor"); + + // STL matrix and vector initialization + + init_matrix(A_stl,_size); + init_matrix(B_stl,_size); + init_matrix(X_stl,_size); + init_matrix(resu_stl,_size); + + for (int j=0; j<_size; ++j) + { + for (int i=0; i::matrix_matrix_product(A_stl,B_stl,X_stl,_size); +// +// typename Interface::real_type error= +// STL_interface::norm_diff(X_stl,resu_stl); +// +// if (error>1.e-6){ +// INFOS("WRONG CALCULATION...residual=" << error); +// // exit(1); +// } + + } + +private : + + typename Interface::stl_matrix A_stl; + typename Interface::stl_matrix B_stl; + typename Interface::stl_matrix X_stl; + typename Interface::stl_matrix resu_stl; + + typename Interface::gene_matrix A_ref; + typename Interface::gene_matrix B_ref; + typename Interface::gene_matrix X_ref; + + typename Interface::gene_matrix A; + typename Interface::gene_matrix B; + typename Interface::gene_matrix X; + + int _size; + double _cost; + +}; + + +#endif + + + diff --git a/simulation/externals/eigen/bench/btl/actions/basic_actions.hh b/simulation/externals/eigen/bench/btl/actions/basic_actions.hh new file mode 100644 index 0000000..a3333ea --- /dev/null +++ b/simulation/externals/eigen/bench/btl/actions/basic_actions.hh @@ -0,0 +1,21 @@ + +#include "action_axpy.hh" +#include "action_axpby.hh" + +#include "action_matrix_vector_product.hh" +#include "action_atv_product.hh" + +#include "action_matrix_matrix_product.hh" +// #include "action_ata_product.hh" +#include "action_aat_product.hh" + +#include "action_trisolve.hh" +#include "action_trmm.hh" +#include "action_symv.hh" +// #include "action_symm.hh" +#include "action_syr2.hh" +#include "action_ger.hh" +#include "action_rot.hh" + +// #include "action_lu_solve.hh" + diff --git a/simulation/externals/eigen/bench/btl/cmake/FindACML.cmake b/simulation/externals/eigen/bench/btl/cmake/FindACML.cmake new file mode 100644 index 0000000..4989fa2 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/cmake/FindACML.cmake @@ -0,0 +1,51 @@ + +if (ACML_LIBRARIES) + set(ACML_FIND_QUIETLY TRUE) +endif (ACML_LIBRARIES) + +find_library(ACML_LIBRARIES + NAMES + acml_mp acml_mv + PATHS + $ENV{ACMLDIR}/lib + $ENV{ACML_DIR}/lib + ${LIB_INSTALL_DIR} +) + +find_file(ACML_LIBRARIES + NAMES + libacml_mp.so + PATHS + /usr/lib + /usr/lib64 + $ENV{ACMLDIR}/lib + ${LIB_INSTALL_DIR} +) + +if(NOT ACML_LIBRARIES) + message(STATUS "Multi-threaded library not found, looking for single-threaded") + find_library(ACML_LIBRARIES + NAMES + acml acml_mv + PATHS + $ENV{ACMLDIR}/lib + $ENV{ACML_DIR}/lib + ${LIB_INSTALL_DIR} + ) + find_file(ACML_LIBRARIES + libacml.so libacml_mv.so + PATHS + /usr/lib + /usr/lib64 + $ENV{ACMLDIR}/lib + ${LIB_INSTALL_DIR} + ) +endif() + + + + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ACML DEFAULT_MSG ACML_LIBRARIES) + +mark_as_advanced(ACML_LIBRARIES) diff --git a/simulation/externals/eigen/bench/btl/cmake/FindATLAS.cmake b/simulation/externals/eigen/bench/btl/cmake/FindATLAS.cmake new file mode 100644 index 0000000..4136a98 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/cmake/FindATLAS.cmake @@ -0,0 +1,31 @@ + +if (ATLAS_LIBRARIES) + set(ATLAS_FIND_QUIETLY TRUE) +endif (ATLAS_LIBRARIES) + +find_file(ATLAS_LIB libatlas.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) +find_library(ATLAS_LIB satlas PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) + +find_file(ATLAS_LAPACK NAMES liblapack_atlas.so.3 liblapack.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) +find_library(ATLAS_LAPACK NAMES lapack_atlas lapack PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) + +find_file(ATLAS_F77BLAS libf77blas.so.3 PATHS /usr/lib /usr/lib/atlas /usr/lib64 /usr/lib64/atlas $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) +find_library(ATLAS_F77BLAS f77blas PATHS $ENV{ATLASDIR} ${LIB_INSTALL_DIR}) + +if(ATLAS_LIB AND ATLAS_CBLAS AND ATLAS_LAPACK AND ATLAS_F77BLAS) + + set(ATLAS_LIBRARIES ${ATLAS_LAPACK} ${ATLAS_LIB}) + + # search the default lapack lib link to it + find_file(ATLAS_REFERENCE_LAPACK liblapack.so.3 PATHS /usr/lib /usr/lib64) + find_library(ATLAS_REFERENCE_LAPACK NAMES lapack) +# if(ATLAS_REFERENCE_LAPACK) +# set(ATLAS_LIBRARIES ${ATLAS_LIBRARIES} ${ATLAS_REFERENCE_LAPACK}) +# endif() + +endif(ATLAS_LIB AND ATLAS_CBLAS AND ATLAS_LAPACK AND ATLAS_F77BLAS) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(ATLAS DEFAULT_MSG ATLAS_LIBRARIES) + +mark_as_advanced(ATLAS_LIBRARIES) diff --git a/simulation/externals/eigen/bench/btl/cmake/FindBLAZE.cmake b/simulation/externals/eigen/bench/btl/cmake/FindBLAZE.cmake new file mode 100644 index 0000000..dba4c89 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/cmake/FindBLAZE.cmake @@ -0,0 +1,31 @@ +# - Try to find eigen2 headers +# Once done this will define +# +# BLAZE_FOUND - system has blaze lib +# BLAZE_INCLUDE_DIR - the blaze include directory +# +# Copyright (C) 2008 Gael Guennebaud +# Adapted from FindEigen.cmake: +# Copyright (c) 2006, 2007 Montel Laurent, +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (BLAZE_INCLUDE_DIR) + + # in cache already + set(BLAZE_FOUND TRUE) + +else (BLAZE_INCLUDE_DIR) + +find_path(BLAZE_INCLUDE_DIR NAMES blaze/Blaze.h + PATHS + ${INCLUDE_INSTALL_DIR} + ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(BLAZE DEFAULT_MSG BLAZE_INCLUDE_DIR) + +mark_as_advanced(BLAZE_INCLUDE_DIR) + +endif(BLAZE_INCLUDE_DIR) + diff --git a/simulation/externals/eigen/bench/btl/cmake/FindBlitz.cmake b/simulation/externals/eigen/bench/btl/cmake/FindBlitz.cmake new file mode 100644 index 0000000..92880bb --- /dev/null +++ b/simulation/externals/eigen/bench/btl/cmake/FindBlitz.cmake @@ -0,0 +1,40 @@ +# - Try to find blitz lib +# Once done this will define +# +# BLITZ_FOUND - system has blitz lib +# BLITZ_INCLUDES - the blitz include directory +# BLITZ_LIBRARIES - The libraries needed to use blitz + +# Copyright (c) 2006, Montel Laurent, +# Copyright (c) 2007, Allen Winter, +# Copyright (C) 2008 Gael Guennebaud +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +# include(FindLibraryWithDebug) + +if (BLITZ_INCLUDES AND BLITZ_LIBRARIES) + set(Blitz_FIND_QUIETLY TRUE) +endif (BLITZ_INCLUDES AND BLITZ_LIBRARIES) + +find_path(BLITZ_INCLUDES + NAMES + blitz/array.h + PATH_SUFFIXES blitz* + PATHS + $ENV{BLITZDIR}/include + ${INCLUDE_INSTALL_DIR} +) + +find_library(BLITZ_LIBRARIES + blitz + PATHS + $ENV{BLITZDIR}/lib + ${LIB_INSTALL_DIR} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Blitz DEFAULT_MSG + BLITZ_INCLUDES BLITZ_LIBRARIES) + +mark_as_advanced(BLITZ_INCLUDES BLITZ_LIBRARIES) diff --git a/simulation/externals/eigen/bench/btl/cmake/FindCBLAS.cmake b/simulation/externals/eigen/bench/btl/cmake/FindCBLAS.cmake new file mode 100644 index 0000000..ce0f2f2 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/cmake/FindCBLAS.cmake @@ -0,0 +1,35 @@ +# include(FindLibraryWithDebug) + +if (CBLAS_INCLUDES AND CBLAS_LIBRARIES) + set(CBLAS_FIND_QUIETLY TRUE) +endif (CBLAS_INCLUDES AND CBLAS_LIBRARIES) + +find_path(CBLAS_INCLUDES + NAMES + cblas.h + PATHS + $ENV{CBLASDIR}/include + ${INCLUDE_INSTALL_DIR} +) + +find_library(CBLAS_LIBRARIES + cblas + PATHS + $ENV{CBLASDIR}/lib + ${LIB_INSTALL_DIR} +) + +find_file(CBLAS_LIBRARIES + libcblas.so.3 + PATHS + /usr/lib + /usr/lib64 + $ENV{CBLASDIR}/lib + ${LIB_INSTALL_DIR} +) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CBLAS DEFAULT_MSG + CBLAS_INCLUDES CBLAS_LIBRARIES) + +mark_as_advanced(CBLAS_INCLUDES CBLAS_LIBRARIES) diff --git a/simulation/externals/eigen/bench/btl/cmake/FindGMM.cmake b/simulation/externals/eigen/bench/btl/cmake/FindGMM.cmake new file mode 100644 index 0000000..5049c64 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/cmake/FindGMM.cmake @@ -0,0 +1,17 @@ +if (GMM_INCLUDE_DIR) + # in cache already + set(GMM_FOUND TRUE) +else (GMM_INCLUDE_DIR) + +find_path(GMM_INCLUDE_DIR NAMES gmm/gmm.h + PATHS + ${INCLUDE_INSTALL_DIR} + ${GMM_INCLUDE_PATH} + ) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GMM DEFAULT_MSG GMM_INCLUDE_DIR ) + +mark_as_advanced(GMM_INCLUDE_DIR) + +endif(GMM_INCLUDE_DIR) diff --git a/simulation/externals/eigen/bench/btl/cmake/FindMKL.cmake b/simulation/externals/eigen/bench/btl/cmake/FindMKL.cmake new file mode 100644 index 0000000..f4d7c6e --- /dev/null +++ b/simulation/externals/eigen/bench/btl/cmake/FindMKL.cmake @@ -0,0 +1,65 @@ + +if (MKL_LIBRARIES) + set(MKL_FIND_QUIETLY TRUE) +endif (MKL_LIBRARIES) + +if(CMAKE_MINOR_VERSION GREATER 4) + +if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64") + +find_library(MKL_LIBRARIES + mkl_core + PATHS + $ENV{MKLLIB} + /opt/intel/mkl/*/lib/em64t + /opt/intel/Compiler/*/*/mkl/lib/em64t + ${LIB_INSTALL_DIR} +) + +find_library(MKL_GUIDE + guide + PATHS + $ENV{MKLLIB} + /opt/intel/mkl/*/lib/em64t + /opt/intel/Compiler/*/*/mkl/lib/em64t + /opt/intel/Compiler/*/*/lib/intel64 + ${LIB_INSTALL_DIR} +) + +if(MKL_LIBRARIES AND MKL_GUIDE) + set(MKL_LIBRARIES ${MKL_LIBRARIES} mkl_intel_lp64 mkl_sequential ${MKL_GUIDE} pthread) +endif() + +else(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64") + +find_library(MKL_LIBRARIES + mkl_core + PATHS + $ENV{MKLLIB} + /opt/intel/mkl/*/lib/32 + /opt/intel/Compiler/*/*/mkl/lib/32 + ${LIB_INSTALL_DIR} +) + +find_library(MKL_GUIDE + guide + PATHS + $ENV{MKLLIB} + /opt/intel/mkl/*/lib/32 + /opt/intel/Compiler/*/*/mkl/lib/32 + /opt/intel/Compiler/*/*/lib/intel32 + ${LIB_INSTALL_DIR} +) + +if(MKL_LIBRARIES AND MKL_GUIDE) + set(MKL_LIBRARIES ${MKL_LIBRARIES} mkl_intel mkl_sequential ${MKL_GUIDE} pthread) +endif() + +endif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "x86_64") + +endif(CMAKE_MINOR_VERSION GREATER 4) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MKL DEFAULT_MSG MKL_LIBRARIES) + +mark_as_advanced(MKL_LIBRARIES) diff --git a/simulation/externals/eigen/bench/btl/cmake/FindMTL4.cmake b/simulation/externals/eigen/bench/btl/cmake/FindMTL4.cmake new file mode 100644 index 0000000..3de4909 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/cmake/FindMTL4.cmake @@ -0,0 +1,31 @@ +# - Try to find eigen2 headers +# Once done this will define +# +# MTL4_FOUND - system has eigen2 lib +# MTL4_INCLUDE_DIR - the eigen2 include directory +# +# Copyright (C) 2008 Gael Guennebaud +# Adapted from FindEigen.cmake: +# Copyright (c) 2006, 2007 Montel Laurent, +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (MTL4_INCLUDE_DIR) + + # in cache already + set(MTL4_FOUND TRUE) + +else (MTL4_INCLUDE_DIR) + +find_path(MTL4_INCLUDE_DIR NAMES boost/numeric/mtl/mtl.hpp + PATHS + ${INCLUDE_INSTALL_DIR} + ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(MTL4 DEFAULT_MSG MTL4_INCLUDE_DIR) + +mark_as_advanced(MTL4_INCLUDE_DIR) + +endif(MTL4_INCLUDE_DIR) + diff --git a/simulation/externals/eigen/bench/btl/cmake/FindOPENBLAS.cmake b/simulation/externals/eigen/bench/btl/cmake/FindOPENBLAS.cmake new file mode 100644 index 0000000..2a09194 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/cmake/FindOPENBLAS.cmake @@ -0,0 +1,17 @@ + +if (OPENBLAS_LIBRARIES) + set(OPENBLAS_FIND_QUIETLY TRUE) +endif (OPENBLAS_LIBRARIES) + +find_file(OPENBLAS_LIBRARIES NAMES libopenblas.so libopenblas.so.0 PATHS /usr/lib /usr/lib64 $ENV{OPENBLASDIR} ${LIB_INSTALL_DIR}) +find_library(OPENBLAS_LIBRARIES openblas PATHS $ENV{OPENBLASDIR} ${LIB_INSTALL_DIR}) + +if(OPENBLAS_LIBRARIES AND CMAKE_COMPILER_IS_GNUCXX) + set(OPENBLAS_LIBRARIES ${OPENBLAS_LIBRARIES} "-lpthread -lgfortran") +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(OPENBLAS DEFAULT_MSG + OPENBLAS_LIBRARIES) + +mark_as_advanced(OPENBLAS_LIBRARIES) diff --git a/simulation/externals/eigen/bench/btl/cmake/FindPackageHandleStandardArgs.cmake b/simulation/externals/eigen/bench/btl/cmake/FindPackageHandleStandardArgs.cmake new file mode 100644 index 0000000..7f122ed --- /dev/null +++ b/simulation/externals/eigen/bench/btl/cmake/FindPackageHandleStandardArgs.cmake @@ -0,0 +1,60 @@ +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... ) +# +# This macro is intended to be used in FindXXX.cmake modules files. +# It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and +# it also sets the _FOUND variable. +# The package is found if all variables listed are TRUE. +# Example: +# +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR) +# +# LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and +# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE. +# If it is not found and REQUIRED was used, it fails with FATAL_ERROR, +# independent whether QUIET was used or not. +# +# If it is found, the location is reported using the VAR1 argument, so +# here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out. +# If the second argument is DEFAULT_MSG, the message in the failure case will +# be "Could NOT find LibXml2", if you don't like this message you can specify +# your own custom failure message there. + +MACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 ) + + IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + IF (${_NAME}_FIND_REQUIRED) + SET(_FAIL_MESSAGE "Could not find REQUIRED package ${_NAME}") + ELSE (${_NAME}_FIND_REQUIRED) + SET(_FAIL_MESSAGE "Could not find OPTIONAL package ${_NAME}") + ENDIF (${_NAME}_FIND_REQUIRED) + ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + SET(_FAIL_MESSAGE "${_FAIL_MSG}") + ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG") + + STRING(TOUPPER ${_NAME} _NAME_UPPER) + + SET(${_NAME_UPPER}_FOUND TRUE) + IF(NOT ${_VAR1}) + SET(${_NAME_UPPER}_FOUND FALSE) + ENDIF(NOT ${_VAR1}) + + FOREACH(_CURRENT_VAR ${ARGN}) + IF(NOT ${_CURRENT_VAR}) + SET(${_NAME_UPPER}_FOUND FALSE) + ENDIF(NOT ${_CURRENT_VAR}) + ENDFOREACH(_CURRENT_VAR) + + IF (${_NAME_UPPER}_FOUND) + IF (NOT ${_NAME}_FIND_QUIETLY) + MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}") + ENDIF (NOT ${_NAME}_FIND_QUIETLY) + ELSE (${_NAME_UPPER}_FOUND) + IF (${_NAME}_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}") + ELSE (${_NAME}_FIND_REQUIRED) + IF (NOT ${_NAME}_FIND_QUIETLY) + MESSAGE(STATUS "${_FAIL_MESSAGE}") + ENDIF (NOT ${_NAME}_FIND_QUIETLY) + ENDIF (${_NAME}_FIND_REQUIRED) + ENDIF (${_NAME_UPPER}_FOUND) +ENDMACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS) diff --git a/simulation/externals/eigen/bench/btl/cmake/FindTvmet.cmake b/simulation/externals/eigen/bench/btl/cmake/FindTvmet.cmake new file mode 100644 index 0000000..26a29d9 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/cmake/FindTvmet.cmake @@ -0,0 +1,32 @@ +# - Try to find tvmet headers +# Once done this will define +# +# TVMET_FOUND - system has tvmet lib +# TVMET_INCLUDE_DIR - the tvmet include directory +# +# Copyright (C) 2008 Gael Guennebaud +# Adapted from FindEigen.cmake: +# Copyright (c) 2006, 2007 Montel Laurent, +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (TVMET_INCLUDE_DIR) + + # in cache already + set(TVMET_FOUND TRUE) + +else (TVMET_INCLUDE_DIR) + +find_path(TVMET_INCLUDE_DIR NAMES tvmet/tvmet.h + PATHS + ${TVMETDIR}/ + ${INCLUDE_INSTALL_DIR} + ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Tvmet DEFAULT_MSG TVMET_INCLUDE_DIR) + +mark_as_advanced(TVMET_INCLUDE_DIR) + +endif(TVMET_INCLUDE_DIR) + diff --git a/simulation/externals/eigen/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake b/simulation/externals/eigen/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake new file mode 100644 index 0000000..545048b --- /dev/null +++ b/simulation/externals/eigen/bench/btl/cmake/MacroOptionalAddSubdirectory.cmake @@ -0,0 +1,31 @@ +# - MACRO_OPTIONAL_ADD_SUBDIRECTORY() combines ADD_SUBDIRECTORY() with an OPTION() +# MACRO_OPTIONAL_ADD_SUBDIRECTORY( ) +# If you use MACRO_OPTIONAL_ADD_SUBDIRECTORY() instead of ADD_SUBDIRECTORY(), +# this will have two effects +# 1 - CMake will not complain if the directory doesn't exist +# This makes sense if you want to distribute just one of the subdirs +# in a source package, e.g. just one of the subdirs in kdeextragear. +# 2 - If the directory exists, it will offer an option to skip the +# subdirectory. +# This is useful if you want to compile only a subset of all +# directories. + +# Copyright (c) 2007, Alexander Neundorf, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +MACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY _dir ) + GET_FILENAME_COMPONENT(_fullPath ${_dir} ABSOLUTE) + IF(EXISTS ${_fullPath}) + IF(${ARGC} EQUAL 2) + OPTION(BUILD_${_dir} "Build directory ${_dir}" ${ARGV1}) + ELSE(${ARGC} EQUAL 2) + OPTION(BUILD_${_dir} "Build directory ${_dir}" TRUE) + ENDIF(${ARGC} EQUAL 2) + IF(BUILD_${_dir}) + ADD_SUBDIRECTORY(${_dir}) + ENDIF(BUILD_${_dir}) + ENDIF(EXISTS ${_fullPath}) +ENDMACRO (MACRO_OPTIONAL_ADD_SUBDIRECTORY) diff --git a/simulation/externals/eigen/bench/btl/data/CMakeLists.txt b/simulation/externals/eigen/bench/btl/data/CMakeLists.txt new file mode 100644 index 0000000..6af2a36 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/data/CMakeLists.txt @@ -0,0 +1,32 @@ + +ADD_CUSTOM_TARGET(copy_scripts) + +SET(script_files go_mean mk_mean_script.sh mk_new_gnuplot.sh + perlib_plot_settings.txt action_settings.txt gnuplot_common_settings.hh ) + +FOREACH(script_file ${script_files}) +ADD_CUSTOM_COMMAND( + TARGET copy_scripts + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${script_file} ${CMAKE_CURRENT_BINARY_DIR}/ + ARGS +) +ENDFOREACH(script_file) + +ADD_CUSTOM_COMMAND( + TARGET copy_scripts + POST_BUILD + COMMAND ${CMAKE_CXX_COMPILER} --version | head -n 1 > ${CMAKE_CURRENT_BINARY_DIR}/compiler_version.txt + ARGS +) +ADD_CUSTOM_COMMAND( + TARGET copy_scripts + POST_BUILD + COMMAND echo "${Eigen_SOURCE_DIR}" > ${CMAKE_CURRENT_BINARY_DIR}/eigen_root_dir.txt + ARGS +) + +add_executable(smooth smooth.cxx) +add_executable(regularize regularize.cxx) +add_executable(main mean.cxx) +add_dependencies(main copy_scripts) diff --git a/simulation/externals/eigen/bench/btl/data/action_settings.txt b/simulation/externals/eigen/bench/btl/data/action_settings.txt new file mode 100644 index 0000000..39d2b5d --- /dev/null +++ b/simulation/externals/eigen/bench/btl/data/action_settings.txt @@ -0,0 +1,19 @@ +aat ; "{/*1.5 A x A^T}" ; "matrix size" ; 4:5000 +ata ; "{/*1.5 A^T x A}" ; "matrix size" ; 4:5000 +atv ; "{/*1.5 matrix^T x vector}" ; "matrix size" ; 4:5000 +axpby ; "{/*1.5 Y = alpha X + beta Y}" ; "vector size" ; 5:1000000 +axpy ; "{/*1.5 Y += alpha X}" ; "vector size" ; 5:1000000 +matrix_matrix ; "{/*1.5 matrix matrix product}" ; "matrix size" ; 4:5000 +matrix_vector ; "{/*1.5 matrix vector product}" ; "matrix size" ; 4:5000 +trmm ; "{/*1.5 triangular matrix matrix product}" ; "matrix size" ; 4:5000 +trisolve_vector ; "{/*1.5 triangular solver - vector (X = inv(L) X)}" ; "size" ; 4:5000 +trisolve_matrix ; "{/*1.5 triangular solver - matrix (M = inv(L) M)}" ; "size" ; 4:5000 +cholesky ; "{/*1.5 Cholesky decomposition}" ; "matrix size" ; 4:5000 +complete_lu_decomp ; "{/*1.5 Complete LU decomposition}" ; "matrix size" ; 4:5000 +partial_lu_decomp ; "{/*1.5 Partial LU decomposition}" ; "matrix size" ; 4:5000 +tridiagonalization ; "{/*1.5 Tridiagonalization}" ; "matrix size" ; 4:5000 +hessenberg ; "{/*1.5 Hessenberg decomposition}" ; "matrix size" ; 4:5000 +symv ; "{/*1.5 symmetric matrix vector product}" ; "matrix size" ; 4:5000 +syr2 ; "{/*1.5 symmretric rank-2 update (A += u^T v + u v^T)}" ; "matrix size" ; 4:5000 +ger ; "{/*1.5 general rank-1 update (A += u v^T)}" ; "matrix size" ; 4:5000 +rot ; "{/*1.5 apply rotation in the plane}" ; "vector size" ; 4:1000000 diff --git a/simulation/externals/eigen/bench/btl/data/gnuplot_common_settings.hh b/simulation/externals/eigen/bench/btl/data/gnuplot_common_settings.hh new file mode 100644 index 0000000..6f677df --- /dev/null +++ b/simulation/externals/eigen/bench/btl/data/gnuplot_common_settings.hh @@ -0,0 +1,87 @@ +set noclip points +set clip one +set noclip two +set bar 1.000000 +set border 31 lt -1 lw 1.000 +set xdata +set ydata +set zdata +set x2data +set y2data +set boxwidth +set dummy x,y +set format x "%g" +set format y "%g" +set format x2 "%g" +set format y2 "%g" +set format z "%g" +set angles radians +set nogrid +set key title "" +set key left top Right noreverse box linetype -2 linewidth 1.000 samplen 4 spacing 1 width 0 +set nolabel +set noarrow +# set nolinestyle # deprecated +set nologscale +set logscale x 10 +set offsets 0, 0, 0, 0 +set pointsize 1 +set encoding default +set nopolar +set noparametric +set view 60, 30, 1, 1 +set samples 100, 100 +set isosamples 10, 10 +set surface +set nocontour +set clabel '%8.3g' +set mapping cartesian +set nohidden3d +set cntrparam order 4 +set cntrparam linear +set cntrparam levels auto 5 +set cntrparam points 5 +set size ratio 0 1,1 +set origin 0,0 +# set data style lines +# set function style lines +set xzeroaxis lt -2 lw 1.000 +set x2zeroaxis lt -2 lw 1.000 +set yzeroaxis lt -2 lw 1.000 +set y2zeroaxis lt -2 lw 1.000 +set tics in +set ticslevel 0.5 +set tics scale 1, 0.5 +set mxtics default +set mytics default +set mx2tics default +set my2tics default +set xtics border mirror norotate autofreq +set ytics border mirror norotate autofreq +set ztics border nomirror norotate autofreq +set nox2tics +set noy2tics +set timestamp "" bottom norotate offset 0,0 +set rrange [ * : * ] noreverse nowriteback # (currently [-0:10] ) +set trange [ * : * ] noreverse nowriteback # (currently [-5:5] ) +set urange [ * : * ] noreverse nowriteback # (currently [-5:5] ) +set vrange [ * : * ] noreverse nowriteback # (currently [-5:5] ) +set xlabel "matrix size" offset 0,0 +set x2label "" offset 0,0 +set timefmt "%d/%m/%y\n%H:%M" +set xrange [ 10 : 1000 ] noreverse nowriteback +set x2range [ * : * ] noreverse nowriteback # (currently [-10:10] ) +set ylabel "MFLOPS" offset 0,0 +set y2label "" offset 0,0 +set yrange [ * : * ] noreverse nowriteback # (currently [-10:10] ) +set y2range [ * : * ] noreverse nowriteback # (currently [-10:10] ) +set zlabel "" offset 0,0 +set zrange [ * : * ] noreverse nowriteback # (currently [-10:10] ) +set zero 1e-08 +set lmargin -1 +set bmargin -1 +set rmargin -1 +set tmargin -1 +set locale "C" +set xrange [4:1024] + diff --git a/simulation/externals/eigen/bench/btl/data/go_mean b/simulation/externals/eigen/bench/btl/data/go_mean new file mode 100644 index 0000000..42338ca --- /dev/null +++ b/simulation/externals/eigen/bench/btl/data/go_mean @@ -0,0 +1,58 @@ +#!/bin/bash + +if [ $# < 1 ]; then + echo "Usage: $0 working_directory [tiny|large [prefix]]" +else + +mkdir -p $1 +##cp ../libs/*/*.dat $1 + +mode=large +if [ $# > 2 ]; then + mode=$2 +fi +if [ $# > 3 ]; then + prefix=$3 +fi + +EIGENDIR=`cat eigen_root_dir.txt` + +webpagefilename=$1/index.html +meanstatsfilename=$1/mean.html + +echo '' > $meanstatsfilename +echo '' > $webpagefilename +echo '

Configuration' >> $webpagefilename +echo '

    '\ + '
  • ' `cat /proc/cpuinfo | grep "model name" | head -n 1`\ + ' (' `uname -m` ')
  • '\ + '
  • compiler: ' `cat compiler_version.txt` '
  • '\ + '
  • eigen3: ' `hg identify -i $EIGENDIR` '
  • '\ + '
' \ + '

' >> $webpagefilename + +source mk_mean_script.sh axpy $1 11 2500 100000 250000 $mode $prefix +source mk_mean_script.sh axpby $1 11 2500 100000 250000 $mode $prefix +source mk_mean_script.sh matrix_vector $1 11 50 300 1000 $mode $prefix +source mk_mean_script.sh atv $1 11 50 300 1000 $mode $prefix +source mk_mean_script.sh matrix_matrix $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh aat $1 11 100 300 1000 $mode $prefix +# source mk_mean_script.sh ata $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh trmm $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh trisolve_vector $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh trisolve_matrix $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh cholesky $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh partial_lu_decomp $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh tridiagonalization $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh hessenberg $1 11 100 300 1000 $mode $prefix +source mk_mean_script.sh symv $1 11 50 300 1000 $mode $prefix +source mk_mean_script.sh syr2 $1 11 50 300 1000 $mode $prefix +source mk_mean_script.sh ger $1 11 50 300 1000 $mode $prefix +source mk_mean_script.sh rot $1 11 2500 100000 250000 $mode $prefix +source mk_mean_script.sh complete_lu_decomp $1 11 100 300 1000 $mode $prefix + +fi + +## compile the web page ## + +#echo `cat footer.html` >> $webpagefilename \ No newline at end of file diff --git a/simulation/externals/eigen/bench/btl/data/mean.cxx b/simulation/externals/eigen/bench/btl/data/mean.cxx new file mode 100644 index 0000000..c567ef3 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/data/mean.cxx @@ -0,0 +1,182 @@ +//===================================================== +// File : mean.cxx +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:15 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include +#include +#include +#include +#include "bench_parameter.hh" +#include "utils/xy_file.hh" +#include + +using namespace std; + +double mean_calc(const vector & tab_sizes, const vector & tab_mflops, const int size_min, const int size_max); + +class Lib_Mean{ + +public: + Lib_Mean( void ):_lib_name(),_mean_in_cache(),_mean_out_of_cache(){ + MESSAGE("Lib_mean Default Ctor"); + MESSAGE("!!! should not be used"); + exit(0); + } + Lib_Mean(const string & name, const double & mic, const double & moc):_lib_name(name),_mean_in_cache(mic),_mean_out_of_cache(moc){ + MESSAGE("Lib_mean Ctor"); + } + Lib_Mean(const Lib_Mean & lm):_lib_name(lm._lib_name),_mean_in_cache(lm._mean_in_cache),_mean_out_of_cache(lm._mean_out_of_cache){ + MESSAGE("Lib_mean Copy Ctor"); + } + ~Lib_Mean( void ){ + MESSAGE("Lib_mean Dtor"); + } + + double _mean_in_cache; + double _mean_out_of_cache; + string _lib_name; + + bool operator < ( const Lib_Mean &right) const + { + //return ( this->_mean_out_of_cache > right._mean_out_of_cache) ; + return ( this->_mean_in_cache > right._mean_in_cache) ; + } + +}; + + +int main( int argc , char *argv[] ) +{ + + if (argc<6){ + INFOS("!!! Error ... usage : main what mic Mic moc Moc filename1 finename2..."); + exit(0); + } + INFOS(argc); + + int min_in_cache=atoi(argv[2]); + int max_in_cache=atoi(argv[3]); + int min_out_of_cache=atoi(argv[4]); + int max_out_of_cache=atoi(argv[5]); + + + multiset s_lib_mean ; + + for (int i=6;i tab_sizes; + vector tab_mflops; + + read_xy_file(filename,tab_sizes,tab_mflops); + + mic=mean_calc(tab_sizes,tab_mflops,min_in_cache,max_in_cache); + moc=mean_calc(tab_sizes,tab_mflops,min_out_of_cache,max_out_of_cache); + + Lib_Mean cur_lib_mean(filename,mic,moc); + + s_lib_mean.insert(cur_lib_mean); + + } + + } + + + cout << "" << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + + multiset::iterator is = s_lib_mean.begin(); + Lib_Mean best(*is); + + + for (is=s_lib_mean.begin(); is!=s_lib_mean.end() ; is++){ + + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + cout << " " << endl ; + + } + + cout << "
" << argv[1] << " in cache
mean perf
Mflops
in cache
% best
out of cache
mean perf
Mflops
out of cache
% best
details comments
" << is->_lib_name << " " << is->_mean_in_cache << " " << 100*(is->_mean_in_cache/best._mean_in_cache) << " " << is->_mean_out_of_cache << " " << 100*(is->_mean_out_of_cache/best._mean_out_of_cache) << " " << + "_lib_name<<"_"<snippet/" + "_lib_name<<"_flags\">flags " << + "_lib_name<<"_comments\">click here
" << endl ; + + ofstream output_file ("../order_lib",ios::out) ; + + for (is=s_lib_mean.begin(); is!=s_lib_mean.end() ; is++){ + output_file << is->_lib_name << endl ; + } + + output_file.close(); + +} + +double mean_calc(const vector & tab_sizes, const vector & tab_mflops, const int size_min, const int size_max){ + + int size=tab_sizes.size(); + int nb_sample=0; + double mean=0.0; + + for (int i=0;i=size_min)&&(tab_sizes[i]<=size_max)){ + + nb_sample++; + mean+=tab_mflops[i]; + + } + + + } + + if (nb_sample==0){ + INFOS("no data for mean calculation"); + return 0.0; + } + + return mean/nb_sample; +} + + + + diff --git a/simulation/externals/eigen/bench/btl/data/mk_gnuplot_script.sh b/simulation/externals/eigen/bench/btl/data/mk_gnuplot_script.sh new file mode 100644 index 0000000..2ca7b5c --- /dev/null +++ b/simulation/externals/eigen/bench/btl/data/mk_gnuplot_script.sh @@ -0,0 +1,68 @@ +#! /bin/bash +WHAT=$1 +DIR=$2 +echo $WHAT script generation +cat $WHAT.hh > $WHAT.gnuplot + +DATA_FILE=`find $DIR -name "*.dat" | grep $WHAT` + +echo plot \\ >> $WHAT.gnuplot + +for FILE in $DATA_FILE +do + LAST=$FILE +done + +echo LAST=$LAST + +for FILE in $DATA_FILE +do + if [ $FILE != $LAST ] + then + BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} + echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >> $WHAT.gnuplot + fi +done +BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} +echo "'"$LAST"'" title "'"$TITLE"'" >> $WHAT.gnuplot + +#echo set term postscript color >> $WHAT.gnuplot +#echo set output "'"$WHAT.ps"'" >> $WHAT.gnuplot +echo set term pbm small color >> $WHAT.gnuplot +echo set output "'"$WHAT.ppm"'" >> $WHAT.gnuplot +echo plot \\ >> $WHAT.gnuplot + +for FILE in $DATA_FILE +do + if [ $FILE != $LAST ] + then + BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} + echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >> $WHAT.gnuplot + fi +done +BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} +echo "'"$LAST"'" title "'"$TITLE"'" >> $WHAT.gnuplot + +echo set term jpeg large >> $WHAT.gnuplot +echo set output "'"$WHAT.jpg"'" >> $WHAT.gnuplot +echo plot \\ >> $WHAT.gnuplot + +for FILE in $DATA_FILE +do + if [ $FILE != $LAST ] + then + BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} + echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >> $WHAT.gnuplot + fi +done +BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} +echo "'"$LAST"'" title "'"$TITLE"'" >> $WHAT.gnuplot + + +gnuplot -persist < $WHAT.gnuplot + +rm $WHAT.gnuplot + + + + diff --git a/simulation/externals/eigen/bench/btl/data/mk_mean_script.sh b/simulation/externals/eigen/bench/btl/data/mk_mean_script.sh new file mode 100644 index 0000000..b10df02 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/data/mk_mean_script.sh @@ -0,0 +1,52 @@ +#! /bin/bash +WHAT=$1 +DIR=$2 +MINIC=$3 +MAXIC=$4 +MINOC=$5 +MAXOC=$6 +prefix=$8 + +meanstatsfilename=$2/mean.html + +WORK_DIR=tmp +mkdir $WORK_DIR + +DATA_FILE=`find $DIR -name "*.dat" | grep _${WHAT}` + +if [ -n "$DATA_FILE" ]; then + + echo "" + echo "$1..." + for FILE in $DATA_FILE + do + ##echo hello world + ##echo "mk_mean_script1" ${FILE} + BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} + + ##echo "mk_mean_script1" ${TITLE} + cp $FILE ${WORK_DIR}/${TITLE} + + done + + cd $WORK_DIR + ../main $1 $3 $4 $5 $6 * >> ../$meanstatsfilename + ../mk_new_gnuplot.sh $1 $2 $7 + rm -f *.gnuplot + cd .. + + echo '
' >> $meanstatsfilename + + webpagefilename=$2/index.html + # echo '

'${WHAT}'

' >> $webpagefilename + echo '
'${WHAT}'
' >> $webpagefilename + +fi + +rm -R $WORK_DIR + + + + + + diff --git a/simulation/externals/eigen/bench/btl/data/mk_new_gnuplot.sh b/simulation/externals/eigen/bench/btl/data/mk_new_gnuplot.sh new file mode 100644 index 0000000..fad3b23 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/data/mk_new_gnuplot.sh @@ -0,0 +1,54 @@ +#!/bin/bash +WHAT=$1 +DIR=$2 + +cat ../gnuplot_common_settings.hh > ${WHAT}.gnuplot + +echo "set title " `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 2` >> $WHAT.gnuplot +echo "set xlabel " `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 3` " offset 0,0" >> $WHAT.gnuplot +echo "set xrange [" `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 4` "]" >> $WHAT.gnuplot + +if [ $# > 3 ]; then + if [ "$3" == "tiny" ]; then + echo "set xrange [2:16]" >> $WHAT.gnuplot + echo "set nologscale" >> $WHAT.gnuplot + fi +fi + + + +DATA_FILE=`cat ../order_lib` +echo set term postscript color rounded enhanced >> $WHAT.gnuplot +echo set output "'"../${DIR}/$WHAT.ps"'" >> $WHAT.gnuplot + +# echo set term svg color rounded enhanced >> $WHAT.gnuplot +# echo "set terminal svg enhanced size 1000 1000 fname \"Times\" fsize 36" >> $WHAT.gnuplot +# echo set output "'"../${DIR}/$WHAT.svg"'" >> $WHAT.gnuplot + +echo plot \\ >> $WHAT.gnuplot + +for FILE in $DATA_FILE +do + LAST=$FILE +done + +for FILE in $DATA_FILE +do + BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat} + + echo "'"$FILE"'" `grep $TITLE ../perlib_plot_settings.txt | head -n 1 | cut -d ";" -f 2` "\\" >> $WHAT.gnuplot + if [ $FILE != $LAST ] + then + echo ", \\" >> $WHAT.gnuplot + fi +done +echo " " >> $WHAT.gnuplot + +gnuplot -persist < $WHAT.gnuplot + +rm $WHAT.gnuplot + +ps2pdf ../${DIR}/$WHAT.ps ../${DIR}/$WHAT.pdf +convert -background white -density 120 -rotate 90 -resize 800 +dither -colors 256 -quality 0 ../${DIR}/$WHAT.ps -background white -flatten ../${DIR}/$WHAT.png + +# pstoedit -rotate -90 -xscale 0.8 -yscale 0.8 -centered -yshift -50 -xshift -100 -f plot-svg aat.ps aat2.svg diff --git a/simulation/externals/eigen/bench/btl/data/perlib_plot_settings.txt b/simulation/externals/eigen/bench/btl/data/perlib_plot_settings.txt new file mode 100644 index 0000000..f023cfe --- /dev/null +++ b/simulation/externals/eigen/bench/btl/data/perlib_plot_settings.txt @@ -0,0 +1,16 @@ +eigen3 ; with lines lw 4 lt 1 lc rgbcolor "black" +eigen2 ; with lines lw 3 lt 1 lc rgbcolor "#999999" +EigenBLAS ; with lines lw 3 lt 3 lc rgbcolor "#999999" +eigen3_novec ; with lines lw 2 lt 1 lc rgbcolor "#999999" +eigen3_nogccvec ; with lines lw 2 lt 2 lc rgbcolor "#991010" +INTEL_MKL ; with lines lw 3 lt 1 lc rgbcolor "#ff0000" +ATLAS ; with lines lw 3 lt 1 lc rgbcolor "#008000" +gmm ; with lines lw 3 lt 1 lc rgbcolor "#0000ff" +ublas ; with lines lw 3 lt 1 lc rgbcolor "#00b7ff" +mtl4 ; with lines lw 3 lt 1 lc rgbcolor "#d18847" +blitz ; with lines lw 3 lt 1 lc rgbcolor "#ff00ff" +F77 ; with lines lw 3 lt 3 lc rgbcolor "#e6e64c" +OPENBLAS ; with lines lw 3 lt 1 lc rgbcolor "#C05600" +C ; with lines lw 3 lt 3 lc rgbcolor "#e6bd96" +ACML ; with lines lw 2 lt 3 lc rgbcolor "#e6e64c" +blaze ; with lines lw 3 lt 1 lc rgbcolor "#ff00ff" diff --git a/simulation/externals/eigen/bench/btl/data/regularize.cxx b/simulation/externals/eigen/bench/btl/data/regularize.cxx new file mode 100644 index 0000000..eea2b8b --- /dev/null +++ b/simulation/externals/eigen/bench/btl/data/regularize.cxx @@ -0,0 +1,131 @@ +//===================================================== +// File : regularize.cxx +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:15 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include +#include +#include +#include +#include "bench_parameter.hh" +#include + +using namespace std; + +void read_xy_file(const string & filename, vector & tab_sizes, vector & tab_mflops); +void regularize_curve(const string & filename, + const vector & tab_mflops, + const vector & tab_sizes, + int start_cut_size, int stop_cut_size); +///////////////////////////////////////////////////////////////////////////////////////////////// + +int main( int argc , char *argv[] ) +{ + + // input data + + if (argc<4){ + INFOS("!!! Error ... usage : main filename start_cut_size stop_cut_size regularize_filename"); + exit(0); + } + INFOS(argc); + + int start_cut_size=atoi(argv[2]); + int stop_cut_size=atoi(argv[3]); + + string filename=argv[1]; + string regularize_filename=argv[4]; + + INFOS(filename); + INFOS("start_cut_size="< tab_sizes; + vector tab_mflops; + + read_xy_file(filename,tab_sizes,tab_mflops); + + // regularizeing + + regularize_curve(regularize_filename,tab_mflops,tab_sizes,start_cut_size,stop_cut_size); + + +} + +////////////////////////////////////////////////////////////////////////////////////// + +void regularize_curve(const string & filename, + const vector & tab_mflops, + const vector & tab_sizes, + int start_cut_size, int stop_cut_size) +{ + int size=tab_mflops.size(); + ofstream output_file (filename.c_str(),ios::out) ; + + int i=0; + + while(tab_sizes[i] & tab_sizes, vector & tab_mflops){ + + ifstream input_file (filename.c_str(),ios::in) ; + + if (!input_file){ + INFOS("!!! Error opening "<> size >> mflops ){ + nb_point++; + tab_sizes.push_back(size); + tab_mflops.push_back(mflops); + } + SCRUTE(nb_point); + + input_file.close(); +} + diff --git a/simulation/externals/eigen/bench/btl/data/smooth.cxx b/simulation/externals/eigen/bench/btl/data/smooth.cxx new file mode 100644 index 0000000..e5270cc --- /dev/null +++ b/simulation/externals/eigen/bench/btl/data/smooth.cxx @@ -0,0 +1,198 @@ +//===================================================== +// File : smooth.cxx +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:15 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include +#include +#include +#include +#include +#include "bench_parameter.hh" +#include + +using namespace std; + +void read_xy_file(const string & filename, vector & tab_sizes, vector & tab_mflops); +void write_xy_file(const string & filename, vector & tab_sizes, vector & tab_mflops); +void smooth_curve(const vector & tab_mflops, vector & smooth_tab_mflops,int window_half_width); +void centered_smooth_curve(const vector & tab_mflops, vector & smooth_tab_mflops,int window_half_width); + +///////////////////////////////////////////////////////////////////////////////////////////////// + +int main( int argc , char *argv[] ) +{ + + // input data + + if (argc<3){ + INFOS("!!! Error ... usage : main filename window_half_width smooth_filename"); + exit(0); + } + INFOS(argc); + + int window_half_width=atoi(argv[2]); + + string filename=argv[1]; + string smooth_filename=argv[3]; + + INFOS(filename); + INFOS("window_half_width="< tab_sizes; + vector tab_mflops; + + read_xy_file(filename,tab_sizes,tab_mflops); + + // smoothing + + vector smooth_tab_mflops; + + //smooth_curve(tab_mflops,smooth_tab_mflops,window_half_width); + centered_smooth_curve(tab_mflops,smooth_tab_mflops,window_half_width); + + // output result + + write_xy_file(smooth_filename,tab_sizes,smooth_tab_mflops); + + +} + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +template +double weighted_mean(const VECTOR & data) +{ + + double mean=0.0; + + for (int i=0 ; i & tab_mflops, vector & smooth_tab_mflops,int window_half_width){ + + int window_width=2*window_half_width+1; + + int size=tab_mflops.size(); + + vector sample(window_width); + + for (int i=0 ; i < size ; i++){ + + for ( int j=0 ; j < window_width ; j++ ){ + + int shifted_index=i+j-window_half_width; + if (shifted_index<0) shifted_index=0; + if (shifted_index>size-1) shifted_index=size-1; + sample[j]=tab_mflops[shifted_index]; + + } + + smooth_tab_mflops.push_back(weighted_mean(sample)); + + } + +} + +void centered_smooth_curve(const vector & tab_mflops, vector & smooth_tab_mflops,int window_half_width){ + + int max_window_width=2*window_half_width+1; + + int size=tab_mflops.size(); + + + for (int i=0 ; i < size ; i++){ + + deque sample; + + + sample.push_back(tab_mflops[i]); + + for ( int j=1 ; j <= window_half_width ; j++ ){ + + int before=i-j; + int after=i+j; + + if ((before>=0)&&(after & tab_sizes, vector & tab_mflops){ + + ofstream output_file (filename.c_str(),ios::out) ; + + for (int i=0 ; i < tab_sizes.size() ; i++) + { + output_file << tab_sizes[i] << " " << tab_mflops[i] << endl ; + } + + output_file.close(); + +} + + +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +void read_xy_file(const string & filename, vector & tab_sizes, vector & tab_mflops){ + + ifstream input_file (filename.c_str(),ios::in) ; + + if (!input_file){ + INFOS("!!! Error opening "<> size >> mflops ){ + nb_point++; + tab_sizes.push_back(size); + tab_mflops.push_back(mflops); + } + SCRUTE(nb_point); + + input_file.close(); +} + diff --git a/simulation/externals/eigen/bench/btl/data/smooth_all.sh b/simulation/externals/eigen/bench/btl/data/smooth_all.sh new file mode 100644 index 0000000..3e5bfdf --- /dev/null +++ b/simulation/externals/eigen/bench/btl/data/smooth_all.sh @@ -0,0 +1,68 @@ +#! /bin/bash +ORIG_DIR=$1 +SMOOTH_DIR=${ORIG_DIR}_smooth +mkdir ${SMOOTH_DIR} + +AXPY_FILE=`find ${ORIG_DIR} -name "*.dat" | grep axpy` +for FILE in ${AXPY_FILE} +do + echo $FILE + BASE=${FILE##*/} + ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}_tmp + ./regularize ${SMOOTH_DIR}/${BASE}_tmp 2500 15000 ${SMOOTH_DIR}/${BASE} + rm -f ${SMOOTH_DIR}/${BASE}_tmp +done + + +MATRIX_VECTOR_FILE=`find ${ORIG_DIR} -name "*.dat" | grep matrix_vector` +for FILE in ${MATRIX_VECTOR_FILE} +do + echo $FILE + BASE=${FILE##*/} + ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}_tmp + ./regularize ${SMOOTH_DIR}/${BASE}_tmp 50 180 ${SMOOTH_DIR}/${BASE} + rm -f ${SMOOTH_DIR}/${BASE}_tmp +done + +MATRIX_MATRIX_FILE=`find ${ORIG_DIR} -name "*.dat" | grep matrix_matrix` +for FILE in ${MATRIX_MATRIX_FILE} +do + echo $FILE + BASE=${FILE##*/} + ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE} +done + +AAT_FILE=`find ${ORIG_DIR} -name "*.dat" | grep _aat` +for FILE in ${AAT_FILE} +do + echo $FILE + BASE=${FILE##*/} + ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE} +done + + +ATA_FILE=`find ${ORIG_DIR} -name "*.dat" | grep _ata` +for FILE in ${ATA_FILE} +do + echo $FILE + BASE=${FILE##*/} + ./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE} +done + +### no smoothing for tinyvector and matrices libs + +TINY_BLITZ_FILE=`find ${ORIG_DIR} -name "*.dat" | grep tiny_blitz` +for FILE in ${TINY_BLITZ_FILE} +do + echo $FILE + BASE=${FILE##*/} + cp ${ORIG_DIR}/${BASE} ${SMOOTH_DIR}/${BASE} +done + +TVMET_FILE=`find ${ORIG_DIR} -name "*.dat" | grep tvmet` +for FILE in ${TVMET_FILE} +do + echo $FILE + BASE=${FILE##*/} + cp ${ORIG_DIR}/${BASE} ${SMOOTH_DIR}/${BASE} +done diff --git a/simulation/externals/eigen/bench/btl/generic_bench/bench.hh b/simulation/externals/eigen/bench/btl/generic_bench/bench.hh new file mode 100644 index 0000000..7b7b951 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/generic_bench/bench.hh @@ -0,0 +1,168 @@ +//===================================================== +// File : bench.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:16 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BENCH_HH +#define BENCH_HH + +#include "btl.hh" +#include "bench_parameter.hh" +#include +#include "utilities.h" +#include "size_lin_log.hh" +#include "xy_file.hh" +#include +#include +#include "timers/portable_perf_analyzer.hh" +// #include "timers/mixed_perf_analyzer.hh" +// #include "timers/x86_perf_analyzer.hh" +// #include "timers/STL_perf_analyzer.hh" +#ifdef HAVE_MKL +extern "C" void cblas_saxpy(const int, const float, const float*, const int, float *, const int); +#endif +using namespace std; + +template class Perf_Analyzer, class Action> +BTL_DONT_INLINE void bench( int size_min, int size_max, int nb_point ) +{ + if (BtlConfig::skipAction(Action::name())) + return; + + string filename="bench_"+Action::name()+".dat"; + + INFOS("starting " < tab_mflops(nb_point); + std::vector tab_sizes(nb_point); + + // matrices and vector size calculations + size_lin_log(nb_point,size_min,size_max,tab_sizes); + + std::vector oldSizes; + std::vector oldFlops; + bool hasOldResults = read_xy_file(filename, oldSizes, oldFlops, true); + int oldi = oldSizes.size() - 1; + + // loop on matrix size + Perf_Analyzer perf_action; + for (int i=nb_point-1;i>=0;i--) + { + //INFOS("size=" <=0 && oldSizes[oldi]>tab_sizes[i]) + --oldi; + if (oldi>=0 && oldSizes[oldi]==tab_sizes[i]) + { + if (oldFlops[oldi] "; + else + std::cout << "\t < "; + std::cout << oldFlops[oldi]; + } + --oldi; + } + std::cout << " MFlops (" << nb_point-i << "/" << nb_point << ")" << std::endl; + } + + if (!BtlConfig::Instance.overwriteResults) + { + if (hasOldResults) + { + // merge the two data + std::vector newSizes; + std::vector newFlops; + unsigned int i=0; + unsigned int j=0; + while (i +BTL_DONT_INLINE void bench( int size_min, int size_max, int nb_point ){ + + // if the rdtsc is not available : + bench(size_min,size_max,nb_point); + // if the rdtsc is available : +// bench(size_min,size_max,nb_point); + + + // Only for small problem size. Otherwize it will be too long +// bench(size_min,size_max,nb_point); +// bench(size_min,size_max,nb_point); + +} + +#endif diff --git a/simulation/externals/eigen/bench/btl/generic_bench/bench_parameter.hh b/simulation/externals/eigen/bench/btl/generic_bench/bench_parameter.hh new file mode 100644 index 0000000..2b01149 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/generic_bench/bench_parameter.hh @@ -0,0 +1,53 @@ +//===================================================== +// File : bench_parameter.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:16 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BENCH_PARAMETER_HH +#define BENCH_PARAMETER_HH + +// minimal time for each measurement +#define REAL_TYPE float +// minimal time for each measurement +#define MIN_TIME 0.2 +// nb of point on bench curves +#define NB_POINT 100 +// min vector size for axpy bench +#define MIN_AXPY 5 +// max vector size for axpy bench +#define MAX_AXPY 3000000 +// min matrix size for matrix vector product bench +#define MIN_MV 5 +// max matrix size for matrix vector product bench +#define MAX_MV 5000 +// min matrix size for matrix matrix product bench +#define MIN_MM 5 +// max matrix size for matrix matrix product bench +#define MAX_MM MAX_MV +// min matrix size for LU bench +#define MIN_LU 5 +// max matrix size for LU bench +#define MAX_LU 3000 +// max size for tiny vector and matrix +#define TINY_MV_MAX_SIZE 16 +// default nb_sample for x86 timer +#define DEFAULT_NB_SAMPLE 1000 + +// how many times we run a single bench (keep the best perf) +#define DEFAULT_NB_TRIES 3 + +#endif diff --git a/simulation/externals/eigen/bench/btl/generic_bench/btl.hh b/simulation/externals/eigen/bench/btl/generic_bench/btl.hh new file mode 100644 index 0000000..706b00f --- /dev/null +++ b/simulation/externals/eigen/bench/btl/generic_bench/btl.hh @@ -0,0 +1,242 @@ +//===================================================== +// File : btl.hh +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BTL_HH +#define BTL_HH + +#include "bench_parameter.hh" +#include +#include +#include +#include +#include "utilities.h" + +#if (defined __GNUC__) +#define BTL_ALWAYS_INLINE __attribute__((always_inline)) inline +#else +#define BTL_ALWAYS_INLINE inline +#endif + +#if (defined __GNUC__) +#define BTL_DONT_INLINE __attribute__((noinline)) +#else +#define BTL_DONT_INLINE +#endif + +#if (defined __GNUC__) +#define BTL_ASM_COMMENT(X) asm("#" X) +#else +#define BTL_ASM_COMMENT(X) +#endif + +#ifdef __SSE__ +#include "xmmintrin.h" +// This enables flush to zero (FTZ) and denormals are zero (DAZ) modes: +#define BTL_DISABLE_SSE_EXCEPTIONS() { _mm_setcsr(_mm_getcsr() | 0x8040); } +#else +#define BTL_DISABLE_SSE_EXCEPTIONS() +#endif + +/** Enhanced std::string +*/ +class BtlString : public std::string +{ +public: + BtlString() : std::string() {} + BtlString(const BtlString& str) : std::string(static_cast(str)) {} + BtlString(const std::string& str) : std::string(str) {} + BtlString(const char* str) : std::string(str) {} + + operator const char* () const { return c_str(); } + + void trim( bool left = true, bool right = true ) + { + int lspaces, rspaces, len = length(), i; + lspaces = rspaces = 0; + + if ( left ) + for (i=0; i=0 && (at(i)==' '||at(i)=='\t'||at(i)=='\r'||at(i)=='\n'); rspaces++,i--); + + *this = substr(lspaces, len-lspaces-rspaces); + } + + std::vector split( const BtlString& delims = "\t\n ") const + { + std::vector ret; + unsigned int numSplits = 0; + size_t start, pos; + start = 0; + do + { + pos = find_first_of(delims, start); + if (pos == start) + { + ret.push_back(""); + start = pos + 1; + } + else if (pos == npos) + ret.push_back( substr(start) ); + else + { + ret.push_back( substr(start, pos - start) ); + start = pos + 1; + } + //start = find_first_not_of(delims, start); + ++numSplits; + } while (pos != npos); + return ret; + } + + bool endsWith(const BtlString& str) const + { + if(str.size()>this->size()) + return false; + return this->substr(this->size()-str.size(),str.size()) == str; + } + bool contains(const BtlString& str) const + { + return this->find(str)size(); + } + bool beginsWith(const BtlString& str) const + { + if(str.size()>this->size()) + return false; + return this->substr(0,str.size()) == str; + } + + BtlString toLowerCase( void ) + { + std::transform(begin(), end(), begin(), static_cast(::tolower) ); + return *this; + } + BtlString toUpperCase( void ) + { + std::transform(begin(), end(), begin(), static_cast(::toupper) ); + return *this; + } + + /** Case insensitive comparison. + */ + bool isEquiv(const BtlString& str) const + { + BtlString str0 = *this; + str0.toLowerCase(); + BtlString str1 = str; + str1.toLowerCase(); + return str0 == str1; + } + + /** Decompose the current string as a path and a file. + For instance: "dir1/dir2/file.ext" leads to path="dir1/dir2/" and filename="file.ext" + */ + void decomposePathAndFile(BtlString& path, BtlString& filename) const + { + std::vector elements = this->split("/\\"); + path = ""; + filename = elements.back(); + elements.pop_back(); + if (this->at(0)=='/') + path = "/"; + for (unsigned int i=0 ; i config = BtlString(_config).split(" \t\n"); + for (unsigned int i = 0; i m_selectedActionNames; +}; + +#define BTL_MAIN \ + BtlConfig BtlConfig::Instance + +#endif // BTL_HH diff --git a/simulation/externals/eigen/bench/btl/generic_bench/init/init_function.hh b/simulation/externals/eigen/bench/btl/generic_bench/init/init_function.hh new file mode 100644 index 0000000..e467cb6 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/generic_bench/init/init_function.hh @@ -0,0 +1,54 @@ +//===================================================== +// File : init_function.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:18 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef INIT_FUNCTION_HH +#define INIT_FUNCTION_HH + +double simple_function(int index) +{ + return index; +} + +double simple_function(int index_i, int index_j) +{ + return index_i+index_j; +} + +double pseudo_random(int /*index*/) +{ + return std::rand()/double(RAND_MAX); +} + +double pseudo_random(int /*index_i*/, int /*index_j*/) +{ + return std::rand()/double(RAND_MAX); +} + + +double null_function(int /*index*/) +{ + return 0.0; +} + +double null_function(int /*index_i*/, int /*index_j*/) +{ + return 0.0; +} + +#endif diff --git a/simulation/externals/eigen/bench/btl/generic_bench/init/init_matrix.hh b/simulation/externals/eigen/bench/btl/generic_bench/init/init_matrix.hh new file mode 100644 index 0000000..6382d30 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/generic_bench/init/init_matrix.hh @@ -0,0 +1,64 @@ +//===================================================== +// File : init_matrix.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:19 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef INIT_MATRIX_HH +#define INIT_MATRIX_HH + +// The Vector class must satisfy the following part of STL vector concept : +// resize() method +// [] operator for setting element +// value_type defined +template +BTL_DONT_INLINE void init_row(Vector & X, int size, int row){ + + X.resize(size); + + for (unsigned int j=0;j +BTL_DONT_INLINE void init_matrix(Vector & A, int size){ + A.resize(size); + for (unsigned int row=0; row(A[row],size,row); + } +} + +template +BTL_DONT_INLINE void init_matrix_symm(Matrix& A, int size){ + A.resize(size); + for (unsigned int row=0; row +// Copyright (C) EDF R&D, lun sep 30 14:23:18 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef INIT_VECTOR_HH +#define INIT_VECTOR_HH + +// The Vector class must satisfy the following part of STL vector concept : +// resize() method +// [] operator for setting element +// value_type defined +template +void init_vector(Vector & X, int size){ + + X.resize(size); + + for (unsigned int i=0;i +// Copyright (C) EDF R&D, lun sep 30 14:23:16 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BENCH_STATIC_HH +#define BENCH_STATIC_HH + +#include "btl.hh" +#include "bench_parameter.hh" +#include +#include "utilities.h" +#include "xy_file.hh" +#include "static/static_size_generator.hh" +#include "timers/portable_perf_analyzer.hh" +// #include "timers/mixed_perf_analyzer.hh" +// #include "timers/x86_perf_analyzer.hh" + +using namespace std; + + +template class Perf_Analyzer, template class Action, template class Interface> +BTL_DONT_INLINE void bench_static(void) +{ + if (BtlConfig::skipAction(Action >::name())) + return; + + string filename = "bench_" + Action >::name() + ".dat"; + + INFOS("starting " << filename); + + const int max_size = TINY_MV_MAX_SIZE; + + std::vector tab_mflops; + std::vector tab_sizes; + + static_size_generator::go(tab_sizes,tab_mflops); + + dump_xy_file(tab_sizes,tab_mflops,filename); +} + +// default Perf Analyzer +template class Action, template class Interface> +BTL_DONT_INLINE void bench_static(void) +{ + bench_static(); + //bench_static(); + //bench_static(); +} + +#endif + + + + + + + + + + + + + + + diff --git a/simulation/externals/eigen/bench/btl/generic_bench/static/intel_bench_fixed_size.hh b/simulation/externals/eigen/bench/btl/generic_bench/static/intel_bench_fixed_size.hh new file mode 100644 index 0000000..b4edcbc --- /dev/null +++ b/simulation/externals/eigen/bench/btl/generic_bench/static/intel_bench_fixed_size.hh @@ -0,0 +1,66 @@ +//===================================================== +// File : intel_bench_fixed_size.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, mar dc 3 18:59:37 CET 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef _BENCH_FIXED_SIZE_HH_ +#define _BENCH_FIXED_SIZE_HH_ + +#include "utilities.h" +#include "function_time.hh" + +template +double bench_fixed_size(int size, unsigned long long & nb_calc,unsigned long long & nb_init) +{ + + Action action(size); + + double time_baseline=time_init(nb_init,action); + + while (time_baseline < MIN_TIME) { + + //INFOS("nb_init="< > > perf_action; + tab_mflops.push_back(perf_action.eval_mflops(SIZE)); + std::cout << tab_mflops.back() << " MFlops" << std::endl; + static_size_generator::go(tab_sizes,tab_mflops); + }; +}; + +//recursion end + +template class Perf_Analyzer, template class Action, template class Interface> +struct static_size_generator<1,Perf_Analyzer,Action,Interface>{ + static void go(vector & tab_sizes, vector & tab_mflops) + { + tab_sizes.push_back(1); + Perf_Analyzer > > perf_action; + tab_mflops.push_back(perf_action.eval_mflops(1)); + }; +}; + +#endif + + + + diff --git a/simulation/externals/eigen/bench/btl/generic_bench/timers/STL_perf_analyzer.hh b/simulation/externals/eigen/bench/btl/generic_bench/timers/STL_perf_analyzer.hh new file mode 100644 index 0000000..c9f894b --- /dev/null +++ b/simulation/externals/eigen/bench/btl/generic_bench/timers/STL_perf_analyzer.hh @@ -0,0 +1,82 @@ +//===================================================== +// File : STL_perf_analyzer.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, mar dc 3 18:59:35 CET 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef _STL_PERF_ANALYSER_HH +#define _STL_PERF_ANALYSER_HH + +#include "STL_timer.hh" +#include "bench_parameter.hh" + +template +class STL_Perf_Analyzer{ +public: + STL_Perf_Analyzer(unsigned long long nb_sample=DEFAULT_NB_SAMPLE):_nb_sample(nb_sample),_chronos() + { + MESSAGE("STL_Perf_Analyzer Ctor"); + }; + STL_Perf_Analyzer( const STL_Perf_Analyzer & ){ + INFOS("Copy Ctor not implemented"); + exit(0); + }; + ~STL_Perf_Analyzer( void ){ + MESSAGE("STL_Perf_Analyzer Dtor"); + }; + + + inline double eval_mflops(int size) + { + + ACTION action(size); + + _chronos.start_baseline(_nb_sample); + + do { + + action.initialize(); + } while (_chronos.check()); + + double baseline_time=_chronos.get_time(); + + _chronos.start(_nb_sample); + do { + action.initialize(); + action.calculate(); + } while (_chronos.check()); + + double calculate_time=_chronos.get_time(); + + double corrected_time=calculate_time-baseline_time; + + // cout << size <<" "< +// Copyright (C) EDF R&D, mar dc 3 18:59:35 CET 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// STL Timer Class. Adapted (L.P.) from the timer class by Musser et Al +// described int the Book : STL Tutorial and reference guide. +// Define a timer class for analyzing algorithm performance. +#include +#include +#include +#include +#include +using namespace std; + +class STL_Timer { +public: + STL_Timer(){ baseline = false; }; // Default constructor + // Start a series of r trials: + void start(unsigned int r){ + reps = r; + count = 0; + iterations.clear(); + iterations.reserve(reps); + initial = time(0); + }; + // Start a series of r trials to determine baseline time: + void start_baseline(unsigned int r) + { + baseline = true; + start(r); + } + // Returns true if the trials have been completed, else false + bool check() + { + ++count; + final = time(0); + if (initial < final) { + iterations.push_back(count); + initial = final; + count = 0; + } + return (iterations.size() < reps); + }; + // Returns the results for external use + double get_time( void ) + { + sort(iterations.begin(), iterations.end()); + return 1.0/iterations[reps/2]; + }; +private: + unsigned int reps; // Number of trials + // For storing loop iterations of a trial + vector iterations; + // For saving initial and final times of a trial + time_t initial, final; + // For counting loop iterations of a trial + unsigned long count; + // true if this is a baseline computation, false otherwise + bool baseline; + // For recording the baseline time + double baseline_time; +}; + diff --git a/simulation/externals/eigen/bench/btl/generic_bench/timers/mixed_perf_analyzer.hh b/simulation/externals/eigen/bench/btl/generic_bench/timers/mixed_perf_analyzer.hh new file mode 100644 index 0000000..e190236 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/generic_bench/timers/mixed_perf_analyzer.hh @@ -0,0 +1,73 @@ +//===================================================== +// File : mixed_perf_analyzer.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, mar dc 3 18:59:36 CET 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef _MIXED_PERF_ANALYSER_HH +#define _MIXED_PERF_ANALYSER_HH + +#include "x86_perf_analyzer.hh" +#include "portable_perf_analyzer.hh" + +// choose portable perf analyzer for long calculations and x86 analyser for short ones + + +template +class Mixed_Perf_Analyzer{ + +public: + Mixed_Perf_Analyzer( void ):_x86pa(),_ppa(),_use_ppa(true) + { + MESSAGE("Mixed_Perf_Analyzer Ctor"); + }; + Mixed_Perf_Analyzer( const Mixed_Perf_Analyzer & ){ + INFOS("Copy Ctor not implemented"); + exit(0); + }; + ~Mixed_Perf_Analyzer( void ){ + MESSAGE("Mixed_Perf_Analyzer Dtor"); + }; + + + inline double eval_mflops(int size) + { + + double result=0.0; + if (_use_ppa){ + result=_ppa.eval_mflops(size); + if (_ppa.get_nb_calc()>DEFAULT_NB_SAMPLE){_use_ppa=false;} + } + else{ + result=_x86pa.eval_mflops(size); + } + + return result; + } + +private: + + Portable_Perf_Analyzer _ppa; + X86_Perf_Analyzer _x86pa; + bool _use_ppa; + +}; + +#endif + + + + diff --git a/simulation/externals/eigen/bench/btl/generic_bench/timers/portable_perf_analyzer.hh b/simulation/externals/eigen/bench/btl/generic_bench/timers/portable_perf_analyzer.hh new file mode 100644 index 0000000..5e579fb --- /dev/null +++ b/simulation/externals/eigen/bench/btl/generic_bench/timers/portable_perf_analyzer.hh @@ -0,0 +1,103 @@ +//===================================================== +// File : portable_perf_analyzer.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002 +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef _PORTABLE_PERF_ANALYZER_HH +#define _PORTABLE_PERF_ANALYZER_HH + +#include "utilities.h" +#include "timers/portable_timer.hh" + +template +class Portable_Perf_Analyzer{ +public: + Portable_Perf_Analyzer( ):_nb_calc(0), m_time_action(0), _chronos(){ + MESSAGE("Portable_Perf_Analyzer Ctor"); + }; + Portable_Perf_Analyzer( const Portable_Perf_Analyzer & ){ + INFOS("Copy Ctor not implemented"); + exit(0); + }; + ~Portable_Perf_Analyzer(){ + MESSAGE("Portable_Perf_Analyzer Dtor"); + }; + + BTL_DONT_INLINE double eval_mflops(int size) + { + Action action(size); + +// action.initialize(); +// time_action = time_calculate(action); + while (m_time_action < MIN_TIME) + { + if(_nb_calc==0) _nb_calc = 1; + else _nb_calc *= 2; + action.initialize(); + m_time_action = time_calculate(action); + } + + // optimize + for (int i=1; i +// Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef _PORTABLE_PERF_ANALYZER_HH +#define _PORTABLE_PERF_ANALYZER_HH + +#include "utilities.h" +#include "timers/portable_timer.hh" + +template +class Portable_Perf_Analyzer{ +public: + Portable_Perf_Analyzer( void ):_nb_calc(1),_nb_init(1),_chronos(){ + MESSAGE("Portable_Perf_Analyzer Ctor"); + }; + Portable_Perf_Analyzer( const Portable_Perf_Analyzer & ){ + INFOS("Copy Ctor not implemented"); + exit(0); + }; + ~Portable_Perf_Analyzer( void ){ + MESSAGE("Portable_Perf_Analyzer Dtor"); + }; + + + + inline double eval_mflops(int size) + { + + Action action(size); + +// double time_baseline = time_init(action); +// while (time_baseline < MIN_TIME_INIT) +// { +// _nb_init *= 2; +// time_baseline = time_init(action); +// } +// +// // optimize +// for (int i=1; i +#include + + +class Portable_Timer +{ + public: + + Portable_Timer() + { + } + + void start() + { + m_start_time = double(mach_absolute_time())*1e-9;; + + } + + void stop() + { + m_stop_time = double(mach_absolute_time())*1e-9;; + + } + + double elapsed() + { + return user_time(); + } + + double user_time() + { + return m_stop_time - m_start_time; + } + + +private: + + double m_stop_time, m_start_time; + +}; // Portable_Timer (Apple) + +#else + +#include +#include +#include +#include + +class Portable_Timer +{ + public: + + Portable_Timer() + { + m_clkid = BtlConfig::Instance.realclock ? CLOCK_REALTIME : CLOCK_PROCESS_CPUTIME_ID; + } + + Portable_Timer(int clkid) : m_clkid(clkid) + {} + + void start() + { + timespec ts; + clock_gettime(m_clkid, &ts); + m_start_time = double(ts.tv_sec) + 1e-9 * double(ts.tv_nsec); + + } + + void stop() + { + timespec ts; + clock_gettime(m_clkid, &ts); + m_stop_time = double(ts.tv_sec) + 1e-9 * double(ts.tv_nsec); + + } + + double elapsed() + { + return user_time(); + } + + double user_time() + { + return m_stop_time - m_start_time; + } + + +private: + + int m_clkid; + double m_stop_time, m_start_time; + +}; // Portable_Timer (Linux) + +#endif + +#endif // PORTABLE_TIMER_HPP diff --git a/simulation/externals/eigen/bench/btl/generic_bench/timers/x86_perf_analyzer.hh b/simulation/externals/eigen/bench/btl/generic_bench/timers/x86_perf_analyzer.hh new file mode 100644 index 0000000..37ea21d --- /dev/null +++ b/simulation/externals/eigen/bench/btl/generic_bench/timers/x86_perf_analyzer.hh @@ -0,0 +1,108 @@ +//===================================================== +// File : x86_perf_analyzer.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef _X86_PERF_ANALYSER_HH +#define _X86_PERF_ANALYSER_HH + +#include "x86_timer.hh" +#include "bench_parameter.hh" + +template +class X86_Perf_Analyzer{ +public: + X86_Perf_Analyzer( unsigned long long nb_sample=DEFAULT_NB_SAMPLE):_nb_sample(nb_sample),_chronos() + { + MESSAGE("X86_Perf_Analyzer Ctor"); + _chronos.find_frequency(); + }; + X86_Perf_Analyzer( const X86_Perf_Analyzer & ){ + INFOS("Copy Ctor not implemented"); + exit(0); + }; + ~X86_Perf_Analyzer( void ){ + MESSAGE("X86_Perf_Analyzer Dtor"); + }; + + + inline double eval_mflops(int size) + { + + ACTION action(size); + + int nb_loop=5; + double calculate_time=0.0; + double baseline_time=0.0; + + for (int j=0 ; j < nb_loop ; j++){ + + _chronos.clear(); + + for(int i=0 ; i < _nb_sample ; i++) + { + _chronos.start(); + action.initialize(); + action.calculate(); + _chronos.stop(); + _chronos.add_get_click(); + } + + calculate_time += double(_chronos.get_shortest_clicks())/_chronos.frequency(); + + if (j==0) action.check_result(); + + _chronos.clear(); + + for(int i=0 ; i < _nb_sample ; i++) + { + _chronos.start(); + action.initialize(); + _chronos.stop(); + _chronos.add_get_click(); + + } + + baseline_time+=double(_chronos.get_shortest_clicks())/_chronos.frequency(); + + } + + double corrected_time = (calculate_time-baseline_time)/double(nb_loop); + + +// INFOS("_nb_sample="<<_nb_sample); +// INFOS("baseline_time="< +// Copyright (C) EDF R&D, mar d�c 3 18:59:35 CET 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef _X86_TIMER_HH +#define _X86_TIMER_HH + +#include +#include +#include +#include +//#include "system_time.h" +#define u32 unsigned int +#include +#include "utilities.h" +#include +#include +#include +#include + +// frequence de la becanne en Hz +//#define FREQUENCY 648000000 +//#define FREQUENCY 1400000000 +#define FREQUENCY 1695000000 + +using namespace std; + + +class X86_Timer { + +public : + + X86_Timer( void ):_frequency(FREQUENCY),_nb_sample(0) + { + MESSAGE("X86_Timer Default Ctor"); + } + + inline void start( void ){ + + rdtsc(_click_start.n32[0],_click_start.n32[1]); + + } + + + inline void stop( void ){ + + rdtsc(_click_stop.n32[0],_click_stop.n32[1]); + + } + + + inline double frequency( void ){ + return _frequency; + } + + double get_elapsed_time_in_second( void ){ + + return (_click_stop.n64-_click_start.n64)/double(FREQUENCY); + + + } + + unsigned long long get_click( void ){ + + return (_click_stop.n64-_click_start.n64); + + } + + inline void find_frequency( void ){ + + time_t initial, final; + int dummy=2; + + initial = time(0); + start(); + do { + dummy+=2; + } + while(time(0)==initial); + // On est au debut d'un cycle d'une seconde !!! + initial = time(0); + start(); + do { + dummy+=2; + } + while(time(0)==initial); + final=time(0); + stop(); + // INFOS("fine grained time : "<< get_elapsed_time_in_second()); + // INFOS("coarse grained time : "<< final-initial); + _frequency=_frequency*get_elapsed_time_in_second()/double(final-initial); + /// INFOS("CPU frequency : "<< _frequency); + + } + + void add_get_click( void ){ + + _nb_sample++; + _counted_clicks[get_click()]++; + fill_history_clicks(); + + } + + void dump_statistics(string filemane){ + + ofstream outfile (filemane.c_str(),ios::out) ; + + std::map::iterator itr; + for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++) + { + outfile << (*itr).first << " " << (*itr).second << endl ; + } + + outfile.close(); + + } + + void dump_history(string filemane){ + + ofstream outfile (filemane.c_str(),ios::out) ; + + + + for(int i=0 ; i<_history_mean_clicks.size() ; i++) + { + outfile << i << " " + << _history_mean_clicks[i] << " " + << _history_shortest_clicks[i] << " " + << _history_most_occured_clicks[i] << endl ; + } + + outfile.close(); + + } + + + + double get_mean_clicks( void ){ + + std::map::iterator itr; + + unsigned long long mean_clicks=0; + + for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++) + { + + mean_clicks+=(*itr).second*(*itr).first; + } + + return mean_clicks/double(_nb_sample); + + } + + double get_shortest_clicks( void ){ + + return double((*_counted_clicks.begin()).first); + + } + + void fill_history_clicks( void ){ + + _history_mean_clicks.push_back(get_mean_clicks()); + _history_shortest_clicks.push_back(get_shortest_clicks()); + _history_most_occured_clicks.push_back(get_most_occured_clicks()); + + } + + + double get_most_occured_clicks( void ){ + + unsigned long long moc=0; + unsigned long long max_occurence=0; + + std::map::iterator itr; + + for(itr=_counted_clicks.begin() ; itr!=_counted_clicks.end() ; itr++) + { + + if (max_occurence<=(*itr).second){ + max_occurence=(*itr).second; + moc=(*itr).first; + } + } + + return double(moc); + + } + + void clear( void ) + { + _counted_clicks.clear(); + + _history_mean_clicks.clear(); + _history_shortest_clicks.clear(); + _history_most_occured_clicks.clear(); + + _nb_sample=0; + } + + + +private : + + union + { + unsigned long int n32[2] ; + unsigned long long n64 ; + } _click_start; + + union + { + unsigned long int n32[2] ; + unsigned long long n64 ; + } _click_stop; + + double _frequency ; + + map _counted_clicks; + + vector _history_mean_clicks; + vector _history_shortest_clicks; + vector _history_most_occured_clicks; + + unsigned long long _nb_sample; + + + +}; + + +#endif diff --git a/simulation/externals/eigen/bench/btl/generic_bench/utils/size_lin_log.hh b/simulation/externals/eigen/bench/btl/generic_bench/utils/size_lin_log.hh new file mode 100644 index 0000000..bbc9f54 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/generic_bench/utils/size_lin_log.hh @@ -0,0 +1,70 @@ +//===================================================== +// File : size_lin_log.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, mar dc 3 18:59:37 CET 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef SIZE_LIN_LOG +#define SIZE_LIN_LOG + +#include "size_log.hh" + +template +void size_lin_log(const int nb_point, const int /*size_min*/, const int size_max, Vector & X) +{ + int ten=10; + int nine=9; + + X.resize(nb_point); + + if (nb_point>ten){ + + for (int i=0;i +void size_log(const int nb_point, const int size_min, const int size_max, Vector & X) +{ + X.resize(nb_point); + + float ls_min=log(float(size_min)); + float ls_max=log(float(size_max)); + + float ls=0.0; + + float delta_ls=(ls_max-ls_min)/(float(nb_point-1)); + + int size=0; + + for (int i=0;i +//# include ok for gcc3.01 +# include + +/* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */ + +# define HEREWEARE cout< +// Copyright (C) EDF R&D, lun sep 30 14:23:20 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef XY_FILE_HH +#define XY_FILE_HH +#include +#include +#include +#include +using namespace std; + +bool read_xy_file(const std::string & filename, std::vector & tab_sizes, + std::vector & tab_mflops, bool quiet = false) +{ + + std::ifstream input_file (filename.c_str(),std::ios::in); + + if (!input_file){ + if (!quiet) { + INFOS("!!! Error opening "<> size >> mflops ){ + nb_point++; + tab_sizes.push_back(size); + tab_mflops.push_back(mflops); + } + SCRUTE(nb_point); + + input_file.close(); + return true; +} + +// The Vector class must satisfy the following part of STL vector concept : +// resize() method +// [] operator for seting element +// the vector element must have the << operator define + +using namespace std; + +template +void dump_xy_file(const Vector_A & X, const Vector_B & Y, const std::string & filename){ + + ofstream outfile (filename.c_str(),ios::out) ; + int size=X.size(); + + for (int i=0;i BLASFUNC(cdotu) (int *, float *, int *, float *, int *); +std::complex BLASFUNC(cdotc) (int *, float *, int *, float *, int *); +std::complex BLASFUNC(zdotu) (int *, double *, int *, double *, int *); +std::complex BLASFUNC(zdotc) (int *, double *, int *, double *, int *); +double BLASFUNC(xdotu) (int *, double *, int *, double *, int *); +double BLASFUNC(xdotc) (int *, double *, int *, double *, int *); +#endif + +int BLASFUNC(cdotuw) (int *, float *, int *, float *, int *, float*); +int BLASFUNC(cdotcw) (int *, float *, int *, float *, int *, float*); +int BLASFUNC(zdotuw) (int *, double *, int *, double *, int *, double*); +int BLASFUNC(zdotcw) (int *, double *, int *, double *, int *, double*); + +int BLASFUNC(saxpy) (int *, float *, float *, int *, float *, int *); +int BLASFUNC(daxpy) (int *, double *, double *, int *, double *, int *); +int BLASFUNC(qaxpy) (int *, double *, double *, int *, double *, int *); +int BLASFUNC(caxpy) (int *, float *, float *, int *, float *, int *); +int BLASFUNC(zaxpy) (int *, double *, double *, int *, double *, int *); +int BLASFUNC(xaxpy) (int *, double *, double *, int *, double *, int *); +int BLASFUNC(caxpyc)(int *, float *, float *, int *, float *, int *); +int BLASFUNC(zaxpyc)(int *, double *, double *, int *, double *, int *); +int BLASFUNC(xaxpyc)(int *, double *, double *, int *, double *, int *); + +int BLASFUNC(scopy) (int *, float *, int *, float *, int *); +int BLASFUNC(dcopy) (int *, double *, int *, double *, int *); +int BLASFUNC(qcopy) (int *, double *, int *, double *, int *); +int BLASFUNC(ccopy) (int *, float *, int *, float *, int *); +int BLASFUNC(zcopy) (int *, double *, int *, double *, int *); +int BLASFUNC(xcopy) (int *, double *, int *, double *, int *); + +int BLASFUNC(sswap) (int *, float *, int *, float *, int *); +int BLASFUNC(dswap) (int *, double *, int *, double *, int *); +int BLASFUNC(qswap) (int *, double *, int *, double *, int *); +int BLASFUNC(cswap) (int *, float *, int *, float *, int *); +int BLASFUNC(zswap) (int *, double *, int *, double *, int *); +int BLASFUNC(xswap) (int *, double *, int *, double *, int *); + +float BLASFUNC(sasum) (int *, float *, int *); +float BLASFUNC(scasum)(int *, float *, int *); +double BLASFUNC(dasum) (int *, double *, int *); +double BLASFUNC(qasum) (int *, double *, int *); +double BLASFUNC(dzasum)(int *, double *, int *); +double BLASFUNC(qxasum)(int *, double *, int *); + +int BLASFUNC(isamax)(int *, float *, int *); +int BLASFUNC(idamax)(int *, double *, int *); +int BLASFUNC(iqamax)(int *, double *, int *); +int BLASFUNC(icamax)(int *, float *, int *); +int BLASFUNC(izamax)(int *, double *, int *); +int BLASFUNC(ixamax)(int *, double *, int *); + +int BLASFUNC(ismax) (int *, float *, int *); +int BLASFUNC(idmax) (int *, double *, int *); +int BLASFUNC(iqmax) (int *, double *, int *); +int BLASFUNC(icmax) (int *, float *, int *); +int BLASFUNC(izmax) (int *, double *, int *); +int BLASFUNC(ixmax) (int *, double *, int *); + +int BLASFUNC(isamin)(int *, float *, int *); +int BLASFUNC(idamin)(int *, double *, int *); +int BLASFUNC(iqamin)(int *, double *, int *); +int BLASFUNC(icamin)(int *, float *, int *); +int BLASFUNC(izamin)(int *, double *, int *); +int BLASFUNC(ixamin)(int *, double *, int *); + +int BLASFUNC(ismin)(int *, float *, int *); +int BLASFUNC(idmin)(int *, double *, int *); +int BLASFUNC(iqmin)(int *, double *, int *); +int BLASFUNC(icmin)(int *, float *, int *); +int BLASFUNC(izmin)(int *, double *, int *); +int BLASFUNC(ixmin)(int *, double *, int *); + +float BLASFUNC(samax) (int *, float *, int *); +double BLASFUNC(damax) (int *, double *, int *); +double BLASFUNC(qamax) (int *, double *, int *); +float BLASFUNC(scamax)(int *, float *, int *); +double BLASFUNC(dzamax)(int *, double *, int *); +double BLASFUNC(qxamax)(int *, double *, int *); + +float BLASFUNC(samin) (int *, float *, int *); +double BLASFUNC(damin) (int *, double *, int *); +double BLASFUNC(qamin) (int *, double *, int *); +float BLASFUNC(scamin)(int *, float *, int *); +double BLASFUNC(dzamin)(int *, double *, int *); +double BLASFUNC(qxamin)(int *, double *, int *); + +float BLASFUNC(smax) (int *, float *, int *); +double BLASFUNC(dmax) (int *, double *, int *); +double BLASFUNC(qmax) (int *, double *, int *); +float BLASFUNC(scmax) (int *, float *, int *); +double BLASFUNC(dzmax) (int *, double *, int *); +double BLASFUNC(qxmax) (int *, double *, int *); + +float BLASFUNC(smin) (int *, float *, int *); +double BLASFUNC(dmin) (int *, double *, int *); +double BLASFUNC(qmin) (int *, double *, int *); +float BLASFUNC(scmin) (int *, float *, int *); +double BLASFUNC(dzmin) (int *, double *, int *); +double BLASFUNC(qxmin) (int *, double *, int *); + +int BLASFUNC(sscal) (int *, float *, float *, int *); +int BLASFUNC(dscal) (int *, double *, double *, int *); +int BLASFUNC(qscal) (int *, double *, double *, int *); +int BLASFUNC(cscal) (int *, float *, float *, int *); +int BLASFUNC(zscal) (int *, double *, double *, int *); +int BLASFUNC(xscal) (int *, double *, double *, int *); +int BLASFUNC(csscal)(int *, float *, float *, int *); +int BLASFUNC(zdscal)(int *, double *, double *, int *); +int BLASFUNC(xqscal)(int *, double *, double *, int *); + +float BLASFUNC(snrm2) (int *, float *, int *); +float BLASFUNC(scnrm2)(int *, float *, int *); + +double BLASFUNC(dnrm2) (int *, double *, int *); +double BLASFUNC(qnrm2) (int *, double *, int *); +double BLASFUNC(dznrm2)(int *, double *, int *); +double BLASFUNC(qxnrm2)(int *, double *, int *); + +int BLASFUNC(srot) (int *, float *, int *, float *, int *, float *, float *); +int BLASFUNC(drot) (int *, double *, int *, double *, int *, double *, double *); +int BLASFUNC(qrot) (int *, double *, int *, double *, int *, double *, double *); +int BLASFUNC(csrot) (int *, float *, int *, float *, int *, float *, float *); +int BLASFUNC(zdrot) (int *, double *, int *, double *, int *, double *, double *); +int BLASFUNC(xqrot) (int *, double *, int *, double *, int *, double *, double *); + +int BLASFUNC(srotg) (float *, float *, float *, float *); +int BLASFUNC(drotg) (double *, double *, double *, double *); +int BLASFUNC(qrotg) (double *, double *, double *, double *); +int BLASFUNC(crotg) (float *, float *, float *, float *); +int BLASFUNC(zrotg) (double *, double *, double *, double *); +int BLASFUNC(xrotg) (double *, double *, double *, double *); + +int BLASFUNC(srotmg)(float *, float *, float *, float *, float *); +int BLASFUNC(drotmg)(double *, double *, double *, double *, double *); + +int BLASFUNC(srotm) (int *, float *, int *, float *, int *, float *); +int BLASFUNC(drotm) (int *, double *, int *, double *, int *, double *); +int BLASFUNC(qrotm) (int *, double *, int *, double *, int *, double *); + +/* Level 2 routines */ + +int BLASFUNC(sger)(int *, int *, float *, float *, int *, + float *, int *, float *, int *); +int BLASFUNC(dger)(int *, int *, double *, double *, int *, + double *, int *, double *, int *); +int BLASFUNC(qger)(int *, int *, double *, double *, int *, + double *, int *, double *, int *); +int BLASFUNC(cgeru)(int *, int *, float *, float *, int *, + float *, int *, float *, int *); +int BLASFUNC(cgerc)(int *, int *, float *, float *, int *, + float *, int *, float *, int *); +int BLASFUNC(zgeru)(int *, int *, double *, double *, int *, + double *, int *, double *, int *); +int BLASFUNC(zgerc)(int *, int *, double *, double *, int *, + double *, int *, double *, int *); +int BLASFUNC(xgeru)(int *, int *, double *, double *, int *, + double *, int *, double *, int *); +int BLASFUNC(xgerc)(int *, int *, double *, double *, int *, + double *, int *, double *, int *); + +int BLASFUNC(sgemv)(char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(dgemv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(qgemv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(cgemv)(char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zgemv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xgemv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(strsv) (char *, char *, char *, int *, float *, int *, + float *, int *); +int BLASFUNC(dtrsv) (char *, char *, char *, int *, double *, int *, + double *, int *); +int BLASFUNC(qtrsv) (char *, char *, char *, int *, double *, int *, + double *, int *); +int BLASFUNC(ctrsv) (char *, char *, char *, int *, float *, int *, + float *, int *); +int BLASFUNC(ztrsv) (char *, char *, char *, int *, double *, int *, + double *, int *); +int BLASFUNC(xtrsv) (char *, char *, char *, int *, double *, int *, + double *, int *); + +int BLASFUNC(stpsv) (char *, char *, char *, int *, float *, float *, int *); +int BLASFUNC(dtpsv) (char *, char *, char *, int *, double *, double *, int *); +int BLASFUNC(qtpsv) (char *, char *, char *, int *, double *, double *, int *); +int BLASFUNC(ctpsv) (char *, char *, char *, int *, float *, float *, int *); +int BLASFUNC(ztpsv) (char *, char *, char *, int *, double *, double *, int *); +int BLASFUNC(xtpsv) (char *, char *, char *, int *, double *, double *, int *); + +int BLASFUNC(strmv) (char *, char *, char *, int *, float *, int *, + float *, int *); +int BLASFUNC(dtrmv) (char *, char *, char *, int *, double *, int *, + double *, int *); +int BLASFUNC(qtrmv) (char *, char *, char *, int *, double *, int *, + double *, int *); +int BLASFUNC(ctrmv) (char *, char *, char *, int *, float *, int *, + float *, int *); +int BLASFUNC(ztrmv) (char *, char *, char *, int *, double *, int *, + double *, int *); +int BLASFUNC(xtrmv) (char *, char *, char *, int *, double *, int *, + double *, int *); + +int BLASFUNC(stpmv) (char *, char *, char *, int *, float *, float *, int *); +int BLASFUNC(dtpmv) (char *, char *, char *, int *, double *, double *, int *); +int BLASFUNC(qtpmv) (char *, char *, char *, int *, double *, double *, int *); +int BLASFUNC(ctpmv) (char *, char *, char *, int *, float *, float *, int *); +int BLASFUNC(ztpmv) (char *, char *, char *, int *, double *, double *, int *); +int BLASFUNC(xtpmv) (char *, char *, char *, int *, double *, double *, int *); + +int BLASFUNC(stbmv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); +int BLASFUNC(dtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); +int BLASFUNC(qtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); +int BLASFUNC(ctbmv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); +int BLASFUNC(ztbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); +int BLASFUNC(xtbmv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); + +int BLASFUNC(stbsv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); +int BLASFUNC(dtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); +int BLASFUNC(qtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); +int BLASFUNC(ctbsv) (char *, char *, char *, int *, int *, float *, int *, float *, int *); +int BLASFUNC(ztbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); +int BLASFUNC(xtbsv) (char *, char *, char *, int *, int *, double *, int *, double *, int *); + +int BLASFUNC(ssymv) (char *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(dsymv) (char *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(qsymv) (char *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(csymv) (char *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zsymv) (char *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xsymv) (char *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(sspmv) (char *, int *, float *, float *, + float *, int *, float *, float *, int *); +int BLASFUNC(dspmv) (char *, int *, double *, double *, + double *, int *, double *, double *, int *); +int BLASFUNC(qspmv) (char *, int *, double *, double *, + double *, int *, double *, double *, int *); +int BLASFUNC(cspmv) (char *, int *, float *, float *, + float *, int *, float *, float *, int *); +int BLASFUNC(zspmv) (char *, int *, double *, double *, + double *, int *, double *, double *, int *); +int BLASFUNC(xspmv) (char *, int *, double *, double *, + double *, int *, double *, double *, int *); + +int BLASFUNC(ssyr) (char *, int *, float *, float *, int *, + float *, int *); +int BLASFUNC(dsyr) (char *, int *, double *, double *, int *, + double *, int *); +int BLASFUNC(qsyr) (char *, int *, double *, double *, int *, + double *, int *); +int BLASFUNC(csyr) (char *, int *, float *, float *, int *, + float *, int *); +int BLASFUNC(zsyr) (char *, int *, double *, double *, int *, + double *, int *); +int BLASFUNC(xsyr) (char *, int *, double *, double *, int *, + double *, int *); + +int BLASFUNC(ssyr2) (char *, int *, float *, + float *, int *, float *, int *, float *, int *); +int BLASFUNC(dsyr2) (char *, int *, double *, + double *, int *, double *, int *, double *, int *); +int BLASFUNC(qsyr2) (char *, int *, double *, + double *, int *, double *, int *, double *, int *); +int BLASFUNC(csyr2) (char *, int *, float *, + float *, int *, float *, int *, float *, int *); +int BLASFUNC(zsyr2) (char *, int *, double *, + double *, int *, double *, int *, double *, int *); +int BLASFUNC(xsyr2) (char *, int *, double *, + double *, int *, double *, int *, double *, int *); + +int BLASFUNC(sspr) (char *, int *, float *, float *, int *, + float *); +int BLASFUNC(dspr) (char *, int *, double *, double *, int *, + double *); +int BLASFUNC(qspr) (char *, int *, double *, double *, int *, + double *); +int BLASFUNC(cspr) (char *, int *, float *, float *, int *, + float *); +int BLASFUNC(zspr) (char *, int *, double *, double *, int *, + double *); +int BLASFUNC(xspr) (char *, int *, double *, double *, int *, + double *); + +int BLASFUNC(sspr2) (char *, int *, float *, + float *, int *, float *, int *, float *); +int BLASFUNC(dspr2) (char *, int *, double *, + double *, int *, double *, int *, double *); +int BLASFUNC(qspr2) (char *, int *, double *, + double *, int *, double *, int *, double *); +int BLASFUNC(cspr2) (char *, int *, float *, + float *, int *, float *, int *, float *); +int BLASFUNC(zspr2) (char *, int *, double *, + double *, int *, double *, int *, double *); +int BLASFUNC(xspr2) (char *, int *, double *, + double *, int *, double *, int *, double *); + +int BLASFUNC(cher) (char *, int *, float *, float *, int *, + float *, int *); +int BLASFUNC(zher) (char *, int *, double *, double *, int *, + double *, int *); +int BLASFUNC(xher) (char *, int *, double *, double *, int *, + double *, int *); + +int BLASFUNC(chpr) (char *, int *, float *, float *, int *, float *); +int BLASFUNC(zhpr) (char *, int *, double *, double *, int *, double *); +int BLASFUNC(xhpr) (char *, int *, double *, double *, int *, double *); + +int BLASFUNC(cher2) (char *, int *, float *, + float *, int *, float *, int *, float *, int *); +int BLASFUNC(zher2) (char *, int *, double *, + double *, int *, double *, int *, double *, int *); +int BLASFUNC(xher2) (char *, int *, double *, + double *, int *, double *, int *, double *, int *); + +int BLASFUNC(chpr2) (char *, int *, float *, + float *, int *, float *, int *, float *); +int BLASFUNC(zhpr2) (char *, int *, double *, + double *, int *, double *, int *, double *); +int BLASFUNC(xhpr2) (char *, int *, double *, + double *, int *, double *, int *, double *); + +int BLASFUNC(chemv) (char *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zhemv) (char *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xhemv) (char *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(chpmv) (char *, int *, float *, float *, + float *, int *, float *, float *, int *); +int BLASFUNC(zhpmv) (char *, int *, double *, double *, + double *, int *, double *, double *, int *); +int BLASFUNC(xhpmv) (char *, int *, double *, double *, + double *, int *, double *, double *, int *); + +int BLASFUNC(snorm)(char *, int *, int *, float *, int *); +int BLASFUNC(dnorm)(char *, int *, int *, double *, int *); +int BLASFUNC(cnorm)(char *, int *, int *, float *, int *); +int BLASFUNC(znorm)(char *, int *, int *, double *, int *); + +int BLASFUNC(sgbmv)(char *, int *, int *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(dgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(qgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(cgbmv)(char *, int *, int *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xgbmv)(char *, int *, int *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(ssbmv)(char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(dsbmv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(qsbmv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(csbmv)(char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zsbmv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xsbmv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(chbmv)(char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zhbmv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xhbmv)(char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +/* Level 3 routines */ + +int BLASFUNC(sgemm)(char *, char *, int *, int *, int *, float *, + float *, int *, float *, int *, float *, float *, int *); +int BLASFUNC(dgemm)(char *, char *, int *, int *, int *, double *, + double *, int *, double *, int *, double *, double *, int *); +int BLASFUNC(qgemm)(char *, char *, int *, int *, int *, double *, + double *, int *, double *, int *, double *, double *, int *); +int BLASFUNC(cgemm)(char *, char *, int *, int *, int *, float *, + float *, int *, float *, int *, float *, float *, int *); +int BLASFUNC(zgemm)(char *, char *, int *, int *, int *, double *, + double *, int *, double *, int *, double *, double *, int *); +int BLASFUNC(xgemm)(char *, char *, int *, int *, int *, double *, + double *, int *, double *, int *, double *, double *, int *); + +int BLASFUNC(cgemm3m)(char *, char *, int *, int *, int *, float *, + float *, int *, float *, int *, float *, float *, int *); +int BLASFUNC(zgemm3m)(char *, char *, int *, int *, int *, double *, + double *, int *, double *, int *, double *, double *, int *); +int BLASFUNC(xgemm3m)(char *, char *, int *, int *, int *, double *, + double *, int *, double *, int *, double *, double *, int *); + +int BLASFUNC(sge2mm)(char *, char *, char *, int *, int *, + float *, float *, int *, float *, int *, + float *, float *, int *); +int BLASFUNC(dge2mm)(char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *, + double *, double *, int *); +int BLASFUNC(cge2mm)(char *, char *, char *, int *, int *, + float *, float *, int *, float *, int *, + float *, float *, int *); +int BLASFUNC(zge2mm)(char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *, + double *, double *, int *); + +int BLASFUNC(strsm)(char *, char *, char *, char *, int *, int *, + float *, float *, int *, float *, int *); +int BLASFUNC(dtrsm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); +int BLASFUNC(qtrsm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); +int BLASFUNC(ctrsm)(char *, char *, char *, char *, int *, int *, + float *, float *, int *, float *, int *); +int BLASFUNC(ztrsm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); +int BLASFUNC(xtrsm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); + +int BLASFUNC(strmm)(char *, char *, char *, char *, int *, int *, + float *, float *, int *, float *, int *); +int BLASFUNC(dtrmm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); +int BLASFUNC(qtrmm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); +int BLASFUNC(ctrmm)(char *, char *, char *, char *, int *, int *, + float *, float *, int *, float *, int *); +int BLASFUNC(ztrmm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); +int BLASFUNC(xtrmm)(char *, char *, char *, char *, int *, int *, + double *, double *, int *, double *, int *); + +int BLASFUNC(ssymm)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(dsymm)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(qsymm)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(csymm)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zsymm)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xsymm)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(csymm3m)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zsymm3m)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xsymm3m)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(ssyrk)(char *, char *, int *, int *, float *, float *, int *, + float *, float *, int *); +int BLASFUNC(dsyrk)(char *, char *, int *, int *, double *, double *, int *, + double *, double *, int *); +int BLASFUNC(qsyrk)(char *, char *, int *, int *, double *, double *, int *, + double *, double *, int *); +int BLASFUNC(csyrk)(char *, char *, int *, int *, float *, float *, int *, + float *, float *, int *); +int BLASFUNC(zsyrk)(char *, char *, int *, int *, double *, double *, int *, + double *, double *, int *); +int BLASFUNC(xsyrk)(char *, char *, int *, int *, double *, double *, int *, + double *, double *, int *); + +int BLASFUNC(ssyr2k)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(dsyr2k)(char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); +int BLASFUNC(qsyr2k)(char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); +int BLASFUNC(csyr2k)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zsyr2k)(char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); +int BLASFUNC(xsyr2k)(char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); + +int BLASFUNC(chemm)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zhemm)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xhemm)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(chemm3m)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zhemm3m)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); +int BLASFUNC(xhemm3m)(char *, char *, int *, int *, double *, double *, int *, + double *, int *, double *, double *, int *); + +int BLASFUNC(cherk)(char *, char *, int *, int *, float *, float *, int *, + float *, float *, int *); +int BLASFUNC(zherk)(char *, char *, int *, int *, double *, double *, int *, + double *, double *, int *); +int BLASFUNC(xherk)(char *, char *, int *, int *, double *, double *, int *, + double *, double *, int *); + +int BLASFUNC(cher2k)(char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zher2k)(char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); +int BLASFUNC(xher2k)(char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); +int BLASFUNC(cher2m)(char *, char *, char *, int *, int *, float *, float *, int *, + float *, int *, float *, float *, int *); +int BLASFUNC(zher2m)(char *, char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); +int BLASFUNC(xher2m)(char *, char *, char *, int *, int *, double *, double *, int *, + double*, int *, double *, double *, int *); + +int BLASFUNC(sgemt)(char *, int *, int *, float *, float *, int *, + float *, int *); +int BLASFUNC(dgemt)(char *, int *, int *, double *, double *, int *, + double *, int *); +int BLASFUNC(cgemt)(char *, int *, int *, float *, float *, int *, + float *, int *); +int BLASFUNC(zgemt)(char *, int *, int *, double *, double *, int *, + double *, int *); + +int BLASFUNC(sgema)(char *, char *, int *, int *, float *, + float *, int *, float *, float *, int *, float *, int *); +int BLASFUNC(dgema)(char *, char *, int *, int *, double *, + double *, int *, double*, double *, int *, double*, int *); +int BLASFUNC(cgema)(char *, char *, int *, int *, float *, + float *, int *, float *, float *, int *, float *, int *); +int BLASFUNC(zgema)(char *, char *, int *, int *, double *, + double *, int *, double*, double *, int *, double*, int *); + +int BLASFUNC(sgems)(char *, char *, int *, int *, float *, + float *, int *, float *, float *, int *, float *, int *); +int BLASFUNC(dgems)(char *, char *, int *, int *, double *, + double *, int *, double*, double *, int *, double*, int *); +int BLASFUNC(cgems)(char *, char *, int *, int *, float *, + float *, int *, float *, float *, int *, float *, int *); +int BLASFUNC(zgems)(char *, char *, int *, int *, double *, + double *, int *, double*, double *, int *, double*, int *); + +int BLASFUNC(sgetf2)(int *, int *, float *, int *, int *, int *); +int BLASFUNC(dgetf2)(int *, int *, double *, int *, int *, int *); +int BLASFUNC(qgetf2)(int *, int *, double *, int *, int *, int *); +int BLASFUNC(cgetf2)(int *, int *, float *, int *, int *, int *); +int BLASFUNC(zgetf2)(int *, int *, double *, int *, int *, int *); +int BLASFUNC(xgetf2)(int *, int *, double *, int *, int *, int *); + +int BLASFUNC(sgetrf)(int *, int *, float *, int *, int *, int *); +int BLASFUNC(dgetrf)(int *, int *, double *, int *, int *, int *); +int BLASFUNC(qgetrf)(int *, int *, double *, int *, int *, int *); +int BLASFUNC(cgetrf)(int *, int *, float *, int *, int *, int *); +int BLASFUNC(zgetrf)(int *, int *, double *, int *, int *, int *); +int BLASFUNC(xgetrf)(int *, int *, double *, int *, int *, int *); + +int BLASFUNC(slaswp)(int *, float *, int *, int *, int *, int *, int *); +int BLASFUNC(dlaswp)(int *, double *, int *, int *, int *, int *, int *); +int BLASFUNC(qlaswp)(int *, double *, int *, int *, int *, int *, int *); +int BLASFUNC(claswp)(int *, float *, int *, int *, int *, int *, int *); +int BLASFUNC(zlaswp)(int *, double *, int *, int *, int *, int *, int *); +int BLASFUNC(xlaswp)(int *, double *, int *, int *, int *, int *, int *); + +int BLASFUNC(sgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *); +int BLASFUNC(dgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); +int BLASFUNC(qgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); +int BLASFUNC(cgetrs)(char *, int *, int *, float *, int *, int *, float *, int *, int *); +int BLASFUNC(zgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); +int BLASFUNC(xgetrs)(char *, int *, int *, double *, int *, int *, double *, int *, int *); + +int BLASFUNC(sgesv)(int *, int *, float *, int *, int *, float *, int *, int *); +int BLASFUNC(dgesv)(int *, int *, double *, int *, int *, double*, int *, int *); +int BLASFUNC(qgesv)(int *, int *, double *, int *, int *, double*, int *, int *); +int BLASFUNC(cgesv)(int *, int *, float *, int *, int *, float *, int *, int *); +int BLASFUNC(zgesv)(int *, int *, double *, int *, int *, double*, int *, int *); +int BLASFUNC(xgesv)(int *, int *, double *, int *, int *, double*, int *, int *); + +int BLASFUNC(spotf2)(char *, int *, float *, int *, int *); +int BLASFUNC(dpotf2)(char *, int *, double *, int *, int *); +int BLASFUNC(qpotf2)(char *, int *, double *, int *, int *); +int BLASFUNC(cpotf2)(char *, int *, float *, int *, int *); +int BLASFUNC(zpotf2)(char *, int *, double *, int *, int *); +int BLASFUNC(xpotf2)(char *, int *, double *, int *, int *); + +int BLASFUNC(spotrf)(char *, int *, float *, int *, int *); +int BLASFUNC(dpotrf)(char *, int *, double *, int *, int *); +int BLASFUNC(qpotrf)(char *, int *, double *, int *, int *); +int BLASFUNC(cpotrf)(char *, int *, float *, int *, int *); +int BLASFUNC(zpotrf)(char *, int *, double *, int *, int *); +int BLASFUNC(xpotrf)(char *, int *, double *, int *, int *); + +int BLASFUNC(slauu2)(char *, int *, float *, int *, int *); +int BLASFUNC(dlauu2)(char *, int *, double *, int *, int *); +int BLASFUNC(qlauu2)(char *, int *, double *, int *, int *); +int BLASFUNC(clauu2)(char *, int *, float *, int *, int *); +int BLASFUNC(zlauu2)(char *, int *, double *, int *, int *); +int BLASFUNC(xlauu2)(char *, int *, double *, int *, int *); + +int BLASFUNC(slauum)(char *, int *, float *, int *, int *); +int BLASFUNC(dlauum)(char *, int *, double *, int *, int *); +int BLASFUNC(qlauum)(char *, int *, double *, int *, int *); +int BLASFUNC(clauum)(char *, int *, float *, int *, int *); +int BLASFUNC(zlauum)(char *, int *, double *, int *, int *); +int BLASFUNC(xlauum)(char *, int *, double *, int *, int *); + +int BLASFUNC(strti2)(char *, char *, int *, float *, int *, int *); +int BLASFUNC(dtrti2)(char *, char *, int *, double *, int *, int *); +int BLASFUNC(qtrti2)(char *, char *, int *, double *, int *, int *); +int BLASFUNC(ctrti2)(char *, char *, int *, float *, int *, int *); +int BLASFUNC(ztrti2)(char *, char *, int *, double *, int *, int *); +int BLASFUNC(xtrti2)(char *, char *, int *, double *, int *, int *); + +int BLASFUNC(strtri)(char *, char *, int *, float *, int *, int *); +int BLASFUNC(dtrtri)(char *, char *, int *, double *, int *, int *); +int BLASFUNC(qtrtri)(char *, char *, int *, double *, int *, int *); +int BLASFUNC(ctrtri)(char *, char *, int *, float *, int *, int *); +int BLASFUNC(ztrtri)(char *, char *, int *, double *, int *, int *); +int BLASFUNC(xtrtri)(char *, char *, int *, double *, int *, int *); + +int BLASFUNC(spotri)(char *, int *, float *, int *, int *); +int BLASFUNC(dpotri)(char *, int *, double *, int *, int *); +int BLASFUNC(qpotri)(char *, int *, double *, int *, int *); +int BLASFUNC(cpotri)(char *, int *, float *, int *, int *); +int BLASFUNC(zpotri)(char *, int *, double *, int *, int *); +int BLASFUNC(xpotri)(char *, int *, double *, int *, int *); + +#endif diff --git a/simulation/externals/eigen/bench/btl/libs/BLAS/blas_interface.hh b/simulation/externals/eigen/bench/btl/libs/BLAS/blas_interface.hh new file mode 100644 index 0000000..6510546 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/BLAS/blas_interface.hh @@ -0,0 +1,83 @@ +//===================================================== +// File : blas_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:28 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef blas_PRODUIT_MATRICE_VECTEUR_HH +#define blas_PRODUIT_MATRICE_VECTEUR_HH + +#include +#include +extern "C" +{ +#include "blas.h" + + // Cholesky Factorization +// void spotrf_(const char* uplo, const int* n, float *a, const int* ld, int* info); +// void dpotrf_(const char* uplo, const int* n, double *a, const int* ld, int* info); + void ssytrd_(char *uplo, const int *n, float *a, const int *lda, float *d, float *e, float *tau, float *work, int *lwork, int *info ); + void dsytrd_(char *uplo, const int *n, double *a, const int *lda, double *d, double *e, double *tau, double *work, int *lwork, int *info ); + void sgehrd_( const int *n, int *ilo, int *ihi, float *a, const int *lda, float *tau, float *work, int *lwork, int *info ); + void dgehrd_( const int *n, int *ilo, int *ihi, double *a, const int *lda, double *tau, double *work, int *lwork, int *info ); + + // LU row pivoting +// void dgetrf_( int *m, int *n, double *a, int *lda, int *ipiv, int *info ); +// void sgetrf_(const int* m, const int* n, float *a, const int* ld, int* ipivot, int* info); + // LU full pivoting + void sgetc2_(const int* n, float *a, const int *lda, int *ipiv, int *jpiv, int*info ); + void dgetc2_(const int* n, double *a, const int *lda, int *ipiv, int *jpiv, int*info ); +#ifdef HAS_LAPACK +#endif +} + +#define MAKE_STRING2(S) #S +#define MAKE_STRING(S) MAKE_STRING2(S) + +#define CAT2(A,B) A##B +#define CAT(A,B) CAT2(A,B) + + +template class blas_interface; + + +static char notrans = 'N'; +static char trans = 'T'; +static char nonunit = 'N'; +static char lower = 'L'; +static char right = 'R'; +static char left = 'L'; +static int intone = 1; + + + +#define SCALAR float +#define SCALAR_PREFIX s +#include "blas_interface_impl.hh" +#undef SCALAR +#undef SCALAR_PREFIX + + +#define SCALAR double +#define SCALAR_PREFIX d +#include "blas_interface_impl.hh" +#undef SCALAR +#undef SCALAR_PREFIX + +#endif + + + diff --git a/simulation/externals/eigen/bench/btl/libs/BLAS/blas_interface_impl.hh b/simulation/externals/eigen/bench/btl/libs/BLAS/blas_interface_impl.hh new file mode 100644 index 0000000..fc4ba2a --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/BLAS/blas_interface_impl.hh @@ -0,0 +1,147 @@ + +#define BLAS_FUNC(NAME) CAT(CAT(SCALAR_PREFIX,NAME),_) + +template<> class blas_interface : public c_interface_base +{ + +public : + + static SCALAR fone; + static SCALAR fzero; + + static inline std::string name() + { + return MAKE_STRING(CBLASNAME); + } + + static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + BLAS_FUNC(gemv)(¬rans,&N,&N,&fone,A,&N,B,&intone,&fzero,X,&intone); + } + + static inline void symv(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + BLAS_FUNC(symv)(&lower, &N,&fone,A,&N,B,&intone,&fzero,X,&intone); + } + + static inline void syr2(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + BLAS_FUNC(syr2)(&lower,&N,&fone,B,&intone,X,&intone,A,&N); + } + + static inline void ger(gene_matrix & A, gene_vector & X, gene_vector & Y, int N){ + BLAS_FUNC(ger)(&N,&N,&fone,X,&intone,Y,&intone,A,&N); + } + + static inline void rot(gene_vector & A, gene_vector & B, SCALAR c, SCALAR s, int N){ + BLAS_FUNC(rot)(&N,A,&intone,B,&intone,&c,&s); + } + + static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + BLAS_FUNC(gemv)(&trans,&N,&N,&fone,A,&N,B,&intone,&fzero,X,&intone); + } + + static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){ + BLAS_FUNC(gemm)(¬rans,¬rans,&N,&N,&N,&fone,A,&N,B,&N,&fzero,X,&N); + } + + static inline void transposed_matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N){ + BLAS_FUNC(gemm)(¬rans,¬rans,&N,&N,&N,&fone,A,&N,B,&N,&fzero,X,&N); + } + +// static inline void ata_product(gene_matrix & A, gene_matrix & X, int N){ +// ssyrk_(&lower,&trans,&N,&N,&fone,A,&N,&fzero,X,&N); +// } + + static inline void aat_product(gene_matrix & A, gene_matrix & X, int N){ + BLAS_FUNC(syrk)(&lower,¬rans,&N,&N,&fone,A,&N,&fzero,X,&N); + } + + static inline void axpy(SCALAR coef, const gene_vector & X, gene_vector & Y, int N){ + BLAS_FUNC(axpy)(&N,&coef,X,&intone,Y,&intone); + } + + static inline void axpby(SCALAR a, const gene_vector & X, SCALAR b, gene_vector & Y, int N){ + BLAS_FUNC(scal)(&N,&b,Y,&intone); + BLAS_FUNC(axpy)(&N,&a,X,&intone,Y,&intone); + } + + static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){ + int N2 = N*N; + BLAS_FUNC(copy)(&N2, X, &intone, C, &intone); + char uplo = 'L'; + int info = 0; + BLAS_FUNC(potrf)(&uplo, &N, C, &N, &info); + if(info!=0) std::cerr << "potrf_ error " << info << "\n"; + } + + static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ + int N2 = N*N; + BLAS_FUNC(copy)(&N2, X, &intone, C, &intone); + int info = 0; + int * ipiv = (int*)alloca(sizeof(int)*N); + BLAS_FUNC(getrf)(&N, &N, C, &N, ipiv, &info); + if(info!=0) std::cerr << "getrf_ error " << info << "\n"; + } + + static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){ + BLAS_FUNC(copy)(&N, B, &intone, X, &intone); + BLAS_FUNC(trsv)(&lower, ¬rans, &nonunit, &N, L, &N, X, &intone); + } + + static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix & X, int N){ + BLAS_FUNC(copy)(&N, B, &intone, X, &intone); + BLAS_FUNC(trsm)(&right, &lower, ¬rans, &nonunit, &N, &N, &fone, L, &N, X, &N); + } + + static inline void trmm(gene_matrix & A, gene_matrix & B, gene_matrix & /*X*/, int N){ + BLAS_FUNC(trmm)(&left, &lower, ¬rans,&nonunit, &N,&N,&fone,A,&N,B,&N); + } + + #ifdef HAS_LAPACK + + static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ + int N2 = N*N; + BLAS_FUNC(copy)(&N2, X, &intone, C, &intone); + int info = 0; + int * ipiv = (int*)alloca(sizeof(int)*N); + int * jpiv = (int*)alloca(sizeof(int)*N); + BLAS_FUNC(getc2)(&N, C, &N, ipiv, jpiv, &info); + } + + + + static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){ + { + int N2 = N*N; + int inc = 1; + BLAS_FUNC(copy)(&N2, X, &inc, C, &inc); + } + int info = 0; + int ilo = 1; + int ihi = N; + int bsize = 64; + int worksize = N*bsize; + SCALAR* d = new SCALAR[N+worksize]; + BLAS_FUNC(gehrd)(&N, &ilo, &ihi, C, &N, d, d+N, &worksize, &info); + delete[] d; + } + + static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){ + { + int N2 = N*N; + int inc = 1; + BLAS_FUNC(copy)(&N2, X, &inc, C, &inc); + } + char uplo = 'U'; + int info = 0; + int bsize = 64; + int worksize = N*bsize; + SCALAR* d = new SCALAR[3*N+worksize]; + BLAS_FUNC(sytrd)(&uplo, &N, C, &N, d, d+N, d+2*N, d+3*N, &worksize, &info); + delete[] d; + } + + #endif // HAS_LAPACK + +}; + +SCALAR blas_interface::fone = SCALAR(1); +SCALAR blas_interface::fzero = SCALAR(0); diff --git a/simulation/externals/eigen/bench/btl/libs/BLAS/c_interface_base.h b/simulation/externals/eigen/bench/btl/libs/BLAS/c_interface_base.h new file mode 100644 index 0000000..de61380 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/BLAS/c_interface_base.h @@ -0,0 +1,73 @@ + +#ifndef BTL_C_INTERFACE_BASE_H +#define BTL_C_INTERFACE_BASE_H + +#include "utilities.h" +#include + +template class c_interface_base +{ + +public: + + typedef real real_type; + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef real* gene_matrix; + typedef real* gene_vector; + + static void free_matrix(gene_matrix & A, int /*N*/){ + delete[] A; + } + + static void free_vector(gene_vector & B){ + delete[] B; + } + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + int N = A_stl.size(); + A = new real[N*N]; + for (int j=0;j +// Copyright (C) EDF R&D, lun sep 30 14:23:28 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "blas_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +#include "action_cholesky.hh" +#include "action_lu_decomp.hh" +#include "action_partial_lu.hh" +#include "action_trisolve_matrix.hh" + +#ifdef HAS_LAPACK +#include "action_hessenberg.hh" +#endif + +BTL_MAIN; + +int main() +{ + + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_LU,MAX_LU,NB_POINT); + bench > >(MIN_LU,MAX_LU,NB_POINT); + + #ifdef HAS_LAPACK +// bench > >(MIN_LU,MAX_LU,NB_POINT); + bench > >(MIN_LU,MAX_LU,NB_POINT); + bench > >(MIN_LU,MAX_LU,NB_POINT); + #endif + + //bench > >(MIN_LU,MAX_LU,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/STL/CMakeLists.txt b/simulation/externals/eigen/bench/btl/libs/STL/CMakeLists.txt new file mode 100644 index 0000000..4cfc2dc --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/STL/CMakeLists.txt @@ -0,0 +1,2 @@ + +btl_add_bench(btl_STL main.cpp OFF) diff --git a/simulation/externals/eigen/bench/btl/libs/STL/STL_interface.hh b/simulation/externals/eigen/bench/btl/libs/STL/STL_interface.hh new file mode 100644 index 0000000..ef4cc92 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/STL/STL_interface.hh @@ -0,0 +1,244 @@ +//===================================================== +// File : STL_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:24 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef STL_INTERFACE_HH +#define STL_INTERFACE_HH +#include +#include +#include "utilities.h" + +using namespace std; + +template +class STL_interface{ + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef stl_matrix gene_matrix; + + typedef stl_vector gene_vector; + + static inline std::string name( void ) + { + return "STL"; + } + + static void free_matrix(gene_matrix & /*A*/, int /*N*/){} + + static void free_vector(gene_vector & /*B*/){} + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A = A_stl; + } + + static inline void vector_from_stl(gene_vector & B, stl_vector & B_stl){ + B = B_stl; + } + + static inline void vector_to_stl(gene_vector & B, stl_vector & B_stl){ + B_stl = B ; + } + + + static inline void matrix_to_stl(gene_matrix & A, stl_matrix & A_stl){ + A_stl = A ; + } + + static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){ + for (int i=0;i=j) + { + for (int k=0;k > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/blaze/CMakeLists.txt b/simulation/externals/eigen/bench/btl/libs/blaze/CMakeLists.txt new file mode 100644 index 0000000..e99a085 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/blaze/CMakeLists.txt @@ -0,0 +1,13 @@ + +find_package(BLAZE) +find_package(Boost COMPONENTS system) +if (BLAZE_FOUND AND Boost_FOUND) + include_directories(${BLAZE_INCLUDE_DIR} ${Boost_INCLUDE_DIRS}) + btl_add_bench(btl_blaze main.cpp) + # Note: The newest blaze version requires C++14. + # Ideally, we should set this depending on the version of Blaze we found + set_property(TARGET btl_blaze PROPERTY CXX_STANDARD 14) + if(BUILD_btl_blaze) + target_link_libraries(btl_blaze ${Boost_LIBRARIES}) + endif() +endif () diff --git a/simulation/externals/eigen/bench/btl/libs/blaze/blaze_interface.hh b/simulation/externals/eigen/bench/btl/libs/blaze/blaze_interface.hh new file mode 100644 index 0000000..ee15239 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/blaze/blaze_interface.hh @@ -0,0 +1,140 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BLAZE_INTERFACE_HH +#define BLAZE_INTERFACE_HH + +#include +#include +// using namespace blaze; + +#include + +template +class blaze_interface { + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef blaze::DynamicMatrix gene_matrix; + typedef blaze::DynamicVector gene_vector; + + static inline std::string name() { return "blaze"; } + + static void free_matrix(gene_matrix & A, int N){ + return ; + } + + static void free_vector(gene_vector & B){ + return ; + } + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.resize(A_stl[0].size(), A_stl.size()); + + for (int j=0; j ipvt(N); +// lu_factor(R, ipvt); +// } + +// static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){ +// X = lower_trisolve(L, B); +// } + + static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){ + cible = source; + } + + static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){ + cible = source; + } + +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/libs/blaze/main.cpp b/simulation/externals/eigen/bench/btl/libs/blaze/main.cpp new file mode 100644 index 0000000..80e8f4e --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/blaze/main.cpp @@ -0,0 +1,40 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "blaze_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/blitz/CMakeLists.txt b/simulation/externals/eigen/bench/btl/libs/blitz/CMakeLists.txt new file mode 100644 index 0000000..880ab73 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/blitz/CMakeLists.txt @@ -0,0 +1,17 @@ + +find_package(Blitz) + +if (BLITZ_FOUND) + include_directories(${BLITZ_INCLUDES}) + + btl_add_bench(btl_blitz btl_blitz.cpp) + if (BUILD_btl_blitz) + target_link_libraries(btl_blitz ${BLITZ_LIBRARIES}) + endif (BUILD_btl_blitz) + + btl_add_bench(btl_tiny_blitz btl_tiny_blitz.cpp OFF) + if (BUILD_btl_tiny_blitz) + target_link_libraries(btl_tiny_blitz ${BLITZ_LIBRARIES}) + endif (BUILD_btl_tiny_blitz) + +endif (BLITZ_FOUND) diff --git a/simulation/externals/eigen/bench/btl/libs/blitz/blitz_LU_solve_interface.hh b/simulation/externals/eigen/bench/btl/libs/blitz/blitz_LU_solve_interface.hh new file mode 100644 index 0000000..dcb9f56 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/blitz/blitz_LU_solve_interface.hh @@ -0,0 +1,192 @@ +//===================================================== +// File : blitz_LU_solve_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:31 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BLITZ_LU_SOLVE_INTERFACE_HH +#define BLITZ_LU_SOLVE_INTERFACE_HH + +#include "blitz/array.h" +#include + +BZ_USING_NAMESPACE(blitz) + +template +class blitz_LU_solve_interface : public blitz_interface +{ + +public : + + typedef typename blitz_interface::gene_matrix gene_matrix; + typedef typename blitz_interface::gene_vector gene_vector; + + typedef blitz::Array Pivot_Vector; + + inline static void new_Pivot_Vector(Pivot_Vector & pivot,int N) + { + + pivot.resize(N); + + } + + inline static void free_Pivot_Vector(Pivot_Vector & pivot) + { + + return; + + } + + + static inline real matrix_vector_product_sliced(const gene_matrix & A, gene_vector B, int row, int col_start, int col_end) + { + + real somme=0.; + + for (int j=col_start ; j=big ) big = abs( LU( i, j ) ) ; + } + if( big==0. ) { + INFOS( "blitz_LU_factor::Singular matrix" ) ; + exit( 0 ) ; + } + ImplicitScaling( i ) = 1./big ; + } + // Loop over columns of Crout's method : + for( int j=0; j=big ) { + dum = ImplicitScaling( i )*abs( theSum ) ; + big = dum ; + index_max = i ; + } + } + // Interchanging rows and the scale factor : + if( j!=index_max ) { + for( int k=0; k=0; i-- ) { + theSum = X( i ) ; + // theSum = B( i ) ; + theSum -= matrix_vector_product_sliced(LU, X, i, i+1, N) ; + // theSum -= sum( LU( i, Range( i+1, toEnd ) )*X( Range( i+1, toEnd ) ) ) ; + // theSum -= sum( LU( i, Range( i+1, toEnd ) )*B( Range( i+1, toEnd ) ) ) ; + // Store a component of the solution vector : + X( i ) = theSum/LU( i, i ) ; + // B( i ) = theSum/LU( i, i ) ; + } + + } + +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/libs/blitz/blitz_interface.hh b/simulation/externals/eigen/bench/btl/libs/blitz/blitz_interface.hh new file mode 100644 index 0000000..a67c47c --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/blitz/blitz_interface.hh @@ -0,0 +1,147 @@ +//===================================================== +// File : blitz_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BLITZ_INTERFACE_HH +#define BLITZ_INTERFACE_HH + +#include +#include +#include +#include +#include +#include + +BZ_USING_NAMESPACE(blitz) + +template +class blitz_interface{ + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef blitz::Array gene_matrix; + typedef blitz::Array gene_vector; +// typedef blitz::Matrix gene_matrix; +// typedef blitz::Vector gene_vector; + + static inline std::string name() { return "blitz"; } + + static void free_matrix(gene_matrix & A, int N){} + + static void free_vector(gene_vector & B){} + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.resize(A_stl[0].size(),A_stl.size()); + for (int j=0; j(source); +// for (int i=0;i(source); + cible = source; + } + +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/libs/blitz/btl_blitz.cpp b/simulation/externals/eigen/bench/btl/libs/blitz/btl_blitz.cpp new file mode 100644 index 0000000..16d2b59 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/blitz/btl_blitz.cpp @@ -0,0 +1,51 @@ +//===================================================== +// File : main.cpp +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "blitz_interface.hh" +#include "blitz_LU_solve_interface.hh" +#include "bench.hh" +#include "action_matrix_vector_product.hh" +#include "action_matrix_matrix_product.hh" +#include "action_axpy.hh" +#include "action_lu_solve.hh" +#include "action_ata_product.hh" +#include "action_aat_product.hh" +#include "action_atv_product.hh" + +BTL_MAIN; + +int main() +{ + + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + //bench > >(MIN_LU,MAX_LU,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/blitz/btl_tiny_blitz.cpp b/simulation/externals/eigen/bench/btl/libs/blitz/btl_tiny_blitz.cpp new file mode 100644 index 0000000..9fddde7 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/blitz/btl_tiny_blitz.cpp @@ -0,0 +1,38 @@ +//===================================================== +// File : main.cpp +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "tiny_blitz_interface.hh" +#include "static/bench_static.hh" +#include "action_matrix_vector_product.hh" +#include "action_matrix_matrix_product.hh" +#include "action_axpy.hh" + +BTL_MAIN; + +int main() +{ + bench_static(); + bench_static(); + bench_static(); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/blitz/tiny_blitz_interface.hh b/simulation/externals/eigen/bench/btl/libs/blitz/tiny_blitz_interface.hh new file mode 100644 index 0000000..6b26db7 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/blitz/tiny_blitz_interface.hh @@ -0,0 +1,106 @@ +//===================================================== +// File : tiny_blitz_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef TINY_BLITZ_INTERFACE_HH +#define TINY_BLITZ_INTERFACE_HH + +#include "blitz/array.h" +#include "blitz/tiny.h" +#include "blitz/tinymat.h" +#include "blitz/tinyvec.h" +#include + +#include + +BZ_USING_NAMESPACE(blitz) + +template +class tiny_blitz_interface +{ + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef TinyVector gene_vector; + typedef TinyMatrix gene_matrix; + + static inline std::string name() { return "tiny_blitz"; } + + static void free_matrix(gene_matrix & A, int N){} + + static void free_vector(gene_vector & B){} + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + for (int j=0; j +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen3_interface.hh" +#include "static/bench_static.hh" +#include "action_matrix_vector_product.hh" +#include "action_matrix_matrix_product.hh" +#include "action_axpy.hh" +#include "action_lu_solve.hh" +#include "action_ata_product.hh" +#include "action_aat_product.hh" +#include "action_atv_product.hh" +#include "action_cholesky.hh" +#include "action_trisolve.hh" + +BTL_MAIN; + +int main() +{ + + bench_static(); + bench_static(); + bench_static(); + bench_static(); + bench_static(); + bench_static(); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/eigen2/eigen2_interface.hh b/simulation/externals/eigen/bench/btl/libs/eigen2/eigen2_interface.hh new file mode 100644 index 0000000..1deabda --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/eigen2/eigen2_interface.hh @@ -0,0 +1,168 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef EIGEN2_INTERFACE_HH +#define EIGEN2_INTERFACE_HH +// #include +#include +#include +#include +#include +#include +#include "btl.hh" + +using namespace Eigen; + +template +class eigen2_interface +{ + +public : + + enum {IsFixedSize = (SIZE!=Dynamic)}; + + typedef real real_type; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef Eigen::Matrix gene_matrix; + typedef Eigen::Matrix gene_vector; + + static inline std::string name( void ) + { + #if defined(EIGEN_VECTORIZE_SSE) + if (SIZE==Dynamic) return "eigen2"; else return "tiny_eigen2"; + #elif defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX) + if (SIZE==Dynamic) return "eigen2"; else return "tiny_eigen2"; + #else + if (SIZE==Dynamic) return "eigen2_novec"; else return "tiny_eigen2_novec"; + #endif + } + + static void free_matrix(gene_matrix & A, int N) {} + + static void free_vector(gene_vector & B) {} + + static BTL_DONT_INLINE void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.resize(A_stl[0].size(), A_stl.size()); + + for (int j=0; j().solveTriangular(B); + } + + static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int N){ + X = L.template marked().solveTriangular(B); + } + + static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){ + C = X.llt().matrixL(); +// C = X; +// Cholesky::computeInPlace(C); +// Cholesky::computeInPlaceBlock(C); + } + + static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ + C = X.lu().matrixLU(); +// C = X.inverse(); + } + + static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){ + C = Tridiagonalization(X).packedMatrix(); + } + + static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int N){ + C = HessenbergDecomposition(X).packedMatrix(); + } + + + +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/libs/eigen2/main_adv.cpp b/simulation/externals/eigen/bench/btl/libs/eigen2/main_adv.cpp new file mode 100644 index 0000000..fe33689 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/eigen2/main_adv.cpp @@ -0,0 +1,44 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen2_interface.hh" +#include "bench.hh" +#include "action_trisolve.hh" +#include "action_trisolve_matrix.hh" +#include "action_cholesky.hh" +#include "action_hessenberg.hh" +#include "action_lu_decomp.hh" +// #include "action_partial_lu.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/eigen2/main_linear.cpp b/simulation/externals/eigen/bench/btl/libs/eigen2/main_linear.cpp new file mode 100644 index 0000000..c17d16c --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/eigen2/main_linear.cpp @@ -0,0 +1,34 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen2_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/eigen2/main_matmat.cpp b/simulation/externals/eigen/bench/btl/libs/eigen2/main_matmat.cpp new file mode 100644 index 0000000..cd9dc9c --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/eigen2/main_matmat.cpp @@ -0,0 +1,35 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen2_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/eigen2/main_vecmat.cpp b/simulation/externals/eigen/bench/btl/libs/eigen2/main_vecmat.cpp new file mode 100644 index 0000000..8b66cd2 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/eigen2/main_vecmat.cpp @@ -0,0 +1,36 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen2_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); +// bench > >(MIN_MV,MAX_MV,NB_POINT); +// bench > >(MIN_MV,MAX_MV,NB_POINT); +// bench > >(MIN_MV,MAX_MV,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/eigen3/CMakeLists.txt b/simulation/externals/eigen/bench/btl/libs/eigen3/CMakeLists.txt new file mode 100644 index 0000000..00cae23 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/eigen3/CMakeLists.txt @@ -0,0 +1,65 @@ + + +if((NOT EIGEN3_INCLUDE_DIR) AND Eigen_SOURCE_DIR) + # unless EIGEN3_INCLUDE_DIR is defined, let's use current Eigen version + set(EIGEN3_INCLUDE_DIR ${Eigen_SOURCE_DIR}) + set(EIGEN3_FOUND TRUE) +else() + find_package(Eigen3) +endif() + +if (EIGEN3_FOUND) + + include_directories(${EIGEN3_INCLUDE_DIR}) + btl_add_bench(btl_eigen3_linear main_linear.cpp) + btl_add_bench(btl_eigen3_vecmat main_vecmat.cpp) + btl_add_bench(btl_eigen3_matmat main_matmat.cpp) + btl_add_bench(btl_eigen3_adv main_adv.cpp ) + + btl_add_target_property(btl_eigen3_linear COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3") + btl_add_target_property(btl_eigen3_vecmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3") + btl_add_target_property(btl_eigen3_matmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3") + btl_add_target_property(btl_eigen3_adv COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=eigen3") + + option(BTL_BENCH_NOGCCVEC "also bench Eigen explicit vec without GCC's auto vec" OFF) + if(CMAKE_COMPILER_IS_GNUCXX AND BTL_BENCH_NOGCCVEC) + btl_add_bench(btl_eigen3_nogccvec_linear main_linear.cpp) + btl_add_bench(btl_eigen3_nogccvec_vecmat main_vecmat.cpp) + btl_add_bench(btl_eigen3_nogccvec_matmat main_matmat.cpp) + btl_add_bench(btl_eigen3_nogccvec_adv main_adv.cpp ) + + btl_add_target_property(btl_eigen3_nogccvec_linear COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec") + btl_add_target_property(btl_eigen3_nogccvec_vecmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec") + btl_add_target_property(btl_eigen3_nogccvec_matmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec") + btl_add_target_property(btl_eigen3_nogccvec_adv COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=eigen3_nogccvec") + endif() + + + if(NOT BTL_NOVEC) + btl_add_bench(btl_eigen3_novec_linear main_linear.cpp OFF) + btl_add_bench(btl_eigen3_novec_vecmat main_vecmat.cpp OFF) + btl_add_bench(btl_eigen3_novec_matmat main_matmat.cpp OFF) + btl_add_bench(btl_eigen3_novec_adv main_adv.cpp OFF) + btl_add_target_property(btl_eigen3_novec_linear COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec") + btl_add_target_property(btl_eigen3_novec_vecmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec") + btl_add_target_property(btl_eigen3_novec_matmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec") + btl_add_target_property(btl_eigen3_novec_adv COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_novec") + +# if(BUILD_btl_eigen3_adv) +# target_link_libraries(btl_eigen3_adv ${MKL_LIBRARIES}) +# endif(BUILD_btl_eigen3_adv) + + endif(NOT BTL_NOVEC) + + btl_add_bench(btl_tiny_eigen3 btl_tiny_eigen3.cpp OFF) + + if(NOT BTL_NOVEC) + btl_add_bench(btl_tiny_eigen3_novec btl_tiny_eigen3.cpp OFF) + btl_add_target_property(btl_tiny_eigen3_novec COMPILE_FLAGS "-DBTL_PREFIX=eigen3_tiny") + + if(BUILD_btl_tiny_eigen3_novec) + btl_add_target_property(btl_tiny_eigen3_novec COMPILE_FLAGS "-DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=eigen3_tiny_novec") + endif(BUILD_btl_tiny_eigen3_novec) + endif(NOT BTL_NOVEC) + +endif (EIGEN3_FOUND) diff --git a/simulation/externals/eigen/bench/btl/libs/eigen3/btl_tiny_eigen3.cpp b/simulation/externals/eigen/bench/btl/libs/eigen3/btl_tiny_eigen3.cpp new file mode 100644 index 0000000..d1515be --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/eigen3/btl_tiny_eigen3.cpp @@ -0,0 +1,46 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen3_interface.hh" +#include "static/bench_static.hh" +#include "action_matrix_vector_product.hh" +#include "action_matrix_matrix_product.hh" +#include "action_axpy.hh" +#include "action_lu_solve.hh" +#include "action_ata_product.hh" +#include "action_aat_product.hh" +#include "action_atv_product.hh" +#include "action_cholesky.hh" +#include "action_trisolve.hh" + +BTL_MAIN; + +int main() +{ + + bench_static(); + bench_static(); + bench_static(); + bench_static(); + bench_static(); + bench_static(); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/eigen3/eigen3_interface.hh b/simulation/externals/eigen/bench/btl/libs/eigen3/eigen3_interface.hh new file mode 100644 index 0000000..b821fd7 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/eigen3/eigen3_interface.hh @@ -0,0 +1,240 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef EIGEN3_INTERFACE_HH +#define EIGEN3_INTERFACE_HH + +#include +#include +#include "btl.hh" + +using namespace Eigen; + +template +class eigen3_interface +{ + +public : + + enum {IsFixedSize = (SIZE!=Dynamic)}; + + typedef real real_type; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef Eigen::Matrix gene_matrix; + typedef Eigen::Matrix gene_vector; + + static inline std::string name( void ) + { + return EIGEN_MAKESTRING(BTL_PREFIX); + } + + static void free_matrix(gene_matrix & /*A*/, int /*N*/) {} + + static void free_vector(gene_vector & /*B*/) {} + + static BTL_DONT_INLINE void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.resize(A_stl[0].size(), A_stl.size()); + + for (unsigned int j=0; j().setZero(); + X.template selfadjointView().rankUpdate(A); + } + + static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){ + X.noalias() = A*B; + } + + static inline void symv(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){ + X.noalias() = (A.template selfadjointView() * B); +// internal::product_selfadjoint_vector(N,A.data(),N, B.data(), 1, X.data(), 1); + } + + template static void triassign(Dest& dst, const Src& src) + { + typedef typename Dest::Scalar Scalar; + typedef typename internal::packet_traits::type Packet; + const int PacketSize = sizeof(Packet)/sizeof(Scalar); + int size = dst.cols(); + for(int j=0; j(j, index, src); + else + dst.template copyPacket(index, j, src); + } + + // do the non-vectorizable part of the assignment + for (int index = alignedEnd; index(N,A.data(),N, X.data(), 1, Y.data(), 1, -1); + for(int j=0; j(c,s)); + } + + static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int /*N*/){ + X.noalias() = (A.transpose()*B); + } + + static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int /*N*/){ + Y += coef * X; + } + + static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int /*N*/){ + Y = a*X + b*Y; + } + + static EIGEN_DONT_INLINE void copy_matrix(const gene_matrix & source, gene_matrix & cible, int /*N*/){ + cible = source; + } + + static EIGEN_DONT_INLINE void copy_vector(const gene_vector & source, gene_vector & cible, int /*N*/){ + cible = source; + } + + static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector& X, int /*N*/){ + X = L.template triangularView().solve(B); + } + + static inline void trisolve_lower_matrix(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int /*N*/){ + X = L.template triangularView().solve(B); + } + + static inline void trmm(const gene_matrix & L, const gene_matrix& B, gene_matrix& X, int /*N*/){ + X.noalias() = L.template triangularView() * B; + } + + static inline void cholesky(const gene_matrix & X, gene_matrix & C, int /*N*/){ + C = X; + internal::llt_inplace::blocked(C); + //C = X.llt().matrixL(); +// C = X; +// Cholesky::computeInPlace(C); +// Cholesky::computeInPlaceBlock(C); + } + + static inline void lu_decomp(const gene_matrix & X, gene_matrix & C, int /*N*/){ + C = X.fullPivLu().matrixLU(); + } + + static inline void partial_lu_decomp(const gene_matrix & X, gene_matrix & C, int N){ + Matrix piv(N); + DenseIndex nb; + C = X; + internal::partial_lu_inplace(C,piv,nb); +// C = X.partialPivLu().matrixLU(); + } + + static inline void tridiagonalization(const gene_matrix & X, gene_matrix & C, int N){ + typename Tridiagonalization::CoeffVectorType aux(N-1); + C = X; + internal::tridiagonalization_inplace(C, aux); + } + + static inline void hessenberg(const gene_matrix & X, gene_matrix & C, int /*N*/){ + C = HessenbergDecomposition(X).packedMatrix(); + } + + + +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/libs/eigen3/main_adv.cpp b/simulation/externals/eigen/bench/btl/libs/eigen3/main_adv.cpp new file mode 100644 index 0000000..9586535 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/eigen3/main_adv.cpp @@ -0,0 +1,44 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen3_interface.hh" +#include "bench.hh" +#include "action_trisolve.hh" +#include "action_trisolve_matrix.hh" +#include "action_cholesky.hh" +#include "action_hessenberg.hh" +#include "action_lu_decomp.hh" +#include "action_partial_lu.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_LU,MAX_LU,NB_POINT); + bench > >(MIN_LU,MAX_LU,NB_POINT); + bench > >(MIN_LU,MAX_LU,NB_POINT); +// bench > >(MIN_LU,MAX_LU,NB_POINT); + bench > >(MIN_LU,MAX_LU,NB_POINT); + +// bench > >(MIN_LU,MAX_LU,NB_POINT); + bench > >(MIN_LU,MAX_LU,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/eigen3/main_linear.cpp b/simulation/externals/eigen/bench/btl/libs/eigen3/main_linear.cpp new file mode 100644 index 0000000..e8538b7 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/eigen3/main_linear.cpp @@ -0,0 +1,35 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen3_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/eigen3/main_matmat.cpp b/simulation/externals/eigen/bench/btl/libs/eigen3/main_matmat.cpp new file mode 100644 index 0000000..926fa2b --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/eigen3/main_matmat.cpp @@ -0,0 +1,35 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen3_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/eigen3/main_vecmat.cpp b/simulation/externals/eigen/bench/btl/libs/eigen3/main_vecmat.cpp new file mode 100644 index 0000000..0dda444 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/eigen3/main_vecmat.cpp @@ -0,0 +1,36 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "eigen3_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/gmm/CMakeLists.txt b/simulation/externals/eigen/bench/btl/libs/gmm/CMakeLists.txt new file mode 100644 index 0000000..bc25862 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/gmm/CMakeLists.txt @@ -0,0 +1,6 @@ + +find_package(GMM) +if (GMM_FOUND) + include_directories(${GMM_INCLUDES}) + btl_add_bench(btl_gmm main.cpp) +endif (GMM_FOUND) diff --git a/simulation/externals/eigen/bench/btl/libs/gmm/gmm_LU_solve_interface.hh b/simulation/externals/eigen/bench/btl/libs/gmm/gmm_LU_solve_interface.hh new file mode 100644 index 0000000..dcb9f56 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/gmm/gmm_LU_solve_interface.hh @@ -0,0 +1,192 @@ +//===================================================== +// File : blitz_LU_solve_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:31 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BLITZ_LU_SOLVE_INTERFACE_HH +#define BLITZ_LU_SOLVE_INTERFACE_HH + +#include "blitz/array.h" +#include + +BZ_USING_NAMESPACE(blitz) + +template +class blitz_LU_solve_interface : public blitz_interface +{ + +public : + + typedef typename blitz_interface::gene_matrix gene_matrix; + typedef typename blitz_interface::gene_vector gene_vector; + + typedef blitz::Array Pivot_Vector; + + inline static void new_Pivot_Vector(Pivot_Vector & pivot,int N) + { + + pivot.resize(N); + + } + + inline static void free_Pivot_Vector(Pivot_Vector & pivot) + { + + return; + + } + + + static inline real matrix_vector_product_sliced(const gene_matrix & A, gene_vector B, int row, int col_start, int col_end) + { + + real somme=0.; + + for (int j=col_start ; j=big ) big = abs( LU( i, j ) ) ; + } + if( big==0. ) { + INFOS( "blitz_LU_factor::Singular matrix" ) ; + exit( 0 ) ; + } + ImplicitScaling( i ) = 1./big ; + } + // Loop over columns of Crout's method : + for( int j=0; j=big ) { + dum = ImplicitScaling( i )*abs( theSum ) ; + big = dum ; + index_max = i ; + } + } + // Interchanging rows and the scale factor : + if( j!=index_max ) { + for( int k=0; k=0; i-- ) { + theSum = X( i ) ; + // theSum = B( i ) ; + theSum -= matrix_vector_product_sliced(LU, X, i, i+1, N) ; + // theSum -= sum( LU( i, Range( i+1, toEnd ) )*X( Range( i+1, toEnd ) ) ) ; + // theSum -= sum( LU( i, Range( i+1, toEnd ) )*B( Range( i+1, toEnd ) ) ) ; + // Store a component of the solution vector : + X( i ) = theSum/LU( i, i ) ; + // B( i ) = theSum/LU( i, i ) ; + } + + } + +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/libs/gmm/gmm_interface.hh b/simulation/externals/eigen/bench/btl/libs/gmm/gmm_interface.hh new file mode 100644 index 0000000..3ea303c --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/gmm/gmm_interface.hh @@ -0,0 +1,144 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef GMM_INTERFACE_HH +#define GMM_INTERFACE_HH + +#include +#include + +using namespace gmm; + +template +class gmm_interface { + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef gmm::dense_matrix gene_matrix; + typedef stl_vector gene_vector; + + static inline std::string name( void ) + { + return "gmm"; + } + + static void free_matrix(gene_matrix & A, int N){ + return ; + } + + static void free_vector(gene_vector & B){ + return ; + } + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.resize(A_stl[0].size(),A_stl.size()); + + for (int j=0; j ipvt(N); + gmm::lu_factor(R, ipvt); + } + + static inline void hessenberg(const gene_matrix & X, gene_matrix & R, int N){ + gmm::copy(X,R); + gmm::Hessenberg_reduction(R,X,false); + } + + static inline void tridiagonalization(const gene_matrix & X, gene_matrix & R, int N){ + gmm::copy(X,R); + gmm::Householder_tridiagonalization(R,X,false); + } + +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/libs/gmm/main.cpp b/simulation/externals/eigen/bench/btl/libs/gmm/main.cpp new file mode 100644 index 0000000..1f0c051 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/gmm/main.cpp @@ -0,0 +1,51 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "gmm_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" +#include "action_hessenberg.hh" +#include "action_partial_lu.hh" + +BTL_MAIN; + +int main() +{ + + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + //bench > >(MIN_LU,MAX_LU,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/mtl4/.kdbgrc.main b/simulation/externals/eigen/bench/btl/libs/mtl4/.kdbgrc.main new file mode 100644 index 0000000..fed082f --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/mtl4/.kdbgrc.main @@ -0,0 +1,12 @@ +[General] +DebuggerCmdStr= +DriverName=GDB +FileVersion=1 +OptionsSelected= +ProgramArgs= +TTYLevel=7 +WorkingDirectory= + +[Memory] +ColumnWidths=80,0 +NumExprs=0 diff --git a/simulation/externals/eigen/bench/btl/libs/mtl4/CMakeLists.txt b/simulation/externals/eigen/bench/btl/libs/mtl4/CMakeLists.txt new file mode 100644 index 0000000..14b47a8 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/mtl4/CMakeLists.txt @@ -0,0 +1,6 @@ + +find_package(MTL4) +if (MTL4_FOUND) + include_directories(${MTL4_INCLUDE_DIR}) + btl_add_bench(btl_mtl4 main.cpp) +endif (MTL4_FOUND) diff --git a/simulation/externals/eigen/bench/btl/libs/mtl4/main.cpp b/simulation/externals/eigen/bench/btl/libs/mtl4/main.cpp new file mode 100644 index 0000000..96fcfb9 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/mtl4/main.cpp @@ -0,0 +1,46 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "mtl4_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" +#include "action_cholesky.hh" +// #include "action_lu_decomp.hh" + +BTL_MAIN; + +int main() +{ + + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/mtl4/mtl4_LU_solve_interface.hh b/simulation/externals/eigen/bench/btl/libs/mtl4/mtl4_LU_solve_interface.hh new file mode 100644 index 0000000..dcb9f56 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/mtl4/mtl4_LU_solve_interface.hh @@ -0,0 +1,192 @@ +//===================================================== +// File : blitz_LU_solve_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:31 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef BLITZ_LU_SOLVE_INTERFACE_HH +#define BLITZ_LU_SOLVE_INTERFACE_HH + +#include "blitz/array.h" +#include + +BZ_USING_NAMESPACE(blitz) + +template +class blitz_LU_solve_interface : public blitz_interface +{ + +public : + + typedef typename blitz_interface::gene_matrix gene_matrix; + typedef typename blitz_interface::gene_vector gene_vector; + + typedef blitz::Array Pivot_Vector; + + inline static void new_Pivot_Vector(Pivot_Vector & pivot,int N) + { + + pivot.resize(N); + + } + + inline static void free_Pivot_Vector(Pivot_Vector & pivot) + { + + return; + + } + + + static inline real matrix_vector_product_sliced(const gene_matrix & A, gene_vector B, int row, int col_start, int col_end) + { + + real somme=0.; + + for (int j=col_start ; j=big ) big = abs( LU( i, j ) ) ; + } + if( big==0. ) { + INFOS( "blitz_LU_factor::Singular matrix" ) ; + exit( 0 ) ; + } + ImplicitScaling( i ) = 1./big ; + } + // Loop over columns of Crout's method : + for( int j=0; j=big ) { + dum = ImplicitScaling( i )*abs( theSum ) ; + big = dum ; + index_max = i ; + } + } + // Interchanging rows and the scale factor : + if( j!=index_max ) { + for( int k=0; k=0; i-- ) { + theSum = X( i ) ; + // theSum = B( i ) ; + theSum -= matrix_vector_product_sliced(LU, X, i, i+1, N) ; + // theSum -= sum( LU( i, Range( i+1, toEnd ) )*X( Range( i+1, toEnd ) ) ) ; + // theSum -= sum( LU( i, Range( i+1, toEnd ) )*B( Range( i+1, toEnd ) ) ) ; + // Store a component of the solution vector : + X( i ) = theSum/LU( i, i ) ; + // B( i ) = theSum/LU( i, i ) ; + } + + } + +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/libs/mtl4/mtl4_interface.hh b/simulation/externals/eigen/bench/btl/libs/mtl4/mtl4_interface.hh new file mode 100644 index 0000000..3795ac6 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/mtl4/mtl4_interface.hh @@ -0,0 +1,144 @@ +//===================================================== +// Copyright (C) 2008 Gael Guennebaud +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef MTL4_INTERFACE_HH +#define MTL4_INTERFACE_HH + +#include +#include +// #include +#include + +using namespace mtl; + +template +class mtl4_interface { + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef mtl::dense2D > gene_matrix; + typedef mtl::dense_vector gene_vector; + + static inline std::string name() { return "mtl4"; } + + static void free_matrix(gene_matrix & A, int N){ + return ; + } + + static void free_vector(gene_vector & B){ + return ; + } + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.change_dim(A_stl[0].size(), A_stl.size()); + + for (int j=0; j C(N,N); +// C = B; +// X = (A*C); + } + + static inline void transposed_matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int N){ + X = (trans(A)*trans(B)); + } + +// static inline void ata_product(const gene_matrix & A, gene_matrix & X, int N){ +// X = (trans(A)*A); +// } + + static inline void aat_product(const gene_matrix & A, gene_matrix & X, int N){ + X = (A*trans(A)); + } + + static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + X = (A*B); + } + + static inline void atv_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N){ + X = (trans(A)*B); + } + + static inline void axpy(const real coef, const gene_vector & X, gene_vector & Y, int N){ + Y += coef * X; + } + + static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int N){ + Y = a*X + b*Y; + } + +// static inline void cholesky(const gene_matrix & X, gene_matrix & C, int N){ +// C = X; +// recursive_cholesky(C); +// } + +// static inline void lu_decomp(const gene_matrix & X, gene_matrix & R, int N){ +// R = X; +// std::vector ipvt(N); +// lu_factor(R, ipvt); +// } + + static inline void trisolve_lower(const gene_matrix & L, const gene_vector& B, gene_vector & X, int N){ + X = lower_trisolve(L, B); + } + + static inline void copy_matrix(const gene_matrix & source, gene_matrix & cible, int N){ + cible = source; + } + + static inline void copy_vector(const gene_vector & source, gene_vector & cible, int N){ + cible = source; + } + +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/libs/tensors/CMakeLists.txt b/simulation/externals/eigen/bench/btl/libs/tensors/CMakeLists.txt new file mode 100644 index 0000000..09d6d8e --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/tensors/CMakeLists.txt @@ -0,0 +1,44 @@ + + +if((NOT TENSOR_INCLUDE_DIR) AND Eigen_SOURCE_DIR) + # unless TENSOR_INCLUDE_DIR is defined, let's use current Eigen version + set(TENSOR_INCLUDE_DIR ${Eigen_SOURCE_DIR}) + set(TENSOR_FOUND TRUE) +else() + find_package(Tensor) +endif() + +if (TENSOR_FOUND) + + include_directories(${TENSOR_INCLUDE_DIR}) + btl_add_bench(btl_tensor_linear main_linear.cpp) + btl_add_bench(btl_tensor_vecmat main_vecmat.cpp) + btl_add_bench(btl_tensor_matmat main_matmat.cpp) + + btl_add_target_property(btl_tensor_linear COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor") + btl_add_target_property(btl_tensor_vecmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor") + btl_add_target_property(btl_tensor_matmat COMPILE_FLAGS "-fno-exceptions -DBTL_PREFIX=tensor") + + option(BTL_BENCH_NOGCCVEC "also bench Eigen explicit vec without GCC's auto vec" OFF) + if(CMAKE_COMPILER_IS_GNUCXX AND BTL_BENCH_NOGCCVEC) + btl_add_bench(btl_tensor_nogccvec_linear main_linear.cpp) + btl_add_bench(btl_tensor_nogccvec_vecmat main_vecmat.cpp) + btl_add_bench(btl_tensor_nogccvec_matmat main_matmat.cpp) + + btl_add_target_property(btl_tensor_nogccvec_linear COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec") + btl_add_target_property(btl_tensor_nogccvec_vecmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec") + btl_add_target_property(btl_tensor_nogccvec_matmat COMPILE_FLAGS "-fno-exceptions -fno-tree-vectorize -DBTL_PREFIX=tensor_nogccvec") + endif() + + + if(NOT BTL_NOVEC) + btl_add_bench(btl_tensor_novec_linear main_linear.cpp OFF) + btl_add_bench(btl_tensor_novec_vecmat main_vecmat.cpp OFF) + btl_add_bench(btl_tensor_novec_matmat main_matmat.cpp OFF) + btl_add_target_property(btl_tensor_novec_linear COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec") + btl_add_target_property(btl_tensor_novec_vecmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec") + btl_add_target_property(btl_tensor_novec_matmat COMPILE_FLAGS "-fno-exceptions -DEIGEN_DONT_VECTORIZE -DBTL_PREFIX=tensor_novec") + + endif(NOT BTL_NOVEC) + +endif (TENSOR_FOUND) diff --git a/simulation/externals/eigen/bench/btl/libs/tensors/main_linear.cpp b/simulation/externals/eigen/bench/btl/libs/tensors/main_linear.cpp new file mode 100644 index 0000000..e257f1e --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/tensors/main_linear.cpp @@ -0,0 +1,23 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2014 Benoit Steiner +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#include "utilities.h" +#include "tensor_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + return 0; +} diff --git a/simulation/externals/eigen/bench/btl/libs/tensors/main_matmat.cpp b/simulation/externals/eigen/bench/btl/libs/tensors/main_matmat.cpp new file mode 100644 index 0000000..675fcfc --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/tensors/main_matmat.cpp @@ -0,0 +1,21 @@ +//===================================================== +// Copyright (C) 2014 Benoit Steiner +//===================================================== +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +// +#include "utilities.h" +#include "tensor_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} diff --git a/simulation/externals/eigen/bench/btl/libs/tensors/main_vecmat.cpp b/simulation/externals/eigen/bench/btl/libs/tensors/main_vecmat.cpp new file mode 100644 index 0000000..1af00c8 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/tensors/main_vecmat.cpp @@ -0,0 +1,21 @@ +//===================================================== +// Copyright (C) 2014 Benoit Steiner +//===================================================== +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +// +#include "utilities.h" +#include "tensor_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_MV,MAX_MV,NB_POINT); + + return 0; +} diff --git a/simulation/externals/eigen/bench/btl/libs/tensors/tensor_interface.hh b/simulation/externals/eigen/bench/btl/libs/tensors/tensor_interface.hh new file mode 100644 index 0000000..97b8e0f --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/tensors/tensor_interface.hh @@ -0,0 +1,105 @@ +//===================================================== +// Copyright (C) 2014 Benoit Steiner +//===================================================== +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. +// +#ifndef TENSOR_INTERFACE_HH +#define TENSOR_INTERFACE_HH + +#include +#include +#include "btl.hh" + +using namespace Eigen; + +template +class tensor_interface +{ +public : + typedef real real_type; + typedef typename Eigen::Tensor::Index Index; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef Eigen::Tensor gene_matrix; + typedef Eigen::Tensor gene_vector; + + + static inline std::string name( void ) + { + return EIGEN_MAKESTRING(BTL_PREFIX); + } + + static void free_matrix(gene_matrix & /*A*/, int /*N*/) {} + + static void free_vector(gene_vector & /*B*/) {} + + static BTL_DONT_INLINE void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.resize(Eigen::array(A_stl[0].size(), A_stl.size())); + + for (unsigned int j=0; j(i,j)) = A_stl[j][i]; + } + } + } + + static BTL_DONT_INLINE void vector_from_stl(gene_vector & B, stl_vector & B_stl){ + B.resize(B_stl.size()); + + for (unsigned int i=0; i(i,j)); + } + } + } + + static inline void matrix_matrix_product(const gene_matrix & A, const gene_matrix & B, gene_matrix & X, int /*N*/){ + typedef typename Eigen::Tensor::DimensionPair DimPair; + const Eigen::array dims(DimPair(1, 0)); + X/*.noalias()*/ = A.contract(B, dims); + } + + static inline void matrix_vector_product(const gene_matrix & A, const gene_vector & B, gene_vector & X, int /*N*/){ + typedef typename Eigen::Tensor::DimensionPair DimPair; + const Eigen::array dims(DimPair(1, 0)); + X/*.noalias()*/ = A.contract(B, dims); + } + + static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int /*N*/){ + Y += X.constant(coef) * X; + } + + static inline void axpby(real a, const gene_vector & X, real b, gene_vector & Y, int /*N*/){ + Y = X.constant(a)*X + Y.constant(b)*Y; + } + + static EIGEN_DONT_INLINE void copy_matrix(const gene_matrix & source, gene_matrix & cible, int /*N*/){ + cible = source; + } + + static EIGEN_DONT_INLINE void copy_vector(const gene_vector & source, gene_vector & cible, int /*N*/){ + cible = source; + } +}; + +#endif diff --git a/simulation/externals/eigen/bench/btl/libs/tvmet/CMakeLists.txt b/simulation/externals/eigen/bench/btl/libs/tvmet/CMakeLists.txt new file mode 100644 index 0000000..25b565b --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/tvmet/CMakeLists.txt @@ -0,0 +1,6 @@ + +find_package(Tvmet) +if (TVMET_FOUND) + include_directories(${TVMET_INCLUDE_DIR}) + btl_add_bench(btl_tvmet main.cpp OFF) +endif (TVMET_FOUND) diff --git a/simulation/externals/eigen/bench/btl/libs/tvmet/main.cpp b/simulation/externals/eigen/bench/btl/libs/tvmet/main.cpp new file mode 100644 index 0000000..633215c --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/tvmet/main.cpp @@ -0,0 +1,40 @@ +//===================================================== +// File : main.cpp +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "tvmet_interface.hh" +#include "static/bench_static.hh" +#include "action_matrix_vector_product.hh" +#include "action_matrix_matrix_product.hh" +#include "action_atv_product.hh" +#include "action_axpy.hh" + +BTL_MAIN; + +int main() +{ + bench_static(); + bench_static(); + bench_static(); + bench_static(); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/tvmet/tvmet_interface.hh b/simulation/externals/eigen/bench/btl/libs/tvmet/tvmet_interface.hh new file mode 100644 index 0000000..b441ada --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/tvmet/tvmet_interface.hh @@ -0,0 +1,104 @@ +//===================================================== +// File : tvmet_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:30 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef TVMET_INTERFACE_HH +#define TVMET_INTERFACE_HH + +#include +#include +#include + +#include + +using namespace tvmet; + +template +class tvmet_interface{ + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef Vector gene_vector; + typedef Matrix gene_matrix; + + static inline std::string name() { return "tiny_tvmet"; } + + static void free_matrix(gene_matrix & A, int N){} + + static void free_vector(gene_vector & B){} + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + for (int j=0; j +// Copyright (C) EDF R&D, lun sep 30 14:23:27 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#include "utilities.h" +#include "ublas_interface.hh" +#include "bench.hh" +#include "basic_actions.hh" + +BTL_MAIN; + +int main() +{ + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + bench > >(MIN_AXPY,MAX_AXPY,NB_POINT); + + bench > >(MIN_MV,MAX_MV,NB_POINT); + bench > >(MIN_MV,MAX_MV,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); +// bench > >(MIN_MM,MAX_MM,NB_POINT); + + bench > >(MIN_MM,MAX_MM,NB_POINT); + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/btl/libs/ublas/ublas_interface.hh b/simulation/externals/eigen/bench/btl/libs/ublas/ublas_interface.hh new file mode 100644 index 0000000..95cad51 --- /dev/null +++ b/simulation/externals/eigen/bench/btl/libs/ublas/ublas_interface.hh @@ -0,0 +1,141 @@ +//===================================================== +// File : ublas_interface.hh +// Author : L. Plagne +// Copyright (C) EDF R&D, lun sep 30 14:23:27 CEST 2002 +//===================================================== +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +#ifndef UBLAS_INTERFACE_HH +#define UBLAS_INTERFACE_HH + +#include +#include +#include +#include + +using namespace boost::numeric; + +template +class ublas_interface{ + +public : + + typedef real real_type ; + + typedef std::vector stl_vector; + typedef std::vector stl_matrix; + + typedef typename boost::numeric::ublas::matrix gene_matrix; + typedef typename boost::numeric::ublas::vector gene_vector; + + static inline std::string name( void ) { return "ublas"; } + + static void free_matrix(gene_matrix & A, int N) {} + + static void free_vector(gene_vector & B) {} + + static inline void matrix_from_stl(gene_matrix & A, stl_matrix & A_stl){ + A.resize(A_stl.size(),A_stl[0].size()); + for (int j=0; j +#include "../Eigen/Core" + +using namespace Eigen; +using namespace std; + +#define DUMP_CPUID(CODE) {\ + int abcd[4]; \ + abcd[0] = abcd[1] = abcd[2] = abcd[3] = 0;\ + EIGEN_CPUID(abcd, CODE, 0); \ + std::cout << "The code " << CODE << " gives " \ + << (int*)(abcd[0]) << " " << (int*)(abcd[1]) << " " \ + << (int*)(abcd[2]) << " " << (int*)(abcd[3]) << " " << std::endl; \ + } + +int main() +{ + cout << "Eigen's L1 = " << internal::queryL1CacheSize() << endl; + cout << "Eigen's L2/L3 = " << internal::queryTopLevelCacheSize() << endl; + int l1, l2, l3; + internal::queryCacheSizes(l1, l2, l3); + cout << "Eigen's L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl; + + #ifdef EIGEN_CPUID + + int abcd[4]; + int string[8]; + char* string_char = (char*)(string); + + // vendor ID + EIGEN_CPUID(abcd,0x0,0); + string[0] = abcd[1]; + string[1] = abcd[3]; + string[2] = abcd[2]; + string[3] = 0; + cout << endl; + cout << "vendor id = " << string_char << endl; + cout << endl; + int max_funcs = abcd[0]; + + internal::queryCacheSizes_intel_codes(l1, l2, l3); + cout << "Eigen's intel codes L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl; + if(max_funcs>=4) + { + internal::queryCacheSizes_intel_direct(l1, l2, l3); + cout << "Eigen's intel direct L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl; + } + internal::queryCacheSizes_amd(l1, l2, l3); + cout << "Eigen's amd L1, L2, L3 = " << l1 << " " << l2 << " " << l3 << endl; + cout << endl; + + // dump Intel direct method + if(max_funcs>=4) + { + l1 = l2 = l3 = 0; + int cache_id = 0; + int cache_type = 0; + do { + abcd[0] = abcd[1] = abcd[2] = abcd[3] = 0; + EIGEN_CPUID(abcd,0x4,cache_id); + cache_type = (abcd[0] & 0x0F) >> 0; + int cache_level = (abcd[0] & 0xE0) >> 5; // A[7:5] + int ways = (abcd[1] & 0xFFC00000) >> 22; // B[31:22] + int partitions = (abcd[1] & 0x003FF000) >> 12; // B[21:12] + int line_size = (abcd[1] & 0x00000FFF) >> 0; // B[11:0] + int sets = (abcd[2]); // C[31:0] + int cache_size = (ways+1) * (partitions+1) * (line_size+1) * (sets+1); + + cout << "cache[" << cache_id << "].type = " << cache_type << "\n"; + cout << "cache[" << cache_id << "].level = " << cache_level << "\n"; + cout << "cache[" << cache_id << "].ways = " << ways << "\n"; + cout << "cache[" << cache_id << "].partitions = " << partitions << "\n"; + cout << "cache[" << cache_id << "].line_size = " << line_size << "\n"; + cout << "cache[" << cache_id << "].sets = " << sets << "\n"; + cout << "cache[" << cache_id << "].size = " << cache_size << "\n"; + + cache_id++; + } while(cache_type>0 && cache_id<16); + } + + // dump everything + std::cout << endl <<"Raw dump:" << endl; + for(int i=0; i +#include "BenchTimer.h" +#include +#include +#include +#include +#include +using namespace Eigen; + +std::map > results; +std::vector labels; +std::vector sizes; + +template +EIGEN_DONT_INLINE +void compute_norm_equation(Solver &solver, const MatrixType &A) { + if(A.rows()!=A.cols()) + solver.compute(A.transpose()*A); + else + solver.compute(A); +} + +template +EIGEN_DONT_INLINE +void compute(Solver &solver, const MatrixType &A) { + solver.compute(A); +} + +template +void bench(int id, int rows, int size = Size) +{ + typedef Matrix Mat; + typedef Matrix MatDyn; + typedef Matrix MatSquare; + Mat A(rows,size); + A.setRandom(); + if(rows==size) + A = A*A.adjoint(); + BenchTimer t_llt, t_ldlt, t_lu, t_fplu, t_qr, t_cpqr, t_cod, t_fpqr, t_jsvd, t_bdcsvd; + + int svd_opt = ComputeThinU|ComputeThinV; + + int tries = 5; + int rep = 1000/size; + if(rep==0) rep = 1; +// rep = rep*rep; + + LLT llt(size); + LDLT ldlt(size); + PartialPivLU lu(size); + FullPivLU fplu(size,size); + HouseholderQR qr(A.rows(),A.cols()); + ColPivHouseholderQR cpqr(A.rows(),A.cols()); + CompleteOrthogonalDecomposition cod(A.rows(),A.cols()); + FullPivHouseholderQR fpqr(A.rows(),A.cols()); + JacobiSVD jsvd(A.rows(),A.cols()); + BDCSVD bdcsvd(A.rows(),A.cols()); + + BENCH(t_llt, tries, rep, compute_norm_equation(llt,A)); + BENCH(t_ldlt, tries, rep, compute_norm_equation(ldlt,A)); + BENCH(t_lu, tries, rep, compute_norm_equation(lu,A)); + if(size<=1000) + BENCH(t_fplu, tries, rep, compute_norm_equation(fplu,A)); + BENCH(t_qr, tries, rep, compute(qr,A)); + BENCH(t_cpqr, tries, rep, compute(cpqr,A)); + BENCH(t_cod, tries, rep, compute(cod,A)); + if(size*rows<=10000000) + BENCH(t_fpqr, tries, rep, compute(fpqr,A)); + if(size<500) // JacobiSVD is really too slow for too large matrices + BENCH(t_jsvd, tries, rep, jsvd.compute(A,svd_opt)); +// if(size*rows<=20000000) + BENCH(t_bdcsvd, tries, rep, bdcsvd.compute(A,svd_opt)); + + results["LLT"][id] = t_llt.best(); + results["LDLT"][id] = t_ldlt.best(); + results["PartialPivLU"][id] = t_lu.best(); + results["FullPivLU"][id] = t_fplu.best(); + results["HouseholderQR"][id] = t_qr.best(); + results["ColPivHouseholderQR"][id] = t_cpqr.best(); + results["CompleteOrthogonalDecomposition"][id] = t_cod.best(); + results["FullPivHouseholderQR"][id] = t_fpqr.best(); + results["JacobiSVD"][id] = t_jsvd.best(); + results["BDCSVD"][id] = t_bdcsvd.best(); +} + + +int main() +{ + labels.push_back("LLT"); + labels.push_back("LDLT"); + labels.push_back("PartialPivLU"); + labels.push_back("FullPivLU"); + labels.push_back("HouseholderQR"); + labels.push_back("ColPivHouseholderQR"); + labels.push_back("CompleteOrthogonalDecomposition"); + labels.push_back("FullPivHouseholderQR"); + labels.push_back("JacobiSVD"); + labels.push_back("BDCSVD"); + + for(int i=0; i(k,sizes[k](0),sizes[k](1)); + } + + cout.width(32); + cout << "solver/size"; + cout << " "; + for(int k=0; k=1e6) cout << "-"; + else cout << r(k); + cout << " "; + } + cout << endl; + } + + // HTML output + cout << "" << endl; + cout << "" << endl; + for(int k=0; k" << sizes[k](0) << "x" << sizes[k](1) << ""; + cout << "" << endl; + for(int i=0; i"; + ArrayXf r = (results[labels[i]]*100000.f).floor()/100.f; + for(int k=0; k=1e6) cout << ""; + else + { + cout << ""; + } + } + cout << "" << endl; + } + cout << "
solver/size
" << labels[i] << "-" << r(k); + if(i>0) + cout << " (x" << numext::round(10.f*results[labels[i]](k)/results["LLT"](k))/10.f << ")"; + if(i<4 && sizes[k](0)!=sizes[k](1)) + cout << " *"; + cout << "
" << endl; + +// cout << "LLT (ms) " << (results["LLT"]*1000.).format(fmt) << "\n"; +// cout << "LDLT (%) " << (results["LDLT"]/results["LLT"]).format(fmt) << "\n"; +// cout << "PartialPivLU (%) " << (results["PartialPivLU"]/results["LLT"]).format(fmt) << "\n"; +// cout << "FullPivLU (%) " << (results["FullPivLU"]/results["LLT"]).format(fmt) << "\n"; +// cout << "HouseholderQR (%) " << (results["HouseholderQR"]/results["LLT"]).format(fmt) << "\n"; +// cout << "ColPivHouseholderQR (%) " << (results["ColPivHouseholderQR"]/results["LLT"]).format(fmt) << "\n"; +// cout << "CompleteOrthogonalDecomposition (%) " << (results["CompleteOrthogonalDecomposition"]/results["LLT"]).format(fmt) << "\n"; +// cout << "FullPivHouseholderQR (%) " << (results["FullPivHouseholderQR"]/results["LLT"]).format(fmt) << "\n"; +// cout << "JacobiSVD (%) " << (results["JacobiSVD"]/results["LLT"]).format(fmt) << "\n"; +// cout << "BDCSVD (%) " << (results["BDCSVD"]/results["LLT"]).format(fmt) << "\n"; +} diff --git a/simulation/externals/eigen/bench/eig33.cpp b/simulation/externals/eigen/bench/eig33.cpp new file mode 100644 index 0000000..47947a9 --- /dev/null +++ b/simulation/externals/eigen/bench/eig33.cpp @@ -0,0 +1,195 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2010 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +// The computeRoots function included in this is based on materials +// covered by the following copyright and license: +// +// Geometric Tools, LLC +// Copyright (c) 1998-2010 +// Distributed under the Boost Software License, Version 1.0. +// +// Permission is hereby granted, free of charge, to any person or organization +// obtaining a copy of the software and accompanying documentation covered by +// this license (the "Software") to use, reproduce, display, distribute, +// execute, and transmit the Software, and to prepare derivative works of the +// Software, and to permit third-parties to whom the Software is furnished to +// do so, all subject to the following: +// +// The copyright notices in the Software and this entire statement, including +// the above license grant, this restriction and the following disclaimer, +// must be included in all copies of the Software, in whole or in part, and +// all derivative works of the Software, unless such copies or derivative +// works are solely in the form of machine-executable object code generated by +// a source language processor. +// +// 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT +// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE +// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, +// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +#include +#include +#include +#include +#include + +using namespace Eigen; +using namespace std; + +template +inline void computeRoots(const Matrix& m, Roots& roots) +{ + typedef typename Matrix::Scalar Scalar; + const Scalar s_inv3 = 1.0/3.0; + const Scalar s_sqrt3 = std::sqrt(Scalar(3.0)); + + // The characteristic equation is x^3 - c2*x^2 + c1*x - c0 = 0. The + // eigenvalues are the roots to this equation, all guaranteed to be + // real-valued, because the matrix is symmetric. + Scalar c0 = m(0,0)*m(1,1)*m(2,2) + Scalar(2)*m(0,1)*m(0,2)*m(1,2) - m(0,0)*m(1,2)*m(1,2) - m(1,1)*m(0,2)*m(0,2) - m(2,2)*m(0,1)*m(0,1); + Scalar c1 = m(0,0)*m(1,1) - m(0,1)*m(0,1) + m(0,0)*m(2,2) - m(0,2)*m(0,2) + m(1,1)*m(2,2) - m(1,2)*m(1,2); + Scalar c2 = m(0,0) + m(1,1) + m(2,2); + + // Construct the parameters used in classifying the roots of the equation + // and in solving the equation for the roots in closed form. + Scalar c2_over_3 = c2*s_inv3; + Scalar a_over_3 = (c1 - c2*c2_over_3)*s_inv3; + if (a_over_3 > Scalar(0)) + a_over_3 = Scalar(0); + + Scalar half_b = Scalar(0.5)*(c0 + c2_over_3*(Scalar(2)*c2_over_3*c2_over_3 - c1)); + + Scalar q = half_b*half_b + a_over_3*a_over_3*a_over_3; + if (q > Scalar(0)) + q = Scalar(0); + + // Compute the eigenvalues by solving for the roots of the polynomial. + Scalar rho = std::sqrt(-a_over_3); + Scalar theta = std::atan2(std::sqrt(-q),half_b)*s_inv3; + Scalar cos_theta = std::cos(theta); + Scalar sin_theta = std::sin(theta); + roots(2) = c2_over_3 + Scalar(2)*rho*cos_theta; + roots(0) = c2_over_3 - rho*(cos_theta + s_sqrt3*sin_theta); + roots(1) = c2_over_3 - rho*(cos_theta - s_sqrt3*sin_theta); +} + +template +void eigen33(const Matrix& mat, Matrix& evecs, Vector& evals) +{ + typedef typename Matrix::Scalar Scalar; + // Scale the matrix so its entries are in [-1,1]. The scaling is applied + // only when at least one matrix entry has magnitude larger than 1. + + Scalar shift = mat.trace()/3; + Matrix scaledMat = mat; + scaledMat.diagonal().array() -= shift; + Scalar scale = scaledMat.cwiseAbs()/*.template triangularView()*/.maxCoeff(); + scale = std::max(scale,Scalar(1)); + scaledMat/=scale; + + // Compute the eigenvalues +// scaledMat.setZero(); + computeRoots(scaledMat,evals); + + // compute the eigen vectors + // **here we assume 3 differents eigenvalues** + + // "optimized version" which appears to be slower with gcc! +// Vector base; +// Scalar alpha, beta; +// base << scaledMat(1,0) * scaledMat(2,1), +// scaledMat(1,0) * scaledMat(2,0), +// -scaledMat(1,0) * scaledMat(1,0); +// for(int k=0; k<2; ++k) +// { +// alpha = scaledMat(0,0) - evals(k); +// beta = scaledMat(1,1) - evals(k); +// evecs.col(k) = (base + Vector(-beta*scaledMat(2,0), -alpha*scaledMat(2,1), alpha*beta)).normalized(); +// } +// evecs.col(2) = evecs.col(0).cross(evecs.col(1)).normalized(); + +// // naive version +// Matrix tmp; +// tmp = scaledMat; +// tmp.diagonal().array() -= evals(0); +// evecs.col(0) = tmp.row(0).cross(tmp.row(1)).normalized(); +// +// tmp = scaledMat; +// tmp.diagonal().array() -= evals(1); +// evecs.col(1) = tmp.row(0).cross(tmp.row(1)).normalized(); +// +// tmp = scaledMat; +// tmp.diagonal().array() -= evals(2); +// evecs.col(2) = tmp.row(0).cross(tmp.row(1)).normalized(); + + // a more stable version: + if((evals(2)-evals(0))<=Eigen::NumTraits::epsilon()) + { + evecs.setIdentity(); + } + else + { + Matrix tmp; + tmp = scaledMat; + tmp.diagonal ().array () -= evals (2); + evecs.col (2) = tmp.row (0).cross (tmp.row (1)).normalized (); + + tmp = scaledMat; + tmp.diagonal ().array () -= evals (1); + evecs.col(1) = tmp.row (0).cross(tmp.row (1)); + Scalar n1 = evecs.col(1).norm(); + if(n1<=Eigen::NumTraits::epsilon()) + evecs.col(1) = evecs.col(2).unitOrthogonal(); + else + evecs.col(1) /= n1; + + // make sure that evecs[1] is orthogonal to evecs[2] + evecs.col(1) = evecs.col(2).cross(evecs.col(1).cross(evecs.col(2))).normalized(); + evecs.col(0) = evecs.col(2).cross(evecs.col(1)); + } + + // Rescale back to the original size. + evals *= scale; + evals.array()+=shift; +} + +int main() +{ + BenchTimer t; + int tries = 10; + int rep = 400000; + typedef Matrix3d Mat; + typedef Vector3d Vec; + Mat A = Mat::Random(3,3); + A = A.adjoint() * A; +// Mat Q = A.householderQr().householderQ(); +// A = Q * Vec(2.2424567,2.2424566,7.454353).asDiagonal() * Q.transpose(); + + SelfAdjointEigenSolver eig(A); + BENCH(t, tries, rep, eig.compute(A)); + std::cout << "Eigen iterative: " << t.best() << "s\n"; + + BENCH(t, tries, rep, eig.computeDirect(A)); + std::cout << "Eigen direct : " << t.best() << "s\n"; + + Mat evecs; + Vec evals; + BENCH(t, tries, rep, eigen33(A,evecs,evals)); + std::cout << "Direct: " << t.best() << "s\n\n"; + +// std::cerr << "Eigenvalue/eigenvector diffs:\n"; +// std::cerr << (evals - eig.eigenvalues()).transpose() << "\n"; +// for(int k=0;k<3;++k) +// if(evecs.col(k).dot(eig.eigenvectors().col(k))<0) +// evecs.col(k) = -evecs.col(k); +// std::cerr << evecs - eig.eigenvectors() << "\n\n"; +} diff --git a/simulation/externals/eigen/bench/geometry.cpp b/simulation/externals/eigen/bench/geometry.cpp new file mode 100644 index 0000000..b187a51 --- /dev/null +++ b/simulation/externals/eigen/bench/geometry.cpp @@ -0,0 +1,126 @@ + +#include +#include +#include + +using namespace std; +using namespace Eigen; + +#ifndef SCALAR +#define SCALAR float +#endif + +#ifndef SIZE +#define SIZE 8 +#endif + +typedef SCALAR Scalar; +typedef NumTraits::Real RealScalar; +typedef Matrix A; +typedef Matrix B; +typedef Matrix C; +typedef Matrix M; + +template +EIGEN_DONT_INLINE void transform(const Transformation& t, Data& data) +{ + EIGEN_ASM_COMMENT("begin"); + data = t * data; + EIGEN_ASM_COMMENT("end"); +} + +template +EIGEN_DONT_INLINE void transform(const Quaternion& t, Data& data) +{ + EIGEN_ASM_COMMENT("begin quat"); + for(int i=0;i struct ToRotationMatrixWrapper +{ + enum {Dim = T::Dim}; + typedef typename T::Scalar Scalar; + ToRotationMatrixWrapper(const T& o) : object(o) {} + T object; +}; + +template +EIGEN_DONT_INLINE void transform(const ToRotationMatrixWrapper& t, Data& data) +{ + EIGEN_ASM_COMMENT("begin quat via mat"); + data = t.object.toRotationMatrix() * data; + EIGEN_ASM_COMMENT("end quat via mat"); +} + +template +EIGEN_DONT_INLINE void transform(const Transform& t, Data& data) +{ + data = (t * data.colwise().homogeneous()).template block(0,0); +} + +template struct get_dim { enum { Dim = T::Dim }; }; +template +struct get_dim > { enum { Dim = R }; }; + +template +struct bench_impl +{ + static EIGEN_DONT_INLINE void run(const Transformation& t) + { + Matrix::Dim,N> data; + data.setRandom(); + bench_impl::run(t); + BenchTimer timer; + BENCH(timer,10,100000,transform(t,data)); + cout.width(9); + cout << timer.best() << " "; + } +}; + + +template +struct bench_impl +{ + static EIGEN_DONT_INLINE void run(const Transformation&) {} +}; + +template +EIGEN_DONT_INLINE void bench(const std::string& msg, const Transformation& t) +{ + cout << msg << " "; + bench_impl::run(t); + std::cout << "\n"; +} + +int main(int argc, char ** argv) +{ + Matrix mat34; mat34.setRandom(); + Transform iso3(mat34); + Transform aff3(mat34); + Transform caff3(mat34); + Transform proj3(mat34); + Quaternion quat;quat.setIdentity(); + ToRotationMatrixWrapper > quatmat(quat); + Matrix mat33; mat33.setRandom(); + + cout.precision(4); + std::cout + << "N "; + for(int i=0;i +#include +#include +#include +#include "../../BenchTimer.h" +using namespace Eigen; + +#ifndef SCALAR +#error SCALAR must be defined +#endif + +typedef SCALAR Scalar; + +typedef Matrix Mat; + +EIGEN_DONT_INLINE +void gemm(const Mat &A, const Mat &B, Mat &C) +{ + C.noalias() += A * B; +} + +EIGEN_DONT_INLINE +double bench(long m, long n, long k) +{ + Mat A(m,k); + Mat B(k,n); + Mat C(m,n); + A.setRandom(); + B.setRandom(); + C.setZero(); + + BenchTimer t; + + double up = 1e8*4/sizeof(Scalar); + double tm0 = 4, tm1 = 10; + if(NumTraits::IsComplex) + { + up /= 4; + tm0 = 2; + tm1 = 4; + } + + double flops = 2. * m * n * k; + long rep = std::max(1., std::min(100., up/flops) ); + long tries = std::max(tm0, std::min(tm1, up/flops) ); + + BENCH(t, tries, rep, gemm(A,B,C)); + + return 1e-9 * rep * flops / t.best(); +} + +int main(int argc, char **argv) +{ + std::vector results; + + std::ifstream settings("gemm_settings.txt"); + long m, n, k; + while(settings >> m >> n >> k) + { + //std::cerr << " Testing " << m << " " << n << " " << k << std::endl; + results.push_back( bench(m, n, k) ); + } + + std::cout << RowVectorXd::Map(results.data(), results.size()); + + return 0; +} diff --git a/simulation/externals/eigen/bench/perf_monitoring/gemm/gemm_settings.txt b/simulation/externals/eigen/bench/perf_monitoring/gemm/gemm_settings.txt new file mode 100644 index 0000000..5c43e1c --- /dev/null +++ b/simulation/externals/eigen/bench/perf_monitoring/gemm/gemm_settings.txt @@ -0,0 +1,15 @@ +8 8 8 +9 9 9 +24 24 24 +239 239 239 +240 240 240 +2400 24 24 +24 2400 24 +24 24 2400 +24 2400 2400 +2400 24 2400 +2400 2400 24 +2400 2400 64 +4800 23 160 +23 4800 160 +2400 2400 2400 diff --git a/simulation/externals/eigen/bench/perf_monitoring/gemm/lazy_gemm.cpp b/simulation/externals/eigen/bench/perf_monitoring/gemm/lazy_gemm.cpp new file mode 100644 index 0000000..6dc3701 --- /dev/null +++ b/simulation/externals/eigen/bench/perf_monitoring/gemm/lazy_gemm.cpp @@ -0,0 +1,98 @@ +#include +#include +#include +#include +#include "../../BenchTimer.h" +using namespace Eigen; + +#ifndef SCALAR +#error SCALAR must be defined +#endif + +typedef SCALAR Scalar; + +template +EIGEN_DONT_INLINE +void lazy_gemm(const MatA &A, const MatB &B, MatC &C) +{ +// escape((void*)A.data()); +// escape((void*)B.data()); + C.noalias() += A.lazyProduct(B); +// escape((void*)C.data()); +} + +template +EIGEN_DONT_INLINE +double bench() +{ + typedef Matrix MatA; + typedef Matrix MatB; + typedef Matrix MatC; + + MatA A(m,k); + MatB B(k,n); + MatC C(m,n); + A.setRandom(); + B.setRandom(); + C.setZero(); + + BenchTimer t; + + double up = 1e7*4/sizeof(Scalar); + double tm0 = 10, tm1 = 20; + + double flops = 2. * m * n * k; + long rep = std::max(10., std::min(10000., up/flops) ); + long tries = std::max(tm0, std::min(tm1, up/flops) ); + + BENCH(t, tries, rep, lazy_gemm(A,B,C)); + + return 1e-9 * rep * flops / t.best(); +} + +template +double bench_t(int t) +{ + if(t) + return bench(); + else + return bench(); +} + +EIGEN_DONT_INLINE +double bench_mnk(int m, int n, int k, int t) +{ + int id = m*10000 + n*100 + k; + switch(id) { + case 10101 : return bench_t< 1, 1, 1>(t); break; + case 20202 : return bench_t< 2, 2, 2>(t); break; + case 30303 : return bench_t< 3, 3, 3>(t); break; + case 40404 : return bench_t< 4, 4, 4>(t); break; + case 50505 : return bench_t< 5, 5, 5>(t); break; + case 60606 : return bench_t< 6, 6, 6>(t); break; + case 70707 : return bench_t< 7, 7, 7>(t); break; + case 80808 : return bench_t< 8, 8, 8>(t); break; + case 90909 : return bench_t< 9, 9, 9>(t); break; + case 101010 : return bench_t<10,10,10>(t); break; + case 111111 : return bench_t<11,11,11>(t); break; + case 121212 : return bench_t<12,12,12>(t); break; + } + return 0; +} + +int main(int argc, char **argv) +{ + std::vector results; + + std::ifstream settings("lazy_gemm_settings.txt"); + long m, n, k, t; + while(settings >> m >> n >> k >> t) + { + //std::cerr << " Testing " << m << " " << n << " " << k << std::endl; + results.push_back( bench_mnk(m, n, k, t) ); + } + + std::cout << RowVectorXd::Map(results.data(), results.size()); + + return 0; +} diff --git a/simulation/externals/eigen/bench/perf_monitoring/gemm/lazy_gemm_settings.txt b/simulation/externals/eigen/bench/perf_monitoring/gemm/lazy_gemm_settings.txt new file mode 100644 index 0000000..407d5d4 --- /dev/null +++ b/simulation/externals/eigen/bench/perf_monitoring/gemm/lazy_gemm_settings.txt @@ -0,0 +1,15 @@ +1 1 1 0 +2 2 2 0 +3 3 3 0 +4 4 4 0 +4 4 4 1 +5 5 5 0 +6 6 6 0 +7 7 7 0 +7 7 7 1 +8 8 8 0 +9 9 9 0 +10 10 10 0 +11 11 11 0 +12 12 12 0 +12 12 12 1 diff --git a/simulation/externals/eigen/bench/perf_monitoring/gemm/make_plot.sh b/simulation/externals/eigen/bench/perf_monitoring/gemm/make_plot.sh new file mode 100644 index 0000000..cd3214a --- /dev/null +++ b/simulation/externals/eigen/bench/perf_monitoring/gemm/make_plot.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# base name of the bench +# it reads $1.out +# and generates $1.pdf +WHAT=$1 +bench=$2 + +header="rev " +while read line +do + if [ ! -z '$line' ]; then + header="$header \"$line\"" + fi +done < $bench"_settings.txt" + +echo $header > $WHAT.out.header +cat $WHAT.out >> $WHAT.out.header + + +echo "set title '$WHAT'" > $WHAT.gnuplot +echo "set key autotitle columnhead outside " >> $WHAT.gnuplot +echo "set xtics rotate 1" >> $WHAT.gnuplot + +echo "set term pdf color rounded enhanced fontscale 0.35 size 7in,5in" >> $WHAT.gnuplot +echo set output "'"$WHAT.pdf"'" >> $WHAT.gnuplot + +col=`cat $bench"_settings.txt" | wc -l` +echo "plot for [col=2:$col+1] '$WHAT.out.header' using 0:col:xticlabels(1) with lines" >> $WHAT.gnuplot +echo " " >> $WHAT.gnuplot + +gnuplot -persist < $WHAT.gnuplot + +# generate a png file +# convert -background white -density 120 -rotate 90 -resize 800 +dither -colors 256 -quality 0 $WHAT.ps -background white -flatten .$WHAT.png + +# clean +rm $WHAT.out.header $WHAT.gnuplot \ No newline at end of file diff --git a/simulation/externals/eigen/bench/perf_monitoring/gemm/run.sh b/simulation/externals/eigen/bench/perf_monitoring/gemm/run.sh new file mode 100644 index 0000000..9d6ee40 --- /dev/null +++ b/simulation/externals/eigen/bench/perf_monitoring/gemm/run.sh @@ -0,0 +1,156 @@ +#!/bin/bash + +# ./run.sh gemm +# ./run.sh lazy_gemm + +# Examples of environment variables to be set: +# PREFIX="haswell-fma-" +# CXX_FLAGS="-mfma" + +# Options: +# -up : enforce the recomputation of existing data, and keep best results as a merging strategy +# -s : recompute selected changesets only and keep bests + +bench=$1 + +if echo "$*" | grep '\-up' > /dev/null; then + update=true +else + update=false +fi + +if echo "$*" | grep '\-s' > /dev/null; then + selected=true +else + selected=false +fi + +global_args="$*" + +if [ $selected == true ]; then + echo "Recompute selected changesets only and keep bests" +elif [ $update == true ]; then + echo "(Re-)Compute all changesets and keep bests" +else + echo "Skip previously computed changesets" +fi + + + +if [ ! -d "eigen_src" ]; then + hg clone https://bitbucket.org/eigen/eigen eigen_src +else + cd eigen_src + hg pull -u + cd .. +fi + +if [ ! -z '$CXX' ]; then + CXX=g++ +fi + +function make_backup +{ + if [ -f "$1.out" ]; then + mv "$1.out" "$1.backup" + fi +} + +function merge +{ + count1=`echo $1 | wc -w` + count2=`echo $2 | wc -w` + + if [ $count1 == $count2 ]; then + a=( $1 ); b=( $2 ) + res="" + for (( i=0 ; i<$count1 ; i++ )); do + ai=${a[$i]}; bi=${b[$i]} + tmp=`echo "if ($ai > $bi) $ai else $bi " | bc -l` + res="$res $tmp" + done + echo $res + + else + echo $1 + fi +} + +function test_current +{ + rev=$1 + scalar=$2 + name=$3 + + prev="" + if [ -e "$name.backup" ]; then + prev=`grep $rev "$name.backup" | cut -c 14-` + fi + res=$prev + count_rev=`echo $prev | wc -w` + count_ref=`cat $bench"_settings.txt" | wc -l` + if echo "$global_args" | grep "$rev" > /dev/null; then + rev_found=true + else + rev_found=false + fi +# echo $update et $selected et $rev_found because $rev et "$global_args" +# echo $count_rev et $count_ref + if [ $update == true ] || [ $count_rev != $count_ref ] || ([ $selected == true ] && [ $rev_found == true ]); then + if $CXX -O2 -DNDEBUG -march=native $CXX_FLAGS -I eigen_src $bench.cpp -DSCALAR=$scalar -o $name; then + curr=`./$name` + if [ $count_rev == $count_ref ]; then + echo "merge previous $prev" + echo "with new $curr" + else + echo "got $curr" + fi + res=`merge "$curr" "$prev"` +# echo $res + echo "$rev $res" >> $name.out + else + echo "Compilation failed, skip rev $rev" + fi + else + echo "Skip existing results for $rev / $name" + echo "$rev $res" >> $name.out + fi +} + +make_backup $PREFIX"s"$bench +make_backup $PREFIX"d"$bench +make_backup $PREFIX"c"$bench + +cut -f1 -d"#" < changesets.txt | grep -E '[[:alnum:]]' | while read rev +do + if [ ! -z '$rev' ]; then + echo "Testing rev $rev" + cd eigen_src + hg up -C $rev > /dev/null + actual_rev=`hg identify | cut -f1 -d' '` + cd .. + + test_current $actual_rev float $PREFIX"s"$bench + test_current $actual_rev double $PREFIX"d"$bench + test_current $actual_rev "std::complex" $PREFIX"c"$bench + fi + +done + +echo "Float:" +cat $PREFIX"s""$bench.out" +echo " " + +echo "Double:" +cat $PREFIX"d""$bench.out" +echo "" + +echo "Complex:" +cat $PREFIX"c""$bench.out" +echo "" + +./make_plot.sh $PREFIX"s"$bench $bench +./make_plot.sh $PREFIX"d"$bench $bench +./make_plot.sh $PREFIX"c"$bench $bench + + diff --git a/simulation/externals/eigen/bench/product_threshold.cpp b/simulation/externals/eigen/bench/product_threshold.cpp new file mode 100644 index 0000000..dd6d15a --- /dev/null +++ b/simulation/externals/eigen/bench/product_threshold.cpp @@ -0,0 +1,143 @@ + +#include +#include +#include + +using namespace Eigen; +using namespace std; + +#define END 9 + +template struct map_size { enum { ret = S }; }; +template<> struct map_size<10> { enum { ret = 20 }; }; +template<> struct map_size<11> { enum { ret = 50 }; }; +template<> struct map_size<12> { enum { ret = 100 }; }; +template<> struct map_size<13> { enum { ret = 300 }; }; + +template struct alt_prod +{ + enum { + ret = M==1 && N==1 ? InnerProduct + : K==1 ? OuterProduct + : M==1 ? GemvProduct + : N==1 ? GemvProduct + : GemmProduct + }; +}; + +void print_mode(int mode) +{ + if(mode==InnerProduct) std::cout << "i"; + if(mode==OuterProduct) std::cout << "o"; + if(mode==CoeffBasedProductMode) std::cout << "c"; + if(mode==LazyCoeffBasedProductMode) std::cout << "l"; + if(mode==GemvProduct) std::cout << "v"; + if(mode==GemmProduct) std::cout << "m"; +} + +template +EIGEN_DONT_INLINE void prod(const Lhs& a, const Rhs& b, Res& c) +{ + c.noalias() += typename ProductReturnType::Type(a,b); +} + +template +EIGEN_DONT_INLINE void bench_prod() +{ + typedef Matrix Lhs; Lhs a; a.setRandom(); + typedef Matrix Rhs; Rhs b; b.setRandom(); + typedef Matrix Res; Res c; c.setRandom(); + + BenchTimer t; + double n = 2.*double(M)*double(N)*double(K); + int rep = 100000./n; + rep /= 2; + if(rep<1) rep = 1; + do { + rep *= 2; + t.reset(); + BENCH(t,1,rep,prod(a,b,c)); + } while(t.best()<0.1); + + t.reset(); + BENCH(t,5,rep,prod(a,b,c)); + + print_mode(Mode); + std::cout << int(1e-6*n*rep/t.best()) << "\t"; +} + +template struct print_n; +template struct loop_on_m; +template struct loop_on_n; + +template +struct loop_on_k +{ + static void run() + { + std::cout << "K=" << K << "\t"; + print_n::run(); + std::cout << "\n"; + + loop_on_m::run(); + std::cout << "\n\n"; + + loop_on_k::run(); + } +}; + +template +struct loop_on_k { static void run(){} }; + + +template +struct loop_on_m +{ + static void run() + { + std::cout << M << "f\t"; + loop_on_n::run(); + std::cout << "\n"; + + std::cout << M << "f\t"; + loop_on_n::run(); + std::cout << "\n"; + + loop_on_m::run(); + } +}; + +template +struct loop_on_m { static void run(){} }; + +template +struct loop_on_n +{ + static void run() + { + bench_prod::ret : Mode>(); + + loop_on_n::run(); + } +}; + +template +struct loop_on_n { static void run(){} }; + +template struct print_n +{ + static void run() + { + std::cout << map_size::ret << "\t"; + print_n::run(); + } +}; + +template<> struct print_n { static void run(){} }; + +int main() +{ + loop_on_k<1,1,1>::run(); + + return 0; +} diff --git a/simulation/externals/eigen/bench/quat_slerp.cpp b/simulation/externals/eigen/bench/quat_slerp.cpp new file mode 100644 index 0000000..bffb3bf --- /dev/null +++ b/simulation/externals/eigen/bench/quat_slerp.cpp @@ -0,0 +1,247 @@ + +#include +#include +#include +using namespace Eigen; +using namespace std; + + + +template +EIGEN_DONT_INLINE Q nlerp(const Q& a, const Q& b, typename Q::Scalar t) +{ + return Q((a.coeffs() * (1.0-t) + b.coeffs() * t).normalized()); +} + +template +EIGEN_DONT_INLINE Q slerp_eigen(const Q& a, const Q& b, typename Q::Scalar t) +{ + return a.slerp(t,b); +} + +template +EIGEN_DONT_INLINE Q slerp_legacy(const Q& a, const Q& b, typename Q::Scalar t) +{ + typedef typename Q::Scalar Scalar; + static const Scalar one = Scalar(1) - dummy_precision(); + Scalar d = a.dot(b); + Scalar absD = internal::abs(d); + if (absD>=one) + return a; + + // theta is the angle between the 2 quaternions + Scalar theta = std::acos(absD); + Scalar sinTheta = internal::sin(theta); + + Scalar scale0 = internal::sin( ( Scalar(1) - t ) * theta) / sinTheta; + Scalar scale1 = internal::sin( ( t * theta) ) / sinTheta; + if (d<0) + scale1 = -scale1; + + return Q(scale0 * a.coeffs() + scale1 * b.coeffs()); +} + +template +EIGEN_DONT_INLINE Q slerp_legacy_nlerp(const Q& a, const Q& b, typename Q::Scalar t) +{ + typedef typename Q::Scalar Scalar; + static const Scalar one = Scalar(1) - epsilon(); + Scalar d = a.dot(b); + Scalar absD = internal::abs(d); + + Scalar scale0; + Scalar scale1; + + if (absD>=one) + { + scale0 = Scalar(1) - t; + scale1 = t; + } + else + { + // theta is the angle between the 2 quaternions + Scalar theta = std::acos(absD); + Scalar sinTheta = internal::sin(theta); + + scale0 = internal::sin( ( Scalar(1) - t ) * theta) / sinTheta; + scale1 = internal::sin( ( t * theta) ) / sinTheta; + if (d<0) + scale1 = -scale1; + } + + return Q(scale0 * a.coeffs() + scale1 * b.coeffs()); +} + +template +inline T sin_over_x(T x) +{ + if (T(1) + x*x == T(1)) + return T(1); + else + return std::sin(x)/x; +} + +template +EIGEN_DONT_INLINE Q slerp_rw(const Q& a, const Q& b, typename Q::Scalar t) +{ + typedef typename Q::Scalar Scalar; + + Scalar d = a.dot(b); + Scalar theta; + if (d<0.0) + theta = /*M_PI -*/ Scalar(2)*std::asin( (a.coeffs()+b.coeffs()).norm()/2 ); + else + theta = Scalar(2)*std::asin( (a.coeffs()-b.coeffs()).norm()/2 ); + + // theta is the angle between the 2 quaternions +// Scalar theta = std::acos(absD); + Scalar sinOverTheta = sin_over_x(theta); + + Scalar scale0 = (Scalar(1)-t)*sin_over_x( ( Scalar(1) - t ) * theta) / sinOverTheta; + Scalar scale1 = t * sin_over_x( ( t * theta) ) / sinOverTheta; + if (d<0) + scale1 = -scale1; + + return Quaternion(scale0 * a.coeffs() + scale1 * b.coeffs()); +} + +template +EIGEN_DONT_INLINE Q slerp_gael(const Q& a, const Q& b, typename Q::Scalar t) +{ + typedef typename Q::Scalar Scalar; + + Scalar d = a.dot(b); + Scalar theta; +// theta = Scalar(2) * atan2((a.coeffs()-b.coeffs()).norm(),(a.coeffs()+b.coeffs()).norm()); +// if (d<0.0) +// theta = M_PI-theta; + + if (d<0.0) + theta = /*M_PI -*/ Scalar(2)*std::asin( (-a.coeffs()-b.coeffs()).norm()/2 ); + else + theta = Scalar(2)*std::asin( (a.coeffs()-b.coeffs()).norm()/2 ); + + + Scalar scale0; + Scalar scale1; + if(theta*theta-Scalar(6)==-Scalar(6)) + { + scale0 = Scalar(1) - t; + scale1 = t; + } + else + { + Scalar sinTheta = std::sin(theta); + scale0 = internal::sin( ( Scalar(1) - t ) * theta) / sinTheta; + scale1 = internal::sin( ( t * theta) ) / sinTheta; + if (d<0) + scale1 = -scale1; + } + + return Quaternion(scale0 * a.coeffs() + scale1 * b.coeffs()); +} + +int main() +{ + typedef double RefScalar; + typedef float TestScalar; + + typedef Quaternion Qd; + typedef Quaternion Qf; + + unsigned int g_seed = (unsigned int) time(NULL); + std::cout << g_seed << "\n"; +// g_seed = 1259932496; + srand(g_seed); + + Matrix maxerr(7); + maxerr.setZero(); + + Matrix avgerr(7); + avgerr.setZero(); + + cout << "double=>float=>double nlerp eigen legacy(snap) legacy(nlerp) rightway gael's criteria\n"; + + int rep = 100; + int iters = 40; + for (int w=0; w()); + Qd br(b.cast()); + Qd cr; + + + + cout.precision(8); + cout << std::scientific; + for (int i=0; i(); + c[0] = nlerp(a,b,t); + c[1] = slerp_eigen(a,b,t); + c[2] = slerp_legacy(a,b,t); + c[3] = slerp_legacy_nlerp(a,b,t); + c[4] = slerp_rw(a,b,t); + c[5] = slerp_gael(a,b,t); + + VectorXd err(7); + err[0] = (cr.coeffs()-refc.cast().coeffs()).norm(); +// std::cout << err[0] << " "; + for (int k=0; k<6; ++k) + { + err[k+1] = (c[k].coeffs()-refc.coeffs()).norm(); +// std::cout << err[k+1] << " "; + } + maxerr = maxerr.cwise().max(err); + avgerr += err; +// std::cout << "\n"; + b = cr.cast(); + br = cr; + } +// std::cout << "\n"; + } + avgerr /= RefScalar(rep*iters); + cout << "\n\nAccuracy:\n" + << " max: " << maxerr.transpose() << "\n"; + cout << " avg: " << avgerr.transpose() << "\n"; + + // perf bench + Quaternionf a,b; + a.coeffs().setRandom(); + a.normalize(); + b.coeffs().setRandom(); + b.normalize(); + //b = a; + float s = 0.65; + + #define BENCH(FUNC) {\ + BenchTimer t; \ + for(int k=0; k<2; ++k) {\ + t.start(); \ + for(int i=0; i<1000000; ++i) \ + FUNC(a,b,s); \ + t.stop(); \ + } \ + cout << " " << #FUNC << " => \t " << t.value() << "s\n"; \ + } + + cout << "\nSpeed:\n" << std::fixed; + BENCH(nlerp); + BENCH(slerp_eigen); + BENCH(slerp_legacy); + BENCH(slerp_legacy_nlerp); + BENCH(slerp_rw); + BENCH(slerp_gael); +} + diff --git a/simulation/externals/eigen/bench/quatmul.cpp b/simulation/externals/eigen/bench/quatmul.cpp new file mode 100644 index 0000000..8d9d792 --- /dev/null +++ b/simulation/externals/eigen/bench/quatmul.cpp @@ -0,0 +1,47 @@ +#include +#include +#include +#include + +using namespace Eigen; + +template +EIGEN_DONT_INLINE void quatmul_default(const Quat& a, const Quat& b, Quat& c) +{ + c = a * b; +} + +template +EIGEN_DONT_INLINE void quatmul_novec(const Quat& a, const Quat& b, Quat& c) +{ + c = internal::quat_product<0, Quat, Quat, typename Quat::Scalar, Aligned>::run(a,b); +} + +template void bench(const std::string& label) +{ + int tries = 10; + int rep = 1000000; + BenchTimer t; + + Quat a(4, 1, 2, 3); + Quat b(2, 3, 4, 5); + Quat c; + + std::cout.precision(3); + + BENCH(t, tries, rep, quatmul_default(a,b,c)); + std::cout << label << " default " << 1e3*t.best(CPU_TIMER) << "ms \t" << 1e-6*double(rep)/(t.best(CPU_TIMER)) << " M mul/s\n"; + + BENCH(t, tries, rep, quatmul_novec(a,b,c)); + std::cout << label << " novec " << 1e3*t.best(CPU_TIMER) << "ms \t" << 1e-6*double(rep)/(t.best(CPU_TIMER)) << " M mul/s\n"; +} + +int main() +{ + bench("float "); + bench("double"); + + return 0; + +} + diff --git a/simulation/externals/eigen/bench/sparse_cholesky.cpp b/simulation/externals/eigen/bench/sparse_cholesky.cpp new file mode 100644 index 0000000..ecb2267 --- /dev/null +++ b/simulation/externals/eigen/bench/sparse_cholesky.cpp @@ -0,0 +1,216 @@ +// #define EIGEN_TAUCS_SUPPORT +// #define EIGEN_CHOLMOD_SUPPORT +#include +#include + +// g++ -DSIZE=10000 -DDENSITY=0.001 sparse_cholesky.cpp -I.. -DDENSEMATRI -O3 -g0 -DNDEBUG -DNBTRIES=1 -I /home/gael/Coding/LinearAlgebra/taucs_full/src/ -I/home/gael/Coding/LinearAlgebra/taucs_full/build/linux/ -L/home/gael/Coding/LinearAlgebra/taucs_full/lib/linux/ -ltaucs /home/gael/Coding/LinearAlgebra/GotoBLAS/libgoto.a -lpthread -I /home/gael/Coding/LinearAlgebra/SuiteSparse/CHOLMOD/Include/ $CHOLLIB -I /home/gael/Coding/LinearAlgebra/SuiteSparse/UFconfig/ /home/gael/Coding/LinearAlgebra/SuiteSparse/CCOLAMD/Lib/libccolamd.a /home/gael/Coding/LinearAlgebra/SuiteSparse/CHOLMOD/Lib/libcholmod.a -lmetis /home/gael/Coding/LinearAlgebra/SuiteSparse/AMD/Lib/libamd.a /home/gael/Coding/LinearAlgebra/SuiteSparse/CAMD/Lib/libcamd.a /home/gael/Coding/LinearAlgebra/SuiteSparse/CCOLAMD/Lib/libccolamd.a /home/gael/Coding/LinearAlgebra/SuiteSparse/COLAMD/Lib/libcolamd.a -llapack && ./a.out + +#define NOGMM +#define NOMTL + +#ifndef SIZE +#define SIZE 10 +#endif + +#ifndef DENSITY +#define DENSITY 0.01 +#endif + +#ifndef REPEAT +#define REPEAT 1 +#endif + +#include "BenchSparseUtil.h" + +#ifndef MINDENSITY +#define MINDENSITY 0.0004 +#endif + +#ifndef NBTRIES +#define NBTRIES 10 +#endif + +#define BENCH(X) \ + timer.reset(); \ + for (int _j=0; _j EigenSparseTriMatrix; +typedef SparseMatrix EigenSparseSelfAdjointMatrix; + +void fillSpdMatrix(float density, int rows, int cols, EigenSparseSelfAdjointMatrix& dst) +{ + dst.startFill(rows*cols*density); + for(int j = 0; j < cols; j++) + { + dst.fill(j,j) = internal::random(10,20); + for(int i = j+1; i < rows; i++) + { + Scalar v = (internal::random(0,1) < density) ? internal::random() : 0; + if (v!=0) + dst.fill(i,j) = v; + } + + } + dst.endFill(); +} + +#include + +template +void doEigen(const char* name, const EigenSparseSelfAdjointMatrix& sm1, int flags = 0) +{ + std::cout << name << "..." << std::flush; + BenchTimer timer; + timer.start(); + SparseLLT chol(sm1, flags); + timer.stop(); + std::cout << ":\t" << timer.value() << endl; + + std::cout << " nnz: " << sm1.nonZeros() << " => " << chol.matrixL().nonZeros() << "\n"; +// std::cout << "sparse\n" << chol.matrixL() << "%\n"; +} + +int main(int argc, char *argv[]) +{ + int rows = SIZE; + int cols = SIZE; + float density = DENSITY; + BenchTimer timer; + + VectorXf b = VectorXf::Random(cols); + VectorXf x = VectorXf::Random(cols); + + bool densedone = false; + + //for (float density = DENSITY; density>=MINDENSITY; density*=0.5) +// float density = 0.5; + { + EigenSparseSelfAdjointMatrix sm1(rows, cols); + std::cout << "Generate sparse matrix (might take a while)...\n"; + fillSpdMatrix(density, rows, cols, sm1); + std::cout << "DONE\n\n"; + + // dense matrices + #ifdef DENSEMATRIX + if (!densedone) + { + densedone = true; + std::cout << "Eigen Dense\t" << density*100 << "%\n"; + DenseMatrix m1(rows,cols); + eiToDense(sm1, m1); + m1 = (m1 + m1.transpose()).eval(); + m1.diagonal() *= 0.5; + +// BENCH(LLT chol(m1);) +// std::cout << "dense:\t" << timer.value() << endl; + + BenchTimer timer; + timer.start(); + LLT chol(m1); + timer.stop(); + std::cout << "dense:\t" << timer.value() << endl; + int count = 0; + for (int j=0; j("Eigen/Sparse", sm1, Eigen::IncompleteFactorization); + + #ifdef EIGEN_CHOLMOD_SUPPORT + doEigen("Eigen/Cholmod", sm1, Eigen::IncompleteFactorization); + #endif + + #ifdef EIGEN_TAUCS_SUPPORT + doEigen("Eigen/Taucs", sm1, Eigen::IncompleteFactorization); + #endif + + #if 0 + // TAUCS + { + taucs_ccs_matrix A = sm1.asTaucsMatrix(); + + //BENCH(taucs_ccs_matrix* chol = taucs_ccs_factor_llt(&A, 0, 0);) +// BENCH(taucs_supernodal_factor_to_ccs(taucs_ccs_factor_llt_ll(&A));) +// std::cout << "taucs:\t" << timer.value() << endl; + + taucs_ccs_matrix* chol = taucs_ccs_factor_llt(&A, 0, 0); + + for (int j=0; jcolptr[j]; icolptr[j+1]; ++i) + std::cout << chol->values.d[i] << " "; + } + } + + // CHOLMOD + #ifdef EIGEN_CHOLMOD_SUPPORT + { + cholmod_common c; + cholmod_start (&c); + cholmod_sparse A; + cholmod_factor *L; + + A = sm1.asCholmodMatrix(); + BenchTimer timer; +// timer.reset(); + timer.start(); + std::vector perm(cols); +// std::vector set(ncols); + for (int i=0; icolptr[j]; icolptr[j+1]; ++i) +// std::cout << chol->values.s[i] << " "; +// } + } + #endif + + #endif + + + + } + + + return 0; +} + diff --git a/simulation/externals/eigen/bench/sparse_dense_product.cpp b/simulation/externals/eigen/bench/sparse_dense_product.cpp new file mode 100644 index 0000000..f3f5194 --- /dev/null +++ b/simulation/externals/eigen/bench/sparse_dense_product.cpp @@ -0,0 +1,187 @@ + +//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out +//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out +// -DNOGMM -DNOMTL -DCSPARSE +// -I /home/gael/Coding/LinearAlgebra/CSparse/Include/ /home/gael/Coding/LinearAlgebra/CSparse/Lib/libcsparse.a +#ifndef SIZE +#define SIZE 650000 +#endif + +#ifndef DENSITY +#define DENSITY 0.01 +#endif + +#ifndef REPEAT +#define REPEAT 1 +#endif + +#include "BenchSparseUtil.h" + +#ifndef MINDENSITY +#define MINDENSITY 0.0004 +#endif + +#ifndef NBTRIES +#define NBTRIES 10 +#endif + +#define BENCH(X) \ + timer.reset(); \ + for (int _j=0; _j=MINDENSITY; density*=0.5) + { + //fillMatrix(density, rows, cols, sm1); + fillMatrix2(7, rows, cols, sm1); + + // dense matrices + #ifdef DENSEMATRIX + { + std::cout << "Eigen Dense\t" << density*100 << "%\n"; + DenseMatrix m1(rows,cols); + eiToDense(sm1, m1); + + timer.reset(); + timer.start(); + for (int k=0; k m1(sm1); +// std::cout << "Eigen dyn-sparse\t" << m1.nonZeros()/float(m1.rows()*m1.cols())*100 << "%\n"; +// +// BENCH(for (int k=0; k gmmV1(cols), gmmV2(cols); + Map >(&gmmV1[0], cols) = v1; + Map >(&gmmV2[0], cols) = v2; + + BENCH( asm("#myx"); gmm::mult(m1, gmmV1, gmmV2); asm("#myy"); ) + std::cout << " a * v:\t" << timer.value() << endl; + + BENCH( gmm::mult(gmm::transposed(m1), gmmV1, gmmV2); ) + std::cout << " a' * v:\t" << timer.value() << endl; + } + #endif + + #ifndef NOUBLAS + { + std::cout << "ublas sparse\t" << density*100 << "%\n"; + UBlasSparse m1(rows,cols); + eiToUblas(sm1, m1); + + boost::numeric::ublas::vector uv1, uv2; + eiToUblasVec(v1,uv1); + eiToUblasVec(v2,uv2); + +// std::vector gmmV1(cols), gmmV2(cols); +// Map >(&gmmV1[0], cols) = v1; +// Map >(&gmmV2[0], cols) = v2; + + BENCH( uv2 = boost::numeric::ublas::prod(m1, uv1); ) + std::cout << " a * v:\t" << timer.value() << endl; + +// BENCH( boost::ublas::prod(gmm::transposed(m1), gmmV1, gmmV2); ) +// std::cout << " a' * v:\t" << timer.value() << endl; + } + #endif + + // MTL4 + #ifndef NOMTL + { + std::cout << "MTL4\t" << density*100 << "%\n"; + MtlSparse m1(rows,cols); + eiToMtl(sm1, m1); + mtl::dense_vector mtlV1(cols, 1.0); + mtl::dense_vector mtlV2(cols, 1.0); + + timer.reset(); + timer.start(); + for (int k=0; k + +#define NOGMM +#define NOMTL + +#ifndef SIZE +#define SIZE 10 +#endif + +#ifndef DENSITY +#define DENSITY 0.01 +#endif + +#ifndef REPEAT +#define REPEAT 1 +#endif + +#include "BenchSparseUtil.h" + +#ifndef MINDENSITY +#define MINDENSITY 0.0004 +#endif + +#ifndef NBTRIES +#define NBTRIES 10 +#endif + +#define BENCH(X) \ + timer.reset(); \ + for (int _j=0; _j VectorX; + +#include + +template +void doEigen(const char* name, const EigenSparseMatrix& sm1, const VectorX& b, VectorX& x, int flags = 0) +{ + std::cout << name << "..." << std::flush; + BenchTimer timer; timer.start(); + SparseLU lu(sm1, flags); + timer.stop(); + if (lu.succeeded()) + std::cout << ":\t" << timer.value() << endl; + else + { + std::cout << ":\t FAILED" << endl; + return; + } + + bool ok; + timer.reset(); timer.start(); + ok = lu.solve(b,&x); + timer.stop(); + if (ok) + std::cout << " solve:\t" << timer.value() << endl; + else + std::cout << " solve:\t" << " FAILED" << endl; + + //std::cout << x.transpose() << "\n"; +} + +int main(int argc, char *argv[]) +{ + int rows = SIZE; + int cols = SIZE; + float density = DENSITY; + BenchTimer timer; + + VectorX b = VectorX::Random(cols); + VectorX x = VectorX::Random(cols); + + bool densedone = false; + + //for (float density = DENSITY; density>=MINDENSITY; density*=0.5) +// float density = 0.5; + { + EigenSparseMatrix sm1(rows, cols); + fillMatrix(density, rows, cols, sm1); + + // dense matrices + #ifdef DENSEMATRIX + if (!densedone) + { + densedone = true; + std::cout << "Eigen Dense\t" << density*100 << "%\n"; + DenseMatrix m1(rows,cols); + eiToDense(sm1, m1); + + BenchTimer timer; + timer.start(); + FullPivLU lu(m1); + timer.stop(); + std::cout << "Eigen/dense:\t" << timer.value() << endl; + + timer.reset(); + timer.start(); + lu.solve(b,&x); + timer.stop(); + std::cout << " solve:\t" << timer.value() << endl; +// std::cout << b.transpose() << "\n"; +// std::cout << x.transpose() << "\n"; + } + #endif + + #ifdef EIGEN_UMFPACK_SUPPORT + x.setZero(); + doEigen("Eigen/UmfPack (auto)", sm1, b, x, 0); + #endif + + #ifdef EIGEN_SUPERLU_SUPPORT + x.setZero(); + doEigen("Eigen/SuperLU (nat)", sm1, b, x, Eigen::NaturalOrdering); +// doEigen("Eigen/SuperLU (MD AT+A)", sm1, b, x, Eigen::MinimumDegree_AT_PLUS_A); +// doEigen("Eigen/SuperLU (MD ATA)", sm1, b, x, Eigen::MinimumDegree_ATA); + doEigen("Eigen/SuperLU (COLAMD)", sm1, b, x, Eigen::ColApproxMinimumDegree); + #endif + + } + + return 0; +} + diff --git a/simulation/externals/eigen/bench/sparse_product.cpp b/simulation/externals/eigen/bench/sparse_product.cpp new file mode 100644 index 0000000..d2fc44f --- /dev/null +++ b/simulation/externals/eigen/bench/sparse_product.cpp @@ -0,0 +1,323 @@ + +//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out +//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out +// -DNOGMM -DNOMTL -DCSPARSE +// -I /home/gael/Coding/LinearAlgebra/CSparse/Include/ /home/gael/Coding/LinearAlgebra/CSparse/Lib/libcsparse.a + +#include + +#ifndef SIZE +#define SIZE 1000000 +#endif + +#ifndef NNZPERCOL +#define NNZPERCOL 6 +#endif + +#ifndef REPEAT +#define REPEAT 1 +#endif + +#include +#include "BenchTimer.h" +#include "BenchUtil.h" +#include "BenchSparseUtil.h" + +#ifndef NBTRIES +#define NBTRIES 1 +#endif + +#define BENCH(X) \ + timer.reset(); \ + for (int _j=0; _j +// void mkl_multiply(const Lhs& lhs, const Rhs& rhs, Res& res) +// { +// char n = 'N'; +// float alpha = 1; +// char matdescra[6]; +// matdescra[0] = 'G'; +// matdescra[1] = 0; +// matdescra[2] = 0; +// matdescra[3] = 'C'; +// mkl_scscmm(&n, lhs.rows(), rhs.cols(), lhs.cols(), &alpha, matdescra, +// lhs._valuePtr(), lhs._innerIndexPtr(), lhs.outerIndexPtr(), +// pntre, b, &ldb, &beta, c, &ldc); +// // mkl_somatcopy('C', 'T', lhs.rows(), lhs.cols(), 1, +// // lhs._valuePtr(), lhs.rows(), DST, dst_stride); +// } +// +// #endif + + +#ifdef CSPARSE +cs* cs_sorted_multiply(const cs* a, const cs* b) +{ +// return cs_multiply(a,b); + + cs* A = cs_transpose(a, 1); + cs* B = cs_transpose(b, 1); + cs* D = cs_multiply(B,A); /* D = B'*A' */ + cs_spfree (A) ; + cs_spfree (B) ; + cs_dropzeros (D) ; /* drop zeros from D */ + cs* C = cs_transpose (D, 1) ; /* C = D', so that C is sorted */ + cs_spfree (D) ; + return C; + +// cs* A = cs_transpose(a, 1); +// cs* C = cs_transpose(A, 1); +// return C; +} + +cs* cs_sorted_multiply2(const cs* a, const cs* b) +{ + cs* D = cs_multiply(a,b); + cs* E = cs_transpose(D,1); + cs_spfree(D); + cs* C = cs_transpose(E,1); + cs_spfree(E); + return C; +} +#endif + +void bench_sort(); + +int main(int argc, char *argv[]) +{ +// bench_sort(); + + int rows = SIZE; + int cols = SIZE; + float density = DENSITY; + + EigenSparseMatrix sm1(rows,cols), sm2(rows,cols), sm3(rows,cols), sm4(rows,cols); + + BenchTimer timer; + for (int nnzPerCol = NNZPERCOL; nnzPerCol>1; nnzPerCol/=1.1) + { + sm1.setZero(); + sm2.setZero(); + fillMatrix2(nnzPerCol, rows, cols, sm1); + fillMatrix2(nnzPerCol, rows, cols, sm2); +// std::cerr << "filling OK\n"; + + // dense matrices + #ifdef DENSEMATRIX + { + std::cout << "Eigen Dense\t" << nnzPerCol << "%\n"; + DenseMatrix m1(rows,cols), m2(rows,cols), m3(rows,cols); + eiToDense(sm1, m1); + eiToDense(sm2, m2); + + timer.reset(); + timer.start(); + for (int k=0; k m1(sm1), m2(sm2), m3(sm3); + std::cout << "Eigen dyn-sparse\t" << m1.nonZeros()/(float(m1.rows())*float(m1.cols()))*100 << "% * " + << m2.nonZeros()/(float(m2.rows())*float(m2.cols()))*100 << "%\n"; + +// timer.reset(); +// timer.start(); + BENCH(for (int k=0; k +#include +#include +#include + +#ifndef SIZE +#define SIZE 10000 +#endif + +#ifndef DENSITY +#define DENSITY 0.01 +#endif + +#ifndef REPEAT +#define REPEAT 1 +#endif + +#include "BenchSparseUtil.h" + +#ifndef MINDENSITY +#define MINDENSITY 0.0004 +#endif + +#ifndef NBTRIES +#define NBTRIES 10 +#endif + +#define BENCH(X) \ + timer.reset(); \ + for (int _j=0; _j +void dostuff(const char* name, EigenSparseMatrix& sm1) +{ + int rows = sm1.rows(); + int cols = sm1.cols(); + sm1.setZero(); + BenchTimer t; + SetterType* set1 = new SetterType(sm1); + t.reset(); t.start(); + for (int k=0; k(0,rows-1),internal::random(0,cols-1)) += 1; + t.stop(); + std::cout << "std::map => \t" << t.value()-rtime + << " nnz=" << set1->nonZeros() << std::flush; + + // getchar(); + + t.reset(); t.start(); delete set1; t.stop(); + std::cout << " back: \t" << t.value() << "\n"; +} + +int main(int argc, char *argv[]) +{ + int rows = SIZE; + int cols = SIZE; + float density = DENSITY; + + EigenSparseMatrix sm1(rows,cols), sm2(rows,cols); + + + nentries = rows*cols*density; + std::cout << "n = " << nentries << "\n"; + int dummy; + BenchTimer t; + + t.reset(); t.start(); + for (int k=0; k(0,rows-1) + internal::random(0,cols-1); + t.stop(); + rtime = t.value(); + std::cout << "rtime = " << rtime << " (" << dummy << ")\n\n"; + const int Bits = 6; + for (;;) + { + dostuff >("std::map ", sm1); + dostuff >("gnu::hash_map", sm1); + dostuff >("google::dense", sm1); + dostuff >("google::sparse", sm1); + +// { +// RandomSetter set1(sm1); +// t.reset(); t.start(); +// for (int k=0; k(0,rows-1),internal::random(0,cols-1)) += 1; +// t.stop(); +// std::cout << "gnu::hash_map => \t" << t.value()-rtime +// << " nnz=" << set1.nonZeros() << "\n";getchar(); +// } +// { +// RandomSetter set1(sm1); +// t.reset(); t.start(); +// for (int k=0; k(0,rows-1),internal::random(0,cols-1)) += 1; +// t.stop(); +// std::cout << "google::dense => \t" << t.value()-rtime +// << " nnz=" << set1.nonZeros() << "\n";getchar(); +// } +// { +// RandomSetter set1(sm1); +// t.reset(); t.start(); +// for (int k=0; k(0,rows-1),internal::random(0,cols-1)) += 1; +// t.stop(); +// std::cout << "google::sparse => \t" << t.value()-rtime +// << " nnz=" << set1.nonZeros() << "\n";getchar(); +// } + std::cout << "\n\n"; + } + + return 0; +} + diff --git a/simulation/externals/eigen/bench/sparse_setter.cpp b/simulation/externals/eigen/bench/sparse_setter.cpp new file mode 100644 index 0000000..a9f0b11 --- /dev/null +++ b/simulation/externals/eigen/bench/sparse_setter.cpp @@ -0,0 +1,485 @@ + +//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out +//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out +// -DNOGMM -DNOMTL -DCSPARSE +// -I /home/gael/Coding/LinearAlgebra/CSparse/Include/ /home/gael/Coding/LinearAlgebra/CSparse/Lib/libcsparse.a +#ifndef SIZE +#define SIZE 100000 +#endif + +#ifndef NBPERROW +#define NBPERROW 24 +#endif + +#ifndef REPEAT +#define REPEAT 2 +#endif + +#ifndef NBTRIES +#define NBTRIES 2 +#endif + +#ifndef KK +#define KK 10 +#endif + +#ifndef NOGOOGLE +#define EIGEN_GOOGLEHASH_SUPPORT +#include +#endif + +#include "BenchSparseUtil.h" + +#define CHECK_MEM +// #define CHECK_MEM std/**/::cout << "check mem\n"; getchar(); + +#define BENCH(X) \ + timer.reset(); \ + for (int _j=0; _j Coordinates; +typedef std::vector Values; + +EIGEN_DONT_INLINE Scalar* setinnerrand_eigen(const Coordinates& coords, const Values& vals); +EIGEN_DONT_INLINE Scalar* setrand_eigen_dynamic(const Coordinates& coords, const Values& vals); +EIGEN_DONT_INLINE Scalar* setrand_eigen_compact(const Coordinates& coords, const Values& vals); +EIGEN_DONT_INLINE Scalar* setrand_eigen_sumeq(const Coordinates& coords, const Values& vals); +EIGEN_DONT_INLINE Scalar* setrand_eigen_gnu_hash(const Coordinates& coords, const Values& vals); +EIGEN_DONT_INLINE Scalar* setrand_eigen_google_dense(const Coordinates& coords, const Values& vals); +EIGEN_DONT_INLINE Scalar* setrand_eigen_google_sparse(const Coordinates& coords, const Values& vals); +EIGEN_DONT_INLINE Scalar* setrand_scipy(const Coordinates& coords, const Values& vals); +EIGEN_DONT_INLINE Scalar* setrand_ublas_mapped(const Coordinates& coords, const Values& vals); +EIGEN_DONT_INLINE Scalar* setrand_ublas_coord(const Coordinates& coords, const Values& vals); +EIGEN_DONT_INLINE Scalar* setrand_ublas_compressed(const Coordinates& coords, const Values& vals); +EIGEN_DONT_INLINE Scalar* setrand_ublas_genvec(const Coordinates& coords, const Values& vals); +EIGEN_DONT_INLINE Scalar* setrand_mtl(const Coordinates& coords, const Values& vals); + +int main(int argc, char *argv[]) +{ + int rows = SIZE; + int cols = SIZE; + bool fullyrand = true; + + BenchTimer timer; + Coordinates coords; + Values values; + if(fullyrand) + { + Coordinates pool; + pool.reserve(cols*NBPERROW); + std::cerr << "fill pool" << "\n"; + for (int i=0; i stencil(SIZE,SIZE); + Vector2i ij(internal::random(0,rows-1),internal::random(0,cols-1)); +// if(stencil.coeffRef(ij.x(), ij.y())==0) + { +// stencil.coeffRef(ij.x(), ij.y()) = 1; + pool.push_back(ij); + + } + ++i; + } + std::cerr << "pool ok" << "\n"; + int n = cols*NBPERROW*KK; + coords.reserve(n); + values.reserve(n); + for (int i=0; i(0,pool.size()); + coords.push_back(pool[i]); + values.push_back(internal::random()); + } + } + else + { + for (int j=0; j(0,rows-1),j)); + values.push_back(internal::random()); + } + } + std::cout << "nnz = " << coords.size() << "\n"; + CHECK_MEM + + // dense matrices + #ifdef DENSEMATRIX + { + BENCH(setrand_eigen_dense(coords,values);) + std::cout << "Eigen Dense\t" << timer.value() << "\n"; + } + #endif + + // eigen sparse matrices +// if (!fullyrand) +// { +// BENCH(setinnerrand_eigen(coords,values);) +// std::cout << "Eigen fillrand\t" << timer.value() << "\n"; +// } + { + BENCH(setrand_eigen_dynamic(coords,values);) + std::cout << "Eigen dynamic\t" << timer.value() << "\n"; + } +// { +// BENCH(setrand_eigen_compact(coords,values);) +// std::cout << "Eigen compact\t" << timer.value() << "\n"; +// } + { + BENCH(setrand_eigen_sumeq(coords,values);) + std::cout << "Eigen sumeq\t" << timer.value() << "\n"; + } + { +// BENCH(setrand_eigen_gnu_hash(coords,values);) +// std::cout << "Eigen std::map\t" << timer.value() << "\n"; + } + { + BENCH(setrand_scipy(coords,values);) + std::cout << "scipy\t" << timer.value() << "\n"; + } + #ifndef NOGOOGLE + { + BENCH(setrand_eigen_google_dense(coords,values);) + std::cout << "Eigen google dense\t" << timer.value() << "\n"; + } + { + BENCH(setrand_eigen_google_sparse(coords,values);) + std::cout << "Eigen google sparse\t" << timer.value() << "\n"; + } + #endif + + #ifndef NOUBLAS + { +// BENCH(setrand_ublas_mapped(coords,values);) +// std::cout << "ublas mapped\t" << timer.value() << "\n"; + } + { + BENCH(setrand_ublas_genvec(coords,values);) + std::cout << "ublas vecofvec\t" << timer.value() << "\n"; + } + /*{ + timer.reset(); + timer.start(); + for (int k=0; k mat(SIZE,SIZE); + //mat.startFill(2000000/*coords.size()*/); + for (int i=0; i mat(SIZE,SIZE); + mat.reserve(coords.size()/10); + for (int i=0; i mat(SIZE,SIZE); + for (int j=0; j aux(SIZE,SIZE); + mat.reserve(n); + for (int i=j*n; i<(j+1)*n; ++i) + { + aux.insert(coords[i].x(), coords[i].y()) += vals[i]; + } + aux.finalize(); + mat += aux; + } + return &mat.coeffRef(coords[0].x(), coords[0].y()); +} + +EIGEN_DONT_INLINE Scalar* setrand_eigen_compact(const Coordinates& coords, const Values& vals) +{ + using namespace Eigen; + DynamicSparseMatrix setter(SIZE,SIZE); + setter.reserve(coords.size()/10); + for (int i=0; i mat = setter; + CHECK_MEM; + return &mat.coeffRef(coords[0].x(), coords[0].y()); +} + +EIGEN_DONT_INLINE Scalar* setrand_eigen_gnu_hash(const Coordinates& coords, const Values& vals) +{ + using namespace Eigen; + SparseMatrix mat(SIZE,SIZE); + { + RandomSetter, StdMapTraits > setter(mat); + for (int i=0; i mat(SIZE,SIZE); + { + RandomSetter, GoogleDenseHashMapTraits> setter(mat); + for (int i=0; i mat(SIZE,SIZE); + { + RandomSetter, GoogleSparseHashMapTraits> setter(mat); + for (int i=0; i +void coo_tocsr(const int n_row, + const int n_col, + const int nnz, + const Coordinates Aij, + const Values Ax, + int Bp[], + int Bj[], + T Bx[]) +{ + //compute number of non-zero entries per row of A coo_tocsr + std::fill(Bp, Bp + n_row, 0); + + for (int n = 0; n < nnz; n++){ + Bp[Aij[n].x()]++; + } + + //cumsum the nnz per row to get Bp[] + for(int i = 0, cumsum = 0; i < n_row; i++){ + int temp = Bp[i]; + Bp[i] = cumsum; + cumsum += temp; + } + Bp[n_row] = nnz; + + //write Aj,Ax into Bj,Bx + for(int n = 0; n < nnz; n++){ + int row = Aij[n].x(); + int dest = Bp[row]; + + Bj[dest] = Aij[n].y(); + Bx[dest] = Ax[n]; + + Bp[row]++; + } + + for(int i = 0, last = 0; i <= n_row; i++){ + int temp = Bp[i]; + Bp[i] = last; + last = temp; + } + + //now Bp,Bj,Bx form a CSR representation (with possible duplicates) +} + +template< class T1, class T2 > +bool kv_pair_less(const std::pair& x, const std::pair& y){ + return x.first < y.first; +} + + +template +void csr_sort_indices(const I n_row, + const I Ap[], + I Aj[], + T Ax[]) +{ + std::vector< std::pair > temp; + + for(I i = 0; i < n_row; i++){ + I row_start = Ap[i]; + I row_end = Ap[i+1]; + + temp.clear(); + + for(I jj = row_start; jj < row_end; jj++){ + temp.push_back(std::make_pair(Aj[jj],Ax[jj])); + } + + std::sort(temp.begin(),temp.end(),kv_pair_less); + + for(I jj = row_start, n = 0; jj < row_end; jj++, n++){ + Aj[jj] = temp[n].first; + Ax[jj] = temp[n].second; + } + } +} + +template +void csr_sum_duplicates(const I n_row, + const I n_col, + I Ap[], + I Aj[], + T Ax[]) +{ + I nnz = 0; + I row_end = 0; + for(I i = 0; i < n_row; i++){ + I jj = row_end; + row_end = Ap[i+1]; + while( jj < row_end ){ + I j = Aj[jj]; + T x = Ax[jj]; + jj++; + while( jj < row_end && Aj[jj] == j ){ + x += Ax[jj]; + jj++; + } + Aj[nnz] = j; + Ax[nnz] = x; + nnz++; + } + Ap[i+1] = nnz; + } +} + +EIGEN_DONT_INLINE Scalar* setrand_scipy(const Coordinates& coords, const Values& vals) +{ + using namespace Eigen; + SparseMatrix mat(SIZE,SIZE); + mat.resizeNonZeros(coords.size()); +// std::cerr << "setrand_scipy...\n"; + coo_tocsr(SIZE,SIZE, coords.size(), coords, vals, mat._outerIndexPtr(), mat._innerIndexPtr(), mat._valuePtr()); +// std::cerr << "coo_tocsr ok\n"; + + csr_sort_indices(SIZE, mat._outerIndexPtr(), mat._innerIndexPtr(), mat._valuePtr()); + + csr_sum_duplicates(SIZE, SIZE, mat._outerIndexPtr(), mat._innerIndexPtr(), mat._valuePtr()); + + mat.resizeNonZeros(mat._outerIndexPtr()[SIZE]); + + return &mat.coeffRef(coords[0].x(), coords[0].y()); +} + + +#ifndef NOUBLAS +EIGEN_DONT_INLINE Scalar* setrand_ublas_mapped(const Coordinates& coords, const Values& vals) +{ + using namespace boost; + using namespace boost::numeric; + using namespace boost::numeric::ublas; + mapped_matrix aux(SIZE,SIZE); + for (int i=0; i mat(aux); + return 0;// &mat(coords[0].x(), coords[0].y()); +} +/*EIGEN_DONT_INLINE Scalar* setrand_ublas_coord(const Coordinates& coords, const Values& vals) +{ + using namespace boost; + using namespace boost::numeric; + using namespace boost::numeric::ublas; + coordinate_matrix aux(SIZE,SIZE); + for (int i=0; i mat(aux); + return 0;//&mat(coords[0].x(), coords[0].y()); +} +EIGEN_DONT_INLINE Scalar* setrand_ublas_compressed(const Coordinates& coords, const Values& vals) +{ + using namespace boost; + using namespace boost::numeric; + using namespace boost::numeric::ublas; + compressed_matrix mat(SIZE,SIZE); + for (int i=0; i > foo; + generalized_vector_of_vector > > aux(SIZE,SIZE); + for (int i=0; i mat(aux); + return 0;//&mat(coords[0].x(), coords[0].y()); +} +#endif + +#ifndef NOMTL +EIGEN_DONT_INLINE void setrand_mtl(const Coordinates& coords, const Values& vals); +#endif + diff --git a/simulation/externals/eigen/bench/sparse_transpose.cpp b/simulation/externals/eigen/bench/sparse_transpose.cpp new file mode 100644 index 0000000..c9aacf5 --- /dev/null +++ b/simulation/externals/eigen/bench/sparse_transpose.cpp @@ -0,0 +1,104 @@ + +//g++ -O3 -g0 -DNDEBUG sparse_transpose.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out +// -DNOGMM -DNOMTL +// -DCSPARSE -I /home/gael/Coding/LinearAlgebra/CSparse/Include/ /home/gael/Coding/LinearAlgebra/CSparse/Lib/libcsparse.a + +#ifndef SIZE +#define SIZE 10000 +#endif + +#ifndef DENSITY +#define DENSITY 0.01 +#endif + +#ifndef REPEAT +#define REPEAT 1 +#endif + +#include "BenchSparseUtil.h" + +#ifndef MINDENSITY +#define MINDENSITY 0.0004 +#endif + +#ifndef NBTRIES +#define NBTRIES 10 +#endif + +#define BENCH(X) \ + timer.reset(); \ + for (int _j=0; _j=MINDENSITY; density*=0.5) + { + fillMatrix(density, rows, cols, sm1); + + // dense matrices + #ifdef DENSEMATRIX + { + DenseMatrix m1(rows,cols), m3(rows,cols); + eiToDense(sm1, m1); + BENCH(for (int k=0; k EigenSparseTriMatrix; +typedef SparseMatrix EigenSparseTriMatrixRow; + +void fillMatrix(float density, int rows, int cols, EigenSparseTriMatrix& dst) +{ + dst.startFill(rows*cols*density); + for(int j = 0; j < cols; j++) + { + for(int i = 0; i < j; i++) + { + Scalar v = (internal::random(0,1) < density) ? internal::random() : 0; + if (v!=0) + dst.fill(i,j) = v; + } + dst.fill(j,j) = internal::random(); + } + dst.endFill(); +} + +int main(int argc, char *argv[]) +{ + int rows = SIZE; + int cols = SIZE; + float density = DENSITY; + BenchTimer timer; + #if 1 + EigenSparseTriMatrix sm1(rows,cols); + typedef Matrix DenseVector; + DenseVector b = DenseVector::Random(cols); + DenseVector x = DenseVector::Random(cols); + + bool densedone = false; + + for (float density = DENSITY; density>=MINDENSITY; density*=0.5) + { + EigenSparseTriMatrix sm1(rows, cols); + fillMatrix(density, rows, cols, sm1); + + // dense matrices + #ifdef DENSEMATRIX + if (!densedone) + { + densedone = true; + std::cout << "Eigen Dense\t" << density*100 << "%\n"; + DenseMatrix m1(rows,cols); + Matrix m2(rows,cols); + eiToDense(sm1, m1); + m2 = m1; + + BENCH(x = m1.marked().solveTriangular(b);) + std::cout << " colmajor^-1 * b:\t" << timer.value() << endl; +// std::cerr << x.transpose() << "\n"; + + BENCH(x = m2.marked().solveTriangular(b);) + std::cout << " rowmajor^-1 * b:\t" << timer.value() << endl; +// std::cerr << x.transpose() << "\n"; + } + #endif + + // eigen sparse matrices + { + std::cout << "Eigen sparse\t" << density*100 << "%\n"; + EigenSparseTriMatrixRow sm2 = sm1; + + BENCH(x = sm1.solveTriangular(b);) + std::cout << " colmajor^-1 * b:\t" << timer.value() << endl; +// std::cerr << x.transpose() << "\n"; + + BENCH(x = sm2.solveTriangular(b);) + std::cout << " rowmajor^-1 * b:\t" << timer.value() << endl; +// std::cerr << x.transpose() << "\n"; + +// x = b; +// BENCH(sm1.inverseProductInPlace(x);) +// std::cout << " colmajor^-1 * b:\t" << timer.value() << " (inplace)" << endl; +// std::cerr << x.transpose() << "\n"; +// +// x = b; +// BENCH(sm2.inverseProductInPlace(x);) +// std::cout << " rowmajor^-1 * b:\t" << timer.value() << " (inplace)" << endl; +// std::cerr << x.transpose() << "\n"; + } + + + + // CSparse + #ifdef CSPARSE + { + std::cout << "CSparse \t" << density*100 << "%\n"; + cs *m1; + eiToCSparse(sm1, m1); + + BENCH(x = b; if (!cs_lsolve (m1, x.data())){std::cerr << "cs_lsolve failed\n"; break;}; ) + std::cout << " colmajor^-1 * b:\t" << timer.value() << endl; + } + #endif + + // GMM++ + #ifndef NOGMM + { + std::cout << "GMM++ sparse\t" << density*100 << "%\n"; + GmmSparse m1(rows,cols); + gmm::csr_matrix m2; + eiToGmm(sm1, m1); + gmm::copy(m1,m2); + std::vector gmmX(cols), gmmB(cols); + Map >(&gmmX[0], cols) = x; + Map >(&gmmB[0], cols) = b; + + gmmX = gmmB; + BENCH(gmm::upper_tri_solve(m1, gmmX, false);) + std::cout << " colmajor^-1 * b:\t" << timer.value() << endl; +// std::cerr << Map >(&gmmX[0], cols).transpose() << "\n"; + + gmmX = gmmB; + BENCH(gmm::upper_tri_solve(m2, gmmX, false);) + timer.stop(); + std::cout << " rowmajor^-1 * b:\t" << timer.value() << endl; +// std::cerr << Map >(&gmmX[0], cols).transpose() << "\n"; + } + #endif + + // MTL4 + #ifndef NOMTL + { + std::cout << "MTL4\t" << density*100 << "%\n"; + MtlSparse m1(rows,cols); + MtlSparseRowMajor m2(rows,cols); + eiToMtl(sm1, m1); + m2 = m1; + mtl::dense_vector x(rows, 1.0); + mtl::dense_vector b(rows, 1.0); + + BENCH(x = mtl::upper_trisolve(m1,b);) + std::cout << " colmajor^-1 * b:\t" << timer.value() << endl; +// std::cerr << x << "\n"; + + BENCH(x = mtl::upper_trisolve(m2,b);) + std::cout << " rowmajor^-1 * b:\t" << timer.value() << endl; +// std::cerr << x << "\n"; + } + #endif + + + std::cout << "\n\n"; + } + #endif + + #if 0 + // bench small matrices (in-place versus return bye value) + { + timer.reset(); + for (int _j=0; _j<10; ++_j) { + Matrix4f m = Matrix4f::Random(); + Vector4f b = Vector4f::Random(); + Vector4f x = Vector4f::Random(); + timer.start(); + for (int _k=0; _k<1000000; ++_k) { + b = m.inverseProduct(b); + } + timer.stop(); + } + std::cout << "4x4 :\t" << timer.value() << endl; + } + + { + timer.reset(); + for (int _j=0; _j<10; ++_j) { + Matrix4f m = Matrix4f::Random(); + Vector4f b = Vector4f::Random(); + Vector4f x = Vector4f::Random(); + timer.start(); + for (int _k=0; _k<1000000; ++_k) { + m.inverseProductInPlace(x); + } + timer.stop(); + } + std::cout << "4x4 IP :\t" << timer.value() << endl; + } + #endif + + return 0; +} + diff --git a/simulation/externals/eigen/bench/spbench/CMakeLists.txt b/simulation/externals/eigen/bench/spbench/CMakeLists.txt new file mode 100644 index 0000000..9327356 --- /dev/null +++ b/simulation/externals/eigen/bench/spbench/CMakeLists.txt @@ -0,0 +1,85 @@ + + +set(BLAS_FOUND TRUE) +set(LAPACK_FOUND TRUE) +set(BLAS_LIBRARIES eigen_blas_static) +set(LAPACK_LIBRARIES eigen_lapack_static) + +set(SPARSE_LIBS "") + +# find_library(PARDISO_LIBRARIES pardiso412-GNU450-X86-64) +# if(PARDISO_LIBRARIES) +# add_definitions("-DEIGEN_PARDISO_SUPPORT") +# set(SPARSE_LIBS ${SPARSE_LIBS} ${PARDISO_LIBRARIES}) +# endif(PARDISO_LIBRARIES) + +find_package(Cholmod) +if(CHOLMOD_FOUND AND BLAS_FOUND AND LAPACK_FOUND) + add_definitions("-DEIGEN_CHOLMOD_SUPPORT") + include_directories(${CHOLMOD_INCLUDES}) + set(SPARSE_LIBS ${SPARSE_LIBS} ${CHOLMOD_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) + set(CHOLMOD_ALL_LIBS ${CHOLMOD_LIBRARIES} ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}) +endif() + +find_package(Umfpack) +if(UMFPACK_FOUND AND BLAS_FOUND) + add_definitions("-DEIGEN_UMFPACK_SUPPORT") + include_directories(${UMFPACK_INCLUDES}) + set(SPARSE_LIBS ${SPARSE_LIBS} ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES}) + set(UMFPACK_ALL_LIBS ${UMFPACK_LIBRARIES} ${BLAS_LIBRARIES}) +endif() + +find_package(SuperLU 4.0) +if(SUPERLU_FOUND AND BLAS_FOUND) + add_definitions("-DEIGEN_SUPERLU_SUPPORT") + include_directories(${SUPERLU_INCLUDES}) + set(SPARSE_LIBS ${SPARSE_LIBS} ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES}) + set(SUPERLU_ALL_LIBS ${SUPERLU_LIBRARIES} ${BLAS_LIBRARIES}) +endif() + + +find_package(PASTIX QUIET COMPONENTS METIS SCOTCH) +# check that the PASTIX found is a version without MPI +find_path(PASTIX_pastix_nompi.h_INCLUDE_DIRS + NAMES pastix_nompi.h + HINTS ${PASTIX_INCLUDE_DIRS} +) +if (NOT PASTIX_pastix_nompi.h_INCLUDE_DIRS) + message(STATUS "A version of Pastix has been found but pastix_nompi.h does not exist in the include directory." + " Because Eigen tests require a version without MPI, we disable the Pastix backend.") +endif() +if(PASTIX_FOUND AND PASTIX_pastix_nompi.h_INCLUDE_DIRS AND BLAS_FOUND) + add_definitions("-DEIGEN_PASTIX_SUPPORT") + include_directories(${PASTIX_INCLUDE_DIRS_DEP}) + if(SCOTCH_FOUND) + include_directories(${SCOTCH_INCLUDE_DIRS}) + set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${SCOTCH_LIBRARIES}) + elseif(METIS_FOUND) + include_directories(${METIS_INCLUDE_DIRS}) + set(PASTIX_LIBRARIES ${PASTIX_LIBRARIES} ${METIS_LIBRARIES}) + endif(SCOTCH_FOUND) + set(SPARSE_LIBS ${SPARSE_LIBS} ${PASTIX_LIBRARIES_DEP} ${ORDERING_LIBRARIES}) + set(PASTIX_ALL_LIBS ${PASTIX_LIBRARIES_DEP}) +endif(PASTIX_FOUND AND BLAS_FOUND) + +if(METIS_FOUND) + include_directories(${METIS_INCLUDE_DIRS}) + set (SPARSE_LIBS ${SPARSE_LIBS} ${METIS_LIBRARIES}) + add_definitions("-DEIGEN_METIS_SUPPORT") +endif(METIS_FOUND) + +find_library(RT_LIBRARY rt) +if(RT_LIBRARY) + set(SPARSE_LIBS ${SPARSE_LIBS} ${RT_LIBRARY}) +endif(RT_LIBRARY) + +add_executable(spbenchsolver spbenchsolver.cpp) +target_link_libraries (spbenchsolver ${SPARSE_LIBS}) + +add_executable(spsolver sp_solver.cpp) +target_link_libraries (spsolver ${SPARSE_LIBS}) + + +add_executable(test_sparseLU test_sparseLU.cpp) +target_link_libraries (test_sparseLU ${SPARSE_LIBS}) + diff --git a/simulation/externals/eigen/bench/spbench/sp_solver.cpp b/simulation/externals/eigen/bench/spbench/sp_solver.cpp new file mode 100644 index 0000000..a1f4bac --- /dev/null +++ b/simulation/externals/eigen/bench/spbench/sp_solver.cpp @@ -0,0 +1,125 @@ +// Small bench routine for Eigen available in Eigen +// (C) Desire NUENTSA WAKAM, INRIA + +#include +#include +#include +#include +#include +#include +#include +#include +//#include +#include +// #include +#include +#include +using namespace std; +using namespace Eigen; + +int main(int argc, char **args) +{ + SparseMatrix A; + typedef SparseMatrix::Index Index; + typedef Matrix DenseMatrix; + typedef Matrix DenseRhs; + VectorXd b, x, tmp; + BenchTimer timer,totaltime; + //SparseLU > solver; +// SuperLU > solver; + ConjugateGradient, Lower,IncompleteCholesky > solver; + ifstream matrix_file; + string line; + int n; + // Set parameters +// solver.iparm(IPARM_THREAD_NBR) = 4; + /* Fill the matrix with sparse matrix stored in Matrix-Market coordinate column-oriented format */ + if (argc < 2) assert(false && "please, give the matrix market file "); + + timer.start(); + totaltime.start(); + loadMarket(A, args[1]); + cout << "End charging matrix " << endl; + bool iscomplex=false, isvector=false; + int sym; + getMarketHeader(args[1], sym, iscomplex, isvector); + if (iscomplex) { cout<< " Not for complex matrices \n"; return -1; } + if (isvector) { cout << "The provided file is not a matrix file\n"; return -1;} + if (sym != 0) { // symmetric matrices, only the lower part is stored + SparseMatrix temp; + temp = A; + A = temp.selfadjointView(); + } + timer.stop(); + + n = A.cols(); + // ====== TESTS FOR SPARSE TUTORIAL ====== +// cout<< "OuterSize " << A.outerSize() << " inner " << A.innerSize() << endl; +// SparseMatrix mat1(A); +// SparseMatrix mat2; +// cout << " norm of A " << mat1.norm() << endl; ; +// PermutationMatrix perm(n); +// perm.resize(n,1); +// perm.indices().setLinSpaced(n, 0, n-1); +// mat2 = perm * mat1; +// mat.subrows(); +// mat2.resize(n,n); +// mat2.reserve(10); +// mat2.setConstant(); +// std::cout<< "NORM " << mat1.squaredNorm()<< endl; + + cout<< "Time to load the matrix " << timer.value() < 2) + loadMarketVector(b, args[2]); + else + { + b.resize(n); + tmp.resize(n); +// tmp.setRandom(); + for (int i = 0; i < n; i++) tmp(i) = i; + b = A * tmp ; + } +// Scaling > scal; +// scal.computeRef(A); +// b = scal.LeftScaling().cwiseProduct(b); + + /* Compute the factorization */ + cout<< "Starting the factorization "<< endl; + timer.reset(); + timer.start(); + cout<< "Size of Input Matrix "<< b.size()<<"\n\n"; + cout<< "Rows and columns "<< A.rows() <<" " < + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/simulation/externals/eigen/bench/spbench/spbenchsolver.cpp b/simulation/externals/eigen/bench/spbench/spbenchsolver.cpp new file mode 100644 index 0000000..4acd003 --- /dev/null +++ b/simulation/externals/eigen/bench/spbench/spbenchsolver.cpp @@ -0,0 +1,87 @@ +#include + +void bench_printhelp() +{ + cout<< " \nbenchsolver : performs a benchmark of all the solvers available in Eigen \n\n"; + cout<< " MATRIX FOLDER : \n"; + cout<< " The matrices for the benchmark should be collected in a folder specified with an environment variable EIGEN_MATRIXDIR \n"; + cout<< " The matrices are stored using the matrix market coordinate format \n"; + cout<< " The matrix and associated right-hand side (rhs) files are named respectively \n"; + cout<< " as MatrixName.mtx and MatrixName_b.mtx. If the rhs does not exist, a random one is generated. \n"; + cout<< " If a matrix is SPD, the matrix should be named as MatrixName_SPD.mtx \n"; + cout<< " If a true solution exists, it should be named as MatrixName_x.mtx; \n" ; + cout<< " it will be used to compute the norm of the error relative to the computed solutions\n\n"; + cout<< " OPTIONS : \n"; + cout<< " -h or --help \n print this help and return\n\n"; + cout<< " -d matrixdir \n Use matrixdir as the matrix folder instead of the one specified in the environment variable EIGEN_MATRIXDIR\n\n"; + cout<< " -o outputfile.xml \n Output the statistics to a xml file \n\n"; + cout<< " --eps Sets the relative tolerance for iterative solvers (default 1e-08) \n\n"; + cout<< " --maxits Sets the maximum number of iterations (default 1000) \n\n"; + +} +int main(int argc, char ** args) +{ + + bool help = ( get_options(argc, args, "-h") || get_options(argc, args, "--help") ); + if(help) { + bench_printhelp(); + return 0; + } + + // Get the location of the test matrices + string matrix_dir; + if (!get_options(argc, args, "-d", &matrix_dir)) + { + if(getenv("EIGEN_MATRIXDIR") == NULL){ + std::cerr << "Please, specify the location of the matrices with -d mat_folder or the environment variable EIGEN_MATRIXDIR \n"; + std::cerr << " Run with --help to see the list of all the available options \n"; + return -1; + } + matrix_dir = getenv("EIGEN_MATRIXDIR"); + } + + std::ofstream statbuf; + string statFile ; + + // Get the file to write the statistics + bool statFileExists = get_options(argc, args, "-o", &statFile); + if(statFileExists) + { + statbuf.open(statFile.c_str(), std::ios::out); + if(statbuf.good()){ + statFileExists = true; + printStatheader(statbuf); + statbuf.close(); + } + else + std::cerr << "Unable to open the provided file for writting... \n"; + } + + // Get the maximum number of iterations and the tolerance + int maxiters = 1000; + double tol = 1e-08; + string inval; + if (get_options(argc, args, "--eps", &inval)) + tol = atof(inval.c_str()); + if(get_options(argc, args, "--maxits", &inval)) + maxiters = atoi(inval.c_str()); + + string current_dir; + // Test the real-arithmetics matrices + Browse_Matrices(matrix_dir, statFileExists, statFile,maxiters, tol); + + // Test the complex-arithmetics matrices + Browse_Matrices >(matrix_dir, statFileExists, statFile, maxiters, tol); + + if(statFileExists) + { + statbuf.open(statFile.c_str(), std::ios::app); + statbuf << " \n"; + cout << "\n Output written in " << statFile << " ...\n"; + statbuf.close(); + } + + return 0; +} + + diff --git a/simulation/externals/eigen/bench/spbench/spbenchsolver.h b/simulation/externals/eigen/bench/spbench/spbenchsolver.h new file mode 100644 index 0000000..19c719c --- /dev/null +++ b/simulation/externals/eigen/bench/spbench/spbenchsolver.h @@ -0,0 +1,554 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2012 Désiré Nuentsa-Wakam +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "spbenchstyle.h" + +#ifdef EIGEN_METIS_SUPPORT +#include +#endif + +#ifdef EIGEN_CHOLMOD_SUPPORT +#include +#endif + +#ifdef EIGEN_UMFPACK_SUPPORT +#include +#endif + +#ifdef EIGEN_PARDISO_SUPPORT +#include +#endif + +#ifdef EIGEN_SUPERLU_SUPPORT +#include +#endif + +#ifdef EIGEN_PASTIX_SUPPORT +#include +#endif + +// CONSTANTS +#define EIGEN_UMFPACK 10 +#define EIGEN_SUPERLU 20 +#define EIGEN_PASTIX 30 +#define EIGEN_PARDISO 40 +#define EIGEN_SPARSELU_COLAMD 50 +#define EIGEN_SPARSELU_METIS 51 +#define EIGEN_BICGSTAB 60 +#define EIGEN_BICGSTAB_ILUT 61 +#define EIGEN_GMRES 70 +#define EIGEN_GMRES_ILUT 71 +#define EIGEN_SIMPLICIAL_LDLT 80 +#define EIGEN_CHOLMOD_LDLT 90 +#define EIGEN_PASTIX_LDLT 100 +#define EIGEN_PARDISO_LDLT 110 +#define EIGEN_SIMPLICIAL_LLT 120 +#define EIGEN_CHOLMOD_SUPERNODAL_LLT 130 +#define EIGEN_CHOLMOD_SIMPLICIAL_LLT 140 +#define EIGEN_PASTIX_LLT 150 +#define EIGEN_PARDISO_LLT 160 +#define EIGEN_CG 170 +#define EIGEN_CG_PRECOND 180 + +using namespace Eigen; +using namespace std; + + +// Global variables for input parameters +int MaximumIters; // Maximum number of iterations +double RelErr; // Relative error of the computed solution +double best_time_val; // Current best time overall solvers +int best_time_id; // id of the best solver for the current system + +template inline typename NumTraits::Real test_precision() { return NumTraits::dummy_precision(); } +template<> inline float test_precision() { return 1e-3f; } +template<> inline double test_precision() { return 1e-6; } +template<> inline float test_precision >() { return test_precision(); } +template<> inline double test_precision >() { return test_precision(); } + +void printStatheader(std::ofstream& out) +{ + // Print XML header + // NOTE It would have been much easier to write these XML documents using external libraries like tinyXML or Xerces-C++. + + out << " \n"; + out << " \n"; + out << "\n]>"; + out << "\n\n\n"; + + out << "\n \n" ; //root XML element + // Print the xsl style section + printBenchStyle(out); + // List all available solvers + out << " \n"; +#ifdef EIGEN_UMFPACK_SUPPORT + out <<" \n"; + out << " LU \n"; + out << " UMFPACK \n"; + out << " \n"; +#endif +#ifdef EIGEN_SUPERLU_SUPPORT + out <<" \n"; + out << " LU \n"; + out << " SUPERLU \n"; + out << " \n"; +#endif +#ifdef EIGEN_CHOLMOD_SUPPORT + out <<" \n"; + out << " LLT SP \n"; + out << " CHOLMOD \n"; + out << " \n"; + + out <<" \n"; + out << " LLT \n"; + out << " CHOLMOD \n"; + out << " \n"; + + out <<" \n"; + out << " LDLT \n"; + out << " CHOLMOD \n"; + out << " \n"; +#endif +#ifdef EIGEN_PARDISO_SUPPORT + out <<" \n"; + out << " LU \n"; + out << " PARDISO \n"; + out << " \n"; + + out <<" \n"; + out << " LLT \n"; + out << " PARDISO \n"; + out << " \n"; + + out <<" \n"; + out << " LDLT \n"; + out << " PARDISO \n"; + out << " \n"; +#endif +#ifdef EIGEN_PASTIX_SUPPORT + out <<" \n"; + out << " LU \n"; + out << " PASTIX \n"; + out << " \n"; + + out <<" \n"; + out << " LLT \n"; + out << " PASTIX \n"; + out << " \n"; + + out <<" \n"; + out << " LDLT \n"; + out << " PASTIX \n"; + out << " \n"; +#endif + + out <<" \n"; + out << " BICGSTAB \n"; + out << " EIGEN \n"; + out << " \n"; + + out <<" \n"; + out << " BICGSTAB_ILUT \n"; + out << " EIGEN \n"; + out << " \n"; + + out <<" \n"; + out << " GMRES_ILUT \n"; + out << " EIGEN \n"; + out << " \n"; + + out <<" \n"; + out << " LDLT \n"; + out << " EIGEN \n"; + out << " \n"; + + out <<" \n"; + out << " LLT \n"; + out << " EIGEN \n"; + out << " \n"; + + out <<" \n"; + out << " CG \n"; + out << " EIGEN \n"; + out << " \n"; + + out <<" \n"; + out << " LU_COLAMD \n"; + out << " EIGEN \n"; + out << " \n"; + +#ifdef EIGEN_METIS_SUPPORT + out <<" \n"; + out << " LU_METIS \n"; + out << " EIGEN \n"; + out << " \n"; +#endif + out << " \n"; + +} + + +template +void call_solver(Solver &solver, const int solver_id, const typename Solver::MatrixType& A, const Matrix& b, const Matrix& refX,std::ofstream& statbuf) +{ + + double total_time; + double compute_time; + double solve_time; + double rel_error; + Matrix x; + BenchTimer timer; + timer.reset(); + timer.start(); + solver.compute(A); + if (solver.info() != Success) + { + std::cerr << "Solver failed ... \n"; + return; + } + timer.stop(); + compute_time = timer.value(); + statbuf << "