robotic 0.2.9.dev1__cp38-cp38-manylinux2014_x86_64.whl → 0.3.0__cp38-cp38-manylinux2014_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- robotic/__init__.py +4 -0
- robotic/_robotic.pyi +13 -13
- robotic/_robotic.so +0 -0
- robotic/include/rai/Algo/rungeKutta.h +1 -1
- robotic/include/rai/Control/TimingMPC.h +2 -2
- robotic/include/rai/Core/array.h +64 -40
- robotic/include/rai/Core/array.ipp +247 -81
- robotic/include/rai/Core/arrayDouble.h +10 -13
- robotic/include/rai/Core/graph.h +22 -2
- robotic/include/rai/Core/h5.h +3 -1
- robotic/include/rai/Core/util.h +8 -7
- robotic/include/rai/Geo/fclInterface.h +3 -1
- robotic/include/rai/Geo/geo.h +6 -2
- robotic/include/rai/Geo/mesh.h +11 -5
- robotic/include/rai/Geo/pairCollision.h +4 -4
- robotic/include/rai/Gui/RenderData.h +4 -3
- robotic/include/rai/Gui/opengl.h +1 -1
- robotic/include/rai/KOMO/komo.h +1 -0
- robotic/include/rai/KOMO/manipTools.h +2 -2
- robotic/include/rai/Kin/F_forces.h +1 -1
- robotic/include/rai/Kin/dof_forceExchange.h +4 -4
- robotic/include/rai/Kin/frame.h +6 -5
- robotic/include/rai/Kin/kin.h +26 -17
- robotic/include/rai/Kin/kin_physx.h +2 -2
- robotic/include/rai/Logic/folWorld.h +1 -1
- robotic/include/rai/Optim/testProblems_Opt.h +2 -2
- robotic/include/rai/Optim/utils.h +2 -2
- robotic/include/rai/PathAlgos/ConfigurationProblem.h +3 -2
- robotic/include/rai/PathAlgos/RRT_PathFinder.h +1 -1
- robotic/include/rai/ry/types.h +3 -2
- robotic/librai.so +0 -0
- robotic/meshTool +0 -0
- robotic/mujoco-import.py +10 -0
- robotic/rai-robotModels/g1/g1.g +11 -2
- robotic/rai-robotModels/g1/g1_clean.g +38 -73
- robotic/rai-robotModels/g1/meshes/head_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_ankle_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_ankle_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_elbow_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_hip_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_hip_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_hip_yaw_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_knee_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_rubber_hand.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_shoulder_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_shoulder_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_shoulder_yaw_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_wrist_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_wrist_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/left_wrist_yaw_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/logo_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/pelvis.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/pelvis_contour_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_ankle_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_ankle_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_elbow_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_hip_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_hip_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_hip_yaw_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_knee_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_rubber_hand.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_shoulder_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_shoulder_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_shoulder_yaw_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_wrist_pitch_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_wrist_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/right_wrist_yaw_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/torso_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/waist_roll_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/waist_support_link.h5 +0 -0
- robotic/rai-robotModels/g1/meshes/waist_yaw_link.h5 +0 -0
- robotic/rai-robotModels/objects/shelf.g +1 -1
- robotic/rai-robotModels/panda/meshes/finger.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/hand.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link0.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link1.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link2.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link3.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link4.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link5.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link6.h5 +0 -0
- robotic/rai-robotModels/panda/meshes/link7.h5 +0 -0
- robotic/rai-robotModels/panda/panda.g +1 -1
- robotic/rai-robotModels/panda/panda_arm_hand_conv.g +24 -0
- robotic/rai-robotModels/panda/panda_arm_hand_conv.yml +24 -0
- robotic/rai-robotModels/panda/panda_clean.g +21 -45
- robotic/rai-robotModels/panda/panda_gripper.g +3 -3
- robotic/rai-robotModels/pr2/meshes/base.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/base_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/caster.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/elbow_flex.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/elbow_flex_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/forearm.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/forearm_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/forearm_roll.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/gripper_palm.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/gripper_palm_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/head_pan.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/head_pan_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/head_tilt.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/head_tilt_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/l_finger.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/l_finger_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/l_finger_tip.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/l_finger_tip_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/shoulder_lift.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/shoulder_lift_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/shoulder_pan.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/shoulder_pan_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/tilting_hokuyo.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/tilting_hokuyo_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/torso_lift.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/torso_lift_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/upper_arm.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/upper_arm_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/upper_arm_roll.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/upper_arm_roll_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/wheel.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/wheel_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/wrist_color.png +0 -0
- robotic/rai-robotModels/pr2/meshes/wrist_flex.h5 +0 -0
- robotic/rai-robotModels/pr2/meshes/wrist_roll.h5 +0 -0
- robotic/rai-robotModels/pr2/pr2.g +7 -7
- robotic/rai-robotModels/pr2/pr2_clean.g +119 -115
- robotic/rai-robotModels/pr2/pr2_conv.g +218 -0
- robotic/rai-robotModels/pr2/pr2_modifications.g +2 -2
- robotic/rai-robotModels/ranger/meshes/ranger_mini3.h5 +0 -0
- robotic/rai-robotModels/ranger/meshes/ranger_mini_v3_wheel.h5 +0 -0
- robotic/rai-robotModels/ranger/meshes/ranger_mini_v3_wheel_right.h5 +0 -0
- robotic/rai-robotModels/ranger/ranger.g +8 -8
- robotic/rai-robotModels/ranger/ranger_clean.g +5 -5
- robotic/rai-robotModels/ranger/ranger_mini_conv.g +14 -0
- robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_base_link.h5 +0 -0
- robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_inner_finger.h5 +0 -0
- robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_inner_knuckle.h5 +0 -0
- robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_outer_finger.h5 +0 -0
- robotic/rai-robotModels/robotiq/meshes/robotiq_arg2f_85_outer_knuckle.h5 +0 -0
- robotic/rai-robotModels/robotiq/robotiq.g +2 -2
- robotic/rai-robotModels/robotiq/robotiq_clean.g +16 -16
- robotic/rai-robotModels/scenarios/ballFinger.g +2 -2
- robotic/rai-robotModels/scenarios/panda_fixRobotiq.g +3 -3
- robotic/rai-robotModels/tests/arm.g +11 -11
- robotic/rai-robotModels/tests/compound.g +3 -6
- robotic/rai-robotModels/ur10/meshes/base.h5 +0 -0
- robotic/rai-robotModels/ur10/meshes/forearm.h5 +0 -0
- robotic/rai-robotModels/ur10/meshes/shoulder.h5 +0 -0
- robotic/rai-robotModels/ur10/meshes/upperarm.h5 +0 -0
- robotic/rai-robotModels/ur10/meshes/wrist1.h5 +0 -0
- robotic/rai-robotModels/ur10/meshes/wrist2.h5 +0 -0
- robotic/rai-robotModels/ur10/meshes/wrist3.h5 +0 -0
- robotic/rai-robotModels/ur10/ur10.g +2 -2
- robotic/rai-robotModels/ur10/ur10_clean.g +8 -8
- robotic/rai-robotModels/ur10/ur10_conv.g +17 -0
- robotic/ry-h5info +2 -2
- robotic/ry-urdfConvert.py +74 -0
- robotic/src/cleanMeshes.py +59 -0
- robotic/src/config_urdf.py +237 -0
- robotic/src/mesh_helper.py +395 -0
- robotic/{rai-robotModels/ranger/meshes/cleanMeshes.mlx → src/meshlabFilters.mlx} +0 -3
- robotic/src/mujoco_io.py +242 -0
- robotic/src/yaml_helper.py +19 -0
- robotic/test.py +15 -0
- robotic/version.py +1 -1
- {robotic-0.2.9.dev1.data → robotic-0.3.0.data}/scripts/ry-h5info +2 -2
- robotic-0.3.0.data/scripts/ry-urdfConvert.py +74 -0
- {robotic-0.2.9.dev1.dist-info → robotic-0.3.0.dist-info}/METADATA +3 -7
- robotic-0.3.0.dist-info/RECORD +367 -0
- robotic/import.py +0 -0
- robotic/rai-robotModels/baxter/baxter.g +0 -49
- robotic/rai-robotModels/baxter/baxter_clean.g +0 -116
- robotic/rai-robotModels/baxter/baxter_clean2.g +0 -205
- robotic/rai-robotModels/baxter/baxter_clean3.g +0 -223
- robotic/rai-robotModels/baxter/baxter_description/meshes/base/PEDESTAL.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/base/pedestal_link_collision.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/head/H0.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/head/H1.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/lower_elbow/E1.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/lower_forearm/W1.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/lower_shoulder/S1.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/torso/base_link.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/torso/base_link_collision.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/upper_elbow/E0.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/upper_forearm/W0.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/upper_shoulder/S0.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_description/meshes/wrist/W2.ply +0 -0
- robotic/rai-robotModels/baxter/baxter_new.g +0 -53
- robotic/rai-robotModels/baxter/rethink_ee_description/meshes/electric_gripper/electric_gripper_base.ply +0 -0
- robotic/rai-robotModels/baxter/rethink_ee_description/meshes/electric_gripper/fingers/extended_narrow.ply +0 -0
- robotic/rai-robotModels/baxter/rethink_ee_description/meshes/electric_gripper/fingers/half_round_tip.ply +0 -0
- robotic/rai-robotModels/baxter/rethink_ee_description/meshes/electric_gripper/fingers/paddle_tip.ply +0 -0
- robotic/rai-robotModels/baxter/rethink_ee_description/meshes/pneumatic_gripper/pneumatic_gripper_base.ply +0 -0
- robotic/rai-robotModels/baxter/rethink_ee_description/meshes/pneumatic_gripper/pneumatic_gripper_w_cup.ply +0 -0
- robotic/rai-robotModels/g1/meshes/head_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_ankle_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_ankle_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_elbow_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_index_0_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_index_1_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_middle_0_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_middle_1_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_palm_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_thumb_0_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_thumb_1_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hand_thumb_2_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hip_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hip_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_hip_yaw_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_knee_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_rubber_hand.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_shoulder_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_shoulder_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_shoulder_yaw_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_wrist_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_wrist_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_wrist_roll_rubber_hand.ply +0 -0
- robotic/rai-robotModels/g1/meshes/left_wrist_yaw_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/logo_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/pelvis.ply +0 -0
- robotic/rai-robotModels/g1/meshes/pelvis_contour_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_ankle_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_ankle_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_elbow_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_index_0_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_index_1_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_middle_0_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_middle_1_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_palm_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_thumb_0_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_thumb_1_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hand_thumb_2_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hip_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hip_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_hip_yaw_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_knee_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_rubber_hand.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_shoulder_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_shoulder_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_shoulder_yaw_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_wrist_pitch_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_wrist_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_wrist_roll_rubber_hand.ply +0 -0
- robotic/rai-robotModels/g1/meshes/right_wrist_yaw_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/torso_constraint_L_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/torso_constraint_L_rod_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/torso_constraint_R_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/torso_constraint_R_rod_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/torso_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/waist_constraint_L.ply +0 -0
- robotic/rai-robotModels/g1/meshes/waist_constraint_R.ply +0 -0
- robotic/rai-robotModels/g1/meshes/waist_roll_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/waist_support_link.ply +0 -0
- robotic/rai-robotModels/g1/meshes/waist_yaw_link.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/finger.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/hand.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link0.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link1.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link2.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link3.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link4.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link5.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link6.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/collision/link7.stl +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/HOWTO.sh +0 -10
- robotic/rai-robotModels/panda/franka_description/meshes/visual/HOWTO2.sh +0 -7
- robotic/rai-robotModels/panda/franka_description/meshes/visual/convMeshes.mlx +0 -38
- robotic/rai-robotModels/panda/franka_description/meshes/visual/finger.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/hand.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link0.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link1.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link2.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link3.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link4.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link5.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link6.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/link7.ply +0 -0
- robotic/rai-robotModels/panda/franka_description/meshes/visual/script.mlx +0 -28
- robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/base.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/base_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/caster.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/caster_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/pr2_wheel.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/base_v0/wheel.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/forearm_v0/forearm.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/forearm_v0/wrist_flex.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/forearm_v0/wrist_roll.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/forearm_v0/wrist_roll_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/gripper_v0/gripper_palm.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/gripper_v0/l_finger.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/gripper_v0/l_finger_tip.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/head_v0/head_pan.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/head_v0/head_pan_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/head_v0/head_tilt.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/head_v0/head_tilt_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/shoulder_lift.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/shoulder_pan.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/shoulder_yaw.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/upper_arm_roll.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/shoulder_v0/upper_arm_roll_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/tilting_laser_v0/hok_tilt.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/tilting_laser_v0/tilting_hokuyo.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/tilting_laser_v0/tilting_hokuyo_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/torso_v0/torso.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/torso_v0/torso_lift.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/torso_v0/torso_lift_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/upper_arm_v0/elbow_flex.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/upper_arm_v0/forearm_roll.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/upper_arm_v0/forearm_roll_L.ply +0 -0
- robotic/rai-robotModels/pr2/pr2_description/meshes/upper_arm_v0/upper_arm.ply +0 -0
- robotic/rai-robotModels/ranger/meshes/cleanMeshes.sh +0 -8
- robotic/rai-robotModels/ranger/meshes/ranger_mini3.ply +0 -0
- robotic/rai-robotModels/ranger/meshes/ranger_mini_v3_wheel.ply +0 -0
- robotic/rai-robotModels/ranger/meshes/ranger_mini_v3_wheel_right.ply +0 -0
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_base_link.ply +0 -0
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_base_link_x.ply +0 -10
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_inner_finger.ply +0 -0
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_inner_knuckle.ply +0 -0
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_outer_finger.ply +0 -0
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_outer_knuckle.ply +0 -0
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_arg2f_85_pad.ply +0 -0
- robotic/rai-robotModels/robotiq/meshes/visual/robotiq_gripper_coupling.ply +0 -0
- robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Base.ply +0 -0
- robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Forearm.ply +0 -0
- robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Shoulder.ply +0 -0
- robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/UpperArm.ply +0 -0
- robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Wrist1.ply +0 -0
- robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Wrist2.ply +0 -0
- robotic/rai-robotModels/ur10/ur_description/meshes/ur10/visual/Wrist3.ply +0 -0
- robotic/ry-urdf2rai +0 -222
- robotic/ry-urdf2yaml +0 -250
- robotic-0.2.9.dev1.data/scripts/ry-urdf2rai +0 -222
- robotic-0.2.9.dev1.data/scripts/ry-urdf2yaml +0 -250
- robotic-0.2.9.dev1.dist-info/RECORD +0 -421
- /robotic/rai-robotModels/robotiq/meshes/{visual/robotiq_ft300.ply → robotiq_ft300.ply} +0 -0
- {robotic-0.2.9.dev1.data → robotic-0.3.0.data}/scripts/ry-bot +0 -0
- {robotic-0.2.9.dev1.data → robotic-0.3.0.data}/scripts/ry-info +0 -0
- {robotic-0.2.9.dev1.data → robotic-0.3.0.data}/scripts/ry-meshTool +0 -0
- {robotic-0.2.9.dev1.data → robotic-0.3.0.data}/scripts/ry-test +0 -0
- {robotic-0.2.9.dev1.data → robotic-0.3.0.data}/scripts/ry-view +0 -0
- {robotic-0.2.9.dev1.dist-info → robotic-0.3.0.dist-info}/LICENSE +0 -0
- {robotic-0.2.9.dev1.dist-info → robotic-0.3.0.dist-info}/WHEEL +0 -0
- {robotic-0.2.9.dev1.dist-info → robotic-0.3.0.dist-info}/top_level.txt +0 -0
|
@@ -11,14 +11,13 @@
|
|
|
11
11
|
#include "array.h"
|
|
12
12
|
|
|
13
13
|
#include <algorithm>
|
|
14
|
+
#include <type_traits>
|
|
14
15
|
|
|
15
16
|
#define ARRAY_flexiMem true
|
|
16
17
|
|
|
17
18
|
namespace rai {
|
|
18
19
|
|
|
19
20
|
//fwd declarations
|
|
20
|
-
extern int64_t globalMemoryTotal, globalMemoryBound;
|
|
21
|
-
extern bool globalMemoryStrict;
|
|
22
21
|
|
|
23
22
|
extern uint lineCount;
|
|
24
23
|
char skip(std::istream& is, const char* skipSymbols, const char* stopSymbols, bool skipCommentLines);
|
|
@@ -77,8 +76,11 @@ template<class T> Array<T>::Array(Array<T>&& a)
|
|
|
77
76
|
isReference(a.isReference),
|
|
78
77
|
M(a.M),
|
|
79
78
|
special(a.special) {
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
if constexpr(std::is_same_v<T, double>){
|
|
80
|
+
if(a.jac) jac = std::move(a.jac);
|
|
81
|
+
}
|
|
82
|
+
// CHECK_EQ(a.d, &a.d0, "NIY for larger tensors");
|
|
83
|
+
if(a.d!=&a.d0) { d=a.d; a.d=&a.d0; }
|
|
82
84
|
a.p=NULL;
|
|
83
85
|
a.N=a.nd=a.d0=a.d1=a.d2=0;
|
|
84
86
|
a.isReference=false;
|
|
@@ -100,11 +102,14 @@ template<class T> Array<T>::Array(std::initializer_list<T> values) : Array() { o
|
|
|
100
102
|
/// initialization via {1., 2., 3., ...} lists, with certain dimensionality
|
|
101
103
|
template<class T> Array<T>::Array(std::initializer_list<uint> dim, std::initializer_list<T> values) : Array() { operator=(values); reshape(dim); }
|
|
102
104
|
|
|
105
|
+
template<class T> Array<T>::Array(const T* p, uint size, bool byReference) : Array() { if(byReference) referTo(p, size); else setCarray(p, size); }
|
|
106
|
+
|
|
103
107
|
template<class T> Array<T>::~Array() {
|
|
104
108
|
#if 0
|
|
105
109
|
clear();
|
|
106
110
|
#else //faster (leaves members non-zeroed..)
|
|
107
111
|
if(special) { delete special; special=NULL; }
|
|
112
|
+
if(d!=&d0) { delete[] d; }
|
|
108
113
|
if(M) {
|
|
109
114
|
globalMemoryTotal -= M*sizeT;
|
|
110
115
|
if(memMove==1) free(p); else delete[] p;
|
|
@@ -247,11 +252,6 @@ template<class T> Array<T>& Array<T>::reshapeAs(const Array<T>& a) {
|
|
|
247
252
|
return *this;
|
|
248
253
|
}
|
|
249
254
|
|
|
250
|
-
template<class T> Array<T>& Array<T>::reshapeFlat() {
|
|
251
|
-
reshape(N);
|
|
252
|
-
return *this;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
255
|
/// return the k-th dimensionality
|
|
256
256
|
template<class T> uint Array<T>::dim(uint k) const {
|
|
257
257
|
CHECK(k<nd, "dimensionality range check error: " <<k <<"!<" <<nd);
|
|
@@ -641,10 +641,10 @@ template<class T> void Array<T>::delColumns(int i, uint k) {
|
|
|
641
641
|
}
|
|
642
642
|
|
|
643
643
|
/// inserts k columns at the i-th column [must be 2D]
|
|
644
|
-
template<class T>
|
|
644
|
+
template<class T> Array<T>& Array<T>::insColumns(int i, uint k) {
|
|
645
645
|
CHECK(memMove, "only with memMove");
|
|
646
646
|
CHECK_EQ(nd, 2, "only for matricies");
|
|
647
|
-
if(!k) return;
|
|
647
|
+
if(!k) return *this;
|
|
648
648
|
if(i<0) i+=d1+1;
|
|
649
649
|
CHECK_LE(i, (int)d1, "range check error");
|
|
650
650
|
uint n=d1;
|
|
@@ -654,6 +654,7 @@ template<class T> void Array<T>::insColumns(int i, uint k) {
|
|
|
654
654
|
memset(p+j*d1+i, 0, sizeT*k);
|
|
655
655
|
if(i) memmove(p+j*d1, p+j*n, sizeT*i);
|
|
656
656
|
}
|
|
657
|
+
return *this;
|
|
657
658
|
}
|
|
658
659
|
|
|
659
660
|
/// changes the range of one dimension (generalization of ins/delColumn to arbitrary tensors)
|
|
@@ -710,8 +711,15 @@ template<class T> T& Array<T>::elem(int i, int j) {
|
|
|
710
711
|
if(j<0) j += d1;
|
|
711
712
|
CHECK(nd==2 && (uint)i<d0 && (uint)j<d1,
|
|
712
713
|
"2D range error (" <<nd <<"=2, " <<i <<"<" <<d0 <<", " <<j <<"<" <<d1 <<")");
|
|
714
|
+
if constexpr(std::is_same_v<T, double>){
|
|
715
|
+
if(isSparseMatrix(*this)) {
|
|
716
|
+
return sparse().addEntry(i, j);
|
|
717
|
+
}
|
|
718
|
+
if(isRowShifted(*this)) {
|
|
719
|
+
return rowShifted().elemNew(i, j);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
713
722
|
return p[i*d1+j];
|
|
714
|
-
|
|
715
723
|
}
|
|
716
724
|
|
|
717
725
|
/// multi-dimensional (tensor) access
|
|
@@ -767,7 +775,7 @@ template<class T> Array<T> Array<T>::ref() const {
|
|
|
767
775
|
|
|
768
776
|
template<class T> Array<T> Array<T>::operator()(std::pair<int, int> I) const {
|
|
769
777
|
Array<T> z;
|
|
770
|
-
z.referToRange(*this, I
|
|
778
|
+
z.referToRange(*this, I);
|
|
771
779
|
// if(I.size()==2) z.referToRange(*this, I.begin()[0], I.begin()[1]);
|
|
772
780
|
// else if(I.size()==0) z.referTo(*this);
|
|
773
781
|
// else if(I.size()==1) z.referToDim(*this, I.begin()[0]);
|
|
@@ -777,9 +785,8 @@ template<class T> Array<T> Array<T>::operator()(std::pair<int, int> I) const {
|
|
|
777
785
|
|
|
778
786
|
/// range reference access
|
|
779
787
|
template<class T> Array<T> Array<T>::operator()(int i, std::pair<int, int> J) const {
|
|
780
|
-
if(i<0) i += d0;
|
|
781
788
|
Array<T> z;
|
|
782
|
-
z.referToRange(*this, i, J
|
|
789
|
+
z.referToRange(*this, i, J);
|
|
783
790
|
// if(J.size()==2)
|
|
784
791
|
// else if(J.size()==0) z.referToDim(*this, i);
|
|
785
792
|
// else if(J.size()==1) z.referToDim(*this, i, J.begin()[0]);
|
|
@@ -789,10 +796,8 @@ template<class T> Array<T> Array<T>::operator()(int i, std::pair<int, int> J) co
|
|
|
789
796
|
|
|
790
797
|
/// range reference access
|
|
791
798
|
template<class T> Array<T> Array<T>::operator()(int i, int j, std::initializer_list<int> K) const {
|
|
792
|
-
if(i<0) i += d0;
|
|
793
|
-
if(j<0) j += d1;
|
|
794
799
|
Array<T> z;
|
|
795
|
-
if(K.size()==2) z.referToRange(*this, i, j, K.begin()[0], K.begin()[1]);
|
|
800
|
+
if(K.size()==2) z.referToRange(*this, i, j, {K.begin()[0], K.begin()[1]});
|
|
796
801
|
else if(K.size()==0) z.referToDim(*this, i, j);
|
|
797
802
|
else if(K.size()==1) z.referToDim(*this, i, j, K.begin()[0]);
|
|
798
803
|
else HALT("range list needs 0,1, or 2 entries exactly");
|
|
@@ -827,8 +832,9 @@ template<class T> Array<T> Array<T>::copy() const { return Array<T>(*this); }
|
|
|
827
832
|
/** @brief a sub array of a 1D Array (corresponds to matlab [i:I]); when
|
|
828
833
|
the upper limit I is -1, it is replaced by the max limit (like
|
|
829
834
|
[i:]) */
|
|
830
|
-
template<class T> Array<T> Array<T>::sub(int
|
|
835
|
+
template<class T> Array<T> Array<T>::sub(std::pair<int, int> _I) const {
|
|
831
836
|
CHECK_EQ(nd, 1, "1D range error ");
|
|
837
|
+
int i=_I.first, I=_I.second-1;
|
|
832
838
|
Array<T> x;
|
|
833
839
|
if(i<0) i+=d0;
|
|
834
840
|
if(I<0) I+=d0;
|
|
@@ -845,8 +851,9 @@ template<class T> Array<T> Array<T>::sub(int i, int I) const {
|
|
|
845
851
|
/** @brief copies a sub array of a 2D Array (corresponds to matlab [i:I, j:J]);
|
|
846
852
|
when the upper limits I or J are -1, they are replaced by the
|
|
847
853
|
max limit (like [i:, j:]) */
|
|
848
|
-
template<class T> Array<T> Array<T>::sub(int
|
|
854
|
+
template<class T> Array<T> Array<T>::sub(std::pair<int, int> _I, std::pair<int, int> _J) const {
|
|
849
855
|
CHECK_EQ(nd, 2, "2D range error ");
|
|
856
|
+
int i=_I.first, I=_I.second-1, j=_J.first, J=_J.second-1;
|
|
850
857
|
Array<T> x;
|
|
851
858
|
if(i<0) i+=d0;
|
|
852
859
|
if(j<0) j+=d1;
|
|
@@ -865,8 +872,9 @@ template<class T> Array<T> Array<T>::sub(int i, int I, int j, int J) const {
|
|
|
865
872
|
/** @brief copies a sub array of a 3D Array (corresponds to matlab [i:I, j:J]);
|
|
866
873
|
when the upper limits I or J are -1, they are replaced by the
|
|
867
874
|
max limit (like [i:, j:]) */
|
|
868
|
-
template<class T> Array<T> Array<T>::sub(int
|
|
875
|
+
template<class T> Array<T> Array<T>::sub(std::pair<int, int> _I, std::pair<int, int> _J, std::pair<int, int> _K) const {
|
|
869
876
|
CHECK_EQ(nd, 3, "3D range error ");
|
|
877
|
+
int i=_I.first, I=_I.second-1, j=_J.first, J=_J.second-1, k=_K.first, K=_K.second-1;
|
|
870
878
|
Array<T> x;
|
|
871
879
|
if(i<0) i+=d0;
|
|
872
880
|
if(j<0) j+=d1;
|
|
@@ -891,8 +899,9 @@ template<class T> Array<T> Array<T>::sub(int i, int I, int j, int J, int k, int
|
|
|
891
899
|
runs from i to I (as explained above) while the second index runs
|
|
892
900
|
over the columns explicitly referred to by cols. (col doesn't have
|
|
893
901
|
to be ordered or could also contain some columns multiply) */
|
|
894
|
-
template<class T> Array<T> Array<T>::
|
|
902
|
+
template<class T> Array<T> Array<T>::pick(std::pair<int, int> _I, Array<uint> cols) const {
|
|
895
903
|
CHECK_EQ(nd, 2, "2D range error ");
|
|
904
|
+
int i=_I.first, I=_I.second-1;
|
|
896
905
|
Array<T> x;
|
|
897
906
|
if(i<0) i+=d0;
|
|
898
907
|
if(I<0) I+=d0;
|
|
@@ -902,7 +911,7 @@ template<class T> Array<T> Array<T>::sub(int i, int I, Array<uint> cols) const {
|
|
|
902
911
|
return x;
|
|
903
912
|
}
|
|
904
913
|
|
|
905
|
-
template<class T> Array<T> Array<T>::
|
|
914
|
+
template<class T> Array<T> Array<T>::pick(Array<uint> elems) const {
|
|
906
915
|
Array<T> x;
|
|
907
916
|
if(nd==1) {
|
|
908
917
|
x.resize(elems.N);
|
|
@@ -930,7 +939,7 @@ template<class T> Array<T> Array<T>::sub(Array<uint> elems) const {
|
|
|
930
939
|
*/
|
|
931
940
|
template<class T>
|
|
932
941
|
Array<T> Array<T>::row(uint row_index) const {
|
|
933
|
-
return sub(row_index, row_index, 0, d1 - 1);
|
|
942
|
+
return sub({row_index, row_index+1},{ 0, d1 - 1+1});
|
|
934
943
|
}
|
|
935
944
|
|
|
936
945
|
/**
|
|
@@ -945,7 +954,7 @@ Array<T> Array<T>::row(uint row_index) const {
|
|
|
945
954
|
*/
|
|
946
955
|
template<class T>
|
|
947
956
|
Array<T> Array<T>::col(uint col_index) const {
|
|
948
|
-
return sub(0, d0 - 1, col_index, col_index).reshape(d0);
|
|
957
|
+
return sub({0, d0 - 1+1},{ col_index, col_index+1}).reshape(d0);
|
|
949
958
|
}
|
|
950
959
|
|
|
951
960
|
/**
|
|
@@ -961,7 +970,7 @@ Array<T> Array<T>::col(uint col_index) const {
|
|
|
961
970
|
*/
|
|
962
971
|
template<class T>
|
|
963
972
|
Array<T> Array<T>::rows(uint start_row, uint end_row) const {
|
|
964
|
-
return sub(start_row, end_row - 1, 0, d1 - 1);
|
|
973
|
+
return sub({start_row, end_row - 1+1},{ 0, d1 - 1+1});
|
|
965
974
|
}
|
|
966
975
|
|
|
967
976
|
/**
|
|
@@ -977,7 +986,7 @@ Array<T> Array<T>::rows(uint start_row, uint end_row) const {
|
|
|
977
986
|
*/
|
|
978
987
|
template<class T>
|
|
979
988
|
Array<T> Array<T>::cols(uint start_col, uint end_col) const {
|
|
980
|
-
return sub(0, d0 - 1, start_col, end_col - 1);
|
|
989
|
+
return sub({0, d0 - 1+1},{ start_col, end_col - 1+1});
|
|
981
990
|
}
|
|
982
991
|
|
|
983
992
|
/// makes this array a reference to the C buffer
|
|
@@ -1013,6 +1022,10 @@ template<class T> Array<T>& Array<T>::operator=(const Array<T>& a) {
|
|
|
1013
1022
|
if(memMove) memmove(p, a.p, sizeT*N);
|
|
1014
1023
|
else for(uint i=0; i<N; i++) p[i]=a.p[i];
|
|
1015
1024
|
if(special) { delete special; special=NULL; }
|
|
1025
|
+
if constexpr(std::is_same_v<T, double>){
|
|
1026
|
+
if(isSpecial(a)) special_copy(*this, a);
|
|
1027
|
+
if(a.jac) jac = std::make_unique<arr>(*a.jac);
|
|
1028
|
+
}
|
|
1016
1029
|
return *this;
|
|
1017
1030
|
}
|
|
1018
1031
|
|
|
@@ -1047,7 +1060,7 @@ template<class T> Array<T> catCol(const Array<Array<T>*>& X) {
|
|
|
1047
1060
|
// d1+=x->d1;
|
|
1048
1061
|
// }
|
|
1049
1062
|
} else {
|
|
1050
|
-
z.resize(d0, d1);
|
|
1063
|
+
z.resize(d0, d1).setZero();
|
|
1051
1064
|
d1=0;
|
|
1052
1065
|
for(const Array<T>* x: X) { z.setMatrixBlock(*x, 0, d1); d1+=x->nd==2?x->d1:1; }
|
|
1053
1066
|
}
|
|
@@ -1068,7 +1081,7 @@ template<class T> Array<T> catCol(const Array<Array<T>>& X) {
|
|
|
1068
1081
|
}
|
|
1069
1082
|
|
|
1070
1083
|
/// set all entries to same value x [default: don't change dimension]
|
|
1071
|
-
template<class T> void Array<T>::
|
|
1084
|
+
template<class T> void Array<T>::setConst(const T& x, int d) {
|
|
1072
1085
|
if(d!=-1) resize(d);
|
|
1073
1086
|
uint i;
|
|
1074
1087
|
for(i=0; i<N; i++) elem(i)=x;
|
|
@@ -1080,7 +1093,9 @@ template<class T> void Array<T>::setId(int d) {
|
|
|
1080
1093
|
CHECK(d!=-1 || (nd==2 && d0==d1), "need squared matrix to set to identity");
|
|
1081
1094
|
if(d!=-1) resize(d, d);
|
|
1082
1095
|
setZero();
|
|
1083
|
-
|
|
1096
|
+
if constexpr(std::is_scalar_v<T>){
|
|
1097
|
+
for(uint i=0; i<d0; i++) operator()(i, i)=(T)1;
|
|
1098
|
+
}else NIY;
|
|
1084
1099
|
}
|
|
1085
1100
|
|
|
1086
1101
|
template<class T> void Array<T>::setDiag(const T& x, int d) {
|
|
@@ -1117,13 +1132,38 @@ template<class T> void Array<T>::setBlockMatrix(const Array<T>& A, const Array<T
|
|
|
1117
1132
|
template<class T> void Array<T>::setBlockMatrix(const Array<T>& A, const Array<T>& B) {
|
|
1118
1133
|
CHECK(A.nd==2 && B.nd==2, "");
|
|
1119
1134
|
CHECK(A.d1==B.d1, "");
|
|
1120
|
-
|
|
1135
|
+
|
|
1136
|
+
if constexpr(std::is_same_v<T, double>){
|
|
1137
|
+
if(isSparse(A)){
|
|
1138
|
+
CHECK(isSparse(B), "");
|
|
1139
|
+
sparse().resize(A.d0+B.d0, A.d1, 0);
|
|
1140
|
+
}else{
|
|
1141
|
+
resize(A.d0+B.d0, A.d1).setZero();
|
|
1142
|
+
}
|
|
1143
|
+
}else{
|
|
1144
|
+
resize(A.d0+B.d0, A.d1).setZero();
|
|
1145
|
+
}
|
|
1146
|
+
|
|
1121
1147
|
setMatrixBlock(A, 0, 0);
|
|
1122
1148
|
setMatrixBlock(B, A.d0, 0);
|
|
1123
1149
|
}
|
|
1124
1150
|
|
|
1125
1151
|
/// constructs a vector x=[a, b]
|
|
1126
1152
|
template<class T> void Array<T>::setBlockVector(const Array<T>& a, const Array<T>& b) {
|
|
1153
|
+
|
|
1154
|
+
if constexpr(std::is_same_v<T, double>){
|
|
1155
|
+
if(a.jac || b.jac) {
|
|
1156
|
+
const Array<T>& A=*a.jac;
|
|
1157
|
+
const Array<T>& B=*b.jac;
|
|
1158
|
+
if(isSparse(A)){
|
|
1159
|
+
CHECK(isSparse(B), "");
|
|
1160
|
+
J().sparse().resize(A.d0+B.d0, A.d1, 0);
|
|
1161
|
+
}else{
|
|
1162
|
+
CHECK(!isSparse(B), "");
|
|
1163
|
+
J().resize(A.d0+B.d0, A.d1).setZero();
|
|
1164
|
+
}
|
|
1165
|
+
}
|
|
1166
|
+
}
|
|
1127
1167
|
CHECK(a.nd==1 && b.nd==1, "");
|
|
1128
1168
|
resize(a.N+b.N);
|
|
1129
1169
|
setVectorBlock(a, 0); //for(i=0;i<a.N;i++) operator()(i )=a(i);
|
|
@@ -1132,6 +1172,13 @@ template<class T> void Array<T>::setBlockVector(const Array<T>& a, const Array<T
|
|
|
1132
1172
|
|
|
1133
1173
|
/// write the matrix B into 'this' matrix at location lo0, lo1
|
|
1134
1174
|
template<class T> void Array<T>::setMatrixBlock(const Array<T>& B, uint lo0, uint lo1) {
|
|
1175
|
+
if constexpr(std::is_same_v<T, double>){
|
|
1176
|
+
if(isSparse(*this)){
|
|
1177
|
+
sparse().add(B, lo0, lo1);
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1135
1182
|
CHECK(!special && !B.special, "");
|
|
1136
1183
|
CHECK(B.nd==1 || B.nd==2, "");
|
|
1137
1184
|
if(B.nd==2) {
|
|
@@ -1155,18 +1202,29 @@ template<class T> void Array<T>::setVectorBlock(const Array<T>& B, uint lo) {
|
|
|
1155
1202
|
CHECK(nd==1 && B.nd==1 && lo+B.N<=N, "");
|
|
1156
1203
|
uint i;
|
|
1157
1204
|
for(i=0; i<B.N; i++) elem(lo+i)=B.elem(i);
|
|
1205
|
+
if constexpr(std::is_same_v<T, double>){
|
|
1206
|
+
if(B.jac) {
|
|
1207
|
+
CHECK(jac && jac->d1==B.jac->d1, "Jacobian needs to be pre-sized");
|
|
1208
|
+
CHECK(!B.jac->jac, "NOT HANDLED YET");
|
|
1209
|
+
jac->setMatrixBlock(*B.jac, lo, 0);
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1158
1212
|
}
|
|
1159
1213
|
|
|
1160
1214
|
/// sorted permutation of length \c n
|
|
1161
1215
|
template<class T> void Array<T>::setStraightPerm(int n) {
|
|
1162
1216
|
if(n!=-1) resize(n);
|
|
1163
|
-
|
|
1217
|
+
if constexpr(std::is_arithmetic_v<T>){
|
|
1218
|
+
for(uint i=0; i<N; i++) elem(i)=static_cast<T>(i);
|
|
1219
|
+
} else NIY;
|
|
1164
1220
|
}
|
|
1165
1221
|
|
|
1166
1222
|
/// reverse sorted permutation of lenth \c N
|
|
1167
1223
|
template<class T> void Array<T>::setReversePerm(int n) {
|
|
1168
1224
|
if(n!=-1) resize(n);
|
|
1169
|
-
|
|
1225
|
+
if constexpr(std::is_arithmetic_v<T>){
|
|
1226
|
+
for(uint i=0; i<N; i++) elem(N-1-i)=static_cast<T>(i);
|
|
1227
|
+
} else NIY;
|
|
1170
1228
|
}
|
|
1171
1229
|
|
|
1172
1230
|
/// permute all elements randomly
|
|
@@ -1209,8 +1267,9 @@ template<class T> void Array<T>::referTo(const Array<T>& a) {
|
|
|
1209
1267
|
}
|
|
1210
1268
|
|
|
1211
1269
|
/// make this array a subarray reference to \c a
|
|
1212
|
-
template<class T> void Array<T>::referToRange(const Array<T>& a, int
|
|
1270
|
+
template<class T> void Array<T>::referToRange(const Array<T>& a, std::pair<int, int> I) {
|
|
1213
1271
|
CHECK_LE(a.nd, 3, "not implemented yet");
|
|
1272
|
+
int i_lo=I.first, i_up=I.second-1;
|
|
1214
1273
|
if(i_lo<0) i_lo+=a.d0;
|
|
1215
1274
|
if(i_up<0) i_up+=a.d0;
|
|
1216
1275
|
if(i_lo>i_up) { clear(); return; }
|
|
@@ -1228,9 +1287,10 @@ template<class T> void Array<T>::referToRange(const Array<T>& a, int i_lo, int i
|
|
|
1228
1287
|
}
|
|
1229
1288
|
|
|
1230
1289
|
/// make this array a subarray reference to \c a
|
|
1231
|
-
template<class T> void Array<T>::referToRange(const Array<T>& a, int i, int
|
|
1290
|
+
template<class T> void Array<T>::referToRange(const Array<T>& a, int i, std::pair<int, int> J) {
|
|
1232
1291
|
CHECK(a.nd>1, "does not make sense");
|
|
1233
1292
|
CHECK_LE(a.nd, 3, "not implemented yet");
|
|
1293
|
+
int j_lo=J.first, j_up=J.second-1;
|
|
1234
1294
|
if(i<0) i+=a.d0;
|
|
1235
1295
|
if(j_lo<0) j_lo+=a.d1;
|
|
1236
1296
|
if(j_up<0) j_up+=a.d1;
|
|
@@ -1247,9 +1307,10 @@ template<class T> void Array<T>::referToRange(const Array<T>& a, int i, int j_lo
|
|
|
1247
1307
|
}
|
|
1248
1308
|
|
|
1249
1309
|
/// make this array a subarray reference to \c a
|
|
1250
|
-
template<class T> void Array<T>::referToRange(const Array<T>& a, int i, int j, int
|
|
1310
|
+
template<class T> void Array<T>::referToRange(const Array<T>& a, int i, int j, std::pair<int, int> K) {
|
|
1251
1311
|
CHECK(a.nd>2, "does not make sense");
|
|
1252
1312
|
CHECK_LE(a.nd, 3, "not implemented yet");
|
|
1313
|
+
int k_lo=K.first, k_up=K.second-1;
|
|
1253
1314
|
if(i<0) i+=a.d0;
|
|
1254
1315
|
if(j<0) j+=a.d1;
|
|
1255
1316
|
if(k_lo<0) k_lo+=a.d2;
|
|
@@ -1336,47 +1397,6 @@ template<class T> void Array<T>::takeOver(Array<T>& a) {
|
|
|
1336
1397
|
#endif
|
|
1337
1398
|
}
|
|
1338
1399
|
|
|
1339
|
-
/** @brief return a `dim'-dimensional grid with `steps' intervals
|
|
1340
|
-
filling the range [lo, hi] in each dimension. Note: returned array is
|
|
1341
|
-
`flat', rather than grid-shaped. */
|
|
1342
|
-
template<class T> Array<T>& Array<T>::setGrid(uint dim, T lo, T hi, uint steps) {
|
|
1343
|
-
CHECK(steps, "steps needs to be >0");
|
|
1344
|
-
uint i, j, k;
|
|
1345
|
-
if(dim==1) {
|
|
1346
|
-
resize(steps+1, 1);
|
|
1347
|
-
for(i=0; i<d0; i++) elem(i)=lo+(hi-lo)*i/steps;
|
|
1348
|
-
return *this;
|
|
1349
|
-
}
|
|
1350
|
-
if(dim==2) {
|
|
1351
|
-
resize(steps+1, steps+1, 2);
|
|
1352
|
-
for(i=0; i<d0; i++) for(j=0; j<d1; j++) {
|
|
1353
|
-
operator()(i, j, 0)=lo+(hi-lo)*i/steps;
|
|
1354
|
-
operator()(i, j, 1)=lo+(hi-lo)*j/steps;
|
|
1355
|
-
}
|
|
1356
|
-
reshape(d0*d1, 2);
|
|
1357
|
-
return *this;
|
|
1358
|
-
}
|
|
1359
|
-
if(dim==3) {
|
|
1360
|
-
resize(uintA{steps+1, steps+1, steps+1, 3});
|
|
1361
|
-
T dx = (hi-lo)/steps;
|
|
1362
|
-
for(i=0; i<d0; i++) for(j=0; j<d1; j++) {
|
|
1363
|
-
T* p = &elem(uintA{i, j, 0, 0});
|
|
1364
|
-
for(k=0; k<d2; k++) {
|
|
1365
|
-
*(p++) = lo+dx*i;
|
|
1366
|
-
*(p++) = lo+dx*j;
|
|
1367
|
-
*(p++) = lo+dx*k;
|
|
1368
|
-
// elem(uintA{i, j, k, 0}) = lo+dx*i;
|
|
1369
|
-
// elem(uintA{i, j, k, 1}) = lo+dx*j;
|
|
1370
|
-
// elem(uintA{i, j, k, 2}) = lo+dx*k;
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
reshape(d0*d1*d2, 3);
|
|
1374
|
-
return *this;
|
|
1375
|
-
}
|
|
1376
|
-
NIY;
|
|
1377
|
-
return *this;
|
|
1378
|
-
}
|
|
1379
|
-
|
|
1380
1400
|
template<class T> T rai::Array<T>::median_nonConst() {
|
|
1381
1401
|
CHECK_GE(N, 1, "");
|
|
1382
1402
|
std::nth_element(p, p+N/2, p+N);
|
|
@@ -1498,7 +1518,7 @@ template<class T> void Array<T>::permuteInv(const Array<uint>& permutation) {
|
|
|
1498
1518
|
template<class T> void Array<T>::permuteRowsInv(const Array<uint>& permutation) {
|
|
1499
1519
|
CHECK_LE(permutation.N, d0, "array smaller than permutation ("<<N<<"<"<<permutation.N<<")");
|
|
1500
1520
|
Array<T> b=(*this);
|
|
1501
|
-
for(uint i=0; i<d0; i++) operator[](permutation(i))
|
|
1521
|
+
for(uint i=0; i<d0; i++) operator[](permutation(i))=b[i];
|
|
1502
1522
|
}
|
|
1503
1523
|
|
|
1504
1524
|
/// randomly permute all entries of 'this'
|
|
@@ -1531,9 +1551,28 @@ template<class T> void Array<T>::shift(int offset, bool wrapAround) {
|
|
|
1531
1551
|
|
|
1532
1552
|
//==================================================================================
|
|
1533
1553
|
|
|
1554
|
+
/// return fraction of non-zeros in the array
|
|
1555
|
+
template<class T> double Array<T>::sparsity() {
|
|
1556
|
+
uint i, m=0;
|
|
1557
|
+
for(i=0; i<N; i++) if(elem(i)) m++;
|
|
1558
|
+
return ((double)m)/N;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
//==================================================================================
|
|
1562
|
+
|
|
1534
1563
|
/** @brief prototype for operator<<, writes the array by separating elements with ELEMSEP, separating rows with LINESEP, using BRACKETS[0] and BRACKETS[1] to brace the data, optionally writs a dimensionality tag before the data (see below), and optinally in binary format */
|
|
1535
1564
|
template<class T> void Array<T>::write(std::ostream& os, const char* ELEMSEP, const char* LINESEP, const char* BRACKETS, bool dimTag, bool binary) const {
|
|
1536
|
-
|
|
1565
|
+
|
|
1566
|
+
if constexpr(std::is_same_v<T, double>){
|
|
1567
|
+
if(special){
|
|
1568
|
+
special_write(os, *this);
|
|
1569
|
+
if(jac) os <<" -- JACOBIAN:\n" <<*jac <<endl;
|
|
1570
|
+
return;
|
|
1571
|
+
}
|
|
1572
|
+
}else{
|
|
1573
|
+
CHECK(!special, "");
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1537
1576
|
CHECK(!binary || memMove, "binary write works only for memMoveable data");
|
|
1538
1577
|
uint i, j, k;
|
|
1539
1578
|
if(!ELEMSEP) ELEMSEP=arrayElemsep;
|
|
@@ -1581,6 +1620,10 @@ template<class T> void Array<T>::write(std::ostream& os, const char* ELEMSEP, co
|
|
|
1581
1620
|
}
|
|
1582
1621
|
if(BRACKETS[1]) os <<BRACKETS[1];
|
|
1583
1622
|
}
|
|
1623
|
+
|
|
1624
|
+
if constexpr(std::is_same_v<T, double>){
|
|
1625
|
+
if(jac) os <<" -- JACOBIAN:\n" <<*jac <<endl;
|
|
1626
|
+
}
|
|
1584
1627
|
}
|
|
1585
1628
|
|
|
1586
1629
|
/** @brief prototype for operator>>, if there is a dimensionality tag: fast reading of ascii (if there is brackets[]) or binary (if there is \\0\\0 brackets) data; otherwise slow ascii read */
|
|
@@ -1607,7 +1650,9 @@ template<class T> Array<T>& Array<T>::read(std::istream& is) {
|
|
|
1607
1650
|
} else { //fast ascii read
|
|
1608
1651
|
for(uint i=0; i<N; i++) {
|
|
1609
1652
|
if(is.fail()) PARSERR("could not read " <<i <<"-th element of an array");
|
|
1610
|
-
|
|
1653
|
+
if constexpr(!std::is_pointer_v<T>){
|
|
1654
|
+
is >>p[i];
|
|
1655
|
+
} else NIY;
|
|
1611
1656
|
}
|
|
1612
1657
|
}
|
|
1613
1658
|
if(expectBracket) {
|
|
@@ -1632,7 +1677,9 @@ template<class T> Array<T>& Array<T>::read(std::istream& is) {
|
|
|
1632
1677
|
continue;
|
|
1633
1678
|
}
|
|
1634
1679
|
if(c!=',') is.putback(c);
|
|
1635
|
-
|
|
1680
|
+
if constexpr(!std::is_pointer_v<T>){
|
|
1681
|
+
is >>x;
|
|
1682
|
+
}else NIY;
|
|
1636
1683
|
if(!is.good()) {
|
|
1637
1684
|
if(!expectBracket) is.clear(); //ok
|
|
1638
1685
|
else PARSERR("failed reading ending bracket ]");
|
|
@@ -1825,6 +1872,7 @@ template<class T> void writeConsecutiveConstant(std::ostream& os, const Array<T>
|
|
|
1825
1872
|
|
|
1826
1873
|
/// contatenation of two arrays
|
|
1827
1874
|
template<class T> Array<T> operator, (const Array<T>& y, const Array<T>& z) { Array<T> x(y); x.append(z); return x; }
|
|
1875
|
+
|
|
1828
1876
|
/// calls Array<T>::read
|
|
1829
1877
|
template<class T> std::istream& operator>>(std::istream& is, Array<T>& x) { x.read(is); return is; }
|
|
1830
1878
|
|
|
@@ -1869,4 +1917,122 @@ template<class T> bool operator<(const Array<T>& v, const Array<T>& w) {
|
|
|
1869
1917
|
return v.N<w.N;
|
|
1870
1918
|
}
|
|
1871
1919
|
|
|
1920
|
+
//core for matrix-matrix (elem-wise) update
|
|
1921
|
+
#define UpdateOperator_MM( op ) \
|
|
1922
|
+
if constexpr(std::is_same_v<T, double>){ \
|
|
1923
|
+
if(isNoArr(x)){ return; } \
|
|
1924
|
+
if(isSparseMatrix(x) && isSparseMatrix(y)){ x.sparse() op y.sparse(); return; } \
|
|
1925
|
+
if(isRowShifted(x) && isRowShifted(y)){ x.rowShifted() op y.rowShifted(); return; } \
|
|
1926
|
+
} \
|
|
1927
|
+
CHECK(!x.special, ""); \
|
|
1928
|
+
CHECK(!y.special, ""); \
|
|
1929
|
+
CHECK_EQ(x.N, y.N, "update operator on different array dimensions (" <<x.N <<", " <<y.N <<")"); \
|
|
1930
|
+
T *xp=x.p, *xstop=xp+x.N; \
|
|
1931
|
+
const T *yp=y.p; \
|
|
1932
|
+
for(; xp!=xstop; xp++, yp++) *xp op *yp;
|
|
1933
|
+
|
|
1934
|
+
//core for matrix-scalar update
|
|
1935
|
+
#define UpdateOperator_MS( op ) \
|
|
1936
|
+
if constexpr(std::is_same_v<T, double>){ \
|
|
1937
|
+
if(isNoArr(x)){ return; } \
|
|
1938
|
+
if(isSparseMatrix(x)){ x.sparse() op y; return; } \
|
|
1939
|
+
if(isRowShifted(x)){ x.rowShifted() op y; return; } \
|
|
1940
|
+
} \
|
|
1941
|
+
CHECK(!x.special, ""); \
|
|
1942
|
+
T *xp=x.p, *xstop=xp+x.N; \
|
|
1943
|
+
for(; xp!=xstop; xp++) *xp op y;
|
|
1944
|
+
|
|
1945
|
+
|
|
1946
|
+
template<class T> void operator+=(Array<T>& x, const Array<T>& y) {
|
|
1947
|
+
UpdateOperator_MM(+=);
|
|
1948
|
+
if constexpr(std::is_same_v<T, double>){
|
|
1949
|
+
if(y.jac) {
|
|
1950
|
+
if(x.jac) *x.jac += *y.jac;
|
|
1951
|
+
else x.J() = *y.jac;
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
// CHECK_EQ(x.N, y.N, "update operator on different array dimensions (" <<x.N <<", " <<y.N <<")");
|
|
1955
|
+
// T* xp=x.p, *xstop=xp+x.N;
|
|
1956
|
+
// const T* yp=y.p;
|
|
1957
|
+
// for(; xp!=xstop; xp++, yp++) *xp += *yp;
|
|
1958
|
+
}
|
|
1959
|
+
template<class T> void operator+=(Array<T>& x, const T& y) {
|
|
1960
|
+
UpdateOperator_MS(+=);
|
|
1961
|
+
// T* xp=x.p, *xstop=xp+x.N;
|
|
1962
|
+
// for(; xp!=xstop; xp++) *xp += y;
|
|
1963
|
+
}
|
|
1964
|
+
template<class T> void operator-=(Array<T>& x, const Array<T>& y) {
|
|
1965
|
+
UpdateOperator_MM(-=);
|
|
1966
|
+
if constexpr(std::is_same_v<T, double>){
|
|
1967
|
+
if(y.jac) {
|
|
1968
|
+
if(x.jac) *x.jac -= *y.jac;
|
|
1969
|
+
else x.J() = -(*y.jac);
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
// CHECK_EQ(x.N, y.N, "update operator on different array dimensions (" <<x.N <<", " <<y.N <<")");
|
|
1973
|
+
// T* xp=x.p, *xstop=xp+x.N;
|
|
1974
|
+
// const T* yp=y.p;
|
|
1975
|
+
// for(; xp!=xstop; xp++, yp++) *xp -= *yp;
|
|
1976
|
+
}
|
|
1977
|
+
template<class T> void operator-=(Array<T>& x, const T& y) {
|
|
1978
|
+
UpdateOperator_MS(-=);
|
|
1979
|
+
// T* xp=x.p, *xstop=xp+x.N;
|
|
1980
|
+
// for(; xp!=xstop; xp++) *xp -= y;
|
|
1981
|
+
}
|
|
1982
|
+
template<class T> void operator*=(Array<T>& x, const T& y) {
|
|
1983
|
+
if constexpr(std::is_same_v<T, double>){
|
|
1984
|
+
if(x.jac) *x.jac *= y;
|
|
1985
|
+
}
|
|
1986
|
+
UpdateOperator_MS(*=);
|
|
1987
|
+
// T* xp=x.p, *xstop=xp+x.N;
|
|
1988
|
+
// for(; xp!=xstop; xp++) *xp *= y;
|
|
1989
|
+
}
|
|
1990
|
+
|
|
1991
|
+
#undef UpdateOperator_MM
|
|
1992
|
+
#undef UpdateOperator_MS
|
|
1993
|
+
|
|
1994
|
+
//===========================================================================
|
|
1995
|
+
|
|
1996
|
+
/** @brief return a `dim'-dimensional grid with `steps' intervals
|
|
1997
|
+
filling the range [lo, hi] in each dimension. Note: returned array is
|
|
1998
|
+
`flat', rather than grid-shaped. */
|
|
1999
|
+
template<class T> Array<T> grid(uint dim, T lo, T hi, uint steps) {
|
|
2000
|
+
Array<T> x;
|
|
2001
|
+
CHECK(steps, "steps needs to be >0");
|
|
2002
|
+
uint i, j, k;
|
|
2003
|
+
if(dim==1) {
|
|
2004
|
+
x.resize(steps+1, 1);
|
|
2005
|
+
for(i=0; i<x.d0; i++) x.elem(i)=lo+(hi-lo)*i/steps;
|
|
2006
|
+
return x;
|
|
2007
|
+
}
|
|
2008
|
+
if(dim==2) {
|
|
2009
|
+
x.resize(steps+1, steps+1, 2);
|
|
2010
|
+
for(i=0; i<x.d0; i++) for(j=0; j<x.d1; j++) {
|
|
2011
|
+
x(i, j, 0)=lo+(hi-lo)*i/steps;
|
|
2012
|
+
x(i, j, 1)=lo+(hi-lo)*j/steps;
|
|
2013
|
+
}
|
|
2014
|
+
x.reshape(x.d0*x.d1, 2);
|
|
2015
|
+
return x;
|
|
2016
|
+
}
|
|
2017
|
+
if(dim==3) {
|
|
2018
|
+
x.resize(uintA{steps+1, steps+1, steps+1, 3});
|
|
2019
|
+
T dx = (hi-lo)/steps;
|
|
2020
|
+
for(i=0; i<x.d0; i++) for(j=0; j<x.d1; j++) {
|
|
2021
|
+
T* p = &x.elem(uintA{i, j, 0, 0});
|
|
2022
|
+
for(k=0; k<x.d2; k++) {
|
|
2023
|
+
*(p++) = lo+dx*i;
|
|
2024
|
+
*(p++) = lo+dx*j;
|
|
2025
|
+
*(p++) = lo+dx*k;
|
|
2026
|
+
// elem(uintA{i, j, k, 0}) = lo+dx*i;
|
|
2027
|
+
// elem(uintA{i, j, k, 1}) = lo+dx*j;
|
|
2028
|
+
// elem(uintA{i, j, k, 2}) = lo+dx*k;
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
x.reshape(x.d0*x.d1*x.d2, 3);
|
|
2032
|
+
return x;
|
|
2033
|
+
}
|
|
2034
|
+
NIY;
|
|
2035
|
+
return x;
|
|
2036
|
+
}
|
|
2037
|
+
|
|
1872
2038
|
} //namespace
|