id
int64
0
458k
file_name
stringlengths
4
119
file_path
stringlengths
14
227
content
stringlengths
24
9.96M
size
int64
24
9.96M
language
stringclasses
1 value
extension
stringclasses
14 values
total_lines
int64
1
219k
avg_line_length
float64
2.52
4.63M
max_line_length
int64
5
9.91M
alphanum_fraction
float64
0
1
repo_name
stringlengths
7
101
repo_stars
int64
100
139k
repo_forks
int64
0
26.4k
repo_open_issues
int64
0
2.27k
repo_license
stringclasses
12 values
repo_extraction_date
stringclasses
433 values
2,288,600
yba_ams_py_controller.py
TshineZheng_Filamentor/src/impl/yba_ams_py_controller.py
import json import select import socket import threading import time from src.impl.yba_ams_controller import YBAAMSController from src.utils.log import LOGE, LOGI class YBAAMSPYController(YBAAMSController): """YBA-AMS-Python 版本,用 python 复刻原版,增加内存指令 Args: YBAAMSController (_type_): _description_ Returns: _type_: _description_ """ @staticmethod def type_name() -> str: return "yba_ams_py" def __init__(self, ip: str, port: int, channel_count: int): super().__init__(ip, port, channel_count) self.broken_detect_thread = None def connect(self): super().connect() self.broken_detect_thread = threading.Thread(target=self.recive_loop, name=f"yba-ams-py({self.ip}) recive_loop") self.broken_detect_thread.start() self.ams_gc() def disconnect(self): super().disconnect() if self.broken_detect_thread: try: self.broken_detect_thread.join() except Exception as e: pass self.broken_detect_thread = None def recive_loop(self): while self.is_running: time.sleep(0.1) if self.sock is None: break try: r, _, _ = select.select([self.sock], [], []) do_read = bool(r) except socket.error: pass if do_read: try: data = b'' while True: if self.sock is None: break packet = self.sock.recv(1024) # 一次接收1024字节 if not packet: break data += packet latest = data[-1:] if latest == b'\x04': break if len(data) != 0: data = str(data[:-1], 'utf-8') try: json_obj = json.loads(data) type = None msg_data = None if 'type' in json_obj: type = json_obj['type'] if 'data' in json_obj: msg_data = json_obj['data'] if type != None: self.on_recv(type, msg_data) except Exception as e: pass except Exception as e: LOGE(f"接收数据失败: {e}") time.sleep(1) pass def on_recv(self, type: int, data): if type == 0: LOGI(f'ESP Info : {data}') elif type == 1: LOGI(f'ESP Info: {data}') def ams_gc(self) -> str: self.send_ams(b'\x2f\x2f\xff\xfe\xff') def get_system_status(self) -> str: self.send_ams(b'\x2f\x2f\xff\xfe\xfe') def ams_sync(self): ams_sync = b'\x2f\x2f\xff\xfe\x02' + self.channel_total.to_bytes(1, 'big') for i in range(self.channel_total): ams_sync += self.ch_state[i].to_bytes(1, 'big') self.send_ams(ams_sync) def heartbeat(self): while self.is_running: if self.sock is not None: self.ams_sync() time.sleep(1)
3,488
Python
.py
93
22.44086
120
0.463393
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,601
gcode_util.py
TshineZheng_Filamentor/src/utils/gcode_util.py
class GCodeInfo(object): def __init__(self): from src import consts self.first_channel = 0 self.layer_height = consts.LAYER_HEIGHT def decodeFromZipUrl(zip_url: str, file_path: str) -> GCodeInfo: import requests import zipfile import io # 发送GET请求并获取ZIP文件的内容 response = requests.get(zip_url) # 确保请求成功 if response.status_code == 200: ret = GCodeInfo() # 使用BytesIO读取下载的内容 zip_data = io.BytesIO(response.content) # 使用zipfile读取ZIP文件 with zipfile.ZipFile(zip_data) as zip_file: # 获取ZIP文件中的所有文件名列表 file_names = zip_file.namelist() # 遍历文件名列表 for file_name in file_names: # 如果文件名符合您要查找的路径 if file_path == file_name: # 打开文本文件 with zip_file.open(file_name) as file: # 逐行读取文件内容 for line in file: # 将bytes转换为str line_str = line.decode('utf-8') # 检查是否包含特定字符串 if line_str.startswith('M620 S'): # 找到匹配的行,返回内容 text = line_str.strip() import re # 正则表达式模式,用于匹配'M620 S'后面的数字,直到遇到非数字字符 pattern = r'M620 S(\d+)' # 搜索匹配的内容 match = re.search(pattern, text) # 如果找到匹配项,则提取数字 if match: number = match.group(1) print(number) # 输出匹配到的数字 ret.first_channel = int(int(number)) return ret elif line_str.startswith('; layer_height = '): value = line_str.split('=')[1].strip() ret.layer_height = float(value) return None
2,421
Python
.py
49
23.22449
74
0.429481
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,602
front.py
TshineZheng_Filamentor/src/utils/front.py
import requests import zipfile import os def unzip_file(zip_path, extract_path): with zipfile.ZipFile(zip_path, 'r') as zip_ref: zip_ref.extractall(extract_path) print(f"文件已解压到 {extract_path}") if os.path.exists('web'): exit('前端已存在,如果要更新,请删除 web 文件夹后重新运行本脚本') print('正在下载前端资源...') # GitHub 用户名和仓库名 owner = "TshineZheng" repo = "FilamentorApp" # GitHub API URL url = f"https://api.github.com/repos/{owner}/{repo}/releases/latest" # 获取最新的 release 信息 response = requests.get(url) release_data = response.json() # 获取最新的 release 的资产(文件) assets = release_data['assets'] for asset in assets: download_url = asset['browser_download_url'] print(f"下载 URL: {download_url}") # 下载文件 file_response = requests.get(download_url) file_name = asset['name'] with open(file_name, 'wb') as f: f.write(file_response.content) print(f"文件 {file_name} 已下载") unzip_file('web.zip', 'web/') os.remove('web.zip')
1,106
Python
.py
31
27.483871
68
0.704846
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,603
persist.py
TshineZheng_Filamentor/src/utils/persist.py
import os from src.consts import STORAGE_PATH def update_printer_channel(printer_id: str, channel: int): with open(f'{STORAGE_PATH}{printer_id}.channel', 'w') as f: f.write(str(channel)) def get_printer_channel(printer_id: str) -> int: # 如果文件不存在,则返回 0 if not os.path.exists(f'{STORAGE_PATH}{printer_id}.channel'): return 0 try: with open(f'{STORAGE_PATH}{printer_id}.channel', 'r') as f: return int(f.read()) except: return 0
519
Python
.py
14
29.428571
67
0.644958
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,604
log.py
TshineZheng_Filamentor/src/utils/log.py
from abc import abstractmethod from typing import Any from loguru import logger as LOG import src.consts def LOGI(msg, *args: Any, **kwargs: Any): LOG.info(msg, *args, **kwargs) def LOGW(msg, *args: Any, **kwargs: Any): LOG.info(msg, *args, **kwargs) def LOGE(msg, *args: Any, **kwargs: Any): LOG.error(msg, *args, **kwargs) def LOGD(msg, *args: Any, **kwargs: Any): LOG.debug(msg, *args, **kwargs) LOG.add( sink = f'{src.consts.STORAGE_PATH}/logs/filamentor.log', enqueue=True, rotation='1 days', retention='1 weeks', encoding='utf-8', backtrace=True, diagnose=True, compression='zip' ) class TAGLOG: @abstractmethod def tag(self): return '' def LOGI(self, msg, *args: Any, **kwargs: Any): LOGI(self.__mix_msg__(msg), *args, **kwargs) def LOGW(self, msg, *args: Any, **kwargs: Any): LOGW(self.__mix_msg__(msg), *args, **kwargs) def LOGE(self, msg, *args: Any, **kwargs: Any): LOGE(self.__mix_msg__(msg), *args, **kwargs) def LOGD(self, msg, *args: Any, **kwargs: Any): LOGD(self.__mix_msg__(msg), *args, **kwargs) def __mix_msg__(self, msg:str): if self.tag == '' or self.tag is None: return msg return f'{self.tag()} | {msg}'
1,286
Python
.py
38
28.684211
60
0.60778
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,605
singleton.py
TshineZheng_Filamentor/src/utils/singleton.py
class Singleton(type): _instances = {} def __call__(cls, *args, **kwargs): if cls not in cls._instances: cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs) return cls._instances[cls]
237
Python
.py
6
32.666667
81
0.586207
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,606
json_util.py
TshineZheng_Filamentor/src/utils/json_util.py
def ast(json_data: dict, key: str, value): if key in json_data: if json_data[key] == value: return True return False
144
Python
.py
5
22.4
42
0.592857
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,607
net_util.py
TshineZheng_Filamentor/src/utils/net_util.py
def get_ip_address(): import socket hostname = socket.gethostname() ip_address = socket.gethostbyname(hostname) return ip_address
146
Python
.py
5
25
47
0.730496
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,608
models.py
TshineZheng_Filamentor/src/web/models.py
from datetime import datetime from typing import Any from zoneinfo import ZoneInfo from fastapi.encoders import jsonable_encoder from pydantic import BaseModel as bm, ConfigDict, model_validator def convert_datetime_to_gmt(dt: datetime) -> str: if not dt.tzinfo: dt = dt.replace(tzinfo=ZoneInfo("UTC")) return dt.strftime("%Y-%m-%dT%H:%M:%S%z") class BaseModel(bm): model_config = ConfigDict( json_encoders={datetime: convert_datetime_to_gmt}, populate_by_name=True, ) @model_validator(mode="before") @classmethod def set_null_microseconds(cls, data: dict[str, Any]) -> dict[str, Any]: datetime_fields = { k: v.replace(microsecond=0) for k, v in data.items() if isinstance(v, datetime) } return {**data, **datetime_fields} def serializable_dict(self, **kwargs): """Return a dict which contains only serializable fields.""" default_dict = self.model_dump() return jsonable_encoder(default_dict)
1,044
Python
.py
27
32.111111
75
0.668322
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,609
front.py
TshineZheng_Filamentor/src/web/front.py
import http.server from typing import Any from src.utils.net_util import get_ip_address front_server: http.server.HTTPServer = None class FrontHandler(http.server.SimpleHTTPRequestHandler): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs, directory='web') def log_message(self, format: str, *args: Any) -> None: pass def start(): import os import threading if os.path.exists('web'): global front_server front_server = http.server.HTTPServer(('', 8001), FrontHandler) threading.Thread(target=front_server.serve_forever).start() myip = get_ip_address() print("========================================") print(f"| 管理页面: http://{myip}:8001 |") print(f"| 接口文档: http://{myip}:7170/docs |") print("========================================") def stop(): if front_server: front_server.shutdown()
954
Python
.py
24
32.916667
71
0.58204
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,610
__init__.py
TshineZheng_Filamentor/src/web/__init__.py
from src.web.controller.router import router as controller_router from src.web.sys.router import router as sys_router from src.web.printer.router import router as printer_router from fastapi.middleware.cors import CORSMiddleware from fastapi import APIRouter, FastAPI import json import logging from fastapi import Request from fastapi.responses import JSONResponse from starlette.middleware.base import BaseHTTPMiddleware, RequestResponseEndpoint class ResponseMiddleware(BaseHTTPMiddleware): async def dispatch(self, request: Request, call_next: RequestResponseEndpoint): response = await call_next(request) if not request.url.path.startswith("/api"): return response # 获取响应内容 response_body = [section async for section in response.body_iterator] response_body = b''.join(response_body).decode('utf-8') # 尝试解析响应内容为 JSON 对象 try: response_data = json.loads(response_body) except json.JSONDecodeError: response_data = response_body # 根据状态码包装响应内容 if response.status_code == 200: new_response = JSONResponse( status_code=response.status_code, content={ "code": response.status_code, "message": "success", "data": response_data } ) else: msg = 'unknown error' if 'detail' in response_data: if isinstance(response_data['detail'], str): msg = response_data['detail'] elif isinstance(response_data['detail'], list): detail = response_data['detail'][0] if 'msg' in detail: msg = detail['msg'] new_response = JSONResponse( status_code=response.status_code, content={ "code": response.status_code, "message": msg, "data": None, "error": response_data } ) # 返回新的响应对象 return new_response class EndpointFilter(logging.Filter): def filter(self, record: logging.LogRecord) -> bool: return record.args and len(record.args) >= 3 and record.args[2] != "/api/sys/sync" def init(fast_api: FastAPI): # Add filter to the logger logging.getLogger("uvicorn.access").addFilter(EndpointFilter()) fast_api.add_middleware(ResponseMiddleware) fast_api.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"] ) api_router = APIRouter() api_router.include_router(sys_router, prefix='/sys') api_router.include_router(printer_router, prefix='/printer') api_router.include_router(controller_router, prefix='/controller') fast_api.include_router(api_router, prefix="/api")
3,049
Python
.py
72
30.944444
90
0.615651
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,611
exceptions.py
TshineZheng_Filamentor/src/web/exceptions.py
from typing import Any from fastapi import HTTPException, status class DetailedHTTPException(HTTPException): STATUS_CODE = status.HTTP_500_INTERNAL_SERVER_ERROR DETAIL = "Server error" def __init__(self, **kwargs: dict[str, Any]) -> None: super().__init__(status_code=self.STATUS_CODE, detail=self.DETAIL, **kwargs) class PermissionDenied(DetailedHTTPException): STATUS_CODE = status.HTTP_403_FORBIDDEN DETAIL = "Permission denied" class NotFound(DetailedHTTPException): STATUS_CODE = status.HTTP_404_NOT_FOUND class BadRequest(DetailedHTTPException): STATUS_CODE = status.HTTP_400_BAD_REQUEST DETAIL = "Bad Request" class NotAuthenticated(DetailedHTTPException): STATUS_CODE = status.HTTP_401_UNAUTHORIZED DETAIL = "User not authenticated" def __init__(self) -> None: super().__init__(headers={"WWW-Authenticate": "Bearer"})
899
Python
.py
20
40.3
84
0.73903
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,612
router.py
TshineZheng_Filamentor/src/web/sys/router.py
from typing import List from fastapi import APIRouter, Depends from src.ams_core import ams_list from src.app_config import DetectRelation, IDBrokenDetect, config router = APIRouter() @router.get('/config') async def get_config(): d = config.to_dict() detect_list = d['detect_list'] detect_relation_list = d['detect_relations'] # 将所有打印机和控制器自带的断料检测器构造出来,还有关系 for printer in config.printer_list: if printer.client.filament_broken_detect() is not None: detect_list.append(IDBrokenDetect(printer.id, printer.client.filament_broken_detect(), printer.alias).to_dict()) detect_relation_list.append(DetectRelation(printer.id, printer.id).to_dict()) # FIXME: 控制器断料检测器绑定打印机的逻辑不对,断料检测器应该和通道或者控制器绑定,而不是和打印机绑定 for c in config.controller_list: if c.controller.get_broken_detect() is not None: detect_list.append(IDBrokenDetect(c.id, c.controller.get_broken_detect(), c.alias).to_dict()) detect_relation_list.append(DetectRelation(printer.id, c.id).to_dict()) return d @router.get('/sync') async def sync(): controller_state: List[dict] = [] ams_info: List[dict] = [] detect_info: List[dict] = [] for printer in config.printer_list: if printer.client.filament_broken_detect() is not None: detect_info.append({ 'detect_id': printer.id, 'is_broken': printer.client.filament_broken_detect().is_filament_broken() }) for c in config.controller_list: controller_state.append( { 'controller_id': c.id, 'channel_states': c.controller.get_channel_states() } ) if c.controller.get_broken_detect() is not None: detect_info.append({ 'detect_id': c.id, 'is_broken': c.controller.get_broken_detect().is_filament_broken() }) for p in ams_list: ams_info.append({ 'printer_id': p.use_printer, 'fila_cur': p.fila_cur, 'cur_task': p.task_name }) for d in config.detect_list: detect_info.append({ 'detect_id': d.id, 'is_broken': d.detect.is_filament_broken() }) return {'ams': ams_info, 'controller': controller_state, 'detect': detect_info}
2,511
Python
.py
56
33.053571
124
0.62069
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,613
schemas.py
TshineZheng_Filamentor/src/web/controller/schemas.py
from src.web.models import BaseModel class ControllerChannelModel(BaseModel): controller_id: str channel: int class YBAAMSControllerModel(BaseModel): ip: str port: int channel_total: int class YBASingleBufferControllerModel(BaseModel): fila_broken_safe_time: int ip: str port: int channel_total: int
342
Python
.py
13
22.076923
48
0.76161
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,614
dependencies.py
TshineZheng_Filamentor/src/web/controller/dependencies.py
from typing import List from fastapi import Depends, Query from src.controller import ChannelAction from src.impl.yba_ams_controller import YBAAMSController from src.impl.yba_ams_py_controller import YBAAMSPYController from src.impl.yba_ams_servo_controller import YBAAMSServoController from src.impl.yba_single_buffer_controller import YBASingleBufferController from src.web.controller.exceptions import ChannelDuplicate, ControllerChannelBinded, ControllerChannelActionError, ControllerChannelNotFoundError, ControllerChannelUnBinded, ControllerNotFoundError, ControllerTypeNotMatch from src.app_config import config from src.web.controller.schemas import ControllerChannelModel async def valid_controller_type(controller_type: str) -> str: if controller_type == YBAAMSPYController.type_name(): return controller_type elif controller_type == YBAAMSServoController.type_name(): return controller_type elif controller_type == YBAAMSController.type_name(): return controller_type elif controller_type == YBASingleBufferController.type_name(): return controller_type else: raise ControllerTypeNotMatch() async def valid_controller_id_exist(controller_id: str) -> str: for c in config.controller_list: if c.id == controller_id: return controller_id raise ControllerNotFoundError() async def valid_controller_channel(channel: int, controller_id: str = Depends(valid_controller_id_exist)) -> ControllerChannelModel: for c in config.controller_list: if c.id == controller_id: if 0 <= channel < c.controller.channel_total: return ControllerChannelModel(controller_id=controller_id, channel=channel) raise ControllerChannelNotFoundError() async def valid_channel_binded(channels: List[int] = Query(alias='channels'), controller_id: str = Depends(valid_controller_id_exist)) -> List[ControllerChannelModel]: if len(channels) != len(set(channels)): raise ChannelDuplicate() for channel in channels: await valid_controller_channel(channel, controller_id) for c in config.channel_relations: for channel in channels: if c.controller_id == controller_id and c.channel == channel: raise ControllerChannelBinded() return [ControllerChannelModel(controller_id=controller_id, channel=channel) for channel in channels] async def valid_channel_unbinded(channel: int, controller_id: str = Depends(valid_controller_id_exist)) -> ControllerChannelModel: for c in config.channel_relations: if c.controller_id == controller_id and c.channel == channel: return ControllerChannelModel(controller_id=controller_id, channel=channel) raise ControllerChannelUnBinded() async def valid_channel_action(action: int) -> ChannelAction: if action == ChannelAction.PUSH.value or action == ChannelAction.PULL.value or action == ChannelAction.STOP.value: return ChannelAction(action) raise ControllerChannelActionError()
3,042
Python
.py
51
53.529412
221
0.765972
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,615
router.py
TshineZheng_Filamentor/src/web/controller/router.py
from typing import List, Union from fastapi import APIRouter, Depends from src.controller import ChannelAction from src.web.controller import service from src.web.controller.dependencies import valid_channel_binded, valid_channel_unbinded, valid_controller_channel, valid_controller_id_exist, valid_controller_type, valid_channel_action from src.web.controller.schemas import ControllerChannelModel, YBAAMSControllerModel, YBASingleBufferControllerModel from src.web.printer.dependencies import valid_ams_printer_task, valid_printer_id_exist router = APIRouter() @router.put('/', dependencies=[Depends(valid_ams_printer_task)]) async def add_controller( alias: str, info: Union[YBASingleBufferControllerModel, YBAAMSControllerModel], type: str = Depends(valid_controller_type) ): await service.add_controller(type, alias, info) @router.delete('/', dependencies=[Depends(valid_ams_printer_task)]) async def delete_controller( id: str = Depends(valid_controller_id_exist), ): await service.remove_controller(id) @router.post('/bind_printer', dependencies=[Depends(valid_ams_printer_task)]) async def bind_printer( printer_id: str = Depends(valid_printer_id_exist), channels: List[ControllerChannelModel] = Depends(valid_channel_binded), ): await service.bind_printer(printer_id=printer_id, channels=channels) @router.post('/unbind_printer', dependencies=[Depends(valid_ams_printer_task)]) async def unbind_printer( printer_id: str = Depends(valid_printer_id_exist), channel: ControllerChannelModel = Depends(valid_channel_unbinded), ): await service.unbind_printer(controller_id=channel.controller_id, printer_id=printer_id, channel=channel.channel) @router.post('/control', dependencies=[Depends(valid_ams_printer_task)]) async def controll( channel: ControllerChannelModel = Depends(valid_controller_channel), action: ChannelAction = Depends(valid_channel_action), ): await service.controll(channel.controller_id, channel.channel, action)
2,032
Python
.py
38
50.026316
186
0.786471
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,616
service.py
TshineZheng_Filamentor/src/web/controller/service.py
from typing import List, Union import uuid from src.controller import ChannelAction, Controller from src.web.controller.exceptions import ControllerTaken from src.app_config import config import src.core_services as core_services from src.web.controller.schemas import ControllerChannelModel, YBAAMSControllerModel async def add_controller(type: str, alias: str, info: Union[YBAAMSControllerModel]) -> Controller: contorller = Controller.generate_controller(type, info.model_dump()) for c in config.controller_list: if c.controller == contorller: raise ControllerTaken() # TODO: 需要验证控制器是否可用 config.add_controller(f'{type}_{uuid.uuid1()}', contorller, alias) config.save() core_services.restart() async def remove_controller(id: str): config.remove_controller(id) config.save() core_services.restart() async def bind_printer(printer_id: str, channels: List[ControllerChannelModel]): for c in channels: config.add_channel_setting(printer_id, c.controller_id, c.channel) config.save() core_services.restart() async def unbind_printer(controller_id: str, printer_id: str, channel: int): config.remove_channel_setting(printer_id, controller_id, channel) config.save() core_services.restart() async def controll(controller_id: str, channel: int, action: int): config.get_controller(controller_id).control( channel, ChannelAction(action))
1,468
Python
.py
32
40.625
98
0.757857
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,617
exceptions.py
TshineZheng_Filamentor/src/web/controller/exceptions.py
from src.web.exceptions import BadRequest class ControllerTypeNotMatch(BadRequest): DETAIL = "控制器类型不支持" class ControllerNotFoundError(BadRequest): DETAIL = "控制器不存在" class ControllerChannelNotFoundError(BadRequest): DETAIL = "控制器通道不存在" class ControllerChannelBinded(BadRequest): DETAIL = "控制器通道已绑定" class ControllerChannelUnBinded(BadRequest): DETAIL = "控制器通道未绑定" class ControllerTaken(BadRequest): DETAIL = "控制器已存在" class ControllerInfoError(BadRequest): DETAIL = "控制器信息有误" class ControllerChannelActionError(BadRequest): DETAIL = "控制器通道动作有误" class ChannelDuplicate(BadRequest): DETAIL = "请求设置的通道有重复"
786
Python
.py
19
30.631579
49
0.802589
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,618
schemas.py
TshineZheng_Filamentor/src/web/printer/schemas.py
from src.web.models import BaseModel class BambuPrinterModel(BaseModel): printer_ip: str lan_password: str device_serial: str
139
Python
.py
5
24.2
36
0.774436
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,619
dependencies.py
TshineZheng_Filamentor/src/web/printer/dependencies.py
from typing import Union from fastapi import Depends from src.impl.bambu_client import BambuClient from src.printer_client import PrinterClient from src.web.exceptions import DetailedHTTPException from src.web.printer.exceptions import ChannelNotFoundError, PrinterHasTaskError, PrinterInfoError, PrinterNotFoundError, PrinterTaken, PrinterTypeNotMatch from src.app_config import config import src.core_services as core_services from src.web.printer.schemas import BambuPrinterModel async def valid_printer_type(type:str) -> str: if type == BambuClient.type_name(): return BambuClient.type_name() else: raise PrinterTypeNotMatch() async def valid_printer_taken(info: Union[BambuPrinterModel], type: str = Depends(valid_printer_type)) -> PrinterClient: printer_client: PrinterClient = None if type == BambuClient.type_name(): try: printer_client = BambuClient(info) except: raise PrinterInfoError() if printer_client is None: raise DetailedHTTPException(status_code=500, detail="未知错误") for p in config.printer_list: if p.client == printer_client: raise PrinterTaken() return printer_client async def valid_printer_id_exist(printer_id:str): for p in config.printer_list: if p.id == printer_id: return printer_id raise PrinterNotFoundError() async def valid_printer_channel(printer_id : str, channel_index: int) -> int: channels = config.get_printer_channel_settings(printer_id) if 0 <= channel_index < len(channels): return channel_index raise ChannelNotFoundError() async def valid_ams_printer_task(): #TODO: 最好能分开打印机判断 if core_services.hasPrintTaskRunning(): raise PrinterHasTaskError()
1,829
Python
.py
41
37.707317
155
0.74158
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,620
router.py
TshineZheng_Filamentor/src/web/printer/router.py
from fastapi import APIRouter, Depends from src.controller import ChannelAction from src.printer_client import PrinterClient from src.web.controller.dependencies import valid_channel_action from src.web.printer.dependencies import valid_ams_printer_task, valid_printer_channel, valid_printer_id_exist, valid_printer_taken import src.web.printer.service as service router = APIRouter() @router.put('/', dependencies=[Depends(valid_ams_printer_task)]) async def create_printer(alias: str, change_temp: int, printer: PrinterClient = Depends(valid_printer_taken)): id = await service.create_printer(printer, alias=alias, change_temp=change_temp), return {'id': id} @router.delete('/', dependencies=[Depends(valid_ams_printer_task)]) async def delete_printer( printer_id: str = Depends(valid_printer_id_exist), ): await service.delete_printer(printer_id) return {'id': printer_id} @router.post('/set_channel', dependencies=[Depends(valid_ams_printer_task)]) async def set_channel( printer_id: str = Depends(valid_printer_id_exist), printer_channel: int = Depends(valid_printer_channel)): # await service.update_printer_channel(printer_id, printer_channel) await service.channel_control(printer_id, printer_channel, ChannelAction.NONE) @ router.post('/set_change_temp') async def set_change_temp( change_temp: int, printer_id: str = Depends(valid_printer_id_exist), ): await service.update_printer_change_temp(printer_id, change_temp) @router.post('/edit_channel_filament_setting') async def edit_channel_filament_setting( filament_type: str, filament_color: str, printer_id: str = Depends(valid_printer_id_exist), printer_channel: int = Depends(valid_printer_channel), ): await service.edit_channel_filament_setting(printer_id, printer_channel, filament_type, filament_color) @router.post('/channel_control', dependencies=[Depends(valid_ams_printer_task)]) async def channel_control( printer_id: str = Depends(valid_printer_id_exist), printer_channel: int = Depends(valid_printer_channel), action: ChannelAction = Depends(valid_channel_action), ): await service.channel_control(printer_id, printer_channel, action)
2,215
Python
.py
44
46.954545
131
0.764133
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,621
service.py
TshineZheng_Filamentor/src/web/printer/service.py
import uuid from src.controller import ChannelAction from src.printer_client import PrinterClient from src.utils import persist from src.app_config import config import src.core_services as core_services from src.ams_core import ams_list async def create_printer(printerClient: PrinterClient, alias: str, change_temp: int) -> str: id = f'{printerClient.type_name()}_{uuid.uuid1()}' # TODO:需要验证打印是否可用 config.add_printer(id, printerClient, alias, change_temp) config.save() core_services.restart() return id async def delete_printer(printer_id: str) -> str: config.remove_printer(printer_id) config.save() core_services.restart() return printer_id async def update_printer_channel(printer_id: str, channel_index: int): persist.update_printer_channel(printer_id, channel_index) core_services.restart() async def update_printer_change_temp(printer_id: str, change_temp: int): config.set_printer_change_tem(printer_id, change_temp) config.save() for p in ams_list: if p.use_printer == printer_id: p.change_tem = change_temp async def edit_channel_filament_setting(printer_id: str, channel: int, filament_type: str, filament_color: str): channels = config.get_printer_channel_settings(printer_id) channels[channel].filament_type = filament_type channels[channel].filament_color = filament_color config.save() async def channel_control(printer_id: str, printer_channel: int, action: ChannelAction): from src.ams_core import ams_list # TODO: 这里写死 0了,应该调整为通过id获取 ams ams_list[0].update_cur_fila(printer_channel) ams_list[0].driver_control(printer_channel, action)
1,735
Python
.py
38
39.921053
112
0.747698
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,622
exceptions.py
TshineZheng_Filamentor/src/web/printer/exceptions.py
from src.web.exceptions import BadRequest, NotFound class PrinterNotFoundError(BadRequest): DETAIL = "没有对应的打印机" class ChannelNotFoundError(BadRequest): DETAIL = '没有对应的通道' class PrinterTaken(BadRequest): DETAIL = '打印机已存在' class PrinterTypeNotMatch(BadRequest): DETAIL = '打印机类型不支持' class PrinterHasTaskError(BadRequest): DETAIL = '打印机打印中,无法调用该接口,请在没有打印任务时再操作' class PrinterInfoError(BadRequest): DETAIL = '打印机信息有误'
574
Python
.py
13
30.769231
51
0.794811
TshineZheng/Filamentor
8
2
0
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,623
setup.py
SUSE_klp-build/setup.py
import setuptools with open("README.md", "r") as f: long_description = f.read() setuptools.setup( name="klp-build", version="0.0.1", author="Marcos Paulo de Souza", author_email="[email protected]", description="The kernel livepatching creation tool", long_description=long_description, long_description_content_type="text/markdown", url="https://gitlab.suse.de/live-patching/klp-build", packages=setuptools.find_packages(exclude=["tests"]), package_data={"scripts": ["run-kgr-test.sh"]}, python_requires=">=3.6", classifiers=[ "Programming Language :: Python :: 3", "Intended Audience :: Developers", ], entry_points={ "console_scripts": ["klp-build=klpbuild.main:main"], }, install_requires=[ "configparser", "cached_property", "GitPython", "lxml", "mako", "markupsafe", "natsort", "osc-tiny", "requests", "filelock", "pyelftools", "zstandard" ], )
1,047
Python
.py
37
22.027027
60
0.608739
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,624
.pylintrc
SUSE_klp-build/.pylintrc
[MASTER] # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may # run arbitrary code. extension-pkg-allow-list= # A comma-separated list of package or module names from where C extensions may # be loaded. Extensions are loading into the active Python interpreter and may # run arbitrary code. (This is an alternative name to extension-pkg-allow-list # for backward compatibility.) extension-pkg-whitelist= # Return non-zero exit code if any of these messages/categories are detected, # even if score is above --fail-under value. Syntax same as enable. Messages # specified are enabled, while categories only check already-enabled messages. fail-on= # Specify a score threshold to be exceeded before program exits with error. fail-under=9.0 # Files or directories to be skipped. They should be base names, not paths. ignore=CVS # Add files or directories matching the regex patterns to the ignore-list. The # regex matches against paths and can be in Posix or Windows format. ignore-paths= # Files or directories matching the regex patterns are skipped. The regex # matches against base names, not paths. The default value ignores emacs file # locks ignore-patterns=^\.# # Python code to execute, usually for sys.path manipulation such as # pygtk.require(). #init-hook= # Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the # number of processors available to use. jobs=1 # Control the amount of potential inferred values when inferring a single # object. This can help the performance when dealing with large functions or # complex, nested conditions. limit-inference-results=100 # List of plugins (as comma separated values of python module names) to load, # usually to register additional checkers. load-plugins= # Pickle collected data for later comparisons. persistent=yes # Minimum Python version to use for version dependent checks. Will default to # the version used to run pylint. py-version=3.6 # Discover python modules and packages in the file system subtree. recursive=no # When enabled, pylint would attempt to guess common misconfiguration and emit # user-friendly hints instead of false-positive error messages. suggestion-mode=yes # Allow loading of arbitrary C extensions. Extensions are imported into the # active Python interpreter and may run arbitrary code. unsafe-load-any-extension=no [MESSAGES CONTROL] # Only show warnings with the listed confidence levels. Leave empty to show # all. Valid levels: HIGH, CONTROL_FLOW, INFERENCE, INFERENCE_FAILURE, # UNDEFINED. confidence= # Disable the message, report, category or checker with the given id(s). You # can either give multiple identifiers separated by comma (,) or put this # option multiple times (only on the command line, not in the configuration # file where it should appear only once). You can also use "--disable=all" to # disable everything first and then re-enable specific checks. For example, if # you want to run only the similarities checker, you can use "--disable=all # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use "--disable=all --enable=classes # --disable=W". disable=raw-checker-failed, bad-inline-option, locally-disabled, file-ignored, suppressed-message, useless-suppression, deprecated-pragma, use-symbolic-message-instead, missing-function-docstring, missing-module-docstring, missing-class-docstring, line-too-long, wrong-import-position, unspecified-encoding, fixme, # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option # multiple time (only on the command line, not in the configuration file where # it should appear only once). See also the "--disable" option for examples. enable=c-extension-no-member [REPORTS] # Python expression which should return a score less than or equal to 10. You # have access to the variables 'fatal', 'error', 'warning', 'refactor', # 'convention', and 'info' which contain the number of messages in each # category, as well as 'statement' which is the total number of statements # analyzed. This score is used by the global evaluation report (RP0004). evaluation=max(0, 0 if fatal else 10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)) # Template used to display messages. This is a python new-style format string # used to format the message information. See doc for all details. #msg-template= # Set the output format. Available formats are text, parseable, colorized, json # and msvs (visual studio). You can also give a reporter class, e.g. # mypackage.mymodule.MyReporterClass. output-format=text # Tells whether to display a full report or only the messages. reports=no # Activate the evaluation score. score=yes [REFACTORING] # Maximum number of nested blocks for function / method body max-nested-blocks=5 # Complete name of functions that never returns. When checking for # inconsistent-return-statements if a never returning function is called then # it will be considered as an explicit return statement and no message will be # printed. never-returning-functions=sys.exit,argparse.parse_error [FORMAT] # Expected format of line ending, e.g. empty (any line ending), LF or CRLF. expected-line-ending-format= # Regexp for a line that is allowed to be longer than the limit. ignore-long-lines=^\s*(# )?<?https?://\S+>?$ # Number of spaces of indent required inside a hanging or continued line. indent-after-paren=4 # String used as indentation unit. This is usually " " (4 spaces) or "\t" (1 # tab). indent-string=' ' # Maximum number of characters on a single line. max-line-length=120 # Maximum number of lines in a module. max-module-lines=1000 # Allow the body of a class to be on the same line as the declaration if body # contains single statement. single-line-class-stmt=no # Allow the body of an if to be on the same line as the test if there is no # else. single-line-if-stmt=no [LOGGING] # The type of string formatting that logging methods do. `old` means using % # formatting, `new` is for `{}` formatting. logging-format-style=old # Logging modules to check that the string format arguments are in logging # function parameter format. logging-modules=logging [MISCELLANEOUS] # List of note tags to take in consideration, separated by a comma. notes=FIXME, XXX, TODO # Regular expression of note tags to take in consideration. #notes-rgx= [SIMILARITIES] # Comments are removed from the similarity computation ignore-comments=yes # Docstrings are removed from the similarity computation ignore-docstrings=yes # Imports are removed from the similarity computation ignore-imports=yes # Signatures are removed from the similarity computation ignore-signatures=no # Minimum lines number of a similarity. min-similarity-lines=4 [SPELLING] # Limits count of emitted suggestions for spelling mistakes. max-spelling-suggestions=4 # Spelling dictionary name. Available dictionaries: none. To make it work, # install the 'python-enchant' package. spelling-dict= # List of comma separated words that should be considered directives if they # appear and the beginning of a comment and should not be checked. spelling-ignore-comment-directives=fmt: on,fmt: off,noqa:,noqa,nosec,isort:skip,mypy: # List of comma separated words that should not be checked. spelling-ignore-words= # A path to a file that contains the private dictionary; one word per line. spelling-private-dict-file= # Tells whether to store unknown words to the private dictionary (see the # --spelling-private-dict-file option) instead of raising a message. spelling-store-unknown-words=no [STRING] # This flag controls whether inconsistent-quotes generates a warning when the # character used as a quote delimiter is used inconsistently within a module. check-quote-consistency=no # This flag controls whether the implicit-str-concat should generate a warning # on implicit string concatenation in sequences defined over several lines. check-str-concat-over-line-jumps=no [TYPECHECK] # List of decorators that produce context managers, such as # contextlib.contextmanager. Add to this list to register other decorators that # produce valid context managers. contextmanager-decorators=contextlib.contextmanager # List of members which are set dynamically and missed by pylint inference # system, and so shouldn't trigger E1101 when accessed. Python regular # expressions are accepted. generated-members= # Tells whether missing members accessed in mixin class should be ignored. A # class is considered mixin if its name matches the mixin-class-rgx option. ignore-mixin-members=yes # Tells whether to warn about missing members when the owner of the attribute # is inferred to be None. ignore-none=yes # This flag controls whether pylint should warn about no-member and similar # checks whenever an opaque object is returned when inferring. The inference # can return multiple potential results while evaluating a Python object, but # some branches might not be evaluated, which results in partial inference. In # that case, it might be useful to still emit no-member and other checks for # the rest of the inferred objects. ignore-on-opaque-inference=yes # List of class names for which member attributes should not be checked (useful # for classes with dynamically set attributes). This supports the use of # qualified names. ignored-classes=optparse.Values,thread._local,_thread._local # List of module names for which member attributes should not be checked # (useful for modules/projects where namespaces are manipulated during runtime # and thus existing member attributes cannot be deduced by static analysis). It # supports qualified module names, as well as Unix pattern matching. ignored-modules= # Show a hint with possible names when a member name was not found. The aspect # of finding the hint is based on edit distance. missing-member-hint=yes # The minimum edit distance a name should have in order to be considered a # similar match for a missing member name. missing-member-hint-distance=1 # The total number of similar names that should be taken in consideration when # showing a hint for a missing member. missing-member-max-choices=1 # Regex pattern to define which classes are considered mixins ignore-mixin- # members is set to 'yes' mixin-class-rgx=.*[Mm]ixin # List of decorators that change the signature of a decorated function. signature-mutators= [VARIABLES] # List of additional names supposed to be defined in builtins. Remember that # you should avoid defining new builtins when possible. additional-builtins= # Tells whether unused global variables should be treated as a violation. allow-global-unused-variables=yes # List of names allowed to shadow builtins allowed-redefined-builtins= # List of strings which can identify a callback function by name. A callback # name must start or end with one of those strings. callbacks=cb_, _cb # A regular expression matching the name of dummy variables (i.e. expected to # not be used). dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_ # Argument names that match this expression will be ignored. Default to name # with leading underscore. ignored-argument-names=_.*|^ignored_|^unused_ # Tells whether we should check for unused import in __init__ files. init-import=no # List of qualified module names which can have objects that can redefine # builtins. redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io [BASIC] # Naming style matching correct argument names. argument-naming-style=snake_case # Regular expression matching correct argument names. Overrides argument- # naming-style. If left empty, argument names will be checked with the set # naming style. #argument-rgx= # Naming style matching correct attribute names. attr-naming-style=snake_case # Regular expression matching correct attribute names. Overrides attr-naming- # style. If left empty, attribute names will be checked with the set naming # style. #attr-rgx= # Bad variable names which should always be refused, separated by a comma. bad-names=foo, bar, baz, toto, tutu, tata # Bad variable names regexes, separated by a comma. If names match any regex, # they will always be refused bad-names-rgxs= # Naming style matching correct class attribute names. class-attribute-naming-style=any # Regular expression matching correct class attribute names. Overrides class- # attribute-naming-style. If left empty, class attribute names will be checked # with the set naming style. #class-attribute-rgx= # Naming style matching correct class constant names. class-const-naming-style=UPPER_CASE # Regular expression matching correct class constant names. Overrides class- # const-naming-style. If left empty, class constant names will be checked with # the set naming style. #class-const-rgx= # Naming style matching correct class names. class-naming-style=PascalCase # Regular expression matching correct class names. Overrides class-naming- # style. If left empty, class names will be checked with the set naming style. #class-rgx= # Naming style matching correct constant names. const-naming-style=UPPER_CASE # Regular expression matching correct constant names. Overrides const-naming- # style. If left empty, constant names will be checked with the set naming # style. #const-rgx= # Minimum line length for functions/classes that require docstrings, shorter # ones are exempt. docstring-min-length=-1 # Naming style matching correct function names. function-naming-style=snake_case # Regular expression matching correct function names. Overrides function- # naming-style. If left empty, function names will be checked with the set # naming style. #function-rgx= # Good variable names which should always be accepted, separated by a comma. good-names=i, j, k, f, e, el ex, ok, Run, _ # Good variable names regexes, separated by a comma. If names match any regex, # they will always be accepted good-names-rgxs= # Include a hint for the correct naming format with invalid-name. include-naming-hint=no # Naming style matching correct inline iteration names. inlinevar-naming-style=any # Regular expression matching correct inline iteration names. Overrides # inlinevar-naming-style. If left empty, inline iteration names will be checked # with the set naming style. #inlinevar-rgx= # Naming style matching correct method names. method-naming-style=snake_case # Regular expression matching correct method names. Overrides method-naming- # style. If left empty, method names will be checked with the set naming style. #method-rgx= # Naming style matching correct module names. module-naming-style=snake_case # Regular expression matching correct module names. Overrides module-naming- # style. If left empty, module names will be checked with the set naming style. #module-rgx= # Colon-delimited sets of names that determine each other's naming style when # the name regexes allow several styles. name-group= # Regular expression which should only match function or class names that do # not require a docstring. no-docstring-rgx=^_ # List of decorators that produce properties, such as abc.abstractproperty. Add # to this list to register other decorators that produce valid properties. # These decorators are taken in consideration only for invalid-name. property-classes=abc.abstractproperty # Regular expression matching correct type variable names. If left empty, type # variable names will be checked with the set naming style. #typevar-rgx= # Naming style matching correct variable names. variable-naming-style=snake_case # Regular expression matching correct variable names. Overrides variable- # naming-style. If left empty, variable names will be checked with the set # naming style. #variable-rgx= [DESIGN] # List of regular expressions of class ancestor names to ignore when counting # public methods (see R0903) exclude-too-few-public-methods= # List of qualified class names to ignore when counting class parents (see # R0901) ignored-parents= # Maximum number of arguments for function / method. max-args=5 # Maximum number of attributes for a class (see R0902). max-attributes=7 # Maximum number of boolean expressions in an if statement (see R0916). max-bool-expr=5 # Maximum number of branch for function / method body. max-branches=12 # Maximum number of locals for function / method body. max-locals=15 # Maximum number of parents for a class (see R0901). max-parents=7 # Maximum number of public methods for a class (see R0904). max-public-methods=20 # Maximum number of return / yield for function / method body. max-returns=6 # Maximum number of statements in function / method body. max-statements=50 # Minimum number of public methods for a class (see R0903). min-public-methods=2 [IMPORTS] # List of modules that can be imported at any level, not just the top level # one. allow-any-import-level= # Allow wildcard imports from modules that define __all__. allow-wildcard-with-all=no # Analyse import fallback blocks. This can be used to support both Python 2 and # 3 compatible code, which means that the block might have code that exists # only in one or another interpreter, leading to false positives when analysed. analyse-fallback-blocks=no # Deprecated modules which should not be used, separated by a comma. deprecated-modules= # Output a graph (.gv or any supported image format) of external dependencies # to the given file (report RP0402 must not be disabled). ext-import-graph= # Output a graph (.gv or any supported image format) of all (i.e. internal and # external) dependencies to the given file (report RP0402 must not be # disabled). import-graph= # Output a graph (.gv or any supported image format) of internal dependencies # to the given file (report RP0402 must not be disabled). int-import-graph= # Force import order to recognize a module as part of the standard # compatibility libraries. known-standard-library= # Force import order to recognize a module as part of a third party library. known-third-party=enchant # Couples of modules and preferred modules, separated by a comma. preferred-modules= [CLASSES] # Warn about protected attribute access inside special methods check-protected-access-in-special-methods=no # List of method names used to declare (i.e. assign) instance attributes. defining-attr-methods=__init__, __new__, setUp, __post_init__ # List of member names, which should be excluded from the protected access # warning. exclude-protected=_asdict, _fields, _replace, _source, _make # List of valid names for the first argument in a class method. valid-classmethod-first-arg=cls # List of valid names for the first argument in a metaclass class method. valid-metaclass-classmethod-first-arg=cls [EXCEPTIONS] # Exceptions that will emit a warning when being caught. Defaults to # "BaseException, Exception". overgeneral-exceptions=builtins.BaseException, builtins.Exception
19,598
Python
.py
433
42.859122
113
0.785338
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,625
test_setup.py
SUSE_klp-build/tests/test_setup.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza import json import logging from pathlib import Path import pytest from klpbuild.setup import Setup import klpbuild.utils as utils from tests.utils import get_workdir lp = "bsc9999999" cs = "15.5u19" def test_missing_file_funcs(): with pytest.raises(ValueError, match=r"You need to specify at least one of the file-funcs variants!"): Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, mod_file_funcs=[], conf_mod_file_funcs=[], file_funcs=[], mod_arg="vmlinux", conf=None, archs=utils.ARCHS, skips=None, no_check=False).setup_project_files() def test_missing_conf_prefix(): with pytest.raises(ValueError, match=r"Please specify --conf with CONFIG_ prefix"): Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, mod_file_funcs=[], conf_mod_file_funcs=[], file_funcs=[], conf="TUN", mod_arg="vmlinux", archs=utils.ARCHS, skips=None, no_check=False).setup_project_files() # Check for multiple variants of file-funcs def test_file_funcs_ok(): Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, conf="CONFIG_TUN", mod_arg="tun", mod_file_funcs=[], conf_mod_file_funcs=[], file_funcs = [["drivers/net/tun.c", "tun_chr_ioctl", "tun_free_netdev"]], archs=utils.ARCHS, skips=None, no_check=False).setup_project_files() Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, conf="CONFIG_TUN", file_funcs=[], conf_mod_file_funcs=[], mod_arg=None, mod_file_funcs = [["tun", "drivers/net/tun.c", "tun_chr_ioctl", "tun_free_netdev"]], archs=utils.ARCHS, skips=None, no_check=False).setup_project_files() Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, conf="CONFIG_TUN", mod_file_funcs=[], file_funcs=[], mod_arg=None, conf_mod_file_funcs = [["CONFIG_TUN", "tun", "drivers/net/tun.c", "tun_chr_ioctl", "tun_free_netdev"]], archs=utils.ARCHS, skips=None, no_check=False).setup_project_files() def test_non_existent_file(): with pytest.raises(RuntimeError, match=r".*: File drivers/net/tuna.c not found on .*"): Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, conf="CONFIG_TUN", mod_arg="tun", mod_file_funcs=[], conf_mod_file_funcs=[], file_funcs = [["drivers/net/tuna.c", "tun_chr_ioctl", "tun_free_netdev"]], archs=utils.ARCHS, skips=None, no_check=False).setup_project_files() def test_non_existent_module(): with pytest.raises(RuntimeError, match=r"Module not found: tuna"): Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, conf="CONFIG_TUN", mod_arg="tuna", mod_file_funcs=[], conf_mod_file_funcs=[], file_funcs = [["drivers/net/tun.c", "tun_chr_ioctl", "tun_free_netdev"]], archs=utils.ARCHS, skips=None, no_check=False).setup_project_files() def test_invalid_sym(caplog): with caplog.at_level(logging.WARNING): Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, conf="CONFIG_TUN", mod_arg="tun", mod_file_funcs=[], conf_mod_file_funcs=[], file_funcs = [["drivers/net/tun.c", "tun_chr_ioctll", "tun_free_netdev"]], archs=utils.ARCHS, skips=None, no_check=False).setup_project_files() assert "Symbols tun_chr_ioctll not found on tun" in caplog.text def test_check_conf_mod_file_funcs(): Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, mod_arg="sch_qfq", conf="CONFIG_TUN", mod_file_funcs=[], file_funcs=[], conf_mod_file_funcs = [["CONFIG_TUN", "tun", "drivers/net/tun.c", "tun_chr_ioctl", "tun_free_netdev"]], archs=[utils.ARCH], skips=None, no_check=False).setup_project_files() def test_check_conf_mod_file_funcs(): # Check that passing mod-file-funcs can create entries differently from general # --module and --file-funcs Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, mod_arg="sch_qfq", conf="CONFIG_NET_SCH_QFQ", conf_mod_file_funcs=[], file_funcs=[["net/sched/sch_qfq.c", "qfq_change_class"]], mod_file_funcs=[["btsdio", "drivers/bluetooth/btsdio.c", "btsdio_probe", "btsdio_remove"]], archs=[utils.ARCH], skips=None, no_check=False).setup_project_files() with open(Path(get_workdir(lp, cs), "codestreams.json")) as f: data = json.loads(f.read())[cs]["files"] sch = data["net/sched/sch_qfq.c"] bts = data["drivers/bluetooth/btsdio.c"] assert sch["conf"] == bts["conf"] assert sch["module"] == "sch_qfq" assert bts["module"] == "btsdio" # Rerun setup and now conf and module should be different Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, mod_arg="sch_qfq", conf="CONFIG_NET_SCH_QFQ", mod_file_funcs=[], file_funcs=[["net/sched/sch_qfq.c", "qfq_change_class"]], conf_mod_file_funcs = [ ["CONFIG_BT_HCIBTSDIO", "btsdio", "drivers/bluetooth/btsdio.c", "btsdio_probe", "btsdio_remove"] ], archs=[utils.ARCH], skips=None, no_check=False).setup_project_files() with open(Path(get_workdir(lp, cs), "codestreams.json")) as f: data = json.loads(f.read())[cs]["files"] sch = data["net/sched/sch_qfq.c"] bts = data["drivers/bluetooth/btsdio.c"] assert sch["conf"] == "CONFIG_NET_SCH_QFQ" assert sch["module"] == "sch_qfq" assert bts["conf"] == "CONFIG_BT_HCIBTSDIO" assert bts["module"] == "btsdio"
5,619
Python
.py
92
53.054348
113
0.638248
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,626
test_extract.py
SUSE_klp-build/tests/test_extract.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza from klpbuild.extractor import Extractor from klpbuild.setup import Setup import klpbuild.utils as utils import logging def test_detect_file_without_ftrace_support(caplog): lp = "bsc9999999" cs = "15.6u0" Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, file_funcs=[["lib/seq_buf.c", "seq_buf_putmem_hex"]], mod_file_funcs=[], conf_mod_file_funcs=[], mod_arg="vmlinux", conf="CONFIG_SMP", archs=[utils.ARCH], skips=None, no_check=False).setup_project_files() with caplog.at_level(logging.WARNING): Extractor(lp_name=lp, lp_filter=cs, apply_patches=False, app="ce", avoid_ext=[], ignore_errors=False).run() assert "lib/seq_buf.o is not compiled with livepatch support (-pg flag)" in caplog.text
906
Python
.py
20
39.35
91
0.678409
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,627
test_utils.py
SUSE_klp-build/tests/test_utils.py
import klpbuild.utils as utils from klpbuild.codestream import Codestream def test_group_classify(): assert utils.classify_codestreams(["15.2u10", "15.2u11", "15.3u10", "15.3u12"]) == \ ["15.2u10-11", "15.3u10-12"] assert utils.classify_codestreams([Codestream("", 15, 2, 10, False), Codestream("", 15, 2, 11, False), Codestream("", 15, 3, 10, False), Codestream("", 15, 3, 12, False)]) == \ ["15.2u10-11", "15.3u10-12"]
631
Python
.py
10
41.1
88
0.452342
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,628
test_ksrc.py
SUSE_klp-build/tests/test_ksrc.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza from klpbuild.ksrc import GitHelper import pytest def test_multiline_upstream_commit_subject(): _, subj = GitHelper.get_commit_data("49c47cc21b5b") assert subj == "net: tls: fix possible race condition between do_tls_getsockopt_conf() and do_tls_setsockopt_conf()" # This CVE is already covered on all codestreams def test_scan_all_cs_patched(caplog): with pytest.raises(SystemExit): GitHelper("bsc_check", "").scan("2022-48801", "", False) assert "All supported codestreams are already patched" not in caplog.text
648
Python
.py
14
43.285714
120
0.749206
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,629
utils.py
SUSE_klp-build/tests/utils.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza from pathlib import Path from klpbuild.config import Config def get_workdir(lp_name, lp_filter): return Config(lp_name, lp_filter).lp_path def get_file_content(lp_name, filter, fname=None): # Check the generated LP files path = Path(get_workdir(lp_name, filter), "ce", filter, "lp") if not fname: fname = f'livepatch_{lp_name}.c' with open(Path(path, fname)) as f: return f.read()
528
Python
.py
15
31.4
65
0.700197
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,630
test_config.py
SUSE_klp-build/tests/test_config.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2024 SUSE # Author: Marcos Paulo de Souza <[email protected]> from klpbuild.codestream import Codestream from klpbuild.config import Config from tests.utils import get_file_content, get_workdir def test_filter(): lp = "bsc9999999" def to_cs(cs_list): ret = [] for cs in cs_list: ret.append(Codestream.from_cs("", cs)) return ret # Same output because filter and skip were not informed assert Config(lp, "").filter_cs(to_cs(["12.5u10", "15.6u10"])) == to_cs(["12.5u10", "15.6u10"]) # Filter only one codestream assert Config(lp, "12.5u10").filter_cs(to_cs(["12.5u10", "12.5u11", "15.6u10"])) == \ to_cs(["12.5u10"]) # Filter codestreams using regex assert Config(lp, "12.5u1[01]").filter_cs(to_cs(["12.5u10", "12.5u11", "15.6u10"])) \ == to_cs(["12.5u10", "12.5u11"]) assert Config(lp, "12.5u1[01]|15.6u10").filter_cs(to_cs(["12.5u10", "12.5u11", "15.6u10"])) \ == to_cs(["12.5u10", "12.5u11", "15.6u10"]) # Use skip with filter assert Config(lp, "12.5u1[01]", skips="15.6u10").filter_cs(to_cs(["12.5u10", "12.5u11", "15.6u10"])) \ == to_cs(["12.5u10", "12.5u11"]) # Use skip with filter assert Config(lp, "12.5u1[01]", skips="15.6").filter_cs(to_cs(["12.5u10", "12.5u11", "15.6u12", "15.6u13"])) \ == to_cs(["12.5u10", "12.5u11"]) # filter is off, but skip will also only filter the 12.5 ones assert Config(lp, "", skips="15.6").filter_cs(to_cs(["12.5u10", "12.5u11", "15.6u12", "15.6u13"])) \ == to_cs(["12.5u10", "12.5u11"]) assert Config(lp, "", skips="15.6u13").filter_cs(to_cs(["12.5u10", "12.5u11", "15.6u12", "15.6u13"])) \ == to_cs(["12.5u10", "12.5u11", "15.6u12"])
2,766
Python
.py
46
34.521739
99
0.384985
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,631
test_templ.py
SUSE_klp-build/tests/test_templ.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza from klpbuild.extractor import Extractor from klpbuild.setup import Setup import klpbuild.utils as utils from tests.utils import get_file_content def test_templ_with_externalized_vars(): lp = "bsc9999999" cs = "15.5u19" Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, file_funcs=[["fs/proc/cmdline.c", "cmdline_proc_show"]], mod_file_funcs=[], conf_mod_file_funcs=[], mod_arg="vmlinux", conf="CONFIG_PROC_FS", archs=utils.ARCHS, skips=None, no_check=False).setup_project_files() Extractor(lp_name=lp, lp_filter=cs, apply_patches=False, app="ce", avoid_ext=[], ignore_errors=False).run() # As we passed vmlinux as module, we don't have the module notifier and # LP_MODULE, linux/module.h is not included # As the code is using the default archs, which is all of them, the # IS_ENABLED macro shouldn't exist content = get_file_content(lp, cs) for check in ["LP_MODULE", "module_notify", "linux/module.h", "#if IS_ENABLED"]: assert check not in content # For this file and symbol, there is one symbol to be looked up, so # klp_funcs should be present assert "klp_funcs" in content def test_templ_without_externalized_vars(): lp = "bsc9999999" cs = "15.5u19" Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, file_funcs=[["net/ipv6/rpl.c", "ipv6_rpl_srh_size"]], mod_file_funcs=[], conf_mod_file_funcs=[], mod_arg="vmlinux", conf="CONFIG_IPV6", archs=[utils.ARCH], skips=None, no_check=False).setup_project_files() Extractor(lp_name=lp, lp_filter=cs, apply_patches=False, app="ce", avoid_ext=[], ignore_errors=False).run() # As we passed vmlinux as module, we don't have the module notifier and # LP_MODULE, linux/module.h is not included # For this file and symbol, no externalized symbols are used, so # klp_funcs shouldn't be preset. content = get_file_content(lp, cs) for check in ["LP_MODULE", "module_notify", "linux/module.h", "klp_funcs"]: assert check not in content # As the config only targets x86_64, IS_ENABLED should be set assert "#if IS_ENABLED" in content # For multifile patches, a third file will be generated and called # livepatch_XXX, and alongside this file the other files will have the prefix # bscXXXXXXX. def test_check_header_file_included(): lp = "bsc9999999" cs = "15.5u17" Setup(lp_name=lp, lp_filter=cs, data_dir=None, cve=None, file_funcs=[["net/ipv6/rpl.c", "ipv6_rpl_srh_size"], ["kernel/events/core.c", "perf_event_exec"]], mod_file_funcs=[], conf_mod_file_funcs=[], mod_arg="vmlinux", conf="CONFIG_IPV6", archs=[utils.ARCH], skips=None, no_check=False).setup_project_files() Extractor(lp_name=lp, lp_filter=cs, apply_patches=False, app="ce", avoid_ext=[], ignore_errors=False).run() # test the livepatch_ prefix file assert "Upstream commit:" in get_file_content(lp, cs) # Check the other two files assert "Upstream commit:" not in get_file_content(lp, cs, f"{lp}_kernel_events_core.c") assert "Upstream commit:" not in get_file_content(lp, cs, f"{lp}_net_ipv6_rpl.c")
3,376
Python
.py
65
45.507692
108
0.667476
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,632
codestream.py
SUSE_klp-build/klpbuild/codestream.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2024 SUSE # Author: Marcos Paulo de Souza <[email protected]> from pathlib import Path import re from klpbuild.utils import ARCH class Codestream: __slots__ = ("data_path", "sle", "sp", "update", "rt", "ktype", "project", "kernel", "archs", "files", "modules", "repo") def __init__(self, data_path, sle, sp, update, rt, project="", kernel="", archs=[], files={}, modules={}): self.data_path = data_path self.sle = sle self.sp = sp self.update = update self.rt = rt self.ktype = "-rt" if rt else "-default" self.project = project self.kernel = kernel self.archs = archs self.files = files self.modules = modules self.repo = self.get_repo() @classmethod def from_codestream(cls, data_path, cs, proj, kernel): # Parse SLE15-SP2_Update_25 to 15.2u25 rt = "rt" if "-RT" in cs else "" sle, _, u = cs.replace("SLE", "").replace("-RT", "").split("_") if "-SP" in sle: sle, sp = sle.split("-SP") else: sp = "0" return cls(data_path, int(sle), int(sp), int(u), rt, proj, kernel) @classmethod def from_cs(cls, data_path, cs): match = re.search(r"(\d+)\.(\d+)(rt)?u(\d+)", cs) return cls(data_path, int(match.group(1)), int(match.group(2)), int(match.group(4)), match.group(3)) @classmethod def from_data(cls, data_path, data): return cls(data_path, data["sle"], data["sp"], data["update"], data["rt"], data["project"], data["kernel"], data["archs"], data["files"], data["modules"]) def __eq__(self, cs): return self.sle == cs.sle and \ self.sp == cs.sp and \ self.update == cs.update and \ self.rt == cs.rt def get_data_dir(self, arch): # For the SLE usage, it should point to the place where the codestreams # are downloaded return Path(self.data_path, arch) def get_sdir(self, arch=ARCH): # Only -rt codestreams have a suffix for source directory ktype = self.ktype.replace("-default", "") return Path(self.get_data_dir(arch), "usr", "src", f"linux-{self.kernel}{ktype}") def get_odir(self): return Path(f"{self.get_sdir(ARCH)}-obj", ARCH, self.ktype.replace("-", "")) def get_ipa_file(self, fname): return Path(self.get_odir(), f"{fname}.000i.ipa-clones") def get_boot_file(self, file, arch=ARCH): assert file in ["vmlinux", "config", "symvers"] return Path(self.get_data_dir(arch), "boot", f"{file}-{self.kname()}") def get_repo(self): if self.update == 0: return "standard" repo = f"SUSE_SLE-{self.sle}" if self.sp != 0: repo = f"{repo}-SP{self.sp}" repo = f"{repo}_Update" # On 15.5 the RT kernels and in the main codestreams if not self.rt or (self.sle == 15 and self.sp == 5): return repo return f"{repo}_Products_SLERT_Update" def set_archs(self, archs): self.archs = archs def set_files(self, files): self.files = files def kname(self): return self.kernel + self.ktype def name(self): if self.rt: return f"{self.sle}.{self.sp}rtu{self.update}" return f"{self.sle}.{self.sp}u{self.update}" def name_cs(self): if self.rt: return f"{self.sle}.{self.sp}rt" return f"{self.sle}.{self.sp}" # Parse 15.2u25 to SLE15-SP2_Update_25 def name_full(self): buf = f"SLE{self.sle}" if int(self.sp) > 0: buf = f"{buf}-SP{self.sp}" if self.rt: buf = f"{buf}-RT" return f"{buf}_Update_{self.update}" # 15.4 onwards we don't have module_mutex, so template generates # different code def is_mod_mutex(self): return self.sle < 15 or (self.sle == 15 and self.sp < 4) def get_mod_path(self, arch): return Path(self.get_data_dir(arch), "lib", "modules", f"{self.kname()}") # Returns the path to the kernel-obj's build dir, used when build testing # the generated module def get_kernel_build_path(self, arch): return Path(self.get_mod_path(arch), "build") def get_all_configs(self, conf): """ Get the config value for all supported architectures of a codestream. If the configuration is not set the return value will be an empty dict. """ configs = {} for arch in self.archs: kconf = self.get_boot_file("config", arch) with open(kconf) as f: match = re.search(rf"{conf}=([ym])", f.read()) if match: configs[arch] = match.group(1) return configs def data(self): return { "sle" : self.sle, "sp" : self.sp, "update" : self.update, "rt" : self.rt, "project" : self.project, "kernel" : self.kernel, "archs" : self.archs, "files" : self.files, "modules" : self.modules, "repo" : self.repo, "data_path" : str(self.data_path), }
5,416
Python
.py
133
30.984962
108
0.550048
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,633
inline.py
SUSE_klp-build/klpbuild/inline.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza <[email protected]> import shutil from pathlib import Path import subprocess from klpbuild.config import Config from klpbuild.utils import ARCH class Inliner(Config): def __init__(self, lp_name, lp_filter): super().__init__(lp_name, lp_filter) if not self.lp_path.exists(): raise ValueError(f"{self.lp_path} not created. Run the setup subcommand first") self.ce_inline_path = shutil.which("ce-inline") if not self.ce_inline_path: raise RuntimeError("ce-inline not found. Aborting.") def check_inline(self, fname, func): ce_args = [ str(self.ce_inline_path), "-where-is-inlined" ] filtered = self.filter_cs() if not filtered: raise RuntimeError(f"Codestream {self.lp_filter} not found. Aborting.") assert len(filtered) == 1 cs = filtered[0] mod = cs.files.get(fname, {}).get("module", None) if not mod: raise RuntimeError(f"File {fname} not in setup phase. Aborting.") ce_args.extend(["-debuginfo", str(self.get_module_obj(ARCH, cs, mod))]) # clang-extract works without ipa-clones, so don't hard require it ipa_f = cs.get_ipa_file(fname) if ipa_f.exists(): ce_args.extend(["-ipa-files", str(ipa_f)]) ce_args.extend(["-symvers", str(cs.get_boot_file("symvers"))]) ce_args.extend([func]) print(" ".join(ce_args)) print(subprocess.check_output(ce_args).decode())
1,602
Python
.py
36
36.944444
91
0.638065
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,634
setup.py
SUSE_klp-build/klpbuild/setup.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza <[email protected]> import copy import json import logging import re from pathlib import Path from natsort import natsorted from klpbuild import utils from klpbuild.config import Config from klpbuild.ksrc import GitHelper class Setup(Config): def __init__( self, lp_name, lp_filter, data_dir, cve, file_funcs, mod_file_funcs, conf_mod_file_funcs, mod_arg, conf, archs, skips, no_check, ): super().__init__(lp_name, lp_filter, data_dir, skips=skips) archs.sort() if not lp_name.startswith("bsc"): raise ValueError("Please use prefix 'bsc' when creating a livepatch for codestreams") if conf and not conf.startswith("CONFIG_"): raise ValueError("Please specify --conf with CONFIG_ prefix") if self.lp_path.exists() and not self.lp_path.is_dir(): raise ValueError("--name needs to be a directory, or not to exist") if not file_funcs and not mod_file_funcs and not conf_mod_file_funcs: raise ValueError("You need to specify at least one of the file-funcs variants!") self.conf["archs"] = archs if cve: self.conf["cve"] = re.search(r"([0-9]+\-[0-9]+)", cve).group(1) self.no_check = no_check self.file_funcs = {} for f in file_funcs: filepath = f[0] funcs = f[1:] self.file_funcs[filepath] = {"module": mod_arg, "conf": conf, "symbols": funcs} for f in mod_file_funcs: fmod = f[0] filepath = f[1] funcs = f[2:] self.file_funcs[filepath] = {"module": fmod, "conf": conf, "symbols": funcs} for f in conf_mod_file_funcs: fconf = f[0] fmod = f[1] filepath = f[2] funcs = f[3:] self.file_funcs[filepath] = {"module": fmod, "conf": fconf, "symbols": funcs} def setup_codestreams(self): ksrc = GitHelper(self.lp_name, self.filter, skips=self.skips) # Called at this point because codestreams is populated commits, patched_cs, patched_kernels, codestreams = ksrc.scan( self.conf.get("cve", ""), "", self.no_check) self.conf["commits"] = commits self.conf["patched_kernels"] = patched_kernels # Add new codestreams to the already existing list, skipping duplicates self.conf["patched_cs"] = natsorted(list(set(self.conf.get("patched_cs", []) + patched_cs))) return codestreams def setup_project_files(self): self.lp_path.mkdir(exist_ok=True) codestreams = self.setup_codestreams() logging.info(f"Affected architectures:") logging.info(f"\t{' '.join(self.conf['archs'])}") logging.info("Checking files, symbols, modules...") # Setup the missing codestream info needed for cs in codestreams: cs.set_files(copy.deepcopy(self.file_funcs)) # Check if the files exist in the respective codestream directories mod_syms = {} kernel = cs.kernel for f, fdata in cs.files.items(): self.validate_config(cs, fdata["conf"], fdata["module"]) sdir = cs.get_sdir() if not Path(sdir, f).is_file(): raise RuntimeError(f"{cs.name()} ({kernel}): File {f} not found on {str(sdir)}") ipa_f = cs.get_ipa_file(f) if not ipa_f.is_file(): msg = f"{cs.name()} ({kernel}): File {ipa_f} not found. Creating an empty file." ipa_f.touch() logging.warning(msg) # If the config was enabled on all supported architectures, # there is no point in leaving the conf being set, since the # feature will be available everywhere. if self.conf["archs"] == utils.ARCHS: fdata["conf"] = "" mod = fdata["module"] if not cs.modules.get(mod, ""): if utils.is_mod(mod): mod_path = str(self.find_module_obj(utils.ARCH, cs, mod, check_support=True)) else: mod_path = str(cs.get_boot_file("vmlinux")) cs.modules[mod] = mod_path mod_syms.setdefault(mod, []) mod_syms[mod].extend(fdata["symbols"]) # Verify if the functions exist in the specified object for mod, syms in mod_syms.items(): arch_syms = self.check_symbol_archs(cs, mod, syms, False) if arch_syms: for arch, syms in arch_syms.items(): m_syms = ",".join(syms) cs_ = f"{cs.name()}-{arch} ({cs.kernel})" logging.warning(f"{cs_}: Symbols {m_syms} not found on {mod} object") self.flush_cs_file(codestreams) # cpp will use this data in the next step with open(self.conf_file, "w") as f: f.write(json.dumps(self.conf, indent=4)) logging.info("Done. Setup finished.")
5,603
Python
.py
122
32.303279
100
0.532794
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,635
config.py
SUSE_klp-build/klpbuild/config.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza <[email protected]> import configparser import copy import json import logging import os import re from collections import OrderedDict from pathlib import Path, PurePath from klpbuild.codestream import Codestream from klpbuild.utils import ARCH, classify_codestreams, is_mod from klpbuild.utils import get_all_symbols_from_object, get_elf_object, get_elf_modinfo_entry class Config: def __init__(self, lp_name, lp_filter, data_dir=None, skips=""): # FIXME: Config is instantiated multiple times, meaning that the # config file gets loaded and the logs are printed as many times. logging.basicConfig(level=logging.INFO, format="%(message)s") home = Path.home() self.user_conf_file = Path(home, ".config/klp-build/config") if not self.user_conf_file.is_file(): logging.warning(f"Warning: user configuration file not found") # If there's no configuration file assume fresh install. # Prepare the system with a default environment and conf. self.setup_user_env(Path(home, "klp")) self.load_user_conf() work = self.get_user_path('work_dir') self.lp_name = lp_name self.lp_path = Path(work, self.lp_name) self.filter = lp_filter self.skips = skips self.codestreams = OrderedDict() self.codestreams_list = [] self.conf = OrderedDict( {"name": str(self.lp_name), "work_dir": str(self.lp_path), "data": str(data_dir), } ) self.conf_file = Path(self.lp_path, "conf.json") if self.conf_file.is_file(): with open(self.conf_file) as f: self.conf = json.loads(f.read(), object_pairs_hook=OrderedDict) self.data = Path(self.conf.get("data", "non-existent")) if not self.data.exists(): self.data = self.get_user_path('data_dir') self.cs_file = Path(self.lp_path, "codestreams.json") if self.cs_file.is_file(): with open(self.cs_file) as f: self.codestreams = json.loads(f.read(), object_pairs_hook=OrderedDict) for _, data in self.codestreams.items(): self.codestreams_list.append(Codestream.from_data(self.data, data)) # will contain the symbols from the to be livepatched object # cached by the codestream : object self.obj_symbols = {} def setup_user_env(self, basedir): workdir = Path(basedir, "livepatches") datadir = Path(basedir, "data") config = configparser.ConfigParser(allow_no_value=True) config['Paths'] = {'work_dir': workdir, 'data_dir': datadir, '## SUSE internal use only ##': None, '#kgr_patches_dir': 'kgraft-patches/', '#kgr_patches_tests_dir': 'kgraft-patches_testscripts/', '#kernel_src_dir': 'kernel-src/', '#ccp_pol_dir': 'kgr-scripts/ccp-pol/'} config['Settings'] = {'workers': 4} logging.info(f"Creating default user configuration: '{self.user_conf_file}'") os.makedirs(os.path.dirname(self.user_conf_file), exist_ok=True) with open(self.user_conf_file, 'w') as f: config.write(f) os.makedirs(workdir, exist_ok=True) os.makedirs(datadir, exist_ok=True) def load_user_conf(self): config = configparser.ConfigParser() logging.info(f"Loading user configuration from '{self.user_conf_file}'") config.read(self.user_conf_file) # Check mandatory fields for s in {'Paths', 'Settings'}: if s not in config: raise ValueError(f"config: '{s}' section not found") self.user_conf = config def get_user_path(self, entry, isdir=True, isopt=False): if entry not in self.user_conf['Paths']: if isopt: return "" raise ValueError(f"config: '{entry}' entry not found") p = Path(self.user_conf['Paths'][entry]) if not p.exists(): raise ValueError(f"'{p}' file or directory not found") if isdir and not p.is_dir(): raise ValueError("{p} should be a directory") if not isdir and not p.is_file(): raise ValueError("{p} should be a file") return p def get_user_settings(self, entry, isopt=False): if entry not in self.user_conf['Settings']: if isopt: return "" raise ValueError(f"config: '{entry}' entry not found") return self.user_conf['Settings'][entry] def lp_out_file(self, fname): fpath = f'{str(fname).replace("/", "_").replace("-", "_")}' return f"{self.lp_name}_{fpath}" def get_cs_dir(self, cs, app): return Path(self.lp_path, app, cs.name()) def get_work_dir(self, cs, fname, app): fpath = f'work_{str(fname).replace("/", "_")}' return Path(self.get_cs_dir(cs, app), fpath) # Return a Codestream object from the codestream name def get_cs(self, cs): return Codestream.from_data(self.data, self.codestreams[cs]) def validate_config(self, cs, conf, mod): """ Check if the CONFIG is enabled on the codestream. If the configuration entry is set as M, check if a module was specified (different from vmlinux). """ configs = {} name = cs.name() # Validate only the specified architectures, but check if the codestream # is supported on that arch (like RT that is currently supported only on # x86_64) for arch, conf_entry in cs.get_all_configs(conf).items(): if conf_entry == "m" and mod == "vmlinux": raise RuntimeError(f"{name}:{arch} ({cs.kernel}): Config {conf} is set as module, but no module was specified") elif conf_entry == "y" and mod != "vmlinux": raise RuntimeError(f"{name}:{arch} ({cs.kernel}): Config {conf} is set as builtin, but a module {mod} was specified") configs.setdefault(conf_entry, []) configs[conf_entry].append(f"{name}:{arch}") if len(configs.keys()) > 1: print(configs["y"]) print(configs["m"]) raise RuntimeError(f"Configuration mismtach between codestreams. Aborting.") def get_tests_path(self): self.kgraft_tests_path = self.get_user_path('kgr_patches_tests_dir') test_sh = Path(self.kgraft_tests_path, f"{self.lp_name}_test_script.sh") test_dir_sh = Path(self.kgraft_tests_path, f"{self.lp_name}/test_script.sh") if test_sh.is_file(): test_src = test_sh elif test_dir_sh.is_file(): # For more complex tests we support using a directory containing # as much files as needed. A `test_script.sh` is still required # as an entry point. test_src = Path(os.path.dirname(test_dir_sh)) else: raise RuntimeError(f"Couldn't find {test_sh} or {test_dir_sh}") return test_src # Update and save codestreams data def flush_cs_file(self, working_cs): for cs in working_cs: self.codestreams[cs.name()] = cs.data() with open(self.cs_file, "w") as f: f.write(json.dumps(self.codestreams, indent=4)) # This function can be called to get the path to a module that has symbols # that were externalized, so we need to find the path to the module as well. def get_module_obj(self, arch, cs, module): if not is_mod(module): return cs.get_boot_file("vmlinux", arch) obj = cs.modules.get(module, "") if not obj: obj = self.find_module_obj(arch, cs, module) return Path(cs.get_mod_path(arch), obj) # Return only the name of the module to be livepatched def find_module_obj(self, arch, cs, mod, check_support=False): assert mod != "vmlinux" # Module name use underscores, but the final module object uses hyphens. mod = mod.replace("_", "[-_]") mod_path = cs.get_mod_path(arch) with open(Path(mod_path, "modules.order")) as f: obj_match = re.search(rf"([\w\/\-]+\/{mod}.k?o)", f.read()) if not obj_match: raise RuntimeError(f"{cs.name()}-{arch} ({cs.kernel}): Module not found: {mod}") # modules.order will show the module with suffix .o, so # make sure the extension. Also check for multiple extensions since we # can have modules being compressed using different algorithms. for ext in [".ko", ".ko.zst", ".ko.gz"]: obj = str(PurePath(obj_match.group(1)).with_suffix(ext)) if Path(mod_path, obj).exists(): break if check_support: # Validate if the module being livepatches is supported or not elffile = get_elf_object(Path(mod_path, obj)) if "no" == get_elf_modinfo_entry(elffile, "supported"): print(f"WARN: {cs.name()}-{arch} ({cs.kernel}): Module {mod} is not supported by SLE") return obj # Return the codestreams list but removing already patched codestreams, # codestreams without file-funcs and not matching the filter def filter_cs(self, cs_list=None, verbose=False): if not cs_list: cs_list = self.codestreams_list full_cs = copy.deepcopy(cs_list) if verbose: logging.info("Checking filter and skips...") result = [] filtered = [] for cs in full_cs: name = cs.name() if self.filter and not re.match(self.filter, name): filtered.append(name) continue elif self.skips and re.match(self.skips, name): filtered.append(name) continue result.append(cs) if verbose: if filtered: logging.info("Skipping codestreams:") logging.info(f'\t{" ".join(classify_codestreams(filtered))}') return result # Cache the symbols using the object path. It differs for each # codestream and architecture # Return all the symbols not found per arch/obj def check_symbol(self, arch, cs, mod, symbols): name = cs.name() self.obj_symbols.setdefault(arch, {}) self.obj_symbols[arch].setdefault(name, {}) if not self.obj_symbols[arch][name].get(mod, ""): obj = self.get_module_obj(arch, cs, mod) self.obj_symbols[arch][name][mod] = get_all_symbols_from_object(obj, True) ret = [] for symbol in symbols: nsyms = self.obj_symbols[arch][name][mod].count(symbol) if nsyms == 0: ret.append(symbol) elif nsyms > 1: print(f"WARNING: {cs.name()}-{arch} ({cs.kernel}): symbol {symbol} duplicated on {mod}") # If len(syms) == 1 means that we found a unique symbol, which is # what we expect, and nothing need to be done. return ret # This functions is used to check if the symbols exist in the module they # we will livepatch. In this case skip_on_host argument will be false, # meaning that we want the symbol to checked against all supported # architectures before creating the livepatches. # # It is also used when we want to check if a symbol externalized in one # architecture exists in the other supported ones. In this case skip_on_host # will be True, since we trust the decisions made by the extractor tool. def check_symbol_archs(self, cs, mod, symbols, skip_on_host): arch_sym = {} # Validate only architectures supported by the codestream for arch in cs.archs: if arch == ARCH and skip_on_host: continue # Skip if the arch is not supported by the livepatch code if not arch in self.conf.get("archs"): continue # Assign the not found symbols on arch syms = self.check_symbol(arch, cs, mod, symbols) if syms: arch_sym[arch] = syms return arch_sym
12,413
Python
.py
252
38.797619
133
0.603922
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,636
ccp.py
SUSE_klp-build/klpbuild/ccp.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza <[email protected]> import os from pathlib import Path import shutil from klpbuild.config import Config from klpbuild.utils import ARCH, is_mod class CCP(Config): def __init__(self, lp_name, lp_filter, avoid_ext): super().__init__(lp_name, lp_filter) self.env = os.environ # List of symbols that are currently not resolvable for klp-ccp avoid_syms = [ "__xadd_wrong_size", "__bad_copy_from", "__bad_copy_to", "rcu_irq_enter_disabled", "rcu_irq_enter_irqson", "rcu_irq_exit_irqson", "verbose", "__write_overflow", "__read_overflow", "__read_overflow2", "__real_strnlen", "__real_strlcpy", "twaddle", "set_geometry", "valid_floppy_drive_params", "__real_memchr_inv", "__real_kmemdup", "lockdep_rtnl_is_held", "lockdep_rht_mutex_is_held", "debug_lockdep_rcu_enabled", "lockdep_rcu_suspicious", "rcu_read_lock_bh_held", "lock_acquire", "preempt_count_add", "rcu_read_lock_any_held", "preempt_count_sub", "lock_release", "trace_hardirqs_off", "trace_hardirqs_on", "debug_smp_processor_id", "lock_is_held_type", "mutex_lock_nested", "rcu_read_lock_held", "__bad_unaligned_access_size", "__builtin_alloca", "tls_validate_xmit_skb_sw", ] # The backlist tells the klp-ccp to always copy the symbol code, # instead of externalizing. This helps in cases where different archs # have different inline decisions, optimizing and sometimes removing the # symbols. if avoid_ext: avoid_syms.extend(avoid_ext) self.env["KCP_EXT_BLACKLIST"] = ",".join(avoid_syms) self.env["KCP_READELF"] = "readelf" self.env["KCP_RENAME_PREFIX"] = "klp" # Generate the list of exported symbols def get_symbol_list(self, out_dir): exts = [] for ext_file in ["fun_exts", "obj_exts"]: ext_path = Path(out_dir, ext_file) if not ext_path.exists(): continue with open(ext_path) as f: for l in f: l = l.strip() if not l.startswith("KALLSYMS") and not l.startswith("KLP_CONVERT"): continue _, sym, var, mod = l.split(" ") if not is_mod(mod): mod = "vmlinux" exts.append((sym, var, mod)) exts.sort(key=lambda tup: tup[0]) # store the externalized symbols and module used in this codestream file symbols = {} for ext in exts: sym, mod = ext[0], ext[2] symbols.setdefault(mod, []) symbols[mod].append(sym) return symbols def cmd_args(self, needs_ibt, cs, fname, funcs, out_dir, fdata, cmd): lp_name = self.lp_out_file(fname) lp_out = Path(out_dir, lp_name) ccp_args = [str(shutil.which("klp-ccp")) , "-P", "suse.KlpPolicy", "--compiler=x86_64-gcc-9.1.0", "-i", f"{funcs}", "-o", f"{str(lp_out)}", "--"] # -flive-patching and -fdump-ipa-clones are only present in upstream gcc # 15.4u0 options # -fno-allow-store-data-races and -Wno-zero-length-bounds # 15.4u1 options # -mindirect-branch-cs-prefix appear in 15.4u1 # more options to be removed # -mharden-sls=all # 15.6 options # -fmin-function-alignment=16 for opt in [ "-flive-patching=inline-clone", "-fdump-ipa-clones", "-fno-allow-store-data-races", "-Wno-zero-length-bounds", "-mindirect-branch-cs-prefix", "-mharden-sls=all", "-fmin-function-alignment=16", ]: cmd = cmd.replace(opt, "") if cs.sle >= 15 and cs.sp >= 4: cmd += " -D__has_attribute(x)=0" ccp_args.extend(cmd.split(" ")) ccp_args = list(filter(None, ccp_args)) # Needed, otherwise threads would interfere with each other env = self.env.copy() env["KCP_KLP_CONVERT_EXTS"] = "1" if needs_ibt else "0" env["KCP_MOD_SYMVERS"] = str(cs.get_boot_file("symvers")) env["KCP_KBUILD_ODIR"] = str(cs.get_odir()) env["KCP_PATCHED_OBJ"] = self.get_module_obj(ARCH, cs, fdata["module"]) env["KCP_KBUILD_SDIR"] = str(cs.get_sdir()) env["KCP_IPA_CLONES_DUMP"] = str(cs.get_ipa_file(fname)) env["KCP_WORK_DIR"] = str(out_dir) return ccp_args, env
4,970
Python
.py
124
28.919355
88
0.536085
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,637
templ.py
SUSE_klp-build/klpbuild/templ.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza <[email protected]> import shutil from datetime import datetime from pathlib import Path from mako.lookup import TemplateLookup from mako.template import Template from klpbuild.config import Config from klpbuild.utils import ARCH, ARCHS, is_mod TEMPL_H = """\ #ifndef _${ fname.upper() }_H #define _${ fname.upper() }_H % if check_enabled: #if IS_ENABLED(${ config }) % endif int ${ fname }_init(void); % if mod: void ${ fname }_cleanup(void); % else: static inline void ${ fname }_cleanup(void) {} % endif % % for p in proto_files: <%include file="${ p }"/> % endfor % if check_enabled: #else /* !IS_ENABLED(${ config }) */ % endif static inline int ${ fname }_init(void) { return 0; } static inline void ${ fname }_cleanup(void) {} % if check_enabled: #endif /* IS_ENABLED(${ config }) */ % endif #endif /* _${ fname.upper() }_H */ """ TEMPL_SUSE_HEADER = """\ <% def get_commits(cmts, cs): if not cmts.get(cs, ''): return ' * Not affected' ret = [] for commit, msg in cmts[cs].items(): if not msg: ret.append(' * Not affected') else: for m in msg: ret.append(f' * {m}') return "\\n".join(ret) %>\ /* * ${fname} * * Fix for CVE-${cve}, bsc#${lp_num} * % if include_header: * Upstream commit: ${get_commits(commits, 'upstream')} * * SLE12-SP5 commit: ${get_commits(commits, '12.5')} * * SLE15-SP2 and -SP3 commit: ${get_commits(commits, 'cve-5.3')} * * SLE15-SP4 and -SP5 commit: ${get_commits(commits, '15.4')} * * SLE15-SP6 commit: ${get_commits(commits, '15.6')} * % endif * Copyright (c) ${year} SUSE * Author: ${ user } <${ email }> * * Based on the original Linux kernel code. Other copyrights apply. * * 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, see <http://www.gnu.org/licenses/>. */ """ TEMPL_KLP_LONE_FILE = """\ <%include file="${ inc_src_file }"/> #include <linux/livepatch.h> % for obj, funcs in klp_objs.items(): static struct klp_func _${ obj }_funcs[] = { % for func in funcs: { .old_name = "${ func }", .new_func = klpp_${ func }, }, % endfor % endfor {} }; static struct klp_object objs[] = { % for obj, _ in klp_objs.items(): { %if obj != "vmlinux": .name = "${ obj }", %endif .funcs = _${ obj }_funcs }, % endfor {} }; static struct klp_patch patch = { .mod = THIS_MODULE, .objs = objs, }; static int ${ fname }_init(void) { return klp_enable_patch(&patch); } static void ${ fname }_cleanup(void) { } module_init(${ fname }_init); module_exit(${ fname }_cleanup); MODULE_LICENSE("GPL"); MODULE_INFO(livepatch, "Y"); """ TEMPL_GET_EXTS = """\ <% def get_exts(app, ibt_mod, ext_vars): # CE doesn't need any additional externalization if ibt_mod and app == 'ce': return '' ext_list = [] for obj, syms in ext_vars.items(): if obj == 'vmlinux': mod = '' else: mod = obj # ibt_mod is only used with IBT if not ibt_mod: for sym in syms: lsym = f'\\t{{ "{sym}",' prefix_var = f'klpe_{sym}' if not mod: var = f' (void *)&{prefix_var} }},' else: var = f' (void *)&{prefix_var},' mod = f' "{obj}" }},' # 73 here is because a tab is 8 spaces, so 72 + 8 == 80, which is # our goal when splitting these lines if len(lsym + var + mod) < 73: ext_list.append(lsym + var + mod) elif len(lsym + var) < 73: ext_list.append(lsym + var) if mod: ext_list.append('\\t ' + mod) else: ext_list.append(lsym) if len(var + mod) < 73: ext_list.append(f'\\t {var}{mod}') else: ext_list.append(f'\\t {var}') if mod: ext_list.append(f'\\t {mod}') else: for sym in syms: start = f"extern typeof({sym})" lsym = f"{sym}" end = f"KLP_RELOC_SYMBOL({ibt_mod}, {obj}, {sym});" if len(start + lsym + end) < 80: ext_list.append(f"{start} {lsym} {end}") elif len(start + lsym) < 80: ext_list.append(f"{start} {lsym}") ext_list.append(f"\\t {end}") else: ext_list.append(start) if len(lsym + end) < 80: ext_list.append(f"\\t {lsym} {end}") else: ext_list.append(f"\\t {lsym}") ext_list.append(f"\\t {end}") return '\\n#include <linux/livepatch.h>\\n\\n' + '\\n'.join(ext_list) %> """ TEMPL_PATCH_VMLINUX = """\ % if check_enabled: #if IS_ENABLED(${ config }) % endif # check_enabled <%include file="${ inc_src_file }"/> #include "livepatch_${ lp_name }.h" % if ext_vars: % if ibt: ${get_exts(app, "vmlinux", ext_vars)} % else: # ibt #include <linux/kernel.h> #include "../kallsyms_relocs.h" static struct klp_kallsyms_reloc klp_funcs[] = { ${get_exts(app, "", ext_vars)} }; int ${ fname }_init(void) { % if mod_mutex: return __klp_resolve_kallsyms_relocs(klp_funcs, ARRAY_SIZE(klp_funcs)); % else: # mod_mutex return klp_resolve_kallsyms_relocs(klp_funcs, ARRAY_SIZE(klp_funcs)); % endif # mod_mutex } % endif # ibt % endif # ext_vars % if check_enabled: #endif /* IS_ENABLED(${ config }) */ % endif # check_enabled """ TEMPL_PATCH_MODULE = """\ % if check_enabled: #if IS_ENABLED(${ config }) #if !IS_MODULE(${ config }) #error "Live patch supports only CONFIG=m" #endif % endif # check_enabled <%include file="${ inc_src_file }"/> #include "livepatch_${ lp_name }.h" % if ext_vars: % if ibt: ${get_exts(app, mod, ext_vars)} % else: # ibt #include <linux/kernel.h> #include <linux/module.h> #include "../kallsyms_relocs.h" #define LP_MODULE "${ mod }" static struct klp_kallsyms_reloc klp_funcs[] = { ${get_exts(app, "", ext_vars)} }; static int module_notify(struct notifier_block *nb, unsigned long action, void *data) { struct module *mod = data; int ret; if (action != MODULE_STATE_COMING || strcmp(mod->name, LP_MODULE)) return 0; % if mod_mutex: mutex_lock(&module_mutex); ret = __klp_resolve_kallsyms_relocs(klp_funcs, ARRAY_SIZE(klp_funcs)); mutex_unlock(&module_mutex); % else: # mod_mutex ret = klp_resolve_kallsyms_relocs(klp_funcs, ARRAY_SIZE(klp_funcs)); % endif # mod_mutex WARN(ret, "%s: delayed kallsyms lookup failed. System is broken and can crash.\\n", __func__); return ret; } static struct notifier_block module_nb = { .notifier_call = module_notify, .priority = INT_MIN+1, }; int ${ fname }_init(void) { int ret; % if mod_mutex: mutex_lock(&module_mutex); if (find_module(LP_MODULE)) { ret = __klp_resolve_kallsyms_relocs(klp_funcs, ARRAY_SIZE(klp_funcs)); if (ret) goto out; } ret = register_module_notifier(&module_nb); out: mutex_unlock(&module_mutex); return ret; % else: # mod_mutex struct module *mod; ret = klp_kallsyms_relocs_init(); if (ret) return ret; ret = register_module_notifier(&module_nb); if (ret) return ret; rcu_read_lock_sched(); mod = (*klpe_find_module)(LP_MODULE); if (!try_module_get(mod)) mod = NULL; rcu_read_unlock_sched(); if (mod) { ret = klp_resolve_kallsyms_relocs(klp_funcs, ARRAY_SIZE(klp_funcs)); } if (ret) unregister_module_notifier(&module_nb); module_put(mod); return ret; % endif # mod_mutex } void ${ fname }_cleanup(void) { unregister_module_notifier(&module_nb); } % endif # ibt % endif # ext_vars % if check_enabled: #endif /* IS_ENABLED(${ config }) */ % endif # check_enabled """ TEMPL_HOLLOW = """\ % if check_enabled: #if IS_ENABLED(${ config }) % endif # check_enabled #include "livepatch_${ lp_name }.h" int ${ fname }_init(void) { \treturn 0; } void ${ fname }_cleanup(void) { } % if check_enabled: #endif /* IS_ENABLED(${ config }) */ % endif # check_enabled """ TEMPL_COMMIT = """\ Fix for CVE-${cve} ("CHANGE ME!") Live patch for CVE-${cve}. ${msg}: % for cmsg in commits: - ${cmsg} % endfor KLP: CVE-${cve} References: bsc#${ lp_name } CVE-${cve} Signed-off-by: ${user} <${email}> """ TEMPL_KBUILD = """\ <% from pathlib import PurePath def get_entries(lpdir, bsc, cs): ret = [] for entry in lpdir.iterdir(): fname = entry.name if not fname.endswith('.c'): continue # Add both the older and the new format to apply flags to objects fname = PurePath(fname).with_suffix('.o') ret.append(f'CFLAGS_{fname} += -Werror') fname = f'{bsc}/{fname}' ret.append(f'CFLAGS_{fname} += -Werror') return "\\n".join(ret) %>\ ${get_entries(lpdir, bsc, cs)} """ TEMPL_PATCHED = """\ <% def get_patched(cs_files, check_enabled): ret = [] for ffile, fdata in cs_files.items(): conf = '' if check_enabled and fdata['conf']: conf = f' IS_ENABLED({fdata["conf"]})' mod = fdata['module'].replace('-', '_') for func in fdata['symbols']: ret.append(f'{mod} {func} klpp_{func}{conf}') return "\\n".join(ret) %>\ ${get_patched(cs_files, check_enabled)} """ TEMPL_MAKEFILE = """\ KDIR := ${ kdir } MOD_PATH := ${ pwd } obj-m := ${ obj } CFLAGS_${ obj } = -Wno-missing-declarations -Wno-missing-prototypes modules: \tmake -C $(KDIR) modules M=$(MOD_PATH) clean: \tmake -C $(KDIR) clean M=$(MOD_PATH) """ class TemplateGen(Config): def __init__(self, lp_name, lp_filter, app="ccp"): super().__init__(lp_name, lp_filter) # Require the IS_ENABLED ifdef guard whenever we have a livepatch that # is not enabled on all architectures self.check_enabled = self.conf["archs"] != ARCHS self.app = app try: import git git_data = git.GitConfigParser() self.user = git_data.get_value("user", "name") self.email = git_data.get_value("user", "email") except: # it couldn't find the default user and email self.user = "Change me" self.email = "change@me" def preproc_slashes(text): txt = r"<%! BS='\\' %>" + text.replace("\\", "${BS}") return r"<%! HASH='##' %>" + txt.replace("##", "${HASH}") def fix_mod_string(self, mod): # Modules like snd-pcm needs to be replaced by snd_pcm in LP_MODULE # and in kallsyms lookup return mod.replace("-", "_") def GeneratePatchedFuncs(self, lp_path, cs_files): render_vars = {"cs_files": cs_files, "check_enabled": self.check_enabled} with open(Path(lp_path, "patched_funcs.csv"), "w") as f: f.write(Template(TEMPL_PATCHED).render(**render_vars)) def get_work_dirname(self, fname): return f'work_{str(fname).replace("/", "_")}' def __GenerateHeaderFile(self, lp_path, cs): out_name = f"livepatch_{self.lp_name}.h" lp_inc_dir = Path() proto_files = [] configs = set() config = "" mod = "" for f, data in cs.files.items(): configs.add(data["conf"]) # At this point we only care to know if we are livepatching a module # or not, so we can overwrite the module. mod = data["module"] if self.app == "ce": proto_files.append(str(Path(self.get_work_dirname(f), "proto.h"))) # Only add the inc_dir if CE is used, since it's the only backend that # produces the proto.h headers if len(proto_files) > 0: lp_inc_dir = self.get_cs_dir(cs, self.app) # Only populate the config check in the header if the livepatch is # patching code under only one config. Otherwise let the developer to # fill it. if len(configs) == 1: config = configs.pop() render_vars = { "fname": str(Path(out_name).with_suffix("")).replace("-", "_"), "check_enabled": self.check_enabled, "proto_files": proto_files, "config": config, "mod": mod, } with open(Path(lp_path, out_name), "w") as f: lpdir = TemplateLookup(directories=[lp_inc_dir], preprocessor=TemplateGen.preproc_slashes) f.write(Template(TEMPL_H, lookup=lpdir).render(**render_vars)) def __BuildKlpObjs(self, cs, src): objs = {} for src_file, fdata in cs.files.items(): if src and src != src_file: continue mod = fdata["module"].replace("-", "_") objs.setdefault(mod, []) objs[mod].extend(fdata["symbols"]) return objs def __GenerateLivepatchFile(self, lp_path, cs, src_file, use_src_name=False): if src_file: lp_inc_dir = str(self.get_work_dir(cs, src_file, self.app)) lp_file = self.lp_out_file(src_file) fdata = cs.files[str(src_file)] mod = self.fix_mod_string(fdata["module"]) if not is_mod(mod): mod = "" fconf = fdata["conf"] exts = fdata["ext_symbols"] ibt = fdata.get("ibt", False) else: lp_inc_dir = Path("non-existent") lp_file = None mod = "" fconf = "" exts = {} ibt = False # if use_src_name is True, the final file will be: # bscXXXXXXX_{src_name}.c # else: # livepatch_bscXXXXXXXX.c if use_src_name: out_name = lp_file else: out_name = f"livepatch_{self.lp_name}.c" render_vars = { "include_header": "livepatch_" in out_name, "cve": self.conf.get("cve", "XXXX-XXXX"), "lp_name": self.lp_name, "lp_num": self.lp_name.replace("bsc", ""), "fname": str(Path(out_name).with_suffix("")).replace("-", "_"), "year": datetime.today().year, "user": self.user, "email": self.email, "config": fconf, "mod": mod, "mod_mutex": cs.is_mod_mutex(), "check_enabled": self.check_enabled, "ext_vars": exts, "inc_src_file": lp_file, "ibt": ibt, "app": self.app, } render_vars['commits'] = self.conf["commits"] with open(Path(lp_path, out_name), "w") as f: lpdir = TemplateLookup(directories=[lp_inc_dir], preprocessor=TemplateGen.preproc_slashes) # For C files, first add the LICENSE header template to the file f.write(Template(TEMPL_SUSE_HEADER, lookup=lpdir).render(**render_vars)) # If we have multiple source files for the same livepatch, # create one hollow file to wire-up the multiple _init and # _clean functions # # If we are patching a module, we should have the # module_notifier armed to signal whenever the module comes on # in order to do the symbol lookups. Otherwise only _init is # needed, and only if there are externalized symbols being used. if not lp_file: temp_str = TEMPL_HOLLOW elif mod: temp_str = TEMPL_GET_EXTS + TEMPL_PATCH_MODULE else: temp_str = TEMPL_GET_EXTS + TEMPL_PATCH_VMLINUX f.write(Template(temp_str, lookup=lpdir).render(**render_vars)) def get_cs_lp_dir(self, cs): return Path(self.get_cs_dir(cs, self.app), "lp") def CreateMakefile(self, cs, fname, final): if not final: work_dir = self.get_work_dir(cs, fname, self.app) obj = "livepatch.o" lp_path = Path(work_dir, "livepatch.c") # Add more data to make it compile correctly shutil.copy(Path(work_dir, self.lp_out_file(fname)), lp_path) with open(lp_path, "a") as f: f.write('#include <linux/module.h>\nMODULE_LICENSE("GPL");') else: work_dir = self.get_cs_lp_dir(cs) obj = f"livepatch_{self.lp_name}.o" render_vars = {"kdir": cs.get_kernel_build_path(ARCH), "pwd": work_dir, "obj": obj} with open(Path(work_dir, "Makefile"), "w") as f: f.write(Template(TEMPL_MAKEFILE).render(**render_vars)) def GenerateLivePatches(self, cs): lp_path = self.get_cs_lp_dir(cs) lp_path.mkdir(exist_ok=True) files = cs.files is_multi_files = len(files.keys()) > 1 self.GeneratePatchedFuncs(lp_path, files) # If there are more then one source file, we cannot fully infer what are # the correct configs and mods to be livepatched, so leave the mod and # config entries empty self.__GenerateHeaderFile(lp_path, cs) # Run the template engine for each touched source file. for src_file, _ in files.items(): self.__GenerateLivepatchFile(lp_path, cs, src_file, is_multi_files) # One additional file to encapsulate the _init and _clenaup methods # of the other source files if is_multi_files: self.__GenerateLivepatchFile(lp_path, cs, None, False) # Create Kbuild.inc file adding an entry for all generated livepatch files. def CreateKbuildFile(self, cs): lpdir = self.get_cs_lp_dir(cs) render_vars = {"bsc": self.lp_name, "cs": cs, "lpdir": lpdir} with open(Path(lpdir, "Kbuild.inc"), "w") as f: f.write(Template(TEMPL_KBUILD).render(**render_vars)) def generate_commit_msg_file(self): cmts = self.conf["commits"].get("upstream", {}) if cmts: cmts = cmts["commits"] render_vars = { "lp_name": self.lp_name.replace("bsc", ""), "user": self.user, "email": self.email, "cve": self.conf.get("cve", "XXXX-XXXX"), "commits": cmts, "msg": "Upstream commits" if len(cmts) > 1 else "Upstream commit", } with open(Path(self.lp_path, "commit.msg"), "w") as f: f.write(Template(TEMPL_COMMIT).render(**render_vars))
19,282
Python
.py
567
26.897707
102
0.570614
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,638
ce.py
SUSE_klp-build/klpbuild/ce.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza <[email protected]> import shutil from pathlib import Path from klpbuild.config import Config from klpbuild.utils import ARCH class CE(Config): def __init__(self, lp_name, lp_filter, avoid_ext, ignore_errors): super().__init__(lp_name, lp_filter) self.app = "ce" self.avoid_externalize = avoid_ext self.ignore_errors = ignore_errors self.ce_path = shutil.which("clang-extract") if not self.ce_path: raise RuntimeError("clang-extract not found. Aborting.") # Check if the extract command line is compilable with gcc # Generate the list of exported symbols def get_symbol_list(self, out_dir): exts = [] dsc_out = Path(out_dir, "lp.dsc") with open(dsc_out) as f: for l in f: l = l.strip() if l.startswith("#"): mod = "vmlinux" if l.count(":") == 2: sym, _, mod = l.replace("#", "").split(":") else: sym, _ = l.replace("#", "").split(":") exts.append((sym, mod)) exts.sort(key=lambda tup: tup[0]) # store the externalized symbols and module used in this codestream file symbols = {} for ext in exts: sym, mod = ext symbols.setdefault(mod, []) symbols[mod].append(sym) return symbols def cmd_args(self, needs_ibt, cs, fname, funcs, out_dir, fdata, cmd): ce_args = [self.ce_path] ce_args.extend(cmd.split(" ")) if self.avoid_externalize: funcs += "," + ",".join(self.avoid_externalize) ce_args = list(filter(None, ce_args)) # Now add the macros to tell clang-extract what to do ce_args.extend( [ f'-DCE_DEBUGINFO_PATH={self.get_module_obj(ARCH, cs, fdata["module"])}', f'-DCE_SYMVERS_PATH={cs.get_boot_file("symvers")}', f"-DCE_OUTPUT_FILE={Path(out_dir, self.lp_out_file(fname))}", f'-DCE_OUTPUT_FUNCTION_PROTOTYPE_HEADER={Path(out_dir, "proto.h")}', f'-DCE_DSC_OUTPUT={Path(out_dir, "lp.dsc")}', f"-DCE_EXTRACT_FUNCTIONS={funcs}", ] ) if needs_ibt: ce_args.extend(["-D__USE_IBT__"]) # clang-extract works without ipa-clones, so don't hard require it ipa_f = cs.get_ipa_file(fname) if ipa_f.exists(): ce_args.extend([f"-DCE_IPACLONES_PATH={ipa_f}"]) # Keep includes is necessary so don't end up expanding all headers, # generating a huge amount of code. This only makes sense for the # kernel so far. ce_args.extend(["-DCE_KEEP_INCLUDES", "-DCE_RENAME_SYMBOLS", "-DCE_LATE_EXTERNALIZE"]) # For debug purposes. Uncomment for dumping clang-extract passes # ce_args.extend(['-DCE_DUMP_PASSES']) if self.ignore_errors: ce_args.extend(["-DCE_IGNORE_CLANG_ERRORS"]) return ce_args, None
3,176
Python
.py
72
33.472222
94
0.565542
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,639
utils.py
SUSE_klp-build/klpbuild/utils.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza <[email protected]> import gzip import io import platform from elftools.common.utils import bytes2str from elftools.elf.elffile import ELFFile from elftools.elf.sections import SymbolTableSection import lzma import zstandard ARCH = platform.processor() ARCHS = ["ppc64le", "s390x", "x86_64"] # Group all codestreams that share code in a format like bellow: # [15.2u10 15.2u11 15.3u10 15.3u12 ] # Will be converted to: # 15.2u10-11 15.3u10 15.3u12 # The returned value will be a list of lists, each internal list will # contain all codestreams which share the same code def classify_codestreams(cs_list): # Group all codestreams that share the same codestream by a new dict # divided by the SLE version alone, making it easier to process # later cs_group = {} for cs in cs_list: if not isinstance(cs, str): cs = cs.name() prefix, up = cs.split("u") if not cs_group.get(prefix, ""): cs_group[prefix] = [int(up)] else: cs_group[prefix].append(int(up)) ret_list = [] for cs, ups in cs_group.items(): if len(ups) == 1: ret_list.append(f"{cs}u{ups[0]}") continue sim = [] while len(ups): if not sim: sim.append(ups.pop(0)) continue cur = ups.pop(0) last_item = sim[len(sim) - 1] if last_item + 1 <= cur: sim.append(cur) continue # they are different, print them if len(sim) == 1: ret_list.append(f"{cs}u{sim[0]}") else: ret_list.append(f"{cs}u{sim[0]}-{last_item}") sim = [cur] # Loop finished, check what's in similar list to print if len(sim) == 1: ret_list.append(f"{cs}u{sim[0]}") elif len(sim) > 1: last_item = sim[len(sim) - 1] ret_list.append(f"{cs}u{sim[0]}-{last_item}") return ret_list def is_mod(mod): return mod != "vmlinux" def get_elf_modinfo_entry(elffile, conf): sec = elffile.get_section_by_name(".modinfo") if not sec: return None # Iterate over all info on modinfo section for line in bytes2str(sec.data()).split("\0"): if line.startswith(conf): key, val = line.split("=") return val.strip() return "" def get_elf_object(obj): with open(obj, "rb") as f: data = f.read() # FIXME: use magic lib instead of checking the file extension if str(obj).endswith(".gz"): io_bytes = io.BytesIO(gzip.decompress(data)) elif str(obj).endswith(".zst"): dctx = zstandard.ZstdDecompressor() io_bytes = io.BytesIO(dctx.decompress(data)) elif str(obj).endswith(".xz"): io_bytes = io.BytesIO(lzma.decompress(data)) else: io_bytes = io.BytesIO(data) return ELFFile(io_bytes) # Load the ELF object and return all symbols def get_all_symbols_from_object(obj, defined): syms = [] for sec in get_elf_object(obj).iter_sections(): if not isinstance(sec, SymbolTableSection): continue if sec['sh_entsize'] == 0: continue for symbol in sec.iter_symbols(): # Somehow we end up receiving an empty symbol if not symbol.name: continue if str(symbol["st_shndx"]) == "SHN_UNDEF" and not defined: syms.append(symbol.name) elif str(symbol["st_shndx"]) != "SHN_UNDEF" and defined: syms.append(symbol.name) return syms
3,730
Python
.py
104
27.875
72
0.596662
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,640
ksrc.py
SUSE_klp-build/klpbuild/ksrc.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza <[email protected] import logging import re import shutil import subprocess import sys from datetime import datetime from pathlib import Path from pathlib import PurePath import git import requests from natsort import natsorted from klpbuild.codestream import Codestream from klpbuild.config import Config from klpbuild.ibs import IBS from klpbuild import utils class GitHelper(Config): def __init__(self, lp_name, lp_filter, data_dir=None, skips=""): super().__init__(lp_name, lp_filter, data_dir, skips) self.kern_src = self.get_user_path('kernel_src_dir', isopt=True) self.kernel_branches = { "12.5": "SLE12-SP5", "15.2": "SLE15-SP2-LTSS", "15.3": "SLE15-SP3-LTSS", "15.4": "SLE15-SP4-LTSS", "15.5": "SLE15-SP5", "15.5rt": "SLE15-SP5-RT", "15.6": "SLE15-SP6", "15.6rt": "SLE15-SP6-RT", "cve-5.3": "cve/linux-5.3-LTSS", "cve-5.14": "cve/linux-5.14-LTSS", } self.branches = [] self.kgr_patches = self.get_user_path('kgr_patches_dir', isopt=True) if not self.kgr_patches: logging.warning("kgr_patches_dir not found") else: # Filter only the branches related to this BSC repo = git.Repo(self.kgr_patches).branches for r in repo: if r.name.startswith(self.lp_name): self.branches.append(r.name) def get_cs_branch(self, cs): cs_sle, sp, cs_up, rt = cs.sle, cs.sp, cs.update, cs.rt if not self.kgr_patches: logging.warning("kgr_patches_dir not found") return "" branch_name = "" for branch in self.branches: # Check if the codestream is a rt one, and if yes, apply the correct # separator later on if rt and "rt" not in branch: continue separator = "u" if rt: separator = "rtu" # First check if the branch has more than code stream sharing # the same code for b in branch.replace(self.lp_name + "_", "").split("_"): # Only check the branches that are the same type of the branch # being searched. Only check RT branches if the codestream is a # RT one. if rt and "rtu" not in b: continue if not rt and "rtu" in b: continue sle, u = b.split(separator) if f"{cs_sle}.{sp}" != f"{sle}": continue # Get codestreams interval up = u down = u if "-" in u: down, up = u.split("-") # Codestream between the branch codestream interval if cs_up >= int(down) and cs_up <= int(up): branch_name = branch break # At this point we found a match for our codestream in # codestreams.json, but we may have a more specialized git # branch later one, like: # bsc1197597_12.4u21-25_15.0u25-28 # bsc1197597_15.0u25-28 # Since 15.0 SLE uses a different kgraft-patches branch to # be built on. In this case, we continue to loop over the # other branches. return branch_name def format_patches(self, version): ver = f"v{version}" # index 1 will be the test file index = 2 if not self.kgr_patches: logging.warning("kgr_patches_dir not found, patches will be incomplete") # Remove dir to avoid leftover patches with different names patches_dir = Path(self.lp_path, "patches") shutil.rmtree(patches_dir, ignore_errors=True) test_src = self.get_tests_path() subprocess.check_output( [ "/usr/bin/git", "-C", str(self.kgraft_tests_path), "format-patch", "-1", f"{test_src}", "--cover-letter", "--start-number", "1", "--subject-prefix", f"PATCH {ver}", "--output-directory", f"{patches_dir}", ] ) # Filter only the branches related to this BSC for branch in self.branches: print(branch) bname = branch.replace(self.lp_name + "_", "") bs = " ".join(bname.split("_")) bsc = self.lp_name.replace("bsc", "bsc#") prefix = f"PATCH {ver} {bsc} {bs}" subprocess.check_output( [ "/usr/bin/git", "-C", str(self.kgr_patches), "format-patch", "-1", branch, "--start-number", f"{index}", "--subject-prefix", f"{prefix}", "--output-directory", f"{patches_dir}", ] ) index += 1 # Currently this function returns the date of the patch and it's subject def get_commit_data(commit, savedir=None): req = requests.get(f"https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id={commit}") req.raise_for_status() # Save the upstream commit if requested if savedir: with open(Path(savedir, f"{commit}.patch"), "w") as f: f.write(req.text) # Search for Subject until a blank line, since commit messages can be # seen in multiple lines. msg = re.search(r"Subject: (.*?)(?:(\n\n))", req.text, re.DOTALL).group(1).replace("\n", "") # Sometimes the MIME-Version string comes right after the commit # message, so we should remove it as well if 'MIME-Version:' in msg: msg = re.sub(r"MIME-Version(.*)", "", msg) dstr = re.search(r"Date: ([\w\s,:]+)", req.text).group(1) d = datetime.strptime(dstr.strip(), "%a, %d %b %Y %H:%M:%S") return d, msg def get_commits(self, cve): if not self.kern_src: logging.info("kernel_src_dir not found, skip getting SUSE commits") return {} # ensure that the user informed the commits at least once per 'project' if not cve: logging.info(f"No CVE informed, skipping the processing of getting the patches.") return {} # Support CVEs from 2020 up to 2029 if not re.match(r"^202[0-9]-[0-9]{4,7}$", cve): logging.info(f"Invalid CVE number {cve}, skipping the processing of getting the patches.") return {} print("Fetching changes from all supported branches...") # Mount the command to fetch all branches for supported codestreams subprocess.check_output(["/usr/bin/git", "-C", self.kern_src, "fetch", "--quiet", "--tags", "origin"] + list(self.kernel_branches.values())) print("Getting SUSE fixes for upstream commits per CVE branch. It can take some time...") # Store all commits from each branch and upstream commits = {} # List of upstream commits, in creation date order ucommits = [] upatches = Path(self.lp_path, "upstream") upatches.mkdir(exist_ok=True, parents=True) # Get backported commits from all possible branches, in order to get # different versions of the same backport done in the CVE branches. # Since the CVE branch can be some patches "behind" the LTSS branch, # it's good to have both backports code at hand by the livepatch author for bc, mbranch in self.kernel_branches.items(): patches = [] commits[bc] = {"commits": []} try: patch_files = subprocess.check_output( ["/usr/bin/git", "-C", self.kern_src, "grep", "-l", f"CVE-{cve}", f"remotes/origin/{mbranch}"], stderr=subprocess.STDOUT, ).decode(sys.stdout.encoding) except subprocess.CalledProcessError: patch_files = "" # If we don't find any commits, add a note about it if not patch_files: continue # Prepare command to extract correct ordering of patches cmd = ["/usr/bin/git", "-C", self.kern_src, "grep", "-o", "-h"] for patch in patch_files.splitlines(): _, fname = patch.split(":") cmd.append("-e") cmd.append(fname) cmd += [f"remotes/origin/{mbranch}:series.conf"] # Now execute the command try: patch_files = subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode(sys.stdout.encoding) except subprocess.CalledProcessError: patch_files = "" # The command above returns a list of strings in the format # branch:file/path idx = 0 for patch in patch_files.splitlines(): if patch.strip().startswith("#"): continue idx += 1 branch_path = Path(self.lp_path, "fixes", bc) branch_path.mkdir(exist_ok=True, parents=True) pfile = subprocess.check_output( ["/usr/bin/git", "-C", self.kern_src, "show", f"remotes/origin/{mbranch}:{patch}"], stderr=subprocess.STDOUT, ).decode(sys.stdout.encoding) # removing the patches.suse dir from the filepath basename = PurePath(patch).name.replace(".patch", "") # Save the patch for later review from the livepatch developer with open(Path(branch_path, f"{idx:02d}-{basename}.patch"), "w") as f: f.write(pfile) # Get the upstream commit and save it. The Git-commit can be # missing from the patch if the commit is not backporting the # upstream fix, and is using a different way to mimic the fix. # In this case add a note for the livepatch author to fill the # blank when finishing the livepatch ups = "" m = re.search(r"Git-commit: ([\w]+)", pfile) if m: ups = m.group(1)[:12] # Aggregate all upstream fixes found if ups and ups not in ucommits: ucommits.append(ups) # Now get all commits related to that file on that branch, # including the "Refresh" ones. try: phashes = subprocess.check_output( [ "/usr/bin/git", "-C", self.kern_src, "log", "--no-merges", "--pretty=oneline", f"remotes/origin/{mbranch}", "--", patch, ], stderr=subprocess.STDOUT, ).decode("ISO-8859-1") except subprocess.CalledProcessError: print( f"File {fname} doesn't exists {mbranch}. It could " " be removed, so the branch is not affected by the issue." ) commits[bc]["commits"] = ["Not affected"] continue # Skip the Update commits, that only change the References tag for hash_entry in phashes.splitlines(): if "Update" in hash_entry and "patches.suse" in hash_entry: continue # Sometimes we can have a commit that touches two files. In # these cases we can have duplicated hash commits, since git # history for each individual file will show the same hash. # Skip if the same hash already exists. hash_commit = hash_entry.split(" ")[0] if hash_commit not in commits[bc]["commits"]: commits[bc]["commits"].append(hash_commit) # Grab each commits subject and date for each commit. The commit dates # will be used to sort the patches in the order they were # created/merged. ucommits_sort = [] for c in ucommits: d, msg = GitHelper.get_commit_data(c, upatches) ucommits_sort.append((d, c, msg)) ucommits_sort.sort() commits["upstream"] = {"commits": []} for d, c, msg in ucommits_sort: commits["upstream"]["commits"].append(f'{c} ("{msg}")') print("") for key, val in commits.items(): print(f"{key}") branch_commits = val["commits"] if not branch_commits: print("None") for c in branch_commits: print(c) print("") return commits def get_patched_tags(self, suse_commits): tag_commits = {} patched = [] total_commits = len(suse_commits) # Grab only the first commit, since they would be put together # in a release either way. The order of the array is backards, the # first entry will be the last patch found. for su in suse_commits: tag_commits[su] = [] tags = subprocess.check_output(["/usr/bin/git", "-C", self.kern_src, "tag", f"--contains={su}", "rpm-*"]) for tag in tags.decode().splitlines(): # Remove noise around the kernel version, like # rpm-5.3.18-150200.24.112--sle15-sp2-ltss-updates if "--" in tag: continue tag = tag.replace("rpm-", "") tag_commits.setdefault(tag, []) tag_commits[tag].append(su) # "patched branches" are those who contain all commits for tag, b in tag_commits.items(): if len(b) == total_commits: patched.append(tag) # remove duplicates return natsorted(list(set(patched))) def is_kernel_patched(self, kernel, suse_commits, cve): commits = [] ret = subprocess.check_output(["/usr/bin/git", "-C", self.kern_src, "log", f"--grep=CVE-{cve}", f"--tags=*rpm-{kernel}", "--pretty=format:\"%H\""]); for c in ret.decode().splitlines(): # Remove quotes for each commit hash commits.append(c.replace("\"", "")) # "patched kernels" are those who contain all commits. return len(suse_commits) == len(commits), commits def get_patched_kernels(self, codestreams, commits, cve): if not commits: return [] if not self.kern_src: logging.info("kernel_src_dir not found, skip getting SUSE commits") return [] if not cve: logging.info("No CVE informed, skipping the processing of getting the patched kernels.") return [] print("Searching for already patched codestreams...") kernels = [] for bc, _ in self.kernel_branches.items(): suse_commits = commits[bc]["commits"] if not suse_commits: continue # Get all the kernels/tags containing the commits in the main SLE # branch. This information alone is not reliable enough to decide # if a kernel is patched. suse_tags = self.get_patched_tags(suse_commits) # Proceed to analyse each codestream's kernel for cs in codestreams: if bc+'u' not in cs.name(): continue kernel = cs.kernel patched, kern_commits = self.is_kernel_patched(kernel, suse_commits, cve) if not patched and kernel not in suse_tags: continue print(f"\n{cs.name()} ({kernel}):") # If no patches/commits were found for this kernel, fallback to # the commits in the main SLE branch. In either case, we can # assume that this kernel is already patched. for c in kern_commits if patched else suse_commits: print(f"{c}") kernels.append(kernel) print("") # remove duplicates return natsorted(list(set(kernels))) @staticmethod def cs_is_affected(cs, cve, commits): # We can only check if the cs is affected or not if the CVE was informed # (so we can get all commits related to that specific CVE). Otherwise we # consider all codestreams as affected. if not cve: return True return len(commits[cs.name_cs()]["commits"]) > 0 @staticmethod def download_supported_file(data_path): logging.info("Downloading codestreams file") cs_url = "https://gitlab.suse.de/live-patching/sle-live-patching-data/raw/master/supported.csv" suse_cert = Path("/etc/ssl/certs/SUSE_Trust_Root.pem") if suse_cert.exists(): req = requests.get(cs_url, verify=suse_cert) else: req = requests.get(cs_url) # exit on error req.raise_for_status() first_line = True codestreams = [] for line in req.iter_lines(): # skip empty lines if not line: continue # skip file header if first_line: first_line = False continue # remove the last two columns, which are dates of the line # and add a fifth field with the forth one + rpm- prefix, and # remove the build counter number full_cs, proj, kernel_full, _, _ = line.decode("utf-8").strip().split(",") kernel = re.sub(r"\.\d+$", "", kernel_full) codestreams.append(Codestream.from_codestream(data_path, full_cs, proj, kernel)) return codestreams def scan(self, cve, conf, no_check): # Always get the latest supported.csv file and check the content # against the codestreams informed by the user all_codestreams = GitHelper.download_supported_file(self.data) if not cve: commits = {} patched_kernels = [] else: commits = self.get_commits(cve) patched_kernels = self.get_patched_kernels(all_codestreams, commits, cve) # list of codestreams that matches the file-funcs argument working_cs = [] patched_cs = [] unaffected_cs = [] data_missing = [] cs_missing = [] conf_not_set = [] if no_check: logging.info("Option --no-check was specified, checking all codestreams that are not filtered out...") for cs in all_codestreams: # Skip patched codestreams if not no_check: if cs.kernel in patched_kernels: patched_cs.append(cs.name()) continue if not GitHelper.cs_is_affected(cs, cve, commits): unaffected_cs.append(cs) continue # Set supported archs for the codestream # RT is supported only on x86_64 at the moment archs = ["x86_64"] if not cs.rt: archs.extend(["ppc64le", "s390x"]) cs.set_archs(archs) if not cs.get_boot_file("config").exists(): data_missing.append(cs) cs_missing.append(cs.name()) # recheck later if we can add the missing codestreams continue if conf and not cs.get_all_configs(conf): conf_not_set.append(cs) continue working_cs.append(cs) # Found missing cs data, downloading and extract if data_missing: logging.info("Download the necessary data from the following codestreams:") logging.info(f'\t{" ".join(cs_missing)}\n') IBS(self.lp_name, self.filter).download_cs_data(data_missing) logging.info("Done.") for cs in data_missing: # Ok, the downloaded codestream has the configuration set if cs.get_all_configs(conf): working_cs.append(cs) # Nope, the config is missing, so don't add it to working_cs else: conf_not_set.append(cs) if conf_not_set: cs_list = utils.classify_codestreams(conf_not_set) logging.info(f"Skipping codestreams without {conf} set:") logging.info(f'\t{" ".join(cs_list)}') if patched_cs: cs_list = utils.classify_codestreams(patched_cs) logging.info("Skipping already patched codestreams:") logging.info(f'\t{" ".join(cs_list)}') if unaffected_cs: cs_list = utils.classify_codestreams(unaffected_cs) logging.info("Skipping unaffected codestreams (missing backports):") logging.info(f'\t{" ".join(cs_list)}') # working_cs will contain the final dict of codestreams that wast set # by the user, avoid downloading missing codestreams that are not affected working_cs = self.filter_cs(working_cs, verbose=True) if not working_cs: logging.info("All supported codestreams are already patched. Exiting klp-build") sys.exit(0) logging.info("All affected codestreams:") cs_list = utils.classify_codestreams(working_cs) logging.info(f'\t{" ".join(cs_list)}') return commits, patched_cs, patched_kernels, working_cs
22,584
Python
.py
486
32.45679
116
0.535214
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,641
ibs.py
SUSE_klp-build/klpbuild/ibs.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza <[email protected]> import concurrent.futures import errno import logging import os import re import shutil import subprocess import sys import time from operator import itemgetter from pathlib import Path import pkg_resources import requests from lxml import etree from lxml.objectify import fromstring from lxml.objectify import SubElement from natsort import natsorted from osctiny import Osc from klpbuild.config import Config from klpbuild.utils import ARCH, ARCHS, get_all_symbols_from_object, get_elf_object, get_elf_modinfo_entry class IBS(Config): def __init__(self, lp_name, lp_filter): super().__init__(lp_name, lp_filter) self.osc = Osc(url="https://api.suse.de") self.ibs_user = self.osc.username self.prj_prefix = f"home:{self.ibs_user}:{self.lp_name}-klp" self.workers = int(self.get_user_settings("workers")) # Total number of work items self.total = 0 # Skip osctiny INFO messages logging.getLogger("osctiny").setLevel(logging.WARNING) def do_work(self, func, args): if len(args) == 0: return with concurrent.futures.ThreadPoolExecutor(max_workers=self.workers) as executor: results = executor.map(func, args) for result in results: if result: logging.error(result) # The projects has different format: 12_5u5 instead of 12.5u5 def get_projects(self): prjs = [] projects = self.osc.search.project(f"starts-with(@name, '{self.prj_prefix}')") for prj in projects.findall("project"): prj_name = prj.get("name") cs = self.convert_prj_to_cs(prj_name) if self.filter and not re.match(self.filter, cs): continue prjs.append(prj) return prjs def get_project_names(self): names = [] i = 1 for result in self.get_projects(): names.append((i, result.get("name"))) i += 1 return natsorted(names, key=itemgetter(1)) def delete_project(self, i, prj, verbose=True): try: ret = self.osc.projects.delete(prj, force=True) if type(ret) is not bool: logging.error(etree.tostring(ret)) raise ValueError(prj) except requests.exceptions.HTTPError as e: # project not found, no problem if e.response.status_code == 404: pass if verbose: logging.info(f"({i}/{self.total}) {prj} deleted") def delete_projects(self, prjs, verbose=True): for i, prj in prjs: self.delete_project(i, prj, verbose) def extract_rpms(self, args): i, cs, arch, rpm, dest = args # We don't need to extract the -extra packages for non x86_64 archs. # These packages are only needed to be uploaded to the kgr-test # repos, since they aren't published, but we need them for testing. if arch != "x86_64" and "-extra" in rpm: return path_dest = cs.get_data_dir(arch) path_dest.mkdir(exist_ok=True, parents=True) rpm_file = Path(dest, rpm) cmd = f"rpm2cpio {rpm_file} | cpio --quiet -uidm" subprocess.check_output(cmd, shell=True, cwd=path_dest) logging.info(f"({i}/{self.total}) extracted {cs.name()} {rpm}: ok") def download_and_extract(self, args): i, cs, _, _, arch, _, rpm, dest = args self.download_binary_rpms(args) # Do not extract kernel-macros rpm if "kernel-macros" not in rpm: self.extract_rpms((i, cs, arch, rpm, dest)) def download_cs_data(self, cs_list): rpms = [] i = 1 cs_data = { "kernel-default": r"(kernel-(default|rt)\-((livepatch|kgraft)?\-?devel)?\-?[\d\.\-]+.(s390x|x86_64|ppc64le).rpm)", "kernel-source": r"(kernel-(source|devel)(\-rt)?\-?[\d\.\-]+.noarch.rpm)", } logging.info("Getting list of files...") for cs in cs_list: prj = cs.project repo = cs.repo path_dest = Path(self.data, "kernel-rpms") path_dest.mkdir(exist_ok=True, parents=True) for arch in cs.archs: for pkg, regex in cs_data.items(): # RT kernels have different package names if cs.rt: if pkg == "kernel-default": pkg = "kernel-rt" elif pkg == "kernel-source": pkg = "kernel-source-rt" if repo != "standard": pkg = f"{pkg}.{repo}" ret = self.osc.build.get_binary_list(prj, repo, arch, pkg) for file in re.findall(regex, str(etree.tostring(ret))): # FIXME: adjust the regex to only deal with strings if isinstance(file, str): rpm = file else: rpm = file[0] # Download all packages for the HOST arch # For the others only download kernel-default if arch != ARCH and not re.search("kernel-default-\d", rpm): continue # Extract the source and kernel-devel in the current # machine arch to make it possible to run klp-build in # different architectures if "kernel-source" in rpm or "kernel-default-devel" in rpm: if arch != ARCH: continue rpms.append((i, cs, prj, repo, arch, pkg, rpm, path_dest)) i += 1 logging.info(f"Downloading {len(rpms)} rpms...") self.total = len(rpms) self.do_work(self.download_and_extract, rpms) # Create a list of paths pointing to lib/modules for each downloaded # codestream for cs in cs_list: for arch in cs.archs: # Extract modules and vmlinux files that are compressed mod_path = Path(cs.get_data_dir(arch), "lib", "modules", cs.kname()) for fext, ecmd in [("zst", "unzstd -f -d"), ("xz", "xz --quiet -d -k")]: cmd = rf'find {mod_path} -name "*ko.{fext}" -exec {ecmd} --quiet {{}} \;' subprocess.check_output(cmd, shell=True) # Extract gzipped files per arch files = ["vmlinux", "symvers"] for f in files: f_path = Path(cs.get_data_dir(arch), "boot", f"{f}-{cs.kname()}.gz") # ppc64le doesn't gzips vmlinux if f_path.exists(): subprocess.check_output(rf'gzip -k -d -f {f_path}', shell=True) # Use the SLE .config shutil.copy(cs.get_boot_file("config"), Path(cs.get_odir(), ".config")) # Recreate the build link to enable us to test the generated LP mod_path = cs.get_kernel_build_path(ARCH) mod_path.unlink() os.symlink(cs.get_odir(), mod_path) # Create symlink from lib to usr/lib so we can use virtme on the # extracted kernels usr_lib = Path(self.data, ARCH, "usr", "lib") if not usr_lib.exists(): usr_lib.symlink_to(Path(self.data, ARCH, "lib")) logging.info("Finished extract vmlinux and modules...") def download_binary_rpms(self, args): i, cs, prj, repo, arch, pkg, rpm, dest = args try: self.osc.build.download_binary(prj, repo, arch, pkg, rpm, dest) logging.info(f"({i}/{self.total}) {cs.name()} {rpm}: ok") except OSError as e: if e.errno == errno.EEXIST: logging.info(f"({i}/{self.total}) {cs.name()} {rpm}: already downloaded. skipping.") else: raise RuntimeError(f"download error on {prj}: {rpm}") def convert_prj_to_cs(self, prj): return prj.replace(f"{self.prj_prefix}-", "").replace("_", ".") def find_missing_symbols(self, cs, arch, lp_mod_path): vmlinux_path = cs.get_boot_file("vmlinux", arch) vmlinux_syms = get_all_symbols_from_object(vmlinux_path, True) # Get list of UNDEFINED symbols from the livepatch module lp_und_symbols = get_all_symbols_from_object(lp_mod_path, False) missing_syms = [] # Find all UNDEFINED symbols that exists in the livepatch module that # aren't defined in the vmlinux for sym in lp_und_symbols: if sym not in vmlinux_syms: missing_syms.append(sym) return missing_syms def validate_livepatch_module(self, cs, arch, rpm_dir, rpm): match = re.search(r"(livepatch)-.*(default|rt)\-(\d+)\-(\d+)\.(\d+)\.(\d+)\.", rpm) if match: dir_path = match.group(1) ktype = match.group(2) lp_file = f"livepatch-{match.group(3)}-{match.group(4)}_{match.group(5)}_{match.group(6)}.ko" else: ktype = "default" match = re.search(r"(kgraft)\-patch\-.*default\-(\d+)\-(\d+)\.(\d+)\.", rpm) if match: dir_path = match.group(1) lp_file = f"kgraft-patch-{match.group(2)}-{match.group(3)}_{match.group(4)}.ko" fdest = Path(rpm_dir, rpm) # Extract the livepatch module for later inspection cmd = f"rpm2cpio {fdest} | cpio --quiet -uidm" subprocess.check_output(cmd, shell=True, cwd=rpm_dir) # Check depends field # At this point we found that our livepatch module depends on # exported functions from other modules. List the modules here. lp_mod_path = Path(rpm_dir, "lib", "modules", f"{cs.kernel}-{ktype}", dir_path, lp_file) elffile = get_elf_object(lp_mod_path) deps = get_elf_modinfo_entry(elffile, "depends") if len(deps): logging.warning(f"{cs.name()}:{arch} has dependencies: {deps}.") funcs = self.find_missing_symbols(cs, arch, lp_mod_path) if funcs: logging.warning(f'{cs.name()}:{arch} Undefined functions: {" ".join(funcs)}') shutil.rmtree(Path(rpm_dir, "lib"), ignore_errors=True) def prepare_tests(self): # Download all built rpms self.download() test_src = self.get_tests_path() run_test = pkg_resources.resource_filename("scripts", "run-kgr-test.sh") logging.info(f"Validating the downloaded RPMs...") for arch in ARCHS: tests_path = Path(self.lp_path, "tests", arch) test_arch_path = Path(tests_path, self.lp_name) # Remove previously created directory and archive shutil.rmtree(test_arch_path, ignore_errors=True) shutil.rmtree(f"{str(test_arch_path)}.tar.xz", ignore_errors=True) test_arch_path.mkdir(exist_ok=True, parents=True) shutil.copy(run_test, test_arch_path) for d in ["built", "repro", "tests.out"]: Path(test_arch_path, d).mkdir(exist_ok=True) logging.info(f"Checking {arch} symbols...") build_cs = [] for cs in self.filter_cs(): if arch not in cs.archs: continue rpm_dir = Path(self.lp_path, "ccp", cs.name(), arch, "rpm") if not rpm_dir.exists(): logging.info(f"{cs.name()}/{arch}: rpm dir not found. Skipping.") continue # TODO: there will be only one rpm, format it directly rpm = os.listdir(rpm_dir) if len(rpm) > 1: raise RuntimeError(f"ERROR: {cs.name()}/{arch}. {len(rpm)} rpms found. Excepting to find only one") for rpm in os.listdir(rpm_dir): # Check for dependencies self.validate_livepatch_module(cs, arch, rpm_dir, rpm) shutil.copy(Path(rpm_dir, rpm), Path(test_arch_path, "built")) if cs.rt and arch != "x86_64": continue build_cs.append(cs.name_full()) logging.info("Done.") # Prepare the config and test files used by kgr-test test_dst = Path(test_arch_path, f"repro/{self.lp_name}") if test_src.is_file(): shutil.copy(test_src, f"{test_dst}_test_script.sh") config = f"{test_dst}_config.in" else: # Alternatively, we create test_dst as a directory containing # at least a test_script.sh and a config.in shutil.copytree(test_src, test_dst) config = Path(test_dst, "config.in") with open(config, "w") as f: f.write("\n".join(natsorted(build_cs))) logging.info(f"Creating {arch} tar file...") subprocess.run( ["tar", "-cJf", f"{self.lp_name}.tar.xz", f"{self.lp_name}"], cwd=tests_path, stdout=sys.stdout, stderr=subprocess.PIPE, check=True, ) logging.info("Done.") # We can try delete a project that was removed, so don't bother with errors def delete_rpms(self, cs): try: for arch in cs.archs: shutil.rmtree(Path(self.lp_path, "ccp", cs.name(), arch, "rpm"), ignore_errors=True) except KeyError: pass def download(self): rpms = [] i = 1 for result in self.get_projects(): prj = result.get("name") cs_name = self.convert_prj_to_cs(prj) cs = self.get_cs(cs_name) # Remove previously downloaded rpms self.delete_rpms(cs) archs = result.xpath("repository/arch") for arch in archs: ret = self.osc.build.get_binary_list(prj, "devbuild", arch, "klp") rpm_name = f"{arch}.rpm" for rpm in ret.xpath("binary/@filename"): if not rpm.endswith(rpm_name): continue if "preempt" in rpm: continue # Create a directory for each arch supported dest = Path(self.lp_path, "ccp", cs.name(), str(arch), "rpm") dest.mkdir(exist_ok=True, parents=True) rpms.append((i, cs, prj, "devbuild", arch, "klp", rpm, dest)) i += 1 logging.info(f"Downloading {len(rpms)} packages...") self.total = len(rpms) self.do_work(self.download_binary_rpms, rpms) logging.info(f"Download finished.") def status(self, wait=False): finished_prj = [] while True: prjs = {} for _, prj in self.get_project_names(): if prj in finished_prj: continue prjs[prj] = {} for res in self.osc.build.get(prj).findall("result"): if not res.xpath("status/@code"): continue code = res.xpath("status/@code")[0] prjs[prj][res.get("arch")] = code print(f"{len(prjs)} codestreams to finish") for prj, archs in prjs.items(): st = [] finished = False # Save the status of all architecture build, and set to fail if # an error happens in any of the supported architectures for k, v in archs.items(): st.append(f"{k}: {v}") if v in ["unresolvable", "failed"]: finished = True # Only set finished is all architectures supported by the # codestreams built without issues if not finished: states = set(archs.values()) if len(states) == 1 and states.pop() == "succeeded": finished = True if finished: finished_prj.append(prj) logging.info("{}\t{}".format(prj, "\t".join(st))) for p in finished_prj: prjs.pop(p, None) if not wait or not prjs: break # Wait 30 seconds before getting status again time.sleep(30) logging.info("") def cleanup(self): prjs = self.get_project_names() self.total = len(prjs) if self.total == 0: logging.info("No projects found.") return logging.info(f"Deleting {self.total} projects...") self.delete_projects(prjs, True) def cs_to_project(self, cs): return self.prj_prefix + "-" + cs.name().replace(".", "_") def create_prj_meta(self, cs): prj = fromstring( "<project name=''><title></title><description></description>" "<build><enable/></build><publish><disable/></publish>" "<debuginfo><disable/></debuginfo>" '<repository name="devbuild">' f"<path project=\"{cs.project}\" repository=\"{cs.repo}\"/>" "</repository>" "</project>" ) repo = prj.find("repository") for arch in cs.archs: ar = SubElement(repo, "arch") ar._setText(arch) return prj def create_lp_package(self, i, cs): # get the kgraft branch related to this codestream from klpbuild.ksrc import GitHelper branch = GitHelper(self.lp_name, self.filter).get_cs_branch(cs) if not branch: logging.info(f"Could not find git branch for {cs.name()}. Skipping.") return logging.info(f"({i}/{self.total}) pushing {cs.name()} using branch {branch}...") # If the project exists, drop it first prj = self.cs_to_project(cs) self.delete_project(i, prj, verbose=False) meta = self.create_prj_meta(cs) prj_desc = f"Development of livepatches for {cs.name()}" try: self.osc.projects.set_meta( prj, metafile=meta, title="", bugowner=self.ibs_user, maintainer=self.ibs_user, description=prj_desc ) self.osc.packages.set_meta(prj, "klp", title="", description="Test livepatch") except Exception as e: logging.error(e, e.response.content) raise RuntimeError("") base_path = Path(self.lp_path, "ccp", cs.name()) # Remove previously created directories prj_path = Path(base_path, "checkout") if prj_path.exists(): shutil.rmtree(prj_path) code_path = Path(base_path, "code") if code_path.exists(): shutil.rmtree(code_path) self.osc.packages.checkout(prj, "klp", prj_path) kgraft_path = self.get_user_path('kgr_patches_dir') # Get the code from codestream subprocess.check_output( ["/usr/bin/git", "clone", "--single-branch", "-b", branch, str(kgraft_path), str(code_path)], stderr=subprocess.STDOUT, ) # Check if the directory related to this bsc exists. # Otherwise only warn the caller about this fact. # This scenario can occur in case of LPing function that is already # part of different LP in which case we modify the existing one. if self.lp_name not in os.listdir(code_path): logging.warning(f"Warning: Directory {self.lp_name} not found on branch {branch}") # Fix RELEASE version with open(Path(code_path, "scripts", "release-version.sh"), "w") as f: ver = cs.name_full().replace("EMBARGO", "") f.write(f"RELEASE={ver}") subprocess.check_output( ["bash", "./scripts/tar-up.sh", "-d", str(prj_path)], stderr=subprocess.STDOUT, cwd=code_path ) shutil.rmtree(code_path) # Add all files to the project, commit the changes and delete the directory. for fname in prj_path.iterdir(): with open(fname, "rb") as fdata: self.osc.packages.push_file(prj, "klp", fname.name, fdata.read()) self.osc.packages.cmd(prj, "klp", "commit", comment=f"Dump {branch}") shutil.rmtree(prj_path) logging.info(f"({i}/{self.total}) {cs.name()} done") def log(self, cs, arch): logging.info(self.osc.build.get_log(self.cs_to_project(cs), "devbuild", arch, "klp")) def push(self, wait=False): cs_list = self.filter_cs() if not cs_list: logging.error(f"push: No codestreams found for {self.lp_name}") sys.exit(1) logging.info(f"Preparing {len(cs_list)} projects on IBS...") self.total = len(cs_list) i = 1 # More threads makes OBS to return error 500 for cs in cs_list: self.create_lp_package(i, cs) i += 1 if wait: # Give some time for IBS to start building the last pushed # codestreams time.sleep(30) self.status(wait) # One more status after everything finished, since we remove # finished builds on each iteration self.status(False)
21,600
Python
.py
455
34.736264
126
0.551658
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,642
main.py
SUSE_klp-build/klpbuild/main.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza <[email protected]> import sys from klpbuild.cmd import main_func def main(): main_func(sys.argv[1:]) if __name__ == "__main__": main()
256
Python
.py
10
23.2
52
0.695833
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,643
cmd.py
SUSE_klp-build/klpbuild/cmd.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza <[email protected]> import argparse from klpbuild.codestream import Codestream from klpbuild.extractor import Extractor from klpbuild.ibs import IBS from klpbuild.inline import Inliner from klpbuild.ksrc import GitHelper from klpbuild.setup import Setup from klpbuild.utils import ARCHS def create_parser() -> argparse.ArgumentParser: parentparser = argparse.ArgumentParser(add_help=False) parentparser.add_argument( "-n", "--name", type=str, required=True, help="The livepatch name. This will be the directory name of the " "resulting livepatches.", ) parentparser.add_argument("--filter", type=str, help=r"Filter out codestreams using a regex. Example: 15\.3u[0-9]+") parser = argparse.ArgumentParser(add_help=False) sub = parser.add_subparsers(dest="cmd") setup = sub.add_parser("setup", parents=[parentparser]) setup.add_argument("--cve", type=str, help="SLE specific. The CVE assigned to this livepatch") setup.add_argument("--conf", type=str, required=True, help="The kernel CONFIG used to be build the livepatch") setup.add_argument( "--no-check", action="store_true", help="SLE specific. Do not check for already patched codestreams, do the setup for all non filtered codestreams.", ) setup.add_argument( "--data-dir", type=str, required=False, default=None, help="The path where source files and modules will be found", ) setup.add_argument( "--file-funcs", required=False, action="append", nargs="*", default=[], help="File and functions to be livepatched. Can be set " "multiple times. The format is --file-funcs file/path.c func1 " "func2 --file-func file/patch2 func1...", ) setup.add_argument( "--mod-file-funcs", required=False, action="append", nargs="*", default=[], help="Module, file and functions to be livepatched. Can be set " "multiple times. The format is --file-funcs module1 file/path.c func1 " "func2 --file-func module2 file/patch2 func1...", ) setup.add_argument( "--conf-mod-file-funcs", required=False, action="append", nargs="*", default=[], help="Conf, module, file and functions to be livepatched. Can be set " "multiple times. The format is --file-funcs conf1 module1 file/path.c func1 " "func2 --file-func conf2 module2 file/patch2 func1...", ) setup.add_argument( "--module", type=str, default="vmlinux", help="The module that will be livepatched for all files" ) setup.add_argument( "--archs", default=ARCHS, choices=ARCHS, nargs="+", help="SLE specific. Supported architectures for this livepatch", ) setup.add_argument("--skips", help="List of codestreams to filter out") check_inline = sub.add_parser("check-inline", parents=[parentparser]) check_inline.add_argument( "--codestream", type=str, default="", required=True, help="SLE specific. Codestream to check the inlined symbol.", ) check_inline.add_argument( "--file", type=str, required=True, help="File to be checked.", ) check_inline.add_argument( "--symbol", type=str, required=True, help="Symbol to be found", ) extract_opts = sub.add_parser("extract", parents=[parentparser]) extract_opts.add_argument( "--avoid-ext", nargs="+", type=str, default=[], help="Functions to be copied into the LP instead of externalizing. " "Useful to make sure to include symbols that are optimized in " "different architectures", ) extract_opts.add_argument( "--apply-patches", action="store_true", help="Apply patches found by get-patches subcommand, if they exist" ) extract_opts.add_argument( "--ignore-errors", action="store_true", help="Don't exit clang-extract if an error is detected when " "extracting the code. Should be used on cases like extracting tracepoints or other code that are " "usually problematic.") extract_opts.add_argument( "--type", type=str, choices=["ccp", "ce"], default="ccp", help="Choose between ccp and ce" ) diff_opts = sub.add_parser("cs-diff", parents=[parentparser]) diff_opts.add_argument( "--cs", nargs=2, type=str, required=True, help="SLE specific. Apply diff on two different codestreams" ) diff_opts.add_argument("--type", type=str, choices=["ccp", "ce"], default="ccp", help="Choose between ccp and ce") fmt = sub.add_parser( "format-patches", parents=[parentparser], help="SLE specific. Extract patches from kgraft-patches" ) fmt.add_argument("-v", "--version", type=int, required=True, help="Version to be added, like vX") patches = sub.add_parser("get-patches", parents=[parentparser]) patches.add_argument( "--cve", required=True, help="SLE specific. CVE number to search for related backported patches" ) scan = sub.add_parser("scan") scan.add_argument( "--cve", required=True, help="SLE specific. Shows which codestreams are vulnerable to the CVE" ) scan.add_argument( "--conf", required=False, help="SLE specific. Helps to check only the codestreams that have this config set." ) sub.add_parser("cleanup", parents=[parentparser], help="SLE specific. Remove livepatch packages from IBS") sub.add_parser( "prepare-tests", parents=[parentparser], help="SLE specific. Download the built tests and check for LP dependencies", ) push = sub.add_parser( "push", parents=[parentparser], help="SLE specific. Push livepatch packages to IBS to be built" ) push.add_argument("--wait", action="store_true", help="Wait until all codestreams builds are finished") status = sub.add_parser("status", parents=[parentparser], help="SLE specific. Check livepatch build status on IBS") status.add_argument("--wait", action="store_true", help="Wait until all codestreams builds are finished") log = sub.add_parser("log", parents=[parentparser], help="SLE specific. Get build log from IBS") log.add_argument("--cs", type=str, required=True, help="The codestream to get the log from") log.add_argument("--arch", type=str, default="x86_64", choices=ARCHS, help="Build architecture") return parser def main_func(main_args): args = create_parser().parse_args(main_args) if args.cmd == "setup": setup = Setup( args.name, args.filter, args.data_dir, args.cve, args.file_funcs, args.mod_file_funcs, args.conf_mod_file_funcs, args.module, args.conf, args.archs, args.skips, args.no_check, ) setup.setup_project_files() elif args.cmd == "extract": Extractor(args.name, args.filter, args.apply_patches, args.type, args.avoid_ext, args.ignore_errors).run() elif args.cmd == "cs-diff": lp_filter = args.cs[0] + "|" + args.cs[1] Extractor(args.name, lp_filter, False, args.type, [], False).diff_cs() elif args.cmd == "check-inline": Inliner(args.name, args.codestream).check_inline(args.file, args.symbol) elif args.cmd == "get-patches": GitHelper(args.name, args.filter).get_commits(args.cve) elif args.cmd == "scan": GitHelper("bsc_check", "").scan(args.cve, args.conf, False) elif args.cmd == "format-patches": GitHelper(args.name, args.filter).format_patches(args.version) elif args.cmd == "status": IBS(args.name, args.filter).status(args.wait) elif args.cmd == "push": IBS(args.name, args.filter).push(args.wait) elif args.cmd == "log": IBS(args.name, args.filter).log(Codestream.from_cs("", args.cs), args.arch) elif args.cmd == "cleanup": IBS(args.name, args.filter).cleanup() elif args.cmd == "prepare-tests": IBS(args.name, args.filter).prepare_tests()
8,416
Python
.py
199
34.994975
122
0.643293
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,644
extractor.py
SUSE_klp-build/klpbuild/extractor.py
# SPDX-License-Identifier: GPL-2.0-only # # Copyright (C) 2021-2024 SUSE # Author: Marcos Paulo de Souza <[email protected]> import concurrent.futures import difflib as dl import json import logging import os import re import shutil import subprocess import sys from collections import OrderedDict from pathlib import Path from pathlib import PurePath from threading import Lock from filelock import FileLock from natsort import natsorted from klpbuild import utils from klpbuild.ccp import CCP from klpbuild.ce import CE from klpbuild.config import Config from klpbuild.templ import TemplateGen class Extractor(Config): def __init__(self, lp_name, lp_filter, apply_patches, app, avoid_ext, ignore_errors): super().__init__(lp_name, lp_filter) self.sdir_lock = FileLock(Path(self.data, utils.ARCH, "sdir.lock")) self.sdir_lock.acquire() if not self.lp_path.exists(): raise ValueError(f"{self.lp_path} not created. Run the setup subcommand first") patches = self.get_patches_dir() self.apply_patches = apply_patches workers = self.get_user_settings('workers', True) if workers == "": self.workers = 4 else: self.workers = int(workers) if self.apply_patches and not patches.exists(): raise ValueError("--apply-patches specified without patches. Run get-patches!") if patches.exists(): self.quilt_log = open(Path(patches, "quilt.log"), "w") self.quilt_log.truncate() else: self.quilt_log = open("/dev/null", "w") self.total = 0 self.make_lock = Lock() if app == "ccp": self.runner = CCP(lp_name, lp_filter, avoid_ext) else: self.runner = CE(lp_name, lp_filter, avoid_ext, ignore_errors) self.app = app self.tem = TemplateGen(self.lp_name, self.filter, self.app) def __del__(self): if self.sdir_lock: self.sdir_lock.release() os.remove(self.sdir_lock.lock_file) @staticmethod def unquote_output(matchobj): return matchobj.group(0).replace('"', "") @staticmethod def process_make_output(output): # some strings have single quotes around double quotes, so remove the # outer quotes output = output.replace("'", "") # Remove the compiler name used to compile the object. TODO: resolve # when clang is used, or other cross-compilers. if output.startswith("gcc "): output = output[4:] # also remove double quotes from macros like -D"KBUILD....=.." return re.sub(r'-D"KBUILD_([\w\#\_\=\(\)])+"', Extractor.unquote_output, output) @staticmethod def get_make_cmd(out_dir, cs, filename, odir, sdir): filename = PurePath(filename) file_ = str(filename.with_suffix(".o")) log_path = Path(out_dir, "make.out.txt") with open(log_path, "w") as f: # Corner case for lib directory, that fails with the conventional # way of grabbing the gcc args used to compile the file. If then # need to ask the make to show the commands for all files inside the # directory. Later process_make_output will take care of picking # what is interesting for klp-build if filename.parent == PurePath("arch/x86/lib") or filename.parent == PurePath("drivers/block/aoe"): file_ = str(filename.parent) + "/" gcc_ver = int(subprocess.check_output(["gcc", "-dumpversion"]).decode().strip()) # gcc12 and higher have a problem with kernel and xrealloc implementation if gcc_ver < 12: cc = "gcc" # if gcc12 or higher is the default compiler, check if gcc7 is available elif shutil.which("gcc-7"): cc = "gcc-7" else: logging.error("Only gcc12 or higher are available, and it's problematic with kernel sources") raise make_args = [ "make", "-sn", f"CC={cc}", f"KLP_CS={cs.name()}", f"HOSTCC={cc}", "WERROR=0", "CFLAGS_REMOVE_objtool=-Werror", file_, ] f.write(f"Executing make on {odir}\n") f.write(" ".join(make_args)) f.write("\n") f.flush() ofname = "." + filename.name.replace(".c", ".o.d") ofname = Path(filename.parent, ofname) completed = subprocess.check_output(make_args, cwd=odir, stderr=f).decode() f.write("Full output of the make command:\n") f.write(str(completed).strip()) f.write("\n") f.flush() # 15.4 onwards changes the regex a little: -MD -> -MMD # 15.6 onwards we don't have -isystem. # Also, it's more difficult to eliminate the objtool command # line, so try to search until the fixdep script for regex in [ rf"(-Wp,(\-MD|\-MMD),{ofname}\s+-nostdinc\s+-isystem.*{str(filename)});", rf"(-Wp,(\-MD|\-MMD),{ofname}\s+-nostdinc\s+.*-c -o {file_} {sdir}/{filename})\s+;.*fixdep" ]: f.write(f"Searching for the pattern: {regex}\n") f.flush() result = re.search(regex, str(completed).strip()) if result: break f.write(f"Not found\n") f.flush() if not result: logging.error(f"Failed to get the kernel cmdline for file {str(ofname)} in {cs.name()}. " f"Check file {str(log_path)} for more details.") return None ret = Extractor.process_make_output(result.group(1)) # WORKAROUND: tomoyo security module uses a generated file that is # not part of kernel-source. For this reason, add a new option for # the backend process to ignore the inclusion of the missing file if "tomoyo" in file_: ret += " -DCONFIG_SECURITY_TOMOYO_INSECURE_BUILTIN_SETTING" # save the cmdline f.write(ret) if not " -pg " in ret: logging.warning(f"{cs.name()}:{file_} is not compiled with livepatch support (-pg flag)") return ret return None def get_patches_dir(self): return Path(self.lp_path, "fixes") def remove_patches(self, cs, fil): sdir = cs.get_sdir() # Check if there were patches applied previously patches_dir = Path(sdir, "patches") if not patches_dir.exists(): return fil.write(f"\nRemoving patches from {cs.name()}({cs.kernel})\n") fil.flush() err = subprocess.run(["quilt", "pop", "-a"], cwd=sdir, stderr=fil, stdout=fil) if err.returncode not in [0, 2]: raise RuntimeError(f"{cs.name()}: quilt pop failed on {sdir}: ({err.returncode}) {err.stderr}") shutil.rmtree(patches_dir, ignore_errors=True) shutil.rmtree(Path(sdir, ".pc"), ignore_errors=True) def apply_all_patches(self, cs, fil): dirs = [] if cs.rt: dirs.extend([f"{cs.sle}.{cs.sp}rtu{cs.update}", f"{cs.sle}.{cs.sp}rt"]) dirs.extend([f"{cs.sle}.{cs.sp}u{cs.update}", f"{cs.sle}.{cs.sp}"]) if cs.sle == 15 and cs.sp < 4: dirs.append("cve-5.3") elif cs.sle == 15 and cs.sp <= 5: dirs.append("cve-5.14") patch_dirs = [] for d in dirs: patch_dirs.append(Path(self.get_patches_dir(), d)) patched = False sdir = cs.get_sdir() for pdir in patch_dirs: if not pdir.exists(): fil.write(f"\nPatches dir {pdir} doesnt exists\n") continue fil.write(f"\nApplying patches on {cs.name()}({cs.kernel}) from {pdir}\n") fil.flush() for patch in sorted(pdir.iterdir(), reverse=True): if not str(patch).endswith(".patch"): continue err = subprocess.run(["quilt", "import", str(patch)], cwd=sdir, stderr=fil, stdout=fil) if err.returncode != 0: fil.write("\nFailed to import patches, remove applied and try again\n") self.remove_patches(cs, fil) err = subprocess.run(["quilt", "push", "-a"], cwd=sdir, stderr=fil, stdout=fil) if err.returncode != 0: fil.write("\nFailed to apply patches, remove applied and try again\n") self.remove_patches(cs, fil) continue patched = True fil.flush() # Stop the loop in the first dir that we find patches. break if not patched: raise RuntimeError(f"{cs.name()}({cs.kernel}): Failed to apply patches. Aborting") def get_cmd_from_json(self, cs, fname): cc_file = Path(cs.get_odir(), "compile_commands.json") # FIXME: compile_commands.json that is packaged with SLE/openSUSE # doesn't quite work yet, so don't use it yet. return None with open(cc_file) as f: buf = f.read() data = json.loads(buf) for d in data: if fname in d["file"]: output = d["command"] return Extractor.process_make_output(output) logging.error(f"Couldn't find cmdline for {fname}. Aborting") return None def process(self, args): i, fname, cs, fdata = args sdir = cs.get_sdir() odir = cs.get_odir() # The header text has two tabs cs_info = cs.name().ljust(15, " ") idx = f"({i}/{self.total})".rjust(15, " ") logging.info(f"{idx} {cs_info} {fname}") out_dir = self.get_work_dir(cs, fname, self.app) out_dir.mkdir(parents=True, exist_ok=True) # create symlink to the respective codestream file os.symlink(Path(sdir, fname), Path(out_dir, Path(fname).name)) # Make can regenerate fixdep for each file being processed per # codestream, so avoid the TXTBUSY error by serializing the 'make -sn' # calls. Make is pretty fast, so there isn't a real slow down here. with self.make_lock: cmd = self.get_cmd_from_json(cs, fname) if not cmd: cmd = Extractor.get_make_cmd(out_dir, cs, fname, odir, sdir) if not cmd: raise # SLE15-SP6 doesn't enabled CET, but we would like to start using # klp-convert either way. needs_ibt = cs.sle > 15 or (cs.sle == 15 and cs.sp >= 6) args, lenv = self.runner.cmd_args(needs_ibt, cs, fname, ",".join(fdata["symbols"]), out_dir, fdata, cmd) # Detect and set ibt information. It will be used in the TemplateGen if '-fcf-protection' in cmd or needs_ibt: cs.files[fname]["ibt"] = True out_log = Path(out_dir, f"{self.app}.out.txt") with open(out_log, "w") as f: # Write the command line used f.write(f"Executing {self.app} on {odir}\n") f.write("\n".join(args) + "\n") f.flush() try: subprocess.run(args, cwd=odir, stdout=f, stderr=f, env=lenv, check=True) except: logging.error(f"Error when processing {cs.name()}:{fname}. Check file {out_log} for details.") raise cs.files[fname]["ext_symbols"] = self.runner.get_symbol_list(out_dir) lp_out = Path(out_dir, self.lp_out_file(fname)) # Remove the local path prefix of the klp-ccp generated comments # Open the file, read, seek to the beginning, write the new data, and # then truncate (which will use the current position in file as the # size) with open(str(lp_out), "r+") as f: file_buf = f.read() f.seek(0) f.write(file_buf.replace(f"from {str(sdir)}/", "from ")) f.truncate() self.tem.CreateMakefile(cs, fname, False) def run(self): logging.info(f"Work directory: {self.lp_path}") working_cs = self.filter_cs(verbose=True) if len(working_cs) == 0: logging.error(f"No codestreams found") sys.exit(1) # Make it perform better by spawning a process function per # cs/file/funcs tuple, instead of spawning a thread per codestream args = [] i = 1 for cs in working_cs: # remove any previously generated files and leftover patches shutil.rmtree(self.get_cs_dir(cs, self.app), ignore_errors=True) self.remove_patches(cs, self.quilt_log) # Apply patches before the LPs were created if self.apply_patches: self.apply_all_patches(cs, self.quilt_log) for fname, fdata in cs.files.items(): args.append((i, fname, cs, fdata)) i += 1 logging.info(f"Extracting code using {self.app}") self.total = len(args) logging.info(f"\nGenerating livepatches for {len(args)} file(s) using {self.workers} workers...") logging.info("\t\tCodestream\tFile") with concurrent.futures.ThreadPoolExecutor(max_workers=self.workers) as executor: results = executor.map(self.process, args) try: for result in results: if result: logging.error(f"{cs}: {result}") except: executor.shutdown() sys.exit(1) # Save the ext_symbols set by execute self.flush_cs_file(working_cs) # TODO: change the templates so we generate a similar code than we # already do for SUSE livepatches # Create the livepatches per codestream for cs in working_cs: self.tem.GenerateLivePatches(cs) self.group_equal_files(args) self.tem.generate_commit_msg_file() logging.info("Checking the externalized symbols in other architectures...") missing_syms = OrderedDict() # Iterate over each codestream, getting each file processed, and all # externalized symbols of this file for cs in working_cs: # Cleanup patches after the LPs were created if they were applied if self.apply_patches: self.remove_patches(cs, self.quilt_log) # Map all symbols related to each obj, to make it check the symbols # only once per object obj_syms = {} for f, fdata in cs.files.items(): for obj, syms in fdata["ext_symbols"].items(): obj_syms.setdefault(obj, []) obj_syms[obj].extend(syms) for obj, syms in obj_syms.items(): missing = self.check_symbol_archs(cs, obj, syms, True) if missing: for arch, arch_syms in missing.items(): missing_syms.setdefault(arch, {}) missing_syms[arch].setdefault(obj, {}) missing_syms[arch][obj].setdefault(cs.name(), []) missing_syms[arch][obj][cs.name()].extend(arch_syms) self.tem.CreateKbuildFile(cs) if missing_syms: with open(Path(self.lp_path, "missing_syms"), "w") as f: f.write(json.dumps(missing_syms, indent=4)) logging.warning("Symbols not found:") logging.warn(json.dumps(missing_syms, indent=4)) def get_work_lp_file(self, cs, fname): return Path(self.get_work_dir(cs, fname, self.app), self.lp_out_file(fname)) def get_cs_code(self, args): cs_files = {} # Mount the cs_files dict for arg in args: _, file, cs, _ = arg cs_files.setdefault(cs.name(), []) fpath = self.get_work_lp_file(cs, file) with open(fpath, "r+") as fi: src = fi.read() src = re.sub(r'#include ".+kconfig\.h"', "", src) # Since 15.4 klp-ccp includes a compiler-version.h header src = re.sub(r'#include ".+compiler\-version\.h"', "", src) # Since RT variants, there is now an definition for auto_type src = src.replace(r"#define __auto_type int\n", "") # We have problems with externalized symbols on macros. Ignore # codestream names specified on paths that are placed on the # expanded macros src = re.sub(f"{cs.get_data_dir(utils.ARCH)}.+{file}", "", src) # We can have more details that can differ for long expanded # macros, like the patterns bellow src = re.sub(rf"\.lineno = \d+,", "", src) # Remove any mentions to klpr_trace, since it's currently # buggy in klp-ccp src = re.sub(r".+klpr_trace.+", "", src) # Remove clang-extract comments src = re.sub(r"clang-extract: .+", "", src) # Reduce the noise from klp-ccp when expanding macros src = re.sub(r"__compiletime_assert_\d+", "__compiletime_assert", src) cs_files[cs.name()].append((file, src)) return cs_files # cs_list should be only two entries def diff_cs(self): args = [] cs_cmp = [] for cs in self.filter_cs(): cs_cmp.append(cs.name()) for fname, _ in cs.files.items(): args.append((_, fname, cs, _)) assert len(cs_cmp) == 2 cs_code = self.get_cs_code(args) f1 = cs_code.get(cs_cmp[0]) f2 = cs_code.get(cs_cmp[1]) assert len(f1) == len(f2) for i in range(len(f1)): content1 = f1[i][1].splitlines() content2 = f2[i][1].splitlines() for l in dl.unified_diff(content1, content2, fromfile=f1[i][0], tofile=f2[i][0]): print(l) # Get the code for each codestream, removing boilerplate code def group_equal_files(self, args): cs_equal = [] processed = [] cs_files = self.get_cs_code(args) toprocess = list(cs_files.keys()) while len(toprocess): current_cs_list = [] # Get an element, and check if it wasn't associated with a previous # codestream cs = toprocess.pop(0) if cs in processed: continue # last element, it's different from all other codestreams, so add it # to the cs_equal alone. if not toprocess: cs_equal.append([cs]) break # start a new list with the current element to compare with others current_cs_list.append(cs) data_cs = cs_files[cs] len_data = len(data_cs) # Compare the file names, and file content between codestrams, # trying to find ones that have the same files and contents for cs_proc in toprocess: data_proc = cs_files[cs_proc] if len_data != len(data_proc): continue ok = True for i in range(len_data): file, src = data_cs[i] file_proc, src_proc = data_proc[i] if file != file_proc or src != src_proc: ok = False break # cs is equal to cs_proc, with the same number of files, same # file names, and the files have the same content. So we don't # need to process cs_proc later in the process if ok: processed.append(cs_proc) current_cs_list.append(cs_proc) # Append the current list of equal codestreams to a global list to # be grouped later cs_equal.append(natsorted(current_cs_list)) # cs_equal will contain a list of lists with codestreams that share the # same code groups = [] for cs_list in cs_equal: groups.append(" ".join(utils.classify_codestreams(cs_list))) with open(Path(self.lp_path, self.app, "groups"), "w") as f: f.write("\n".join(groups)) logging.info("\nGrouping codestreams that share the same content and files:") for group in groups: logging.info(f"\t{group}")
20,784
Python
.py
439
35.164009
112
0.562602
SUSE/klp-build
8
2
4
GPL-2.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,645
__init__.py
PaladinStudiosBVs_Blender-RigAssistant/Blender-RigAssistant/__init__.py
# Addon info bl_info = { "name": "Blender Rig Assistant", "description":"Rig anything with ease", "author": "Thomas Breuker", "blender": (3, 4, 1), "version": (0, 0, 2), "category": "Rigging", "location": "View3D > Sidebar > RigAssistant", "warning": "", "wiki_url": "", "tracker_url": "", } import bpy from mathutils import Vector from .operators.rigshapes import OBJECT_OT_create_circle, OBJECT_OT_create_cube, OBJECT_OT_create_piramid, OBJECT_OT_create_sphere, OBJECT_OT_create_square from .operators.ctrlbones import OBJECT_OT_suffix_l, OBJECT_OT_suffix_r, OBJECT_OT_create_control_bone, OBJECT_OT_create_local_offset_bone, OBJECT_OT_add_controls, OBJECT_OT_remove_controls from .operators.cnstrbones import OBJECT_OT_remove_all_cnstr, OBJECT_OT_create_cnstr, OBJECT_OT_add_cnstr, OBJECT_OT_remove_cnstr_bone, OBJECT_OT_remove_selected_bone, OBJECT_OT_append_cnstr, OBJECT_OT_create_cnstr_ctrl from .operators.deformbones import OBJECT_OT_create_armature, OBJECT_OT_disconnect_bones, OBJECT_OT_remove_roll, OBJECT_OT_chain_parent,OBJECT_OT_chain_rename # Tells the which constraint to pick when using create constraint add constraint or append constraint. class constraint_properties(bpy.types.PropertyGroup): constraint_enum : bpy.props.EnumProperty( name = "type", description = "choose the type of constraint", items = [('OP1',"TRANSFORMS",""), ('OP2',"LOCATION",""), ('OP3',"ROTATION",""), ('OP4',"SCALE",""), ('OP5',"IK",""), ('OP6',"NONE",""), ] ) #switches between local or world space for control bones class world_local_properties(bpy.types.PropertyGroup): world_local_enum : bpy.props.EnumProperty( name = "space", description = "choose between world or local", items = [('OP1',"LOCAL",""), ('OP2',"WORLD",""), ] ) #UI window class VIEW3D_PT_blender_rig_assistant(bpy.types.Panel): bl_space_type = 'VIEW_3D' bl_region_type = 'UI' bl_category = "Rig Assistant" bl_label = "Rig Assistant" def draw(self, context): coltop = self.layout.column(heading="Armature Creator") coltop.label(text="Armature") coltop.operator('object.create_armature',icon = 'ARMATURE_DATA') coltop.operator('object.disconnect_bones', icon = 'BONE_DATA') coltop.operator('object.remove_roll', icon ='OUTLINER_DATA_GREASEPENCIL') coltop.operator('object.chain_parent',icon ='DECORATE_LINKED') coltop.operator('object.chain_rename',icon ='FILE_TEXT') self.layout.separator() rowa=self.layout.row(align=True) rowa.operator('object.prefix_l', icon ='EVENT_L') rowa.operator('object.prefix_r', icon ='EVENT_R') self.layout.separator() col= self.layout.column() col.label(text="Constraints") col.prop(context.scene.type_constrain, "constraint_enum") col.operator('object.create_cnstr', icon = 'CONSTRAINT_BONE') col.operator('object.append_cnstr', icon = 'CONSTRAINT') col.operator('object.add_cnstr', icon = 'GROUP_BONE') self.layout.separator() colb=self.layout.column() colb.label(text="Removing Bones and Constraints") colb.operator('object.remove_all_cnstr', icon = 'CANCEL') colb.operator('object.remove_cnstr_bone', icon = 'CONSTRAINT_BONE') colb.operator('object.remove_selected_bone', icon = 'BONE_DATA') self.layout.separator() colc= self.layout.column() colc.label(text="Controls and Offsets") colc.prop(context.scene.local_world_switch, "world_local_enum") colc.operator('object.create_control_bone', icon = 'OUTLINER_DATA_ARMATURE') colc.operator('object.create_local_offset_bone' , icon = 'CON_ARMATURE') colc.operator('object.create_cnstr_ctrl',icon ='OUTLINER_OB_ARMATURE') self.layout.separator() cold=self.layout.column() cold.label(text="Control Shapes") cold.operator('object.add_controls', icon = 'MOD_SKIN') cold.operator('object.remove_controls', icon ='MOD_PHYSICS') self.layout.separator() colf=self.layout.grid_flow(row_major=True, columns=2, align=True) colf.operator('object.create_circle', icon ='MESH_CIRCLE') colf.operator('object.create_cube', icon ='CUBE') colf.operator('object.create_piramid', icon ='CONE') colf.operator('object.create_sphere', icon ='SPHERE') colf.operator('object.create_square', icon = 'MESH_PLANE') blender_classes = [ constraint_properties, world_local_properties, OBJECT_OT_remove_all_cnstr, OBJECT_OT_create_cnstr, OBJECT_OT_add_cnstr, OBJECT_OT_chain_parent, OBJECT_OT_chain_rename, OBJECT_OT_create_cnstr_ctrl, VIEW3D_PT_blender_rig_assistant, OBJECT_OT_remove_cnstr_bone, OBJECT_OT_remove_selected_bone, OBJECT_OT_create_control_bone, OBJECT_OT_create_local_offset_bone, OBJECT_OT_add_controls, OBJECT_OT_remove_controls, OBJECT_OT_remove_roll, OBJECT_OT_append_cnstr, OBJECT_OT_create_armature, OBJECT_OT_disconnect_bones, OBJECT_OT_suffix_l, OBJECT_OT_suffix_r, OBJECT_OT_create_circle, OBJECT_OT_create_cube, OBJECT_OT_create_piramid, OBJECT_OT_create_sphere, OBJECT_OT_create_square, ] def register(): for blender_class in blender_classes: bpy.utils.register_class(blender_class) bpy.types.Scene.type_constrain = bpy.props.PointerProperty(type = constraint_properties) bpy.types.Scene.local_world_switch = bpy.props.PointerProperty(type = world_local_properties) def unregister(): for blender_class in blender_classes: bpy.utils.unregister_class(blender_class) del bpy.types.Scene.type_constrain del bpy.types.Scene.local_world_switch
5,959
Python
.py
129
39.162791
219
0.677213
PaladinStudiosBVs/Blender-RigAssistant
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,646
deformbones.py
PaladinStudiosBVs_Blender-RigAssistant/Blender-RigAssistant/operators/deformbones.py
import bpy from mathutils import Vector # Handles everything related to deform bones parenting and naming class OBJECT_OT_disconnect_bones(bpy.types.Operator): bl_idname = 'object.disconnect_bones' bl_label = "Disconnect Bones" #Simple operator disconnects bones from eachother def execute (self, context): bpy.ops.armature.parent_clear(type='DISCONNECT') return{'FINISHED'} class OBJECT_OT_create_armature(bpy.types.Operator): bl_idname = 'object.create_armature' bl_label = "Create An Armature" # Creates a starting armature with a zero-ed out bone the is called root def execute (self, context): if bpy.context.selected_objects: bpy.ops.object.mode_set(mode = 'OBJECT') bpy.ops.object.armature_add(enter_editmode=True, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1)) bpy.context.active_bone.name = "root" bpy.ops.transform.translate(value=(0, 1, -1), orient_type='GLOBAL') bpy.context.object.data.collections.new('Deform') bpy.ops.object.mode_set(mode='POSE') bpy.context.object.data.collections['Deform'].assign(bpy.context.object.pose.bones['root']) bpy.context.object.data.collections.remove(bpy.context.object.data.collections['Bones']) bpy.context.object.data.collections.new('CNSTR') bpy.context.object.data.collections.new('CTRL') bpy.context.object.data.collections.new('LocOff') bpy.ops.object.mode_set(mode='EDIT') return{'FINISHED'} class OBJECT_OT_chain_parent(bpy.types.Operator): """Select a bones to parent them""" bl_idname = 'object.chain_parent' bl_label = "Chain Parent" # Activates a mode where every new bone you select is parented to the previous one #enters this mode def execute(self,context): bpy.ops.object.mode_set(mode='EDIT') bpy.ops.armature.select_all(action='DESELECT') self.report({'INFO'}, "Shift click bones in the 3D view to Chain parent/Use control in the outliner") def modal(self, context, event): if event.type == 'LEFTMOUSE': return {'PASS_THROUGH'} elif event.type in {'WHEELUPMOUSE', 'WHEELDOWNMOUSE'}: return {'PASS_THROUGH'} if event.type == 'MOUSEMOVE': selected_bones = bpy.context.selected_bones if len(selected_bones)==2: bpy.ops.armature.parent_set(type='OFFSET') active_bone = bpy.context.object.data.edit_bones.active bpy.ops.armature.select_all(action='DESELECT') bpy.context.object.data.edit_bones[active_bone.name].select = True bpy.context.object.data.edit_bones[active_bone.name].select_head = True bpy.context.object.data.edit_bones[active_bone.name].select_tail = True bpy.context.object.data.edit_bones.active = bpy.context.object.data.edit_bones[active_bone.name] self.report({'INFO'}, "Bones Happily Parented! Press ENTER to stop") # right mouse buttons stops the chain parent action elif event.type in {'RIGHTMOUSE', 'RET'}: bpy.ops.armature.select_all(action='DESELECT') self.report({'INFO'}, "chain bone mode deactivated...") return {'FINISHED'} return {'RUNNING_MODAL'} def invoke(self, context, event): if context.object: context.window_manager.modal_handler_add(self) return {'RUNNING_MODAL'} else: self.report({'WARNING'}, "No active object, could not finish") return {'CANCELLED'} class OBJECT_OT_chain_rename(bpy.types.Operator): """Rename bones to chains""" bl_idname = 'object.chain_rename' bl_label = "Chain Rename" text : bpy.props.StringProperty(name = "Enter Text", default="") startat : bpy.props.IntProperty(name = "Start at", default = 1) def execute(self, context): number = self.startat digits = len(str(len(bpy.context.selected_bones) + self.startat - 1)) # Determine the number of digits needed for bone in bpy.context.selected_bones: bone.name = f"{self.text}_{number:0{digits}d}" # Use format specifier for padding with leading zeros number += 1 return {'FINISHED'} def invoke(self, context, event): return context.window_manager.invoke_props_dialog(self) class OBJECT_OT_remove_roll(bpy.types.Operator): bl_idname = 'object.remove_roll' bl_label = "Remove Roll" #Removes roll from the bone. def execute (self, context): current_mode = bpy.context.object.mode bpy.ops.object.mode_set(mode='EDIT') for b in bpy.context.selected_bones: b.roll = 0 bpy.ops.object.mode_set(mode= current_mode) return{'FINISHED'}
4,936
Python
.py
94
42.659574
118
0.656883
PaladinStudiosBVs/Blender-RigAssistant
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,647
ctrlbones.py
PaladinStudiosBVs_Blender-RigAssistant/Blender-RigAssistant/operators/ctrlbones.py
import bpy from mathutils import Vector #Handles everything related to CTRL_, offset and location bones class OBJECT_OT_create_control_bone(bpy.types.Operator): """creates a cnstr bone for selected bones""" bl_idname = 'object.create_control_bone' bl_label = "Create Control Bones" # Creates a control bone and searches for the CNSTR_ bone to become it's parent # Depending which space is selected CTRL_ bone is either created in world or local space def execute (self, context): boneCollections = bpy.context.object.data.collections_all; visibilityCache = [] for i in boneCollections: visibilityCache.append(i.is_visible) for b in range(0,len(visibilityCache)): boneCollections[b].is_visible = True if bpy.context.selected_pose_bones is None and bpy.context.selected_bones is None : for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear self.report({"WARNING"}, "No Bones selected Check if they are visible") return {'CANCELLED'} # Collection stuff: Check if there's a collection CTRL if it's not, make it if boneCollections.get('CTRL') is None: bcoll = bpy.context.object.data.collections.new('CTRL') current_mode = bpy.context.object.mode if current_mode == 'EDIT' or current_mode == 'POSE': bpy.ops.object.mode_set(mode='EDIT') armanm = bpy.context.active_object armature = bpy.context.object.data bpy.ops.object.mode_set(mode='POSE') pbones = bpy.context.selected_pose_bones bpy.ops.object.mode_set(mode='EDIT') current_bone = 0 if context.scene.local_world_switch.world_local_enum == 'OP1': for b in bpy.context.selected_bones: if bpy.context.object.data.edit_bones.get("CTRL_" + b.name): bpy.context.object.data.edit_bones.remove(bpy.context.object.data.edit_bones.get("CTRL_" + b.name)) cb = bpy.context.object.data.edit_bones.new("CTRL_" + b.name) cb.head = b.head cb.tail = b.tail cb.matrix = b.matrix bpy.context.object.data.edit_bones.get("CTRL_" + b.name).use_deform = False if bpy.context.object.data.edit_bones.get("CNSTR_" + b.name): bpy.context.object.data.edit_bones["CNSTR_" + b.name].parent = bpy.context.object.data.edit_bones[cb.name] if context.scene.local_world_switch.world_local_enum == 'OP2': for b in bpy.context.selected_bones: if bpy.context.object.data.edit_bones.get("CTRL_" + b.name): bpy.context.object.data.edit_bones.remove(bpy.context.object.data.edit_bones.get("CTRL_" + b.name)) cb = bpy.context.object.data.edit_bones.new("CTRL_" + b.name) world_vector=Vector((0,b.length,0)) cb.head = b.head cb.tail = cb.head + world_vector bpy.context.object.data.edit_bones.get("CTRL_" + b.name).use_deform = False if bpy.context.object.data.edit_bones.get("CNSTR_" + b.name): bpy.context.object.data.edit_bones["CNSTR_" + b.name].parent = bpy.context.object.data.edit_bones[cb.name] bpy.ops.object.mode_set(mode='POSE') bpy.ops.pose.select_all(action='DESELECT') for pb in pbones: #Put the bone into the right collection bpy.context.object.data.collections['CTRL'].assign(bpy.context.object.pose.bones["CTRL_" + pbones[current_bone].name]) bpy.context.object.data.bones["CTRL_" + pbones[current_bone].name].select = True current_bone += 1 current_bone=0 for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear bpy.ops.object.mode_set(mode= current_mode) return{'FINISHED'} else: self.report({"WARNING"}, "You gotta be in edit or pose mode") return {'CANCELLED'} class OBJECT_OT_create_local_offset_bone(bpy.types.Operator): """creates a local offset bone to the last selected parents the first selected under it""" bl_idname = 'object.create_local_offset_bone' bl_label = "Create Local Offset Bones" # Creates a duplicate of the selected bone and parents the original bone under it # When 2 bones are selected it duplicates the first selected bone and parents it under the active bone. def execute (self, context): boneCollections = bpy.context.object.data.collections_all; visibilityCache = [] for i in boneCollections: visibilityCache.append(i.is_visible) for b in range(0,len(visibilityCache)): boneCollections[b].is_visible = True if bpy.context.selected_pose_bones is None and bpy.context.selected_bones is None : for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear self.report({"WARNING"}, "No Bones selected Check if they are visible") return {'CANCELLED'} current_mode = bpy.context.object.mode if current_mode == 'EDIT' or current_mode == 'POSE': bpy.ops.object.mode_set(mode='POSE') pbones = bpy.context.selected_pose_bones bpy.ops.object.mode_set(mode='EDIT') armanm = bpy.context.active_object armature = bpy.context.object.data selected_bones = bpy.context.selected_bones selected_active_bone = bpy.context.object.data.edit_bones.active # Collection stuff: Check if there's a collection LocOff if it's not, make it if boneCollections.get('LocOff') is None: bcoll = bpy.context.object.data.collections.new('LocOff') if len(selected_bones) == 2: if selected_bones[0] == selected_active_bone: active=1 else: active=0 cb = bpy.context.object.data.edit_bones.new("LOC_" + selected_bones[active].name) cb.head = selected_bones[active].head cb.tail = selected_bones[active].tail cb.matrix = selected_bones[active].matrix bpy.context.object.data.edit_bones.get("LOC_" + selected_bones[active].name).use_deform = False bpy.context.object.data.edit_bones[cb.name].parent = bpy.context.object.data.edit_bones[selected_active_bone.name] bpy.ops.object.mode_set(mode='POSE') bpy.context.object.data.collections['LocOff'].assign(bpy.context.object.pose.bones["LOC_" + pbones[active].name]) if len(selected_bones) == 1: cb = bpy.context.object.data.edit_bones.new("OFF_" + selected_bones[0].name) cb.head = selected_bones[0].head cb.tail = selected_bones[0].tail cb.matrix = selected_bones[0].matrix bpy.context.object.data.edit_bones.get("OFF_" + selected_bones[0].name).use_deform = False bpy.context.object.data.edit_bones[selected_active_bone.name].parent = bpy.context.object.data.edit_bones[cb.name] bpy.ops.object.mode_set(mode='POSE') bpy.context.object.data.collections['LocOff'].assign(bpy.context.object.pose.bones["OFF_" + pbones[0].name]) for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear bpy.ops.object.mode_set(mode= current_mode) return{'FINISHED'} else: self.report({"WARNING"}, "You gotta be in edit or pose mode") return {'CANCELLED'} class OBJECT_OT_add_controls(bpy.types.Operator): """creates custom shapes on selected pose bones""" bl_idname = 'object.add_controls' bl_label = "Add Control Shapes" # Checks selected bones, checks if there's an object selected # Makes the object the shape of the selected bones def execute (self, context): selected_objects = bpy.context.selected_objects bpy.ops.object.mode_set(mode='POSE') selected_pose_bones = bpy.context.selected_pose_bones bpy.ops.object.mode_set(mode= 'OBJECT') bpy.ops.object.select_all(action='DESELECT') for meshes in selected_objects: if meshes.type == 'MESH': bpy.data.objects[meshes.name].select_set(state = True) mesh_count = len(bpy.context.selected_objects) if mesh_count > 1: print ("Too many meshes selected, Im going to take the first one") bpy.ops.object.mode_set(mode= 'POSE') selected_mesh = bpy.context.selected_objects[0] for bone in selected_pose_bones: bpy.context.object.pose.bones[bone.name].custom_shape = bpy.data.objects[selected_mesh.name] if mesh_count == 1: bpy.ops.object.mode_set(mode= 'POSE') selected_mesh = bpy.context.selected_objects[0] for bone in selected_pose_bones: bpy.context.object.pose.bones[bone.name].custom_shape = bpy.data.objects[selected_mesh.name] if mesh_count == 0: print ("No mesh selected, I can't work with that") return{'FINISHED'} class OBJECT_OT_remove_controls(bpy.types.Operator): """creates custom shapes on selected pose bones""" bl_idname = 'object.remove_controls' bl_label = "Remove Control Shapes" # Removes any object shapes that the bones have currently on them def execute (self, context): selected_pose_bones = bpy.context.selected_pose_bones for shapes in selected_pose_bones: bpy.context.object.pose.bones[shapes.name].custom_shape = None return{'FINISHED'} class OBJECT_OT_suffix_l(bpy.types.Operator): bl_idname = 'object.prefix_l' bl_label = "Suffix .l" # ends a bone name with .l making it suitable for mirroring and symetrization def execute (self, context): current_mode = bpy.context.object.mode bpy.ops.object.mode_set(mode='EDIT') for b in bpy.context.selected_bones: b.name = b.name + ".l" bpy.ops.object.mode_set(mode= current_mode) return{'FINISHED'} class OBJECT_OT_suffix_r(bpy.types.Operator): bl_idname = 'object.prefix_r' bl_label = "Suffix .r" # ends a bone name with .r making it suitable for mirroring and symetrization def execute (self, context): current_mode = bpy.context.object.mode bpy.ops.object.mode_set(mode='EDIT') for b in bpy.context.selected_bones: b.name = b.name + ".r" bpy.ops.object.mode_set(mode= current_mode) return{'FINISHED'}
11,449
Python
.py
195
45.097436
134
0.623228
PaladinStudiosBVs/Blender-RigAssistant
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,648
cnstrbones.py
PaladinStudiosBVs_Blender-RigAssistant/Blender-RigAssistant/operators/cnstrbones.py
import bpy from mathutils import Vector # Does everything with the CNSTR bones and creating constraints class OBJECT_OT_create_cnstr(bpy.types.Operator): """creates a cnstr bone for selected bones""" bl_idname = 'object.create_cnstr' bl_label = "Create Constraint Bones" #Creates a duplicate of the selected bone(s) with the prefix CNSTR_ and #constraints the original bone to the newly created bone. The type of constraint is picked in the UI def execute (self, context): boneCollections = bpy.context.object.data.collections_all; visibilityCache = [] for i in boneCollections: visibilityCache.append(i.is_visible) for b in range(0,len(visibilityCache)): boneCollections[b].is_visible = True if bpy.context.selected_pose_bones is None and bpy.context.selected_bones is None : for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear self.report({"WARNING"}, "No Bones selected Check if they are visible") return {'CANCELLED'} current_mode = bpy.context.object.mode if current_mode == 'EDIT' or current_mode == 'POSE': bpy.ops.object.mode_set(mode='EDIT') armanm = bpy.context.active_object armature = bpy.context.object.data bpy.ops.object.mode_set(mode='POSE') pbones = bpy.context.selected_pose_bones bpy.ops.object.mode_set(mode='EDIT') current_bone = 0 # Collection stuff: Check if there's a collection CNSTR if it's not, make it if boneCollections.get('CNSTR') is None: bcoll = bpy.context.object.data.collections.new('CNSTR') # this part duplicates the bone. If the duplicate already exists it deletes the old one and creates a new one # Also checks if there is a CTRL_ prefixed bone to parent under. for b in bpy.context.selected_bones: if bpy.context.object.data.edit_bones.get("CNSTR_" + b.name): bpy.context.object.data.edit_bones.remove(bpy.context.object.data.edit_bones.get("CNSTR_" + b.name)) cb = armature.edit_bones.new("CNSTR_" + b.name) cb.head = b.head cb.tail = b.tail cb.matrix = b.matrix bpy.context.object.data.edit_bones.get("CNSTR_" + b.name).use_deform = False if bpy.context.object.data.edit_bones.get("CTRL_" + b.name): bpy.context.object.data.edit_bones["CNSTR_" + b.name].parent = bpy.context.object.data.edit_bones["CTRL_" + b.name] #This part sets up the constraint bpy.ops.object.mode_set(mode='POSE') for pb in pbones: for c in pb.constraints: pb.constraints.remove(c) #first put the bone into the right collection bpy.context.object.data.collections['CNSTR'].assign(bpy.context.object.pose.bones["CNSTR_" + pbones[current_bone].name]) bpy.ops.pose.select_all(action='DESELECT') bpy.context.object.data.bones[pbones[current_bone].name].select = True bpy.context.object.data.bones["CNSTR_" + pbones[current_bone].name].select = True bpy.context.object.data.bones.active = bpy.context.object.pose.bones[pbones[current_bone].name].bone if context.scene.type_constrain.constraint_enum == 'OP1': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_TRANSFORMS') if context.scene.type_constrain.constraint_enum == 'OP2': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_LOCATION') if context.scene.type_constrain.constraint_enum == 'OP3': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_ROTATION') if context.scene.type_constrain.constraint_enum == 'OP4': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_SCALE') if context.scene.type_constrain.constraint_enum == 'OP5': bpy.ops.pose.constraint_add_with_targets(type = 'IK') constraint_count = 1-len(bpy.context.selected_pose_bones[0].constraints) bpy.context.selected_pose_bones[0].constraints[constraint_count].use_tail = False bpy.context.selected_pose_bones[0].constraints[constraint_count].chain_count= 2 bpy.ops.pose.select_all(action='DESELECT') current_bone += 1 current_bone=0 for pb in pbones: bpy.context.object.data.bones[pbones[current_bone].name].select = True current_bone += 1 for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear bpy.ops.object.mode_set(mode= current_mode) return{'FINISHED'} else: self.report({"WARNING"}, "You gotta be in edit or pose mode") return {'CANCELLED'} class OBJECT_OT_remove_cnstr_bone(bpy.types.Operator): bl_idname = 'object.remove_cnstr_bone' bl_label = "Remove Constraint Bone" #This cleanly removes a CNSTR_ bone also deleting the contraint on the deform bone def execute (self, context): boneCollections = bpy.context.object.data.collections_all; visibilityCache = [] for i in boneCollections: visibilityCache.append(i.is_visible) for b in range(0,len(visibilityCache)): boneCollections[b].is_visible = True if bpy.context.selected_pose_bones is None and bpy.context.selected_bones is None : for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear self.report({"WARNING"}, "No Bones selected Check if they are visible") return {'CANCELLED'} current_mode = bpy.context.object.mode bpy.ops.object.mode_set(mode='POSE') pbones = bpy.context.selected_pose_bones bpy.ops.object.mode_set(mode='EDIT') for b in bpy.context.selected_bones: if bpy.context.object.data.edit_bones.get("CNSTR_" + b.name): bpy.context.object.data.edit_bones.remove(bpy.context.object.data.edit_bones.get("CNSTR_" + b.name)) for bone in pbones: for c in bone.constraints: bone.constraints.remove(c) # Remove constraint for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear bpy.ops.object.mode_set(mode= current_mode) return{'FINISHED'} class OBJECT_OT_remove_selected_bone(bpy.types.Operator): bl_idname = 'object.remove_selected_bone' bl_label = "Remove Selected Bones" #This just deletes bones def execute (self, context): boneCollections = bpy.context.object.data.collections_all; visibilityCache = [] for i in boneCollections: visibilityCache.append(i.is_visible) for b in range(0,len(visibilityCache)): boneCollections[b].is_visible = True if bpy.context.selected_pose_bones is None and bpy.context.selected_bones is None : for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear self.report({"WARNING"}, "No Bones selected Check if they are visible") return {'CANCELLED'} current_mode = bpy.context.object.mode bpy.ops.object.mode_set(mode='EDIT') for b in bpy.context.selected_bones: bpy.context.object.data.edit_bones.remove(b) bpy.ops.object.mode_set(mode='POSE') bpy.ops.object.mode_set(mode= current_mode) for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear return{'FINISHED'} class OBJECT_OT_remove_all_cnstr(bpy.types.Operator): bl_idname = 'object.remove_all_cnstr' bl_label = "Remove all constraints" # removes all the constraints from a selected bone # goes to pose mode, clocks the selected bones, clocks the constraints and deletes them all # goes back to the previous selected mode def execute (self, context): boneCollections = bpy.context.object.data.collections_all; visibilityCache = [] for i in boneCollections: visibilityCache.append(i.is_visible) for b in range(0,len(visibilityCache)): boneCollections[b].is_visible = True if bpy.context.selected_pose_bones is None and bpy.context.selected_bones is None : for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear self.report({"WARNING"}, "No Bones selected Check if they are visible") return {'CANCELLED'} current_mode = bpy.context.object.mode bpy.ops.object.mode_set(mode='POSE') for bone in bpy.context.selected_pose_bones: for c in bone.constraints: bone.constraints.remove(c) # Remove constraint for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear bpy.ops.object.mode_set(mode= current_mode) return{'FINISHED'} class OBJECT_OT_add_cnstr(bpy.types.Operator): bl_idname = 'object.add_cnstr' bl_label = "Constraint Between Selected Bones" #Adds a constrain between selected bones #Constrain type gets picked in the UI in __init__ #IK has already been set to most used config def execute(self,context): boneCollections = bpy.context.object.data.collections_all; visibilityCache = [] for i in boneCollections: visibilityCache.append(i.is_visible) for b in range(0,len(visibilityCache)): boneCollections[b].is_visible = True if bpy.context.selected_pose_bones is None and bpy.context.selected_bones is None : for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear self.report({"WARNING"}, "No Bones selected Check if they are visible") return {'CANCELLED'} current_mode = bpy.context.object.mode bpy.ops.object.mode_set(mode='POSE') if context.scene.type_constrain.constraint_enum == 'OP1': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_TRANSFORMS') if context.scene.type_constrain.constraint_enum == 'OP2': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_LOCATION') if context.scene.type_constrain.constraint_enum == 'OP3': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_ROTATION') if context.scene.type_constrain.constraint_enum == 'OP4': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_SCALE') if context.scene.type_constrain.constraint_enum == 'OP5': bpy.ops.pose.constraint_add_with_targets(type = 'IK') constraint_count = 1-len(bpy.context.selected_pose_bones[0].constraints) bpy.context.selected_pose_bones[0].constraints[constraint_count].use_tail = False bpy.context.selected_pose_bones[0].constraints[constraint_count].chain_count= 2 for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear bpy.ops.object.mode_set(mode= current_mode) return{'FINISHED'} class OBJECT_OT_append_cnstr(bpy.types.Operator): bl_idname = 'object.append_cnstr' bl_label = "Append Constraint To Bones" #Will append a constraint to a bone that already has a CNSTR bone. #Constrain type gets picked in the UI in __init__ #IK has already been set to most used config def execute(self,context): boneCollections = bpy.context.object.data.collections_all; visibilityCache = [] for i in boneCollections: visibilityCache.append(i.is_visible) for b in range(0,len(visibilityCache)): boneCollections[b].is_visible = True if bpy.context.selected_pose_bones is None and bpy.context.selected_bones is None : for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear self.report({"WARNING"}, "No Bones selected Check if they are visible") return {'CANCELLED'} current_mode = bpy.context.object.mode current_bone = 0 bpy.ops.object.mode_set(mode='POSE') pbones = bpy.context.selected_pose_bones for pb in pbones: bpy.ops.pose.select_all(action='DESELECT') bpy.context.object.data.bones[pbones[current_bone].name].select = True bpy.context.object.data.bones["CNSTR_" + pbones[current_bone].name].select = True bpy.context.object.data.bones.active = bpy.context.object.pose.bones[pbones[current_bone].name].bone if context.scene.type_constrain.constraint_enum == 'OP1': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_TRANSFORMS') if context.scene.type_constrain.constraint_enum == 'OP2': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_LOCATION') if context.scene.type_constrain.constraint_enum == 'OP3': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_ROTATION') if context.scene.type_constrain.constraint_enum == 'OP4': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_SCALE') if context.scene.type_constrain.constraint_enum == 'OP5': bpy.ops.pose.constraint_add_with_targets(type = 'IK') constraint_count = 1-len(bpy.context.selected_pose_bones[0].constraints) bpy.context.selected_pose_bones[0].constraints[constraint_count].use_tail = False bpy.context.selected_pose_bones[0].constraints[constraint_count].chain_count= 2 bpy.ops.pose.select_all(action='DESELECT') current_bone += 1 current_bone=0 for pb in pbones: bpy.context.object.data.bones[pbones[current_bone].name].select = True current_bone += 1 for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear bpy.ops.object.mode_set(mode='EDIT') bpy.ops.object.mode_set(mode= current_mode) return{'FINISHED'} class OBJECT_OT_create_cnstr_ctrl(bpy.types.Operator): """creates a cnstr bone for selected bones""" bl_idname = 'object.create_cnstr_ctrl' bl_label = "Constraint & Control" #Creates a duplicate of the selected bone(s) with the prefix CNSTR_ and #constraints the original bone to the newly created bone. The type of constraint is picked in the UI def execute (self, context): boneCollections = bpy.context.object.data.collections_all; visibilityCache = [] for i in boneCollections: visibilityCache.append(i.is_visible) for b in range(0,len(visibilityCache)): boneCollections[b].is_visible = True if bpy.context.selected_pose_bones is None and bpy.context.selected_bones is None : for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear self.report({"WARNING"}, "No Bones selected Check if they are visible") return {'CANCELLED'} current_mode = bpy.context.object.mode if current_mode == 'EDIT' or current_mode == 'POSE': bpy.ops.object.mode_set(mode='EDIT') armanm = bpy.context.active_object armature = bpy.context.object.data bpy.ops.object.mode_set(mode='POSE') pbones = bpy.context.selected_pose_bones bpy.ops.object.mode_set(mode='EDIT') current_bone = 0 # Collection stuff: Check if there's a collection CNSTR if it's not, make it if boneCollections.get('CNSTR') is None: bcoll = bpy.context.object.data.collections.new('CNSTR') # Collection stuff: Check if there's a collection CTRL if it's not, make it if boneCollections.get('CTRL') is None: bcoll = bpy.context.object.data.collections.new('CTRL') # this part duplicates the bone. If the duplicate already exists it deletes the old one and creates a new one # Also checks if there is a CTRL_ prefixed bone to parent under. for b in bpy.context.selected_bones: if bpy.context.object.data.edit_bones.get("CNSTR_" + b.name): bpy.context.object.data.edit_bones.remove(bpy.context.object.data.edit_bones.get("CNSTR_" + b.name)) cb = armature.edit_bones.new("CNSTR_" + b.name) cb.head = b.head cb.tail = b.tail cb.matrix = b.matrix bpy.context.object.data.edit_bones.get("CNSTR_" + b.name).use_deform = False if bpy.context.object.data.edit_bones.get("CTRL_" + b.name): bpy.context.object.data.edit_bones["CNSTR_" + b.name].parent = bpy.context.object.data.edit_bones["CTRL_" + b.name] #This part sets up the constraint bpy.ops.object.mode_set(mode='POSE') for pb in pbones: for c in pb.constraints: pb.constraints.remove(c) #first put the bone into the right collection bpy.context.object.data.collections['CNSTR'].assign(bpy.context.object.pose.bones["CNSTR_" + pbones[current_bone].name]) bpy.ops.pose.select_all(action='DESELECT') bpy.context.object.data.bones[pbones[current_bone].name].select = True bpy.context.object.data.bones["CNSTR_" + pbones[current_bone].name].select = True bpy.context.object.data.bones.active = bpy.context.object.pose.bones[pbones[current_bone].name].bone if context.scene.type_constrain.constraint_enum == 'OP1': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_TRANSFORMS') if context.scene.type_constrain.constraint_enum == 'OP2': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_LOCATION') if context.scene.type_constrain.constraint_enum == 'OP3': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_ROTATION') if context.scene.type_constrain.constraint_enum == 'OP4': bpy.ops.pose.constraint_add_with_targets(type = 'COPY_SCALE') if context.scene.type_constrain.constraint_enum == 'OP5': bpy.ops.pose.constraint_add_with_targets(type = 'IK') constraint_count = 1-len(bpy.context.selected_pose_bones[0].constraints) bpy.context.selected_pose_bones[0].constraints[constraint_count].use_tail = False bpy.context.selected_pose_bones[0].constraints[constraint_count].chain_count= 2 bpy.ops.pose.select_all(action='DESELECT') current_bone += 1 current_bone=0 for pb in pbones: bpy.context.object.data.bones[pbones[current_bone].name].select = True current_bone += 1 bpy.ops.object.mode_set(mode='EDIT') current_bone=0 if context.scene.local_world_switch.world_local_enum == 'OP1': for b in bpy.context.selected_bones: if bpy.context.object.data.edit_bones.get("CTRL_" + b.name): bpy.context.object.data.edit_bones.remove(bpy.context.object.data.edit_bones.get("CTRL_" + b.name)) cb = bpy.context.object.data.edit_bones.new("CTRL_" + b.name) cb.head = b.head cb.tail = b.tail cb.matrix = b.matrix bpy.context.object.data.edit_bones.get("CTRL_" + b.name).use_deform = False if bpy.context.object.data.edit_bones.get("CNSTR_" + b.name): bpy.context.object.data.edit_bones["CNSTR_" + b.name].parent = bpy.context.object.data.edit_bones[cb.name] if context.scene.local_world_switch.world_local_enum == 'OP2': for b in bpy.context.selected_bones: if bpy.context.object.data.edit_bones.get("CTRL_" + b.name): bpy.context.object.data.edit_bones.remove(bpy.context.object.data.edit_bones.get("CTRL_" + b.name)) cb = bpy.context.object.data.edit_bones.new("CTRL_" + b.name) world_vector=Vector((0,b.length,0)) cb.head = b.head cb.tail = cb.head + world_vector bpy.context.object.data.edit_bones.get("CTRL_" + b.name).use_deform = False if bpy.context.object.data.edit_bones.get("CNSTR_" + b.name): bpy.context.object.data.edit_bones["CNSTR_" + b.name].parent = bpy.context.object.data.edit_bones[cb.name] bpy.ops.object.mode_set(mode='POSE') bpy.ops.pose.select_all(action='DESELECT') for pb in pbones: #Put the bone into the right collection bpy.context.object.data.collections['CTRL'].assign(bpy.context.object.pose.bones["CTRL_" + pbones[current_bone].name]) bpy.context.object.data.bones["CTRL_" + pbones[current_bone].name].select = True current_bone += 1 current_bone=0 current_bone=0 for i in range(0,len(visibilityCache)): boneCollections[i].is_visible = visibilityCache[i] visibilityCache.clear bpy.ops.object.mode_set(mode= current_mode) return{'FINISHED'} else: self.report({"WARNING"}, "You gotta be in edit or pose mode") return {'CANCELLED'}
23,267
Python
.py
381
46.464567
138
0.624921
PaladinStudiosBVs/Blender-RigAssistant
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,649
rigshapes.py
PaladinStudiosBVs_Blender-RigAssistant/Blender-RigAssistant/operators/rigshapes.py
import bpy from mathutils import Vector # Create different shapes that can be used as bone shapes class OBJECT_OT_create_circle(bpy.types.Operator): bl_idname = 'object.create_circle' bl_label = "Circle" def execute (self, context): if bpy.context.selected_objects: bpy.ops.object.mode_set(mode = 'OBJECT') bpy.ops.mesh.primitive_circle_add() bpy.context.object.name = "circle_shpctrl" return{'FINISHED'} class OBJECT_OT_create_cube(bpy.types.Operator): bl_idname = 'object.create_cube' bl_label = "Cube" def execute (self, context): if bpy.context.selected_objects: bpy.ops.object.mode_set(mode = 'OBJECT') bpy.ops.mesh.primitive_cube_add() bpy.context.object.name = "cube_shpctrl" bpy.ops.object.mode_set(mode = 'EDIT') bpy.ops.mesh.delete(type='ONLY_FACE') bpy.ops.object.mode_set(mode = 'OBJECT') bpy.context.object.show_wire = True return{'FINISHED'} class OBJECT_OT_create_piramid(bpy.types.Operator): bl_idname = 'object.create_piramid' bl_label = "Piramid" def execute (self, context): if bpy.context.selected_objects: bpy.ops.object.mode_set(mode = 'OBJECT') bpy.ops.mesh.primitive_cone_add(vertices=4) bpy.context.object.name = "piramid_shpctrl" bpy.ops.object.mode_set(mode = 'EDIT') bpy.ops.transform.rotate(value=0.785398, orient_axis='Z', orient_type='GLOBAL') bpy.ops.mesh.delete(type='ONLY_FACE') bpy.ops.object.mode_set(mode = 'OBJECT') bpy.context.object.show_wire = True return{'FINISHED'} class OBJECT_OT_create_sphere(bpy.types.Operator): bl_idname = 'object.create_sphere' bl_label = "Sphere" def execute (self, context): if bpy.context.selected_objects: bpy.ops.object.mode_set(mode = 'OBJECT') bpy.ops.mesh.primitive_circle_add(enter_editmode=True) bpy.ops.mesh.primitive_circle_add(rotation = (1.5707963267948966, 0, 0)) bpy.ops.mesh.primitive_circle_add(rotation = (0, 1.5707963267948966, 0)) bpy.ops.object.mode_set(mode = 'OBJECT') return{'FINISHED'} class OBJECT_OT_create_square(bpy.types.Operator): bl_idname = 'object.create_square' bl_label = "Square" def execute (self, context): if bpy.context.selected_objects: bpy.ops.object.mode_set(mode = 'OBJECT') bpy.ops.mesh.primitive_plane_add() bpy.context.object.name = "square_shpctrl" bpy.ops.object.mode_set(mode = 'EDIT') bpy.ops.mesh.delete(type='ONLY_FACE') bpy.ops.object.mode_set(mode = 'OBJECT') bpy.context.object.show_wire = True return{'FINISHED'}
2,760
Python
.py
63
36.126984
87
0.656098
PaladinStudiosBVs/Blender-RigAssistant
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,650
config.py
tinaarobot_XSPAM/config.py
import logging from telethon import TelegramClient from os import getenv from ROYEDITX.data import AVISHA logging.basicConfig(format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s', level=logging.WARNING) # VALUES REQUIRED FOR XBOTS API_ID = 18136872 API_HASH = "312d861b78efcd1b02183b2ab52a83a4" CMD_HNDLR = getenv("CMD_HNDLR", default=".") HEROKU_APP_NAME = getenv("HEROKU_APP_NAME", None) HEROKU_API_KEY = getenv("HEROKU_API_KEY", None) BOT_TOKEN = getenv("BOT_TOKEN", default=None) SUDO_USERS = list(map(lambda x: int(x), getenv("SUDO_USERS", default="6922271843").split())) for x in AVISHA: SUDO_USERS.append(x) OWNER_ID = int(getenv("OWNER_ID", default="6922271843")) SUDO_USERS.append(OWNER_ID) # ------------- CLIENTS ------------- X1 = TelegramClient('X1', API_ID, API_HASH).start(bot_token=BOT_TOKEN)
868
Python
.py
19
42
105
0.711328
tinaarobot/XSPAM
8
22
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,651
main.py
tinaarobot_XSPAM/main.py
import sys import glob import asyncio import logging import importlib import urllib3 from pathlib import Path from config import X1 logging.basicConfig(format='[%(levelname) 5s/%(asctime)s] %(name)s: %(message)s', level=logging.WARNING) urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) def load_plugins(plugin_name): path = Path(f"ROYEDITX/modules/{plugin_name}.py") spec = importlib.util.spec_from_file_location(f"ROYEDITX.modules.{plugin_name}", path) load = importlib.util.module_from_spec(spec) load.logger = logging.getLogger(plugin_name) spec.loader.exec_module(load) sys.modules["ROYEDITX.modules." + plugin_name] = load print("♥︎ Xspam has Imported " + plugin_name) files = glob.glob("ROYEDITX/modules/*.py") for name in files: with open(name) as a: patt = Path(a.name) plugin_name = patt.stem load_plugins(plugin_name.replace(".py", "")) print("♥︎ Bot Deployed Successfully.") async def main(): await X1.run_until_disconnected() loop = asyncio.get_event_loop() loop.run_until_complete(main())
1,108
Python
.py
29
34.206897
104
0.735741
tinaarobot/XSPAM
8
22
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,652
data.py
tinaarobot_XSPAM/ROYEDITX/data.py
RAID = [ "ЁЭЧаЁЭЧФ╠ВЁЭЧФ╠ВЁЭЧЧЁЭЧФЁЭЧеЁЭЧЦЁЭЧЫ├ШЁЭЧЧ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШ ЁЭЧЪЁЭЧЫЁЭЧиЁЭЧзЁЭЧЮЁЭЧФ ЁЭЧЮЁЭЧЫЁЭЧФЁЭЧФЁЭЧЮЁЭЧШ ЁЭЧзЁЭЧЫЁЭЧвЁЭЧвЁЭЧЮ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЯдгЁЯдг", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧШ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧЮЁЭЧи ЁЭЧЧЁЭЧФЁЭЧФЁЭЧЯ ЁЭЧЮЁЭЧФЁЭЧе ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧЮЁЭЧФ ЁЭЧЮЁЭЧЫЁЭЧвЁЭЧвЁЭЧб ЁЭЧЮЁЭЧФЁЭЧе ЁЭЧЧЁЭЧиЁЭЧЪЁЭЧФ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧйЁЭЧФЁЭЧЫЁЭЧШЁЭЧШЁЭЧб ЁЭЧбЁЭЧЫЁЭЧЬ ЁЭЧЫЁЭЧФЁЭЧЬ ЁЭЧЮЁЭЧмЁЭЧФ? 9 ЁЭЧаЁЭЧФЁЭЧЫЁЭЧЬЁЭЧбЁЭЧШ ЁЭЧеЁЭЧиЁЭЧЮ ЁЭЧжЁЭЧФЁЭЧЪЁЭЧЬ ЁЭЧйЁЭЧФЁЭЧЫЁЭЧШЁЭЧШЁЭЧб ЁЭЧЧЁЭЧШЁЭЧзЁЭЧФ ЁЭЧЫЁЭЧи ЁЯдгЁЯдгЁЯдй", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧШ ЁЭЧаЁЭЧШ ЁЭЧФЁЭЧШЁЭЧеЁЭЧвЁЭЧгЁЭЧЯЁЭЧФЁЭЧбЁЭЧШЁЭЧгЁЭЧФЁЭЧеЁЭЧЮ ЁЭЧЮЁЭЧФЁЭЧеЁЭЧЮЁЭЧШ ЁЭЧиЁЭЧЧЁЭЧФЁЭЧФЁЭЧб ЁЭЧХЁЭЧЫЁЭЧФЁЭЧе ЁЭЧЧЁЭЧиЁЭЧЪЁЭЧФ тЬИя╕ПЁЯЫл", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШ ЁЭЧжЁЭЧиЁЭЧзЁЭЧЯЁЭЧЬ ЁЭЧХЁЭЧвЁЭЧаЁЭЧХ ЁЭЧЩЁЭЧвЁЭЧЧ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЭЁЭЧЫЁЭЧФЁЭЧФЁЭЧзЁЭЧШ ЁЭЧЭЁЭЧФЁЭЧЯ ЁЭЧЮЁЭЧШ ЁЭЧЮЁЭЧЫЁЭЧФЁЭЧФЁЭЧЮ ЁЭЧЫЁЭЧв ЁЭЧЭЁЭЧФЁЭЧмЁЭЧШЁЭЧЪЁЭЧЬЁЯТг", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШ ЁЭЧжЁЭЧЦЁЭЧвЁЭЧвЁЭЧзЁЭЧШЁЭЧе ЁЭЧЧЁЭЧФЁЭЧФЁЭЧЯ ЁЭЧЧЁЭЧиЁЭЧЪЁЭЧФЁЯСЕ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧЮЁЭЧФЁЭЧЮЁЭЧзЁЭЧШ ЁЯд▒ ЁЭЧЪЁЭЧФЁЭЧЯЁЭЧЬ ЁЭЧЮЁЭЧШ ЁЭЧЮЁЭЧиЁЭЧзЁЭЧзЁЭЧв ЁЯжо ЁЭЧаЁЭЧШ ЁЭЧХЁЭЧФЁЭЧФЁЭЧз ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧгЁЭЧЫЁЭЧЬЁЭЧе ЁЯНЮ ЁЭЧХЁЭЧеЁЭЧШЁЭЧФЁЭЧЧ ЁЭЧЮЁЭЧЬ ЁЭЧзЁЭЧФЁЭЧеЁЭЧЫ ЁЭЧЮЁЭЧЫЁЭЧФЁЭЧмЁЭЧШЁЭЧбЁЭЧЪЁЭЧШ ЁЭЧкЁЭЧв ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз", "ЁЭЧЧЁЭЧиЁЭЧЧЁЭЧЫ ЁЭЧЫЁЭЧЬЁЭЧЯЁЭЧФЁЭЧФЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧйЁЭЧФЁЭЧЫЁЭЧШЁЭЧШЁЭЧб ЁЭЧЮЁЭЧШ ЁЭЧиЁЭЧгЁЭЧе ЁЭЧбЁЭЧЬЁЭЧЦЁЭЧЫЁЭЧШ ЁЯЖЩЁЯЖТЁЯШЩ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШЁЭЧЫЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШ ЁЭЧЮЁЭЧШЁЭЧЯЁЭЧШ ЁЭЧЮЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧЬЁЭЧЯЁЭЧЮЁЭЧШ ЁЯНМЁЯНМЁЯШН", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧйЁЭЧФЁЭЧЫЁЭЧШЁЭЧШЁЭЧб ЁЭЧЧЁЭЧЫЁЭЧФЁЭЧбЁЭЧЧЁЭЧЫЁЭЧШ ЁЭЧйЁЭЧФЁЭЧФЁЭЧЯЁЭЧЬ ЁЯШЛЁЯШЫ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧШ ЁЭЧаЁЭЧШ ЁЭЧФЁЭЧЦ ЁЭЧЯЁЭЧФЁЭЧЪЁЭЧФ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧжЁЭЧФЁЭЧФЁЭЧеЁЭЧЬ ЁЭЧЪЁЭЧФЁЭЧеЁЭЧаЁЭЧЬ ЁЭЧбЁЭЧЬЁЭЧЮЁЭЧФЁЭЧЯ ЁЭЧЭЁЭЧФЁЭЧФЁЭЧмЁЭЧШЁЭЧЪЁЭЧЬ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧйЁЭЧФЁЭЧЫЁЭЧШЁЭЧШЁЭЧб ЁЭЧЮЁЭЧв ЁЭЧЫЁЭЧвЁЭЧеЁЭЧЯЁЭЧЬЁЭЧЦЁЭЧЮЁЭЧж ЁЭЧгЁЭЧШЁЭЧШЁЭЧЯЁЭЧФЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧаЁЭЧФ╠ВЁЭЧФ╠ВЁЭЧЧЁЭЧФЁЭЧеЁЭЧЦЁЭЧЫ├ШЁЭЧЧЁЯШЪ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧв ЁЭЧЮЁЭЧвЁЭЧЯЁЭЧЮЁЭЧФЁЭЧзЁЭЧФ ЁЭЧйЁЭЧФЁЭЧФЁЭЧЯЁЭЧШ ЁЭЧЭЁЭЧЬЁЭЧзЁЭЧи ЁЭЧХЁЭЧЫЁЭЧФЁЭЧЬЁЭЧмЁЭЧФ ЁЭЧЮЁЭЧФ ЁЭЧЯЁЭЧиЁЭЧбЁЭЧЧ ЁЭЧаЁЭЧиЁЭЧХЁЭЧФЁЭЧеЁЭЧФЁЭЧЮ ЁЯдйЁЯдй", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧиЁЭЧаЁЭЧаЁЭЧм ЁЭЧЮЁЭЧЬ ЁЭЧЩЁЭЧФЁЭЧбЁЭЧзЁЭЧФЁЭЧжЁЭЧм ЁЭЧЫЁЭЧи ЁЭЧЯЁЭЧФЁЭЧкЁЭЧЧЁЭЧШ, ЁЭЧзЁЭЧи ЁЭЧФЁЭЧгЁЭЧбЁЭЧЬ ЁЭЧХЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧв ЁЭЧжЁЭЧаЁЭЧХЁЭЧЫЁЭЧФЁЭЧФЁЭЧЯ ЁЯШИЁЯШИ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧФ ЁЭЧгЁЭЧШЁЭЧЫЁЭЧЯЁЭЧФ ЁЭЧХЁЭЧФЁЭЧФЁЭЧг ЁЭЧЫЁЭЧи ЁЭЧаЁЭЧФ╠ВЁЭЧФ╠ВЁЭЧЧЁЭЧФЁЭЧеЁЭЧЦЁЭЧЫ├ШЁЭЧЧ ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧйЁЭЧФЁЭЧЫЁЭЧШЁЭЧШЁЭЧб ЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧШ ЁЭЧаЁЭЧШ ЁЭЧлЁЭЧйЁЭЧЬЁЭЧЧЁЭЧШЁЭЧвЁЭЧж.ЁЭЧЦЁЭЧвЁЭЧа ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧЯЁЭЧФ ЁЭЧЮЁЭЧШ ЁЭЧаЁЭЧиЁЭЧзЁЭЧЫ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧеЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЯдбЁЯШ╣", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧФ ЁЭЧЪЁЭЧеЁЭЧвЁЭЧиЁЭЧг ЁЭЧйЁЭЧФЁЭЧФЁЭЧЯЁЭЧвЁЭЧб ЁЭЧжЁЭЧФЁЭЧФЁЭЧзЁЭЧЫ ЁЭЧаЁЭЧЬЁЭЧЯЁЭЧЮЁЭЧШ ЁЭЧЪЁЭЧФЁЭЧбЁЭЧЪ ЁЭЧХЁЭЧФЁЭЧбЁЭЧЪ ЁЭЧЮЁЭЧеЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЯЩМЁЯП╗тШая╕П ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧЬЁЭЧзЁЭЧШЁЭЧа ЁЭЧЮЁЭЧЬ ЁЭЧЪЁЭЧФЁЭЧФЁЭЧбЁЭЧЧ ЁЭЧаЁЭЧШ ЁЭЧЯЁЭЧиЁЭЧбЁЭЧЧ ЁЭЧЧЁЭЧФЁЭЧФЁЭЧЯЁЭЧЮЁЭЧШ,ЁЭЧзЁЭЧШЁЭЧеЁЭЧШ ЁЭЧЭЁЭЧФЁЭЧЬЁЭЧжЁЭЧФ ЁЭЧШЁЭЧЮ ЁЭЧвЁЭЧе ЁЭЧбЁЭЧЬЁЭЧЮЁЭЧФЁЭЧФЁЭЧЯ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧаЁЭЧФ╠ВЁЭЧФ╠ВЁЭЧЧЁЭЧФЁЭЧеЁЭЧЦЁЭЧЫ├ШЁЭЧЧЁЯдШЁЯП╗ЁЯЩМЁЯП╗тШая╕П ", "ЁЭЧФЁЭЧиЁЭЧЮЁЭЧФЁЭЧФЁЭЧз ЁЭЧаЁЭЧШ ЁЭЧеЁЭЧШЁЭЧЫ ЁЭЧйЁЭЧеЁЭЧбЁЭЧФ ЁЭЧЪЁЭЧФЁЭЧФЁЭЧбЁЭЧЧ ЁЭЧаЁЭЧШ ЁЭЧЧЁЭЧФЁЭЧбЁЭЧЧЁЭЧФ ЁЭЧЧЁЭЧФЁЭЧФЁЭЧЯ ЁЭЧЮЁЭЧШ ЁЭЧаЁЭЧиЁЭЧЫ ЁЭЧжЁЭЧШ ЁЭЧбЁЭЧЬЁЭЧЮЁЭЧФЁЭЧФЁЭЧЯ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧжЁЭЧЫЁЭЧФЁЭЧеЁЭЧЬЁЭЧе ЁЭЧХЁЭЧЫЁЭЧЬ ЁЭЧЧЁЭЧФЁЭЧбЁЭЧЧЁЭЧШ ЁЭЧЭЁЭЧШЁЭЧжЁЭЧФ ЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧЫЁЭЧШЁЭЧЪЁЭЧФ ЁЯЩДЁЯднЁЯдн", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧиЁЭЧаЁЭЧаЁЭЧм ЁЭЧЮЁЭЧШ ЁЭЧжЁЭЧФЁЭЧФЁЭЧзЁЭЧЫ ЁЭЧЯЁЭЧиЁЭЧЧЁЭЧв ЁЭЧЮЁЭЧЫЁЭЧШЁЭЧЯЁЭЧзЁЭЧШ ЁЭЧЮЁЭЧЫЁЭЧШЁЭЧЯЁЭЧзЁЭЧШ ЁЭЧиЁЭЧжЁЭЧЮЁЭЧШ ЁЭЧаЁЭЧиЁЭЧЫ ЁЭЧаЁЭЧШ ЁЭЧФЁЭЧгЁЭЧбЁЭЧФ ЁЭЧЯЁЭЧвЁЭЧЧЁЭЧФ ЁЭЧЧЁЭЧШ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФтШЭЁЯП╗тШЭЁЯП╗ЁЯШм", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧйЁЭЧФЁЭЧЫЁЭЧШЁЭЧШЁЭЧб ЁЭЧЮЁЭЧв ЁЭЧФЁЭЧгЁЭЧбЁЭЧШ ЁЭЧЯЁЭЧиЁЭЧбЁЭЧЧ ЁЭЧгЁЭЧе ЁЭЧЬЁЭЧзЁЭЧбЁЭЧФ ЁЭЧЭЁЭЧЫЁЭЧиЁЭЧЯЁЭЧФЁЭЧФЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧЮЁЭЧЬ ЁЭЧЭЁЭЧЫЁЭЧиЁЭЧЯЁЭЧзЁЭЧШ ЁЭЧЭЁЭЧЫЁЭЧиЁЭЧЯЁЭЧзЁЭЧШ ЁЭЧЫЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЦЁЭЧЫЁЭЧФ ЁЭЧгЁЭЧФЁЭЧЬЁЭЧЧЁЭЧФ ЁЭЧЮЁЭЧе ЁЭЧЧЁЭЧШЁЭЧЪЁЭЧЬЁЯСАЁЯСп ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧзЁЭЧзЁЭЧШЁЭЧеЁЭЧм ЁЭЧЯЁЭЧФЁЭЧЪЁЭЧФ ЁЭЧЮЁЭЧШ ЁЭЧгЁЭЧвЁЭЧкЁЭЧШЁЭЧеЁЭЧХЁЭЧФЁЭЧбЁЭЧЮ ЁЭЧХЁЭЧФЁЭЧбЁЭЧФ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЯФЛ ЁЯФеЁЯдй", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧЦ++ ЁЭЧжЁЭЧзЁЭЧеЁЭЧЬЁЭЧбЁЭЧЪ ЁЭЧШЁЭЧбЁЭЧЦЁЭЧеЁЭЧмЁЭЧгЁЭЧзЁЭЧЬЁЭЧвЁЭЧб ЁЭЧЯЁЭЧФЁЭЧЪЁЭЧФ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧзЁЭЧЬ ЁЭЧЫЁЭЧиЁЭЧмЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧеЁЭЧиЁЭЧЮ ЁЭЧЭЁЭЧФЁЭЧмЁЭЧШЁЭЧЪЁЭЧЬЁЭЧЬЁЭЧЬЁЭЧЬЁЯШИЁЯФеЁЯШН", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧШ ЁЭЧЪЁЭЧФЁЭЧФЁЭЧбЁЭЧЧ ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧЭЁЭЧЫЁЭЧФЁЭЧФЁЭЧЧЁЭЧи ЁЭЧЧЁЭЧФЁЭЧЯ ЁЭЧЮЁЭЧШ ЁЭЧаЁЭЧвЁЭЧе ЁЯжЪ ЁЭЧХЁЭЧФЁЭЧбЁЭЧФ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЭЧФ ЁЯдйЁЯе╡ЁЯШ▒", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧжЁЭЧЫЁЭЧвЁЭЧиЁЭЧЯЁЭЧЧЁЭЧШЁЭЧеЁЭЧЬЁЭЧбЁЭЧЪ ЁЭЧЮЁЭЧФЁЭЧе ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЭЧФ ЁЭЧЫЁЭЧЬЁЭЧЯЁЭЧФЁЭЧзЁЭЧШ ЁЭЧЫЁЭЧиЁЭЧмЁЭЧШ ЁЭЧХЁЭЧЫЁЭЧЬ ЁЭЧЧЁЭЧФЁЭЧеЁЭЧЧ ЁЭЧЫЁЭЧвЁЭЧЪЁЭЧФЁЭЧФЁЭЧФЁЯШ▒ЁЯдоЁЯС║", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧв ЁЭЧеЁЭЧШЁЭЧЧЁЭЧЬ ЁЭЧгЁЭЧШ ЁЭЧХЁЭЧФЁЭЧЬЁЭЧзЁЭЧЫЁЭЧФЁЭЧЯ ЁЭЧЮЁЭЧШ ЁЭЧиЁЭЧжЁЭЧжЁЭЧШ ЁЭЧиЁЭЧжЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧХЁЭЧЬЁЭЧЯЁЭЧкЁЭЧФЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЭЧФ ЁЯТ░ ЁЯШ╡ЁЯдй", "ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ 4 ЁЭЧЫЁЭЧвЁЭЧЯЁЭЧШ ЁЭЧЫЁЭЧФЁЭЧЬ ЁЭЧиЁЭЧбЁЭЧаЁЭЧШ ЁЭЧаЁЭЧжЁЭЧШЁЭЧФЁЭЧЯ ЁЭЧЯЁЭЧФЁЭЧЪЁЭЧФ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧиЁЭЧз ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧзЁЭЧЬ ЁЭЧЫЁЭЧФЁЭЧЬ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧЩЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧШЁЯСКЁЯдоЁЯдвЁЯдв", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧеЁЭЧЪЁЭЧФЁЭЧЧ ЁЭЧЮЁЭЧФ ЁЭЧгЁЭЧШЁЭЧЧ ЁЭЧиЁЭЧЪЁЭЧФ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЭЧФ ЁЭЧЦЁЭЧвЁЭЧеЁЭЧвЁЭЧбЁЭЧФ ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧжЁЭЧФЁЭЧХ ЁЭЧвЁЭЧлЁЭЧмЁЭЧЪЁЭЧШЁЭЧб ЁЭЧЯЁЭЧШЁЭЧЮЁЭЧФЁЭЧе ЁЭЧЭЁЭЧФЁЭЧмЁЭЧШЁЭЧбЁЭЧЪЁЭЧШЁЯдвЁЯдйЁЯе│", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧжЁЭЧиЁЭЧЧЁЭЧв ЁЭЧЯЁЭЧФЁЭЧЪЁЭЧФ ЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧЬЁЭЧЪЁЭЧжЁЭЧгЁЭЧФЁЭЧа ЁЭЧЯЁЭЧФЁЭЧЪЁЭЧФ ЁЭЧЮЁЭЧШ 9999 ЁЭЧЩЁЭЧиЁЭЧЦЁЭЧЮ ЁЭЧЯЁЭЧФЁЭЧЪЁЭЧФЁЭЧФ ЁЭЧЧЁЭЧи ЁЯдйЁЯе│ЁЯФе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧйЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧШ ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧХЁЭЧШЁЭЧжЁЭЧФЁЭЧб ЁЭЧЮЁЭЧШ ЁЭЧЯЁЭЧФЁЭЧЧЁЭЧЧЁЭЧи ЁЭЧХЁЭЧЫЁЭЧФЁЭЧе ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЯдйЁЯе│ЁЯФеЁЯШИ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧЮЁЭЧЫЁЭЧвЁЭЧЧ ЁЭЧЮЁЭЧШ ЁЭЧиЁЭЧжЁЭЧаЁЭЧШ ЁЭЧЦЁЭЧмЁЭЧЯЁЭЧЬЁЭЧбЁЭЧЧЁЭЧШЁЭЧе тЫ╜я╕П ЁЭЧЩЁЭЧЬЁЭЧз ЁЭЧЮЁЭЧФЁЭЧеЁЭЧЮЁЭЧШ ЁЭЧиЁЭЧжЁЭЧаЁЭЧШЁЭЧШ ЁЭЧЧЁЭЧФЁЭЧЯ ЁЭЧаЁЭЧФЁЭЧЮЁЭЧЫЁЭЧФЁЭЧбЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧбЁЭЧФЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЭЧФЁЭЧФЁЯдйЁЯСКЁЯФе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧжЁЭЧЫЁЭЧШЁЭЧШЁЭЧжЁЭЧЫЁЭЧФ ЁЭЧЧЁЭЧФЁЭЧЯ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЭЧФЁЭЧФ ЁЭЧФЁЭЧиЁЭЧе ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧиЁЭЧеЁЭЧФЁЭЧЫЁЭЧШ ЁЭЧгЁЭЧШ ЁЭЧзЁЭЧФЁЭЧФЁЭЧбЁЭЧЪ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧШЁЯШИЁЯШ▒ЁЯдй", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧЦЁЭЧеЁЭЧШЁЭЧЧЁЭЧЬЁЭЧз ЁЭЧЦЁЭЧФЁЭЧеЁЭЧЧ ЁЭЧЧЁЭЧФЁЭЧЯ ЁЭЧЮЁЭЧШ ЁЭЧФЁЭЧЪЁЭЧШ ЁЭЧжЁЭЧШ 500 ЁЭЧЮЁЭЧШ ЁЭЧЮЁЭЧФЁЭЧФЁЭЧеЁЭЧШ ЁЭЧЮЁЭЧФЁЭЧФЁЭЧеЁЭЧШ ЁЭЧбЁЭЧвЁЭЧзЁЭЧШ ЁЭЧбЁЭЧЬЁЭЧЮЁЭЧФЁЭЧЯЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЭЧФ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧШЁЯТ░ЁЯТ░ЁЯдй", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧШ ЁЭЧжЁЭЧФЁЭЧзЁЭЧЫ ЁЭЧжЁЭЧиЁЭЧФЁЭЧе ЁЭЧЮЁЭЧФ ЁЭЧжЁЭЧШЁЭЧл ЁЭЧЮЁЭЧФЁЭЧеЁЭЧкЁЭЧФ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЭЧФ ЁЭЧШЁЭЧЮ ЁЭЧжЁЭЧФЁЭЧзЁЭЧЫ 6-6 ЁЭЧХЁЭЧФЁЭЧЦЁЭЧЫЁЭЧШ ЁЭЧЧЁЭЧШЁЭЧЪЁЭЧЬЁЯТ░ЁЯФеЁЯШ▒", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧФЁЭЧгЁЭЧгЁЭЧЯЁЭЧШ ЁЭЧЮЁЭЧФ 18ЁЭЧк ЁЭЧкЁЭЧФЁЭЧЯЁЭЧФ ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧеЁЭЧЪЁЭЧШЁЭЧе ЁЯФеЁЯдй", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЪЁЭЧФЁЭЧФЁЭЧбЁЭЧЧ ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧвЁЭЧбЁЭЧШЁЭЧгЁЭЧЯЁЭЧиЁЭЧж ЁЭЧЮЁЭЧФ ЁЭЧкЁЭЧеЁЭЧФЁЭЧг ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧеЁЭЧЪЁЭЧШЁЭЧе 30ЁЭЧк ЁЭЧЫЁЭЧЬЁЭЧЪЁЭЧЫ ЁЭЧгЁЭЧвЁЭЧкЁЭЧШЁЭЧе ЁЯТеЁЯШВЁЯШО", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧЮЁЭЧв ЁЭЧФЁЭЧаЁЭЧФЁЭЧнЁЭЧвЁЭЧб ЁЭЧжЁЭЧШ ЁЭЧвЁЭЧеЁЭЧЧЁЭЧШЁЭЧе ЁЭЧЮЁЭЧФЁЭЧеЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ 10 ЁЭЧ┐ЁЭША ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧФЁЭЧиЁЭЧе ЁЭЧЩЁЭЧЯЁЭЧЬЁЭЧгЁЭЧЮЁЭЧФЁЭЧеЁЭЧз ЁЭЧгЁЭЧШ 20 ЁЭЧеЁЭЧж ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧХЁЭЧШЁЭЧЦЁЭЧЫ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЯдоЁЯС┐ЁЯШИЁЯдЦ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЧЁЭЧЬ ЁЭЧХЁЭЧЫЁЭЧиЁЭЧбЁЭЧЧ ЁЭЧаЁЭЧШ ЁЭЧнЁЭЧвЁЭЧаЁЭЧФЁЭЧзЁЭЧв ЁЭЧЧЁЭЧФЁЭЧЯ ЁЭЧЮЁЭЧШ ЁЭЧжЁЭЧиЁЭЧХЁЭЧкЁЭЧФЁЭЧм ЁЭЧЮЁЭЧФ ЁЭЧХЁЭЧЩЁЭЧЩ ЁЭЧйЁЭЧШЁЭЧЪ ЁЭЧжЁЭЧиЁЭЧХ ЁЭЧЦЁЭЧвЁЭЧаЁЭЧХЁЭЧв [15ЁЭЧ░ЁЭЧ║ , 16 ЁЭЧ╢ЁЭЧ╗ЁЭЧ░ЁЭЧ╡ЁЭЧ▓ЁЭША ] ЁЭЧвЁЭЧеЁЭЧЧЁЭЧШЁЭЧе ЁЭЧЦЁЭЧвЁЭЧЧ ЁЭЧЮЁЭЧеЁЭЧйЁЭЧФЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧвЁЭЧе ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЭЁЭЧФЁЭЧХ ЁЭЧЧЁЭЧЬЁЭЧЯЁЭЧЬЁЭЧйЁЭЧШЁЭЧеЁЭЧм ЁЭЧЧЁЭЧШЁЭЧбЁЭЧШ ЁЭЧФЁЭЧмЁЭЧШЁЭЧЪЁЭЧЬ ЁЭЧзЁЭЧФЁЭЧХ ЁЭЧиЁЭЧжЁЭЧгЁЭЧШ ЁЭЧЭЁЭЧФЁЭЧФЁЭЧЧЁЭЧи ЁЭЧЮЁЭЧеЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧвЁЭЧе ЁЭЧЩЁЭЧЬЁЭЧе 9 ЁЭЧаЁЭЧвЁЭЧбЁЭЧзЁЭЧЫ ЁЭЧХЁЭЧФЁЭЧФЁЭЧЧ ЁЭЧйЁЭЧв ЁЭЧШЁЭЧЮ ЁЭЧвЁЭЧе ЁЭЧЩЁЭЧеЁЭЧШЁЭЧШ ЁЭЧЧЁЭЧЬЁЭЧЯЁЭЧЬЁЭЧйЁЭЧШЁЭЧеЁЭЧм ЁЭЧЧЁЭЧШЁЭЧЪЁЭЧЬЁЯЩАЁЯСНЁЯе│ЁЯФе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧЮЁЭЧФЁЭЧФЁЭЧЯЁЭЧЬЁЯЩБЁЯдгЁЯТе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧбЁЭЧЪЁЭЧШЁЭЧж ЁЭЧЦЁЭЧвЁЭЧаЁЭЧаЁЭЧЬЁЭЧз ЁЭЧЮЁЭЧеЁЭЧиЁЭЧЪЁЭЧФ ЁЭЧЩЁЭЧЬЁЭЧе ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧЫЁЭЧШЁЭЧШЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧФЁЭЧиЁЭЧзЁЭЧвЁЭЧаЁЭЧФЁЭЧзЁЭЧЬЁЭЧЦЁЭЧФЁЭЧЯЁЭЧЯЁЭЧм ЁЭЧиЁЭЧгЁЭЧЧЁЭЧФЁЭЧзЁЭЧШ ЁЭЧЫЁЭЧвЁЭЧЭЁЭЧФЁЭЧФЁЭЧмЁЭЧШЁЭЧЪЁЭЧЬЁЯдЦЁЯЩПЁЯдФ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФЁЭЧиЁЭЧжЁЭЧЬ ЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧШ ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧЬЁЭЧбЁЭЧЧЁЭЧЬЁЭЧФЁЭЧб ЁЭЧеЁЭЧФЁЭЧЬЁЭЧЯЁЭЧкЁЭЧФЁЭЧм ЁЯЪВЁЯТеЁЯШВ", "ЁЭЧзЁЭЧи ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧзЁЭЧШЁЭЧеЁЭЧФ ЁЭЧЮЁЭЧЫЁЭЧФЁЭЧбЁЭЧЧЁЭЧФЁЭЧб ЁЭЧжЁЭЧФЁЭЧХ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧШ ЁЭЧЯЁЭЧФЁЭЧкЁЭЧЧЁЭЧШ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬ ЁЭЧЫЁЭЧФЁЭЧЬ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬ ЁЯдвтЬЕЁЯФе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧЬЁЭЧвЁЭЧбЁЭЧЬЁЭЧЦ ЁЭЧХЁЭЧвЁЭЧбЁЭЧЧ ЁЭЧХЁЭЧФЁЭЧбЁЭЧФ ЁЭЧЮЁЭЧШ ЁЭЧйЁЭЧЬЁЭЧеЁЭЧЪЁЭЧЬЁЭЧбЁЭЧЬЁЭЧзЁЭЧм ЁЭЧЯЁЭЧвЁЭЧвЁЭЧжЁЭЧШ ЁЭЧЮЁЭЧФЁЭЧеЁЭЧкЁЭЧФ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧиЁЭЧжЁЭЧЮЁЭЧЬ ЁЯУЪ ЁЯШОЁЯдй", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧжЁЭЧШ ЁЭЧгЁЭЧиЁЭЧЦЁЭЧЫЁЭЧбЁЭЧФ ЁЭЧХЁЭЧФЁЭЧФЁЭЧг ЁЭЧЮЁЭЧФ ЁЭЧбЁЭЧФЁЭЧФЁЭЧа ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧШ ЁЭЧЯЁЭЧвЁЭЧЧЁЭЧШЁЭЧШЁЭЧШЁЭЧШЁЭЧШ ЁЯдйЁЯе│ЁЯШ│", "ЁЭЧзЁЭЧи ЁЭЧФЁЭЧиЁЭЧе ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЧЁЭЧвЁЭЧбЁЭЧв ЁЭЧЮЁЭЧЬ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧШ ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧаЁЭЧШЁЭЧзЁЭЧеЁЭЧв ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧЯЁЭЧкЁЭЧФ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧаЁЭЧФЁЭЧЧЁЭЧФЁЭЧеЁЭЧлЁЭЧЫЁЭЧвЁЭЧЧ ЁЯЪЗЁЯдйЁЯШ▒ЁЯе╢", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧв ЁЭЧЬЁЭЧзЁЭЧбЁЭЧФ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧзЁЭЧШЁЭЧеЁЭЧФ ЁЭЧХЁЭЧФЁЭЧФЁЭЧг ЁЭЧХЁЭЧЫЁЭЧЬ ЁЭЧиЁЭЧжЁЭЧЮЁЭЧв ЁЭЧгЁЭЧФЁЭЧЫЁЭЧЦЁЭЧЫЁЭЧФЁЭЧбЁЭЧФЁЭЧбЁЭЧШ ЁЭЧжЁЭЧШ ЁЭЧаЁЭЧФЁЭЧбЁЭЧФ ЁЭЧЮЁЭЧФЁЭЧе ЁЭЧЧЁЭЧШЁЭЧЪЁЭЧФЁЯШВЁЯС┐ЁЯдй", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧШ ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧЫЁЭЧФЁЭЧЬЁЭЧе ЁЭЧЧЁЭЧеЁЭЧмЁЭЧШЁЭЧе ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧЯЁЭЧФ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЭЧФЁЯТеЁЯФеЁЯФе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧзЁЭЧШЁЭЧЯЁЭЧШЁЭЧЪЁЭЧеЁЭЧФЁЭЧа ЁЭЧЮЁЭЧЬ ЁЭЧжЁЭЧФЁЭЧеЁЭЧЬ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬЁЭЧмЁЭЧвЁЭЧб ЁЭЧЮЁЭЧФ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬ ЁЭЧЮЁЭЧЫЁЭЧФЁЭЧбЁЭЧФ ЁЭЧЮЁЭЧЫЁЭЧвЁЭЧЯ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЭЧФЁЯС┐ЁЯдоЁЯШО", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧФЁЭЧЯЁЭЧШЁЭЧлЁЭЧФ ЁЭЧЧЁЭЧФЁЭЧЯ ЁЭЧЮЁЭЧШЁЭЧШ ЁЭЧЧЁЭЧЭ ЁЭЧХЁЭЧФЁЭЧЭЁЭЧФЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЭЧФЁЭЧФ ЁЯО╢ тмЖя╕ПЁЯдйЁЯТе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧШ ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧЪЁЭЧЬЁЭЧзЁЭЧЫЁЭЧиЁЭЧХ ЁЭЧЧЁЭЧФЁЭЧЯ ЁЭЧЮЁЭЧШ ЁЭЧФЁЭЧгЁЭЧбЁЭЧФ ЁЭЧХЁЭЧвЁЭЧз ЁЭЧЫЁЭЧвЁЭЧжЁЭЧз ЁЭЧЮЁЭЧФЁЭЧеЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЭЧФ ЁЯдйЁЯСКЁЯСдЁЯШН", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧФ ЁЭЧйЁЭЧгЁЭЧж ЁЭЧХЁЭЧФЁЭЧбЁЭЧФ ЁЭЧЮЁЭЧШ 24*7 ЁЭЧХЁЭЧФЁЭЧжЁЭЧЫ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧЧЁЭЧФЁЭЧЬ ЁЭЧЦЁЭЧвЁЭЧаЁЭЧаЁЭЧФЁЭЧбЁЭЧЧ ЁЭЧЧЁЭЧШ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЭЧФ ЁЯдйЁЯТеЁЯФеЁЯФе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧиЁЭЧаЁЭЧаЁЭЧм ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧзЁЭЧШЁЭЧеЁЭЧШ ЁЭЧЯЁЭЧФЁЭЧбЁЭЧЧ ЁЭЧЮЁЭЧв ЁЭЧЧЁЭЧФЁЭЧЯ ЁЭЧЮЁЭЧШ ЁЭЧЮЁЭЧФЁЭЧФЁЭЧз ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧаЁЭЧФ╠ВЁЭЧФ╠ВЁЭЧЧЁЭЧФЁЭЧеЁЭЧЦЁЭЧЫ├ШЁЭЧЧ ЁЯФкЁЯШВЁЯФе", "ЁЭЧжЁЭЧиЁЭЧб ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧФ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧФ ЁЭЧФЁЭЧиЁЭЧе ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧФ ЁЭЧХЁЭЧЫЁЭЧЬ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧФ ЁЯС┐ЁЯШОЁЯСК", "ЁЭЧзЁЭЧиЁЭЧЭЁЭЧЫЁЭЧШ ЁЭЧЧЁЭЧШЁЭЧЮЁЭЧЫ ЁЭЧЮЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧгЁЭЧШ ЁЭЧзЁЭЧФЁЭЧеЁЭЧФЁЭЧж ЁЭЧФЁЭЧзЁЭЧФ ЁЭЧЫЁЭЧФЁЭЧЬ ЁЭЧаЁЭЧиЁЭЧЭЁЭЧЫЁЭЧШ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧШ ЁЭЧЯЁЭЧвЁЭЧЧЁЭЧШЁЭЧШЁЭЧШЁЭЧШ ЁЯС┐ЁЯТеЁЯдйЁЯФе", "ЁЭЧжЁЭЧиЁЭЧб ЁЭЧаЁЭЧФ╠ВЁЭЧФ╠ВЁЭЧЧЁЭЧФЁЭЧеЁЭЧЦЁЭЧЫ├ШЁЭЧЧ ЁЭЧЭЁЭЧмЁЭЧФЁЭЧЧЁЭЧФ ЁЭЧбЁЭЧФ ЁЭЧиЁЭЧЦЁЭЧЫЁЭЧФЁЭЧЯ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧ ЁЭЧЧЁЭЧШЁЭЧбЁЭЧЪЁЭЧШ ЁЭЧШЁЭЧЮ ЁЭЧаЁЭЧЬЁЭЧб ЁЭЧаЁЭЧШЁЭЧЬ тЬЕЁЯдгЁЯФеЁЯдй", "ЁЭЧФЁЭЧгЁЭЧбЁЭЧЬ ЁЭЧФЁЭЧаЁЭЧаЁЭЧФ ЁЭЧжЁЭЧШ ЁЭЧгЁЭЧиЁЭЧЦЁЭЧЫЁЭЧбЁЭЧФ ЁЭЧиЁЭЧжЁЭЧЮЁЭЧв ЁЭЧиЁЭЧж ЁЭЧЮЁЭЧФЁЭЧФЁЭЧЯЁЭЧЬ ЁЭЧеЁЭЧФЁЭЧФЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧЮЁЭЧФЁЭЧиЁЭЧб ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧбЁЭЧШЁЭЧШ ЁЭЧФЁЭЧмЁЭЧФ ЁЭЧзЁЭЧЫЁЭЧФЁЭЧФЁЭЧФ! ЁЭЧзЁЭЧШЁЭЧеЁЭЧШ ЁЭЧЬЁЭЧж ЁЭЧгЁЭЧФЁЭЧгЁЭЧФ ЁЭЧЮЁЭЧФ ЁЭЧбЁЭЧФЁЭЧФЁЭЧа ЁЭЧЯЁЭЧШЁЭЧЪЁЭЧЬ ЁЯШВЁЯС┐ЁЯШ│", "ЁЭЧзЁЭЧвЁЭЧЫЁЭЧФЁЭЧе ЁЭЧХЁЭЧФЁЭЧЫЁЭЧЬЁЭЧб ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧи ЁЭЧХЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧШ ЁЭЧЯЁЭЧФЁЭЧкЁЭЧЧЁЭЧШ ЁЭЧиЁЭЧжЁЭЧаЁЭЧШ ЁЭЧаЁЭЧЬЁЭЧзЁЭЧзЁЭЧЬ ЁЭЧЧЁЭЧФЁЭЧЯ ЁЭЧЮЁЭЧШ ЁЭЧЦЁЭЧШЁЭЧаЁЭЧШЁЭЧбЁЭЧз ЁЭЧжЁЭЧШ ЁЭЧХЁЭЧЫЁЭЧФЁЭЧе ЁЭЧЧЁЭЧи ЁЯПаЁЯдвЁЯдйЁЯТе", "ЁЭЧзЁЭЧиЁЭЧЭЁЭЧЫЁЭЧШ ЁЭЧФЁЭЧХ ЁЭЧзЁЭЧФЁЭЧЮ ЁЭЧбЁЭЧФЁЭЧЫЁЭЧЬ ЁЭЧжЁЭЧаЁЭЧЭЁЭЧЫ ЁЭЧФЁЭЧмЁЭЧФ ЁЭЧЮЁЭЧЬ ЁЭЧаЁЭЧФЁЭЧЬ ЁЭЧЫЁЭЧЬ ЁЭЧЫЁЭЧи ЁЭЧзЁЭЧиЁЭЧЭЁЭЧЫЁЭЧШ ЁЭЧгЁЭЧФЁЭЧЬЁЭЧЧЁЭЧФ ЁЭЧЮЁЭЧФЁЭЧеЁЭЧбЁЭЧШ ЁЭЧкЁЭЧФЁЭЧЯЁЭЧФ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧШЁЭЧШ ЁЭЧФЁЭЧгЁЭЧбЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧжЁЭЧШ ЁЭЧгЁЭЧиЁЭЧЦЁЭЧЫ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬ ЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧФЁЭЧЦЁЭЧЫЁЭЧШЁЭЧШЁЭЧШЁЭЧШ ЁЯдйЁЯСКЁЯСдЁЯШН", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧШ ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧжЁЭЧгЁЭЧвЁЭЧзЁЭЧЬЁЭЧЩЁЭЧм ЁЭЧЧЁЭЧФЁЭЧЯ ЁЭЧЮЁЭЧШ ЁЭЧЯЁЭЧвЁЭЧЩЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЭЁЭЧФЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧЧЁЭЧЬЁЭЧб ЁЭЧХЁЭЧЫЁЭЧФЁЭЧе ЁЯШНЁЯО╢ЁЯО╢ЁЯТе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧФ ЁЭЧбЁЭЧФЁЭЧмЁЭЧФ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬ ЁЭЧЮЁЭЧЫЁЭЧФЁЭЧбЁЭЧФ ЁЭЧЮЁЭЧЫЁЭЧвЁЭЧЯЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧЦЁЭЧЫЁЭЧЬЁЭЧбЁЭЧзЁЭЧФ ЁЭЧаЁЭЧФЁЭЧз ЁЭЧЮЁЭЧФЁЭЧе ЁЯСКЁЯдгЁЯдгЁЯШ│", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧФ ЁЭЧХЁЭЧФЁЭЧФЁЭЧг ЁЭЧЫЁЭЧи ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧв ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬ ЁЭЧЮЁЭЧЫЁЭЧФЁЭЧбЁЭЧШ ЁЭЧгЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧЧЁЭЧкЁЭЧФ ЁЭЧЮЁЭЧШ ЁЭЧиЁЭЧж ЁЭЧгЁЭЧФЁЭЧЬЁЭЧжЁЭЧШ ЁЭЧЮЁЭЧЬ ЁЭЧЧЁЭЧФЁЭЧФЁЭЧеЁЭЧи ЁЭЧгЁЭЧШЁЭЧШЁЭЧзЁЭЧФ ЁЭЧЫЁЭЧи ЁЯН╖ЁЯдйЁЯФе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧФЁЭЧгЁЭЧбЁЭЧФ ЁЭЧХЁЭЧФЁЭЧЧЁЭЧФ ЁЭЧжЁЭЧФ ЁЭЧЯЁЭЧвЁЭЧЧЁЭЧФ ЁЭЧЪЁЭЧЫЁЭЧиЁЭЧжЁЭЧжЁЭЧФ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФЁЭЧФ ЁЭЧЮЁЭЧФЁЭЧЯЁЭЧЯЁЭЧФЁЭЧФЁЭЧг ЁЭЧЮЁЭЧШ ЁЭЧаЁЭЧФЁЭЧе ЁЭЧЭЁЭЧФЁЭЧмЁЭЧШЁЭЧЪЁЭЧЬ ЁЯдйЁЯШ│ЁЯШ│ЁЯФе", "ЁЭЧзЁЭЧвЁЭЧЫЁЭЧФЁЭЧе ЁЭЧаЁЭЧиЁЭЧаЁЭЧаЁЭЧм ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧгЁЭЧиЁЭЧеЁЭЧЬ ЁЭЧЮЁЭЧЬ ЁЭЧгЁЭЧиЁЭЧеЁЭЧЬ ЁЭЧЮЁЭЧЬЁЭЧбЁЭЧЪЁЭЧЩЁЭЧЬЁЭЧжЁЭЧЫЁЭЧШЁЭЧе ЁЭЧЮЁЭЧЬ ЁЭЧХЁЭЧвЁЭЧзЁЭЧзЁЭЧЯЁЭЧШ ЁЭЧЧЁЭЧФЁЭЧЯ ЁЭЧЮЁЭЧШ ЁЭЧзЁЭЧвЁЭЧЧ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧФЁЭЧбЁЭЧЧЁЭЧШЁЭЧе ЁЭЧЫЁЭЧЬ ЁЯШ▒ЁЯШВЁЯдй", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧв ЁЭЧЬЁЭЧзЁЭЧбЁЭЧФ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧЮЁЭЧЬ ЁЭЧжЁЭЧФЁЭЧгЁЭЧбЁЭЧШ ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧХЁЭЧЫЁЭЧЬ ЁЭЧаЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧЧЁЭЧФЁЭЧЬ ЁЭЧмЁЭЧФЁЭЧФЁЭЧЧ ЁЭЧЮЁЭЧФЁЭЧеЁЭЧШЁЭЧЪЁЭЧЬ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬ ЁЯе│ЁЯШНЁЯСКЁЯТе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧиЁЭЧаЁЭЧаЁЭЧм ЁЭЧФЁЭЧиЁЭЧе ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧв ЁЭЧЧЁЭЧФЁЭЧиЁЭЧЧЁЭЧФ ЁЭЧЧЁЭЧФЁЭЧиЁЭЧЧЁЭЧФ ЁЭЧбЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧиЁЭЧбЁЭЧЮЁЭЧШ ЁЭЧбЁЭЧв ЁЭЧХЁЭЧвЁЭЧЯЁЭЧбЁЭЧШ ЁЭЧгЁЭЧШ ЁЭЧХЁЭЧЫЁЭЧЬ ЁЭЧЯЁЭЧФЁЭЧбЁЭЧЧ ЁЭЧЪЁЭЧЫЁЭЧиЁЭЧжЁЭЧФ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧФЁЭЧбЁЭЧЧЁЭЧШЁЭЧе ЁЭЧзЁЭЧФЁЭЧЮ ЁЯШОЁЯШОЁЯдгЁЯФе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧиЁЭЧаЁЭЧаЁЭЧм ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧЮЁЭЧв ЁЭЧвЁЭЧбЁЭЧЯЁЭЧЬЁЭЧбЁЭЧШ ЁЭЧвЁЭЧЯЁЭЧл ЁЭЧгЁЭЧШ ЁЭЧХЁЭЧШЁЭЧЦЁЭЧЫЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧФЁЭЧиЁЭЧе ЁЭЧгЁЭЧФЁЭЧЬЁЭЧжЁЭЧШ ЁЭЧжЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧФ ЁЭЧЮЁЭЧвЁЭЧзЁЭЧЫЁЭЧФ ЁЭЧЮЁЭЧЫЁЭЧвЁЭЧЯ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЯШОЁЯдйЁЯШЭЁЯШН", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧФ ЁЭЧЬЁЭЧзЁЭЧбЁЭЧФ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧЮЁЭЧЬ ЁЭЧзЁЭЧи ЁЭЧЦЁЭЧФЁЭЧЫ ЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧЫЁЭЧЬ ЁЭЧкЁЭЧв ЁЭЧаЁЭЧФЁЭЧжЁЭЧз ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧЧЁЭЧФЁЭЧЬ ЁЭЧжЁЭЧШ ЁЭЧЧЁЭЧиЁЭЧе ЁЭЧбЁЭЧЫЁЭЧЬ ЁЭЧЭЁЭЧФ ЁЭЧгЁЭЧФЁЭЧмЁЭЧШЁЭЧЪЁЭЧФЁЭЧФ ЁЯШПЁЯШПЁЯдйЁЯШН", "ЁЭЧжЁЭЧиЁЭЧб ЁЭЧХЁЭЧШ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬ ЁЭЧЮЁЭЧЬ ЁЭЧФЁЭЧиЁЭЧЯЁЭЧФЁЭЧФЁЭЧЧ ЁЭЧзЁЭЧи ЁЭЧФЁЭЧгЁЭЧбЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧжЁЭЧШ ЁЭЧжЁЭЧШЁЭЧШЁЭЧЮЁЭЧЫ ЁЭЧЮЁЭЧиЁЭЧЦЁЭЧЫ ЁЭЧЮЁЭЧФЁЭЧЬЁЭЧжЁЭЧШ ЁЭЧЪЁЭЧФЁЭЧФЁЭЧбЁЭЧЧ ЁЭЧаЁЭЧФЁЭЧеЁЭЧкЁЭЧФЁЭЧзЁЭЧШ ЁЭЧЫЁЭЧФЁЭЧЬЁЯШПЁЯдмЁЯФеЁЯТе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧФ ЁЭЧмЁЭЧФЁЭЧФЁЭЧе ЁЭЧЫЁЭЧи ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧФЁЭЧиЁЭЧе ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧФ ЁЭЧгЁЭЧмЁЭЧФЁЭЧФЁЭЧе ЁЭЧЫЁЭЧи ЁЭЧаЁЭЧШЁЭЧЬ ЁЭЧФЁЭЧЭЁЭЧФ ЁЭЧаЁЭЧШЁЭЧеЁЭЧФ ЁЭЧЯЁЭЧФЁЭЧбЁЭЧЧ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧвЁЭЧж ЁЭЧЯЁЭЧШ ЁЯдйЁЯдгЁЯТе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШ ЁЭЧиЁЭЧжЁЭЧШЁЭЧеЁЭЧХЁЭЧвЁЭЧз ЁЭЧЯЁЭЧФЁЭЧЪЁЭЧФЁЭЧФЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧжЁЭЧФЁЭЧжЁЭЧзЁЭЧШ ЁЭЧжЁЭЧгЁЭЧФЁЭЧа ЁЭЧЮЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧШ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЪЁЭЧФЁЭЧФЁЭЧбЁЭЧЧ ЁЭЧаЁЭЧШ ЁЭЧжЁЭЧФЁЭЧеЁЭЧЬЁЭЧмЁЭЧФ ЁЭЧЧЁЭЧФЁЭЧФЁЭЧЯ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧаЁЭЧФ╠ВЁЭЧФ╠ВЁЭЧЧЁЭЧФЁЭЧеЁЭЧЦЁЭЧЫ├ШЁЭЧЧ ЁЭЧиЁЭЧжЁЭЧЬ ЁЭЧжЁЭЧФЁЭЧеЁЭЧЬЁЭЧмЁЭЧШ ЁЭЧгЁЭЧе ЁЭЧзЁЭЧФЁЭЧбЁЭЧЪ ЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧФЁЭЧЦЁЭЧЫЁЭЧШ ЁЭЧгЁЭЧФЁЭЧЬЁЭЧЧЁЭЧФ ЁЭЧЫЁЭЧвЁЭЧбЁЭЧЪЁЭЧШ ЁЯШ▒ЁЯШ▒", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШ тЬЛ ЁЭЧЫЁЭЧФЁЭЧзЁЭЧзЁЭЧЫ ЁЭЧЧЁЭЧФЁЭЧЯЁЭЧЮЁЭЧШ ЁЯС╢ ЁЭЧХЁЭЧФЁЭЧЦЁЭЧЦЁЭЧЫЁЭЧШ ЁЭЧбЁЭЧЬЁЭЧЮЁЭЧФЁЭЧЯ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЯШН", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШЁЭЧЫЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШ ЁЭЧЮЁЭЧШЁЭЧЯЁЭЧШ ЁЭЧЮЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧЬЁЭЧЯЁЭЧЮЁЭЧШ ЁЯддЁЯдд", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧз ЁЭЧаЁЭЧШ ЁЭЧжЁЭЧиЁЭЧзЁЭЧЯЁЭЧЬ ЁЭЧХЁЭЧвЁЭЧаЁЭЧХ ЁЭЧЩЁЭЧвЁЭЧЧ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧЮЁЭЧЬ ЁЭЧЭЁЭЧЫЁЭЧФЁЭЧФЁЭЧзЁЭЧШ ЁЭЧЭЁЭЧФЁЭЧЯ ЁЭЧЮЁЭЧШ ЁЭЧЮЁЭЧЫЁЭЧФЁЭЧФЁЭЧЮ ЁЭЧЫЁЭЧв ЁЭЧЭЁЭЧФЁЭЧмЁЭЧШЁЭЧЪЁЭЧЬЁЯТгЁЯТЛ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧйЁЭЧФЁЭЧЫЁЭЧШЁЭЧШЁЭЧб ЁЭЧЮЁЭЧв ЁЭЧЫЁЭЧвЁЭЧеЁЭЧЯЁЭЧЬЁЭЧЦЁЭЧЮЁЭЧж ЁЭЧгЁЭЧШЁЭЧШЁЭЧЯЁЭЧФЁЭЧЮЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧаЁЭЧФ╠ВЁЭЧФ╠ВЁЭЧЧЁЭЧФЁЭЧеЁЭЧЦЁЭЧЫ├ШЁЭЧЧЁЯШЪ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧЬЁЭЧзЁЭЧШЁЭЧа ЁЭЧЮЁЭЧЬ ЁЭЧЪЁЭЧФЁЭЧФЁЭЧбЁЭЧЧ ЁЭЧаЁЭЧШ ЁЭЧЯЁЭЧиЁЭЧбЁЭЧЧ ЁЭЧЧЁЭЧФЁЭЧФЁЭЧЯЁЭЧЮЁЭЧШ,ЁЭЧзЁЭЧШЁЭЧеЁЭЧШ ЁЭЧЭЁЭЧФЁЭЧЬЁЭЧжЁЭЧФ ЁЭЧШЁЭЧЮ ЁЭЧвЁЭЧе ЁЭЧбЁЭЧЬЁЭЧЮЁЭЧФЁЭЧФЁЭЧЯ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧаЁЭЧФ╠ВЁЭЧФ╠ВЁЭЧЧЁЭЧФЁЭЧеЁЭЧЦЁЭЧЫ├ШЁЭЧЧЁЯШЖЁЯддЁЯТЛ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧйЁЭЧФЁЭЧЫЁЭЧШЁЭЧШЁЭЧб ЁЭЧЮЁЭЧв ЁЭЧФЁЭЧгЁЭЧбЁЭЧШ ЁЭЧЯЁЭЧиЁЭЧбЁЭЧЧ ЁЭЧгЁЭЧе ЁЭЧЬЁЭЧзЁЭЧбЁЭЧФ ЁЭЧЭЁЭЧЫЁЭЧиЁЭЧЯЁЭЧФЁЭЧФЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧЮЁЭЧЬ ЁЭЧЭЁЭЧЫЁЭЧиЁЭЧЯЁЭЧзЁЭЧШ ЁЭЧЭЁЭЧЫЁЭЧиЁЭЧЯЁЭЧзЁЭЧШ ЁЭЧЫЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧЦЁЭЧЫЁЭЧФ ЁЭЧгЁЭЧФЁЭЧЬЁЭЧЧЁЭЧФ ЁЭЧЮЁЭЧе ЁЭЧЧЁЭЧШЁЭЧЪЁЭЧЬ ЁЯТжЁЯТЛ", "ЁЭЧжЁЭЧиЁЭЧФЁЭЧе ЁЭЧЮЁЭЧШ ЁЭЧгЁЭЧЬЁЭЧЯЁЭЧЯЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧв ЁЭЧжЁЭЧФЁЭЧЧЁЭЧФЁЭЧЮ ЁЭЧгЁЭЧе ЁЭЧЯЁЭЧЬЁЭЧзЁЭЧФЁЭЧЮЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЯШВЁЯШЖЁЯдд", "ЁЭЧФЁЭЧХЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧФ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧФ ЁЭЧаЁЭЧФЁЭЧЧЁЭЧШЁЭЧеЁЭЧЦЁЭЧЫЁЭЧвЁЭЧвЁЭЧЧ ЁЭЧЮЁЭЧе ЁЭЧгЁЭЧЬЁЭЧЯЁЭЧЯЁЭЧШ ЁЭЧгЁЭЧФЁЭЧгЁЭЧФ ЁЭЧжЁЭЧШ ЁЭЧЯЁЭЧФЁЭЧЧЁЭЧШЁЭЧЪЁЭЧФ ЁЭЧзЁЭЧи ЁЯШ╝ЁЯШВЁЯдд", "ЁЭЧЪЁЭЧФЁЭЧЯЁЭЧЬ ЁЭЧЪЁЭЧФЁЭЧЯЁЭЧЬ ЁЭЧбЁЭЧШ ЁЭЧжЁЭЧЫЁЭЧвЁЭЧе ЁЭЧЫЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠А ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧе ЁЭЧЫЁЭЧШ ЁЯТЛЁЯТЛЁЯТж", "ЁЭЧФЁЭЧХЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧв ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧи ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧШ ЁЭЧгЁЭЧЬЁЭЧЯЁЭЧЯЁЭЧШ ЁЭЧЮЁЭЧиЁЭЧзЁЭЧзЁЭЧШ ЁЭЧЮЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧШ ЁЯШВЁЯС╗ЁЯФе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧв ЁЭЧФЁЭЧЬЁЭЧжЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧФ ЁЭЧФЁЭЧЬЁЭЧжЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧФ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧФ ЁЭЧХЁЭЧШЁЭЧЧ ЁЭЧгЁЭЧШЁЭЧЫЁЭЧЬ ЁЭЧаЁЭЧиЁЭЧзЁЭЧЫ ЁЭЧЧЁЭЧЬЁЭЧФ ЁЯТжЁЯТжЁЯТжЁЯТж", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧШ ЁЭЧаЁЭЧШ ЁЭЧФЁЭЧФЁЭЧФЁЭЧЪ ЁЭЧЯЁЭЧФЁЭЧЪЁЭЧФЁЭЧЧЁЭЧЬЁЭЧФ ЁЭЧаЁЭЧШЁЭЧеЁЭЧФ ЁЭЧаЁЭЧвЁЭЧзЁЭЧФ ЁЭЧЯЁЭЧиЁЭЧбЁЭЧЧ ЁЭЧЧЁЭЧФЁЭЧЯЁЭЧЮЁЭЧШ ЁЯФеЁЯФеЁЯТжЁЯШЖЁЯШЖ", "ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧФЁЭЧЦЁЭЧЫЁЭЧЫЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧв ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧи ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧЯ ЁЭЧбЁЭЧЬЁЭЧЮЁЭЧФЁЭЧЯ", "ЁЭЧЮЁЭЧЬЁЭЧзЁЭЧбЁЭЧФ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧи ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧзЁЭЧЫ ЁЭЧФЁЭЧХЁЭЧХ ЁЭЧФЁЭЧгЁЭЧбЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧв ЁЭЧХЁЭЧЫЁЭЧШЁЭЧЭ ЁЯШЖЁЯС╗ЁЯдд", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧвЁЭЧзЁЭЧв ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧЮЁЭЧШ ЁЭЧгЁЭЧиЁЭЧеЁЭЧФ ЁЭЧЩЁЭЧФЁЭЧФЁЭЧЧ ЁЭЧЧЁЭЧЬЁЭЧФ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧзЁЭЧЫ ЁЭЧФЁЭЧХЁЭЧХ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧЪЁЭЧЩ ЁЭЧЮЁЭЧв ЁЭЧХЁЭЧЫЁЭЧШЁЭЧЭ ЁЯШЖЁЯТжЁЯдд", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧЪЁЭЧЩ ЁЭЧЮЁЭЧв ЁЭЧШЁЭЧзЁЭЧбЁЭЧФ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧФ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧШ ЁЭЧЯЁЭЧвЁЭЧЧЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧЪЁЭЧЩ ЁЭЧзЁЭЧв ЁЭЧаЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧбЁЭЧЪЁЭЧФЁЭЧмЁЭЧЬ ЁЭЧФЁЭЧХЁЭЧХ ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧЯ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧв ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧзЁЭЧФ ЁЭЧЩЁЭЧЬЁЭЧеЁЭЧжЁЭЧШ тЩея╕ПЁЯТжЁЯШЖЁЯШЖЁЯШЖЁЯШЖ", "ЁЭЧЫЁЭЧФЁЭЧеЁЭЧЬ ЁЭЧЫЁЭЧФЁЭЧеЁЭЧЬ ЁЭЧЪЁЭЧЫЁЭЧФЁЭЧФЁЭЧж ЁЭЧаЁЭЧШ ЁЭЧЭЁЭЧЫЁЭЧвЁЭЧгЁЭЧЧЁЭЧФ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧФ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧФ ЁЯдгЁЯдгЁЯТЛЁЯТж", "ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧЯ ЁЭЧзЁЭЧШЁЭЧеЁЭЧШ ЁЭЧХЁЭЧФЁЭЧФЁЭЧг ЁЭЧЮЁЭЧв ЁЭЧХЁЭЧЫЁЭЧШЁЭЧЭ ЁЭЧзЁЭЧШЁЭЧеЁЭЧФ ЁЭЧХЁЭЧФЁЭЧжЁЭЧЮЁЭЧФ ЁЭЧбЁЭЧЫЁЭЧЬ ЁЭЧЫЁЭЧШ ЁЭЧгЁЭЧФЁЭЧгЁЭЧФ ЁЭЧжЁЭЧШ ЁЭЧЯЁЭЧФЁЭЧЧЁЭЧШЁЭЧЪЁЭЧФ ЁЭЧзЁЭЧи", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧзЁЭЧЫ ЁЭЧаЁЭЧШ ЁЭЧХЁЭЧвЁЭЧаЁЭЧХ ЁЭЧЧЁЭЧФЁЭЧЯЁЭЧЮЁЭЧШ ЁЭЧиЁЭЧЧЁЭЧФ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧШ ЁЭЧЯЁЭЧФЁЭЧкЁЭЧЧЁЭЧШ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧв ЁЭЧзЁЭЧеЁЭЧФЁЭЧЬЁЭЧб ЁЭЧаЁЭЧШ ЁЭЧЯЁЭЧШЁЭЧЭЁЭЧФЁЭЧЮЁЭЧШ ЁЭЧзЁЭЧвЁЭЧг ЁЭЧХЁЭЧШЁЭЧЧ ЁЭЧгЁЭЧШ ЁЭЧЯЁЭЧЬЁЭЧзЁЭЧФЁЭЧЮЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧжЁЭЧиЁЭЧФЁЭЧе ЁЭЧЮЁЭЧШ ЁЭЧгЁЭЧЬЁЭЧЯЁЭЧЯЁЭЧШ ЁЯдгЁЯдгЁЯТЛЁЯТЛ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧФЁЭЧЮЁЭЧШ ЁЭЧбЁЭЧиЁЭЧЧЁЭЧШЁЭЧж ЁЭЧЪЁЭЧвЁЭЧвЁЭЧЪЁЭЧЯЁЭЧШ ЁЭЧгЁЭЧШ ЁЭЧиЁЭЧгЁЭЧЯЁЭЧвЁЭЧФЁЭЧЧ ЁЭЧЮЁЭЧФЁЭЧеЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧШ ЁЭЧЯЁЭЧФЁЭЧШЁЭЧкЁЭЧЧЁЭЧШ ЁЯС╗ЁЯФе", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧв ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧЮЁЭЧШ ЁЭЧйЁЭЧЬЁЭЧЧЁЭЧШЁЭЧв ЁЭЧХЁЭЧФЁЭЧбЁЭЧФЁЭЧЮЁЭЧШ ЁЭЧлЁЭЧбЁЭЧлЁЭЧл.ЁЭЧЦЁЭЧвЁЭЧа ЁЭЧгЁЭЧШ ЁЭЧбЁЭЧШЁЭЧШЁЭЧЯЁЭЧФЁЭЧа ЁЭЧЮЁЭЧФЁЭЧеЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧЮЁЭЧиЁЭЧзЁЭЧзЁЭЧШ ЁЭЧЮЁЭЧШ ЁЭЧгЁЭЧЬЁЭЧЯЁЭЧЯЁЭЧШ ЁЯТжЁЯТЛ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧФЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧЧЁЭЧФЁЭЧЬ ЁЭЧЮЁЭЧв ЁЭЧгЁЭЧвЁЭЧеЁЭЧбЁЭЧЫЁЭЧиЁЭЧХ.ЁЭЧЦЁЭЧвЁЭЧа ЁЭЧгЁЭЧШ ЁЭЧиЁЭЧгЁЭЧЯЁЭЧвЁЭЧФЁЭЧЧ ЁЭЧЮЁЭЧФЁЭЧеЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧжЁЭЧиЁЭЧФЁЭЧе ЁЭЧЮЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧШ ЁЯдгЁЯТЛЁЯТж", "ЁЭЧФЁЭЧХЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧв ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧи ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧФЁЭЧЦЁЭЧЫЁЭЧЫЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧШЁЭЧЮЁЭЧв ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧЮЁЭЧЮЁЭЧв ЁЭЧжЁЭЧШ ЁЭЧгЁЭЧЬЁЭЧЯЁЭЧкЁЭЧФЁЭЧйЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧФЁЭЧЦЁЭЧЫЁЭЧЫЁЭЧШ ЁЯдгЁЯдг", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧзЁЭЧЫ ЁЭЧЩЁЭЧФЁЭЧФЁЭЧЧЁЭЧЮЁЭЧШ ЁЭЧеЁЭЧФЁЭЧЮЁЭЧЧЁЭЧЬЁЭЧФ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧШ ЁЭЧЯЁЭЧвЁЭЧЧЁЭЧШ ЁЭЧЭЁЭЧФЁЭЧФ ЁЭЧФЁЭЧХЁЭЧХ ЁЭЧжЁЭЧЬЁЭЧЯЁЭЧкЁЭЧФЁЭЧЯЁЭЧШ ЁЯСДЁЯСД", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧзЁЭЧЫ ЁЭЧаЁЭЧШ ЁЭЧаЁЭЧШЁЭЧеЁЭЧФ ЁЭЧЯЁЭЧиЁЭЧбЁЭЧЧ ЁЭЧЮЁЭЧФЁЭЧФЁЭЧЯЁЭЧФ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЯЁЭЧШЁЭЧзЁЭЧЬ ЁЭЧаЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧЯЁЭЧиЁЭЧбЁЭЧЧ ЁЭЧХЁЭЧФЁЭЧЧЁЭЧШ ЁЭЧаЁЭЧФЁЭЧжЁЭЧзЁЭЧЬ ЁЭЧжЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧв ЁЭЧаЁЭЧШЁЭЧбЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧ ЁЭЧЧЁЭЧФЁЭЧЯЁЭЧФ ЁЭЧХЁЭЧвЁЭЧЫЁЭЧвЁЭЧз ЁЭЧжЁЭЧФЁЭЧжЁЭЧзЁЭЧШ ЁЭЧжЁЭЧШ", "ЁЭЧХЁЭЧШЁЭЧзЁЭЧШ ЁЭЧзЁЭЧи ЁЭЧХЁЭЧФЁЭЧФЁЭЧг ЁЭЧжЁЭЧШ ЁЭЧЯЁЭЧШЁЭЧЪЁЭЧФ ЁЭЧгЁЭЧФЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧФ ЁЭЧЮЁЭЧв ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧЮЁЭЧФЁЭЧеЁЭЧЮЁЭЧШ ЁЭЧбЁЭЧФЁЭЧбЁЭЧЪЁЭЧФ ЁЯТжЁЯТЛ", "ЁЭЧЫЁЭЧФЁЭЧЫЁЭЧФЁЭЧЫЁЭЧФЁЭЧЫ ЁЭЧаЁЭЧШЁЭЧеЁЭЧШ ЁЭЧХЁЭЧШЁЭЧзЁЭЧШ ЁЭЧФЁЭЧЪЁЭЧЯЁЭЧЬ ЁЭЧХЁЭЧФЁЭЧФЁЭЧе ЁЭЧФЁЭЧгЁЭЧбЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧв ЁЭЧЯЁЭЧШЁЭЧЮЁЭЧШ ЁЭЧФЁЭЧФЁЭЧмЁЭЧФ ЁЭЧаЁЭЧФЁЭЧзЁЭЧЫ ЁЭЧЮЁЭЧФЁЭЧз ЁЭЧвЁЭЧе ЁЭЧаЁЭЧШЁЭЧеЁЭЧШ ЁЭЧаЁЭЧвЁЭЧзЁЭЧШ ЁЭЧЯЁЭЧиЁЭЧбЁЭЧЧ ЁЭЧжЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧЧЁЭЧкЁЭЧФЁЭЧмЁЭЧФ ЁЭЧаЁЭЧФЁЭЧзЁЭЧЫ ЁЭЧЮЁЭЧФЁЭЧе", "ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧЯ ЁЭЧХЁЭЧШЁЭЧзЁЭЧФ ЁЭЧзЁЭЧиЁЭЧЭЁЭЧЫЁЭЧШ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЩ ЁЭЧЮЁЭЧЬЁЭЧФ ЁЯдг ЁЭЧФЁЭЧХЁЭЧХ ЁЭЧФЁЭЧгЁЭЧбЁЭЧЬ ЁЭЧЪЁЭЧЩ ЁЭЧЮЁЭЧв ЁЭЧХЁЭЧЫЁЭЧШЁЭЧЭ", "ЁЭЧжЁЭЧЫЁЭЧФЁЭЧеЁЭЧФЁЭЧа ЁЭЧЮЁЭЧФЁЭЧе ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧФ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧФ ЁЭЧЮЁЭЧЬЁЭЧзЁЭЧбЁЭЧФ ЁЭЧЪЁЭЧФЁЭЧФЁЭЧЯЁЭЧЬЁЭЧФ ЁЭЧжЁЭЧиЁЭЧбЁЭЧкЁЭЧФЁЭЧмЁЭЧШЁЭЧЪЁЭЧФ ЁЭЧФЁЭЧгЁЭЧбЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧФ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧШ ЁЭЧиЁЭЧгЁЭЧШЁЭЧе", "ЁЭЧФЁЭЧХЁЭЧШ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧШ ЁЭЧХЁЭЧФЁЭЧЦЁЭЧЫЁЭЧЫЁЭЧШ ЁЭЧФЁЭЧиЁЭЧЮЁЭЧФЁЭЧз ЁЭЧбЁЭЧЫЁЭЧЬ ЁЭЧЫЁЭЧШЁЭЧзЁЭЧв ЁЭЧФЁЭЧгЁЭЧбЁЭЧЬ ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧв ЁЭЧЯЁЭЧШЁЭЧЮЁЭЧШ ЁЭЧФЁЭЧФЁЭЧмЁЭЧФ ЁЭЧаЁЭЧФЁЭЧзЁЭЧЫ ЁЭЧЮЁЭЧФЁЭЧе ЁЭЧЫЁЭЧФЁЭЧЫЁЭЧФЁЭЧЫЁЭЧФЁЭЧЫЁЭЧФ", "ЁЭЧЮЁЭЧЬЁЭЧЧЁЭЧн ЁЭЧаЁЭЧФ╠ВЁЭЧФ╠ВЁЭЧЧЁЭЧФЁЭЧеЁЭЧЦЁЭЧЫ├ШЁЭЧЧ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧв ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧЮЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧе ЁЭЧЯЁЭЧЬЁЭЧмЁЭЧШ ЁЭЧХЁЭЧЫЁЭЧФЁЭЧЬ ЁЭЧЧЁЭЧШЁЭЧЧЁЭЧЬЁЭЧмЁЭЧФ", "ЁЭЧЭЁЭЧиЁЭЧбЁЭЧЪЁЭЧЯЁЭЧШ ЁЭЧаЁЭЧШ ЁЭЧбЁЭЧФЁЭЧЦЁЭЧЫЁЭЧзЁЭЧФ ЁЭЧЫЁЭЧШ ЁЭЧаЁЭЧвЁЭЧеЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧЧЁЭЧФЁЭЧЬ ЁЭЧЧЁЭЧШЁЭЧЮЁЭЧЮЁЭЧШ ЁЭЧжЁЭЧФЁЭЧХ ЁЭЧХЁЭЧвЁЭЧЯЁЭЧзЁЭЧШ ЁЭЧвЁЭЧбЁЭЧЦЁЭЧШ ЁЭЧаЁЭЧвЁЭЧеЁЭЧШ ЁЭЧвЁЭЧбЁЭЧЦЁЭЧШ ЁЭЧаЁЭЧвЁЭЧеЁЭЧШ ЁЯдгЁЯдгЁЯТжЁЯТЛ", "ЁЭЧЪЁЭЧФЁЭЧЯЁЭЧЬ ЁЭЧЪЁЭЧФЁЭЧЯЁЭЧЬ ЁЭЧаЁЭЧШ ЁЭЧеЁЭЧШЁЭЧЫЁЭЧзЁЭЧФ ЁЭЧЫЁЭЧШ ЁЭЧжЁЭЧФЁЭЧбЁЭЧЧ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧв ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧ ЁЭЧЧЁЭЧФЁЭЧЯЁЭЧФ ЁЭЧвЁЭЧе ЁЭЧХЁЭЧФЁЭЧбЁЭЧФ ЁЭЧЧЁЭЧЬЁЭЧФ ЁЭЧеЁЭЧФЁЭЧбЁЭЧЧ ЁЯддЁЯдг", "ЁЭЧжЁЭЧФЁЭЧХ ЁЭЧХЁЭЧвЁЭЧЯЁЭЧзЁЭЧШ ЁЭЧаЁЭЧиЁЭЧЭЁЭЧЫЁЭЧЮЁЭЧв ЁЭЧгЁЭЧФЁЭЧгЁЭЧФ ЁЭЧЮЁЭЧмЁЭЧвЁЭЧиЁЭЧбЁЭЧЮЁЭЧЬ ЁЭЧаЁЭЧШЁЭЧбЁЭЧШ ЁЭЧХЁЭЧФЁЭЧбЁЭЧФЁЭЧЧЁЭЧЬЁЭЧФ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧв ЁЭЧгЁЭЧеЁЭЧШЁЭЧЪЁЭЧбЁЭЧШЁЭЧбЁЭЧз ЁЯдгЁЯдг", "ЁЭЧжЁЭЧиЁЭЧФЁЭЧе ЁЭЧЮЁЭЧШ ЁЭЧгЁЭЧЬЁЭЧЯЁЭЧЯЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧзЁЭЧЫ ЁЭЧаЁЭЧШ ЁЭЧжЁЭЧиЁЭЧФЁЭЧе ЁЭЧЮЁЭЧФ ЁЭЧЯЁЭЧвЁЭЧиЁЭЧЧЁЭЧФ ЁЭЧвЁЭЧе ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧзЁЭЧЫ ЁЭЧаЁЭЧШ ЁЭЧаЁЭЧШЁЭЧеЁЭЧФ ЁЭЧЯЁЭЧвЁЭЧЧЁЭЧФ", "ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧЯ ЁЭЧЦЁЭЧЫЁЭЧФЁЭЧЯ ЁЭЧФЁЭЧгЁЭЧбЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧЦЁЭЧЫЁЭЧЬЁЭЧмЁЭЧФ ЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧФ", "ЁЭЧЫЁЭЧФЁЭЧЫЁЭЧФЁЭЧЫЁЭЧФЁЭЧЫЁЭЧФ ЁЭЧХЁЭЧФЁЭЧЦЁЭЧЫЁЭЧЫЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧФЁЭЧЮЁЭЧв ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧ ЁЭЧЧЁЭЧЬЁЭЧФ ЁЭЧбЁЭЧФЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧЮЁЭЧФЁЭЧеЁЭЧЮЁЭЧШ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧЪЁЭЧЩ ЁЭЧЫЁЭЧШ ЁЭЧХЁЭЧФЁЭЧЧЁЭЧЬ ЁЭЧжЁЭЧШЁЭЧлЁЭЧм ЁЭЧиЁЭЧжЁЭЧЮЁЭЧв ЁЭЧгЁЭЧЬЁЭЧЯЁЭЧФЁЭЧЮЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧвЁЭЧЧЁЭЧШЁЭЧбЁЭЧЪЁЭЧШ ЁЭЧгЁЭЧШЁЭЧгЁЭЧжЁЭЧЬ", "2 ЁЭЧеЁЭЧиЁЭЧгЁЭЧФЁЭЧм ЁЭЧЮЁЭЧЬ ЁЭЧгЁЭЧШЁЭЧгЁЭЧжЁЭЧЬ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧиЁЭЧаЁЭЧаЁЭЧм ЁЭЧжЁЭЧФЁЭЧХЁЭЧжЁЭЧШ ЁЭЧжЁЭЧШЁЭЧлЁЭЧм ЁЯТЛЁЯТж", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧв ЁЭЧЦЁЭЧЫЁЭЧШЁЭЧШЁЭЧаЁЭЧж ЁЭЧжЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧЧЁЭЧкЁЭЧФЁЭЧйЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧаЁЭЧФЁЭЧЧЁЭЧШЁЭЧеЁЭЧЦЁЭЧЫЁЭЧвЁЭЧвЁЭЧЧ ЁЭЧЮЁЭЧШ ЁЭЧгЁЭЧЬЁЭЧЯЁЭЧЯЁЭЧШ ЁЯТжЁЯдг", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧЬ ЁЭЧЦЁЭЧЫЁЭЧиЁЭЧи╠БЁЭЧзЁЭЧЫ ЁЭЧаЁЭЧШ ЁЭЧаЁЭЧиЁЭЧзЁЭЧЫЁЭЧЮЁЭЧШ ЁЭЧЩЁЭЧФЁЭЧеЁЭЧФЁЭЧе ЁЭЧЫЁЭЧвЁЭЧЭЁЭЧФЁЭЧйЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ ЁЭЧЫЁЭЧиЁЭЧЬ ЁЭЧЫЁЭЧиЁЭЧЬ ЁЭЧЫЁЭЧиЁЭЧЬ", "ЁЭЧжЁЭЧгЁЭЧШЁЭЧШЁЭЧЧ ЁЭЧЯЁЭЧФЁЭЧФЁЭЧФ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧЁЭЧи ЁЭЧе├ЖЁЭЧбЁЭЧЧЁЭЧЬЁЭЧЮЁЭЧШ ЁЭЧгЁЭЧЬЁЭЧЯЁЭЧЯЁЭЧШ ЁЯТЛЁЯТжЁЯдг", "ЁЭЧФЁЭЧеЁЭЧШ ЁЭЧеЁЭЧШ ЁЭЧаЁЭЧШЁЭЧеЁЭЧШ ЁЭЧХЁЭЧШЁЭЧзЁЭЧШ ЁЭЧЮЁЭЧмЁЭЧвЁЭЧиЁЭЧб ЁЭЧжЁЭЧгЁЭЧШЁЭЧШЁЭЧЧ ЁЭЧгЁЭЧФЁЭЧЮЁЭЧФЁЭЧЧ ЁЭЧбЁЭЧФ ЁЭЧгЁЭЧФЁЭЧФЁЭЧФ ЁЭЧеЁЭЧФЁЭЧЫЁЭЧФ ЁЭЧФЁЭЧгЁЭЧбЁЭЧШ ЁЭЧХЁЭЧФЁЭЧФЁЭЧг ЁЭЧЮЁЭЧФ ЁЭЧЫЁЭЧФЁЭЧЫЁЭЧФЁЭЧЫЁЯдгЁЯдг", "ЁЭЧжЁЭЧиЁЭЧб ЁЭЧжЁЭЧиЁЭЧб ЁЭЧжЁЭЧиЁЭЧФЁЭЧе ЁЭЧЮЁЭЧШ ЁЭЧгЁЭЧЬЁЭЧЯЁЭЧЯЁЭЧШ ЁЭЧЭЁЭЧЫЁЭЧФЁЭЧбЁЭЧзЁЭЧв ЁЭЧЮЁЭЧШ ЁЭЧжЁЭЧвЁЭЧиЁЭЧЧЁЭЧФЁЭЧЪЁЭЧФЁЭЧе ЁЭЧФЁЭЧгЁЭЧбЁЭЧЬ ЁЭЧаЁЭЧиЁЭЧаЁЭЧаЁЭЧм ЁЭЧЮЁЭЧЬ ЁЭЧбЁЭЧиЁЭЧЧЁЭЧШЁЭЧж ЁЭЧХЁЭЧЫЁЭЧШЁЭЧЭ", "ЁЭЧФЁЭЧХЁЭЧШ ЁЭЧжЁЭЧиЁЭЧб ЁЭЧЯЁЭЧвЁЭЧЧЁЭЧШ ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧХЁЭЧШ╠БЁЭЧЫЁЭЧШЁЭЧб ЁЭЧЮЁЭЧФ ЁЭЧХЁЭЧЫЁЭЧвЁЭЧжЁЭЧЧЁЭЧФ ЁЭЧЩЁЭЧФЁЭЧФЁЭЧЧ ЁЭЧЧЁЭЧиЁЭЧбЁЭЧЪЁЭЧФ", "ЁЭЧзЁЭЧШЁЭЧеЁЭЧЬ ЁЭЧаЁЭЧФ╠БЁЭЧФ╠АЁЭЧЮЁЭЧв ЁЭЧЮЁЭЧЫЁЭЧиЁЭЧЯЁЭЧШ ЁЭЧХЁЭЧФЁЭЧЭЁЭЧФЁЭЧе ЁЭЧаЁЭЧШ ЁЭЧЦЁЭЧЫЁЭЧвЁЭЧЧ ЁЭЧЧЁЭЧФЁЭЧЯЁЭЧФ ЁЯдгЁЯдгЁЯТЛ", "ЁЭЧжЁЭЧЫЁЭЧФЁЭЧеЁЭЧФЁЭЧа ЁЭЧФЁЭЧФ ЁЭЧЪЁЭЧмЁЭЧЬ ЁЭЧЫЁЭЧФЁЭЧЬ ЁЭЧзЁЭЧв ЁЭЧбЁЭЧФЁЭЧнЁЭЧеЁЭЧШЁЭЧб ЁЭЧЭЁЭЧЫЁЭЧиЁЭЧЮЁЭЧФ ЁЭЧЯЁЭЧЬЁЭЧЭЁЭЧЬЁЭЧмЁЭЧШ ЁЭЧвЁЭЧе ЁЭЧФЁЭЧЪЁЭЧФЁЭЧе ЁЭЧЯЁЭЧиЁЭЧбЁЭЧЧ ЁЭЧаЁЭЧШ ЁЭЧЧЁЭЧФЁЭЧа ЁЭЧбЁЭЧЫЁЭЧЬ ЁЭЧзЁЭЧв ЁЭЧжЁЭЧЫЁЭЧЬЁЭЧЯЁЭЧФЁЭЧЭЁЭЧШЁЭЧШЁЭЧз ЁЭЧЮЁЭЧЫЁЭЧФ ЁЭЧЯЁЭЧЬЁЭЧЭЁЭЧЬЁЭЧмЁЭЧШ...ЁЯдгЁЯШВЁЯШВ" ] AVISHA = [6922271843] REPLYRAID = [ "MADARCHOD", "BHOSDIKE", "LAAAWEEE KE BAAAAAL", "MAAAAR KI JHAAAAT KE BBBBBAAAAALLLLL", "MADRCHOD..", "TERI MA KI CHUT..", "LWDE KE BAAALLL.", "MACHAR KI JHAAT KE BAAALLLL", "TERI MA KI CHUT M DU TAPA TAP?", "TERI MA KA BHOSDAA", "TERI BHN SBSBE BDI RANDI.", "TERI MA OSSE BADI RANDDDDD", "TERA BAAP CHKAAAA", "KITNI CHODU TERI MA AB OR..", "TERI MA CHOD DI HM NE", "MIGHTY !! BAAP BOLTE", "TERI MA KE STH REELS BNEGA ROAD PEE", "TERI MA KI CHUT EK DAM TOP SEXY", "MALUM NA PHR KESE LETA HU M TERI MA KI CHUT TAPA TAPPPPP", "LUND KE CHODE TU KEREGA TYPIN", "SPEED PKD LWDEEEE", "BAAP KI SPEED MTCH KRRR", "LWDEEE", "PAPA KI SPEED MTCH NHI HO RHI KYA", "ALE ALE MELA BCHAAAA", "[RYAN](t.me/PYTH0NXD) TERA BAAP !!", "CHUD GYA PAPA SEEE", "KISAN KO KHODNA OR", "SALE RAPEKL KRDKA TERA", "HAHAHAAAAA", "KIDSSSS", "BACHHE TERI MAA KI CHUTT", "TERI BHEN KI CHUTT BHOSDIWALE", "TERI MA CHUD GYI AB FRAR MT HONA", "YE LDNGE BAPP SE", "KIDSSS FRAR HAHAHH", "BHEN KE LWDE SHRM KR", "KITNI GLIYA PDWEGA APNI MA KO", "NALLEE", "SUAR KE PILLE TERI MAAKO SADAK PR LITAKE CHOD DUNGA ЁЯШВЁЯШЖЁЯдд", "ABE TERI MAAKA BHOSDA MADERCHOOD KR PILLE PAPA SE LADEGA TU ЁЯШ╝ЁЯШВЁЯдд", "GALI GALI NE SHOR HE TERI MAA RANDI CHOR HE ЁЯТЛЁЯТЛЁЯТж", "ABE TERI BEHEN KO CHODU RANDIKE PILLE KUTTE KE CHODE ЁЯШВЁЯС╗ЁЯФе", "TERI MAAKO AISE CHODA AISE CHODA TERI MAAA BED PEHI MUTH DIA ЁЯТжЁЯТжЁЯТжЁЯТж", "TERI BEHEN KE BHOSDE ME AAAG LAGADIA MERA MOTA LUND DALKE ЁЯФеЁЯФеЁЯТжЁЯШЖЁЯШЖ", "RANDIKE BACHHE TERI MAAKO CHODU CHAL NIKAL", "KITNA CHODU TERI RANDI MAAKI CHUTH ABB APNI BEHEN KO BHEJ ЁЯШЖЁЯС╗ЁЯдд", "TERI BEHEN KOTO CHOD CHODKE PURA FAAD DIA CHUTH ABB TERI GF KO BHEJ ЁЯШЖЁЯТжЁЯдд", "TERI GF KO ETNA CHODA BEHEN KE LODE TERI GF TO MERI RANDI BANGAYI ABB CHAL TERI MAAKO CHODTA FIRSE тЩея╕ПЁЯТжЁЯШЖЁЯШЖЁЯШЖЁЯШЖ", "HARI HARI GHAAS ME JHOPDA TERI MAAKA BHOSDA ЁЯдгЁЯдгЁЯТЛЁЯТж", "CHAL TERE BAAP KO BHEJ TERA BASKA NHI HE PAPA SE LADEGA TU", "TERI BEHEN KI CHUTH ME BOMB DALKE UDA DUNGA MAAKE LAWDE", "TERI MAAKO TRAIN ME LEJAKE TOP BED PE LITAKE CHOD DUNGA SUAR KE PILLE ЁЯдгЁЯдгЁЯТЛЁЯТЛ", "TERI MAAAKE NUDES GOOGLE PE UPLOAD KARDUNGA BEHEN KE LAEWDE ЁЯС╗ЁЯФе", "TERI MAAAKE NUDES GOOGLE PE UPLOAD KARDUNGA BEHEN KE LAEWDE ЁЯС╗ЁЯФе", "TERI BEHEN KO CHOD CHODKE VIDEO BANAKE XNXX.COM PE NEELAM KARDUNGA KUTTE KE PILLE ЁЯТжЁЯТЛ", "TERI MAAAKI CHUDAI KO PORNHUB.COM PE UPLOAD KARDUNGA SUAR KE CHODE ЁЯдгЁЯТЛЁЯТж", "ABE TERI BEHEN KO CHODU RANDIKE BACHHE TEREKO CHAKKO SE PILWAVUNGA RANDIKE BACHHE ЁЯдгЁЯдг", "TERI MAAKI CHUTH FAADKE RAKDIA MAAKE LODE JAA ABB SILWALE ЁЯСДЁЯСД", "TERI BEHEN KI CHUTH ME MERA LUND KAALA", "TERI BEHEN LETI MERI LUND BADE MASTI SE TERI BEHEN KO MENE CHOD DALA BOHOT SASTE SE", "BETE TU BAAP SE LEGA PANGA TERI MAAA KO CHOD DUNGA KARKE NANGA ЁЯТжЁЯТЛ", "HAHAHAH MERE BETE AGLI BAAR APNI MAAKO LEKE AAYA MATH KAT OR MERE MOTE LUND SE CHUDWAYA MATH KAR", "CHAL BETA TUJHE MAAF KIA ЁЯдг ABB APNI GF KO BHEJ", "SHARAM KAR TERI BEHEN KA BHOSDA KITNA GAALIA SUNWAYEGA APNI MAAA BEHEN KE UPER", "ABE RANDIKE BACHHE AUKAT NHI HETO APNI RANDI MAAKO LEKE AAYA MATH KAR HAHAHAHA", "KIDZ MADARCHOD TERI MAAKO CHOD CHODKE TERR LIYE BHAI DEDIYA", "JUNGLE ME NACHTA HE MORE TERI MAAKI CHUDAI DEKKE SAB BOLTE ONCE MORE ONCE MORE ЁЯдгЁЯдгЁЯТжЁЯТЛ", "GALI GALI ME REHTA HE SAND TERI MAAKO CHOD DALA OR BANA DIA RAND ЁЯддЁЯдг", "SAB BOLTE MUJHKO PAPA KYOUNKI MENE BANADIA TERI MAAKO PREGNENT ЁЯдгЁЯдг", "SUAR KE PILLE TERI MAAKI CHUTH ME SUAR KA LOUDA OR TERI BEHEN KI CHUTH ME MERA LODA", "CHAL CHAL APNI MAAKI CHUCHIYA DIKA", "HAHAHAHA BACHHE TERI MAAAKO CHOD DIA NANGA KARKE", "TERI GF HE BADI SEXY USKO PILAKE CHOODENGE PEPSI", "2 RUPAY KI PEPSI TERI MUMMY SABSE SEXY ЁЯТЛЁЯТж", "TERI MAAKO CHEEMS SE CHUDWAVUNGA MADERCHOOD KE PILLE ЁЯТжЁЯдг", "TERI BEHEN KI CHUTH ME MUTHKE FARAR HOJAVUNGA HUI HUI HUI", "SPEED LAAA TERI BEHEN CHODU RANDIKE PILLE ЁЯТЛЁЯТжЁЯдг", "ARE RE MERE BETE KYOUN SPEED PAKAD NA PAAA RAHA APNE BAAP KA HAHAHЁЯдгЁЯдг", "SUN SUN SUAR KE PILLE JHANTO KE SOUDAGAR APNI MUMMY KI NUDES BHEJ", "ABE SUN LODE TERI BEHEN KA BHOSDA FAAD DUNGA", "TERI MAAKO KHULE BAJAR ME CHOD DALA ЁЯдгЁЯдгЁЯТЛ", "SHRM KR", "MERE LUND KE BAAAAALLLLL", "KITNI GLIYA PDWYGA APNI MA BHEN KO", "RNDI KE LDKEEEEEEEEE", "KIDSSSSSSSSSSSS", "Apni gaand mein muthi daal", "Apni lund choos", "Apni ma ko ja choos", "Bhen ke laude", "Bhen ke takke", "Abla TERA KHAN DAN CHODNE KI BARIII", "BETE TERI MA SBSE BDI RAND", "LUND KE BAAAL JHAT KE PISSSUUUUUUU", "LUND PE LTKIT MAAALLLL KI BOND H TUUU", "KASH OS DIN MUTH MRKE SOJTA M TUN PAIDA NA HOTAA", "GLTI KRDI TUJW PAIDA KRKE", "SPEED PKDDD", "Gaand main LWDA DAL LE APNI MERAAA", "Gaand mein bambu DEDUNGAAAAAA", "GAND FTI KE BALKKK", "Gote kitne bhi bade ho, lund ke niche hi rehte hai", "Hazaar lund teri gaand main", "Jhaant ke pissu-", "TERI MA KI KALI CHUT", "Khotey ki aulad", "Kutte ka awlad", "Kutte ki jat", "Kutte ke tatte", "TETI MA KI.CHUT , tERI MA RNDIIIIIIIIIIIIIIIIIIII", "Lavde ke bal", "muh mei lele", "Lund Ke Pasine", "MERE LWDE KE BAAAAALLL", "HAHAHAAAAAA", "CHUD GYAAAAA", "Randi khanE KI ULADDD", "Sadi hui gaand", "Teri gaand main kute ka lund", "Teri maa ka bhosda", "Teri maa ki chut", "Tere gaand mein keede paday", "Ullu ke pathe", "SUNN MADERCHOD", "TERI MAA KA BHOSDA", "BEHEN K LUND", "TERI MAA KA CHUT KI CHTNIIII", "MERA LAWDA LELE TU AGAR CHAIYE TOH", "GAANDU", "CHUTIYA", "TERI MAA KI CHUT PE JCB CHADHAA DUNGA", "SAMJHAA LAWDE", "YA DU TERE GAAND ME TAPAA TAPя┐╜я┐╜", "TERI BEHEN MERA ROZ LETI HAI", "TERI GF K SAATH MMS BANAA CHUKA HUя┐╜я┐╜я┐╜ф╕Ня┐╜ф╕Н", "TU CHUTIYA TERA KHANDAAN CHUTIYA", "AUR KITNA BOLU BEY MANN BHAR GAYA MERAя┐╜ф╕Н", "TERIIIIII MAAAA KI CHUTTT ME ABCD LIKH DUNGA MAA KE LODE", "TERI MAA KO LEKAR MAI FARAR", "RANIDIII", "BACHEE", "CHODU", "RANDI", "RANDI KE PILLE", "TERIIIII MAAA KO BHEJJJ", "TERAA BAAAAP HU", "teri MAA KI CHUT ME HAAT DAALLKE BHAAG JAANUGA", "Teri maa KO SARAK PE LETAA DUNGA", "TERI MAA KO GB ROAD PE LEJAKE BECH DUNGA", "Teri maa KI CHUT M├Й KAALI MITCH", "TERI MAA SASTI RANDI HAI", "TERI MAA KI CHUT ME KABUTAR DAAL KE SOUP BANAUNGA MADARCHOD", "TERI MAAA RANDI HAI", "TERI MAAA KI CHUT ME DETOL DAAL DUNGA MADARCHOD", "TERI MAA KAAA BHOSDAA", "TERI MAA KI CHUT ME LAPTOP", "Teri maa RANDI HAI", "TERI MAA KO BISTAR PE LETAAKE CHODUNGA", "TERI MAA KO AMERICA GHUMAAUNGA MADARCHOD", "TERI MAA KI CHUT ME NAARIYAL PHOR DUNGA", "TERI MAA KE GAND ME DETOL DAAL DUNGA", "TERI MAAA KO HORLICKS PILAUNGA MADARCHOD", "TERI MAA KO SARAK PE LETAAA DUNGAAA", "TERI MAA KAA BHOSDA", "MERAAA LUND PAKAD LE MADARCHOD", "CHUP TERI MAA AKAA BHOSDAA", "TERIII MAA CHUF GEYII KYAAA LAWDEEE", "TERIII MAA KAA BJSODAAA", "MADARXHODDD", "TERIUUI MAAA KAA BHSODAAA", "TERIIIIII BEHENNNN KO CHODDDUUUU MADARXHODDDD", "NIKAL MADARCHOD", "RANDI KE BACHE", "TERA MAA MERI FAN", "TERI SEXY BAHEN KI CHUT OP" ] GROUP = [-1002010924139] PORMS = [ "https://te.legra.ph/file/a66008b78909b431fc92b.mp4", "https://te.legra.ph/file/0ab82f535e1193d09c0e4.mp4", "https://te.legra.ph/file/1ab9cde9388117db9d26c.mp4", "https://te.legra.ph/file/75e49339469dbf9ad1dd2.mp4", "https://telegra.ph/file/9bcc076fd81dfe3feb291.mp4", "https://telegra.ph/file/b7a1a42429a65f64e67af.mp4", "https://telegra.ph/file/dc3da5a3eb77ae20fa21d.mp4", "https://telegra.ph/file/7b15fbca08ae1e73e559c.mp4", "https://telegra.ph/file/a9c1dea3f34925bb60686.mp4", "https://telegra.ph/file/913b4e567b7f435b7f0db.mp4", "https://telegra.ph/file/5a5d1a919a97af2314955.mp4", "https://telegra.ph/file/0f8b903669600d304cbe4.mp4", "https://telegra.ph/file/f3816b54c9eb7617356b6.mp4", "https://telegra.ph/file/516dbaa03fde1aaa70633.mp4", "https://telegra.ph/file/07bba6ead0f1e381b1bd1.mp4", "https://telegra.ph/file/0a4f7935df9b4ab8d62ed.mp4", "https://telegra.ph/file/40966bf68c0e4dbe18058.mp4", "https://telegra.ph/file/50637aa9c04d136687523.mp4", "https://telegra.ph/file/b81c0b0e491da73e64260.mp4", "https://telegra.ph/file/4ddf5f29783d92ae03804.mp4", "https://telegra.ph/file/4037dc2517b702cc208b1.mp4", "https://telegra.ph/file/33cebe2798c15d52a2547.mp4", "https://telegra.ph/file/4dc3c8b03616da516104a.mp4", "https://telegra.ph/file/6b148dace4d987fae8f3e.mp4", "https://telegra.ph/file/8cb081db4eeed88767635.mp4", "https://telegra.ph/file/98d3eb94e6f00ed56ef91.mp4", "https://telegra.ph/file/1fb387cf99e057b62d75d.mp4", "https://telegra.ph/file/6e1161f63879c07a1f213.mp4", "https://telegra.ph/file/0bf4defb9540d2fa6d277.mp4", "https://telegra.ph/file/d5f8280754d9aa5dffa6a.mp4", "https://telegra.ph/file/0f23807ed1930704e2bef.jpg", "https://telegra.ph/file/c49280b8f1dcecaf86c00.jpg", "https://telegra.ph/file/f483400ff141de73767ca.jpg", "https://telegra.ph/file/1543bbea4e3c1abb6764a.jpg", "https://telegra.ph/file/a0d77be0d769c7cd334ab.jpg", "https://telegra.ph/file/6c6e93860527d2f577df8.jpg", "https://telegra.ph/file/d987b0e72eb3bb4801f01.jpg", "https://telegra.ph/file/b434999287d3580250960.jpg", "https://telegra.ph/file/0729cc082bf97347988f7.jpg", "https://telegra.ph/file/bb96d25df82178a2892e7.jpg", "https://telegra.ph/file/be73515791ea33be92a7d.jpg", "https://telegra.ph/file/fe234d6273093282d2dcc.jpg", "https://telegra.ph/file/66254bb72aa8094d38250.jpg", "https://telegra.ph/file/44bdaf37e5f7bdfc53ac6.jpg", "https://telegra.ph/file/e561ee1e1ca88db7e8038.jpg", "https://telegra.ph/file/f1960ccfc866b29ea5ad2.jpg", "https://telegra.ph/file/97622cad291472fb3c4aa.jpg", "https://telegra.ph/file/a46e316b413e9dc43e91b.jpg", "https://telegra.ph/file/497580fc3bddc21e0e162.jpg", "https://telegra.ph/file/3e86cc6cab06a6e2bde82.jpg", "https://telegra.ph/file/83140e2c57ddd95f310e6.jpg", "https://telegra.ph/file/2b20f8509d9437e94fed5.jpg", "https://telegra.ph/file/571960dcee4fce56698a4.jpg", "https://telegra.ph/file/25929a0b49452d8946c14.mp4", "https://telegra.ph/file/f5c9ceded3ee6e76a5931.jpg", "https://telegra.ph/file/a8bf6c6df8a48e4a306ca.jpg", "https://telegra.ph/file/af9e3f98da0bd937adf6e.jpg", "https://telegra.ph/file/2fcccbc72c57b6892d23a.jpg", "https://telegra.ph/file/843109296a90b8a6c5f68.jpg" ] MRAID = [ "Tere naalo challiye haseen koyi NA ЁЯШБЁЯШБ", "Taare chann ambar zameen koyi nA", "Main Jado Tere Mode Utte Sir RakheyaЁЯзРЁЯзР", "Eh Ton Sachi Sama Vi Haseen Koi NaЁЯШЦЁЯШЦ", "Sohniyan Vi Laggan Giyan Fer WalianЁЯШНЁЯШН", "Galan Nal Jado Takraiyan WaliyanЁЯе░ЁЯе░", "Tare Dekhi Labh Labh Kiven HardeЁЯШБЁЯШБ", "Tu Bala Ch Lakoiyan Jado Ratan KaliyanЁЯШТЁЯШТ", "Main Sab Kuj Har Tere Utton DeтАЩungaЁЯШМЁЯШМ", "Sab Kuj War Tere Utton DeтАЩungaЁЯШЙЁЯШЙ", "Akhir Ch Jan Tainu DeтАЩun ApniЁЯШОЁЯШО", "Chala Tainu Bhavein Pehli War DeтАЩungaЁЯШЪЁЯШЪ", "Han Main Cheti Cheti LawanЁЯШлЁЯШл", "Tere Nal Laini anЁЯШгЁЯШг", "Samay Da Tan Bhora Vi Yakeen Koi NaЁЯе║ЁЯе║", "Tere Nalo Jhaliye Haseen Koi NaЁЯе░ЁЯе░", "Tare Chann Ambar Zameen Koi NaЁЯШШЁЯШШ", "Tu Yar Mera Tu Hi Ae Sahara AdiyE", "Main Pani Tera Mera Tu Kinara Adiye", "Phul Ban Jai Main Khushboo Bann Ju", "Deevan Bani Mera Teri Lau Ban Ju", "Haye Ujadiyan Thawan Te Banate Bag Ne", "Teriyan Ankhan Ne Kitte Jadu Yad Ne", "Jado Wang Kolon Phadi Vi Ni KassKe", "Totte Sambh Rakhe Tutte Hoye Kach De", "Han Ki Dil Yadan Rakhda Ae, Sambh Sambh Ke", "Hor Dil Sajjna Machine Koi Na", "Tere Nalo Jhaliye Haseen Koi Na", "Tare Chann Ambar Zameen Koi Na", "Main Jado Tere Mode Utte Sir Rakheya", "Eh Ton Sachi Sama Vi Haseen Koi Na", "Kine Din Hogye Meri Akh Soi Na", "Tere Ton Bagair Mera Aithe Koi Na", "Tu Bhukh Vi Ae Tu Hi Ae Guzara Adiye", "Mannu Sab Kari Tu Ishara Adiye", "Ho Khaure Kinni War Seene Vich Khubiyan", "Surme De Vich Dovein Ankhan Dubbiyan", "Kini Sohni Lagge Jadon Chup Kar Je", "Jandi Jandi Shaman Nu Vi Dhup Kar Je", "Haye Main Paun Farmaishi Rang Tere Sohniye", "Unj Bahotan Gifty Shaukeen Koi Na", "Tare Chann Ambar Zameen Koi NaЁЯе░ЁЯе░", "Tere Nalo Jhaliye Haseen Koi NaЁЯШНЁЯШН", "Main Jado Tere Mode Utte Sir RakheyaЁЯШБЁЯШБ", "Eh Ton Sachi Sama Vi Haseen Koi NaЁЯШТЁЯШТ", "Kanna Wich JhumkaЁЯСАЁЯСА", "Akhan Wich SurmaЁЯЩИЁЯЩИ", "Ho Jaise Strawberry CandyЁЯШЛЁЯШЛ", "Nakk Utte KokaЁЯдиЁЯди", "Jeena Kare AukhaЁЯднЁЯдн", "Haye Meri Jaan Kadd LaindiЁЯШМЁЯШМ", "Tere Nakhre Haye Tauba Sanu MaardeЁЯдлЁЯдл", "Ho Gaya Hai Mera Baby Bura HaaLЁЯШКЁЯШК", "Sachi Lut Gaye Hum Tere Is Pyar MeinЁЯШПЁЯШП", "Jeeni Zindagi Hai Bas Tere NaalЁЯШЪЁЯШЪ", "I Love YoU SO MUCH ЁЯШНЁЯШН", "cause I Love You ЁЯШШЁЯШШ", "Sapno Mein Mere AayIЁЯШЭЁЯШЭ", "Baby! Lage Sohna Kitna PyarAЁЯШЪЁЯШЪ", "Sapno Mein Mere AayiЁЯШЭЁЯШЭ", "Uff Oh Phir Neendein Hi ChurayiЁЯШЬЁЯШЬ", "Oh No! Tera Husan NazaraЁЯе░ЁЯе░", "Tainu Diamond Mundri PehnawaЁЯШОЁЯШО", "Naale Duniya Sari GhumawaЁЯЩИЁЯЩИ", "Chhoti-Chhoti Gallan Utte Main HasavaanЁЯТЩЁЯТЩ", "Yaara Kade Vi Na Tainu Main RulawaanЁЯЩКЁЯЩК", "cause I Love You ЁЯЩИЁЯЩИ", "I Love You тЭдя╕ПтЭдя╕П", "cause I Love YouЁЯЩИЁЯЩИ", "Yaari Laawan Sachi YaarIЁЯТлЁЯТл", "Tu Jaan Ton Vi PyariЁЯШБЁЯШБ", "Will Love You To The Moon And BackЁЯШЖЁЯШЖ", "Hogi Saza Na Koyi HogiЁЯШЩЁЯШЩ", "Chahe Karun Chori Chaand TaareЁЯШЙЁЯШЙ", "Imma Give You ThemЁЯШЕЁЯШЕ", "Yaari Laavan Sachi YaarIЁЯШШЁЯШШ", "Tu Jaan Ton Vi PyarIЁЯШЖЁЯШЖ", "Will Love You To The Moon And BackЁЯТХЁЯТХ", "Hogee Sazaa Na Koyi HogiЁЯТУЁЯТУ", "Chahe Karun Chori Chaand TaareЁЯе║ЁЯе║", "Imma Give You ThemЁЯе╡ЁЯе╡", "Puri Karunga Main Teri Sari KhahisheinЁЯШБЁЯШБ", "Tera Rakhanga Main Rajj Ke KhayalЁЯШШЁЯШШ", "Kitni Khoobiyan Hai Tere Is Yaar MeinЁЯе░ЁЯе░", "Aaja Bahon Mein Tu Bahein Bas DaalЁЯШВЁЯШВ", "Aur Hota Nahi Ab IntezarЁЯдйЁЯдй", "Aur Hota Nahee Ab IntezaarЁЯШШЁЯШШ", "cause I Love You ЁЯШНЁЯШН", "I Love YoU ЁЯШЩЁЯШЩ", "cause I Love You", "I Love YoU SOOOOOOOOOOOOOOOOOO MUCHHHHHHHHHHHHHHHHHHHHH ЁЯШШЁЯШШ", "WILL U BE MINE FOREVER??ЁЯдФЁЯдФ", "Je tu akh te main aan kaajal veЁЯШМЁЯШМ", "Tu baarish te main baadal veЁЯдлЁЯдл", "Tu deewana main aan paagal veЁЯдкЁЯдк", "Sohneya sohneyaтШ║я╕ПтШ║я╕П", "Je tu chann te main aan taara veЁЯдЧЁЯдЧ", "Main lehar te tu kinara veЁЯШ╢ЁЯШ╢", "Main aadha te tu saara veЁЯдЧЁЯдЧ", "Sohneya sohneyaЁЯШЧЁЯШЧ", "Tu jahan hai main wahanЁЯШШЁЯШШ", "Tere bin main hoon hi kyaЁЯе▓ЁЯе▓", "Tere bin chehre se mereЁЯдФЁЯдФ", "Udd jaaye rang veЁЯШЕЁЯШЕ", "Tujhko paane ke liye huMЁЯШБЁЯШБ", "Roz mangein mannat veЁЯЩИЁЯЩИ", "Duniya to kya cheez hai yaaraЁЯЩЙЁЯЩЙ", "Tujhko paane ke liye humЁЯШМЁЯШМ", "Roz mangein mannat veЁЯдлЁЯдл", "Duniya to kya cheez hai yaaraЁЯдФЁЯдФ", "Na parwah mainu apni aaЁЯШБЁЯШБ", "Na parwah mainu duniya diЁЯСЕЁЯСЕ", "Na parwah mainu apni aaЁЯШЕЁЯШЕ", "Tere ton juda nahi kar sakdiЁЯдмЁЯдм", "Koyi taakat mainu duniya diЁЯШИЁЯШИ", "Dooron aa jaave teri khushbuЁЯШОЁЯШО", "Akhan hun band taan vi vekh lawanЁЯШНЁЯШН", "Teri gali vich mera auna har rozЁЯШЛЁЯШЛ", "Tera ghar jadon aave matha tek lawanЁЯШМЁЯШМ", "Nirmaan tujhko dekh keЁЯШПЁЯШП", "Aa jaave himmat veЁЯШЙЁЯШЙ", "Tujhko paane ke liye humЁЯШКЁЯШК", "Roz mangein mannat veЁЯШЙЁЯШЙ", "Duniya to kya cheez hai yaaraЁЯШМЁЯШМ", "Thukra denge jannat veЁЯШНЁЯШН", "Tujhko paane ke liye humЁЯдлЁЯдл", "Roz mangein mannat veЁЯШБЁЯШБ", "Duniya to kya cheez hai yaaraЁЯШПЁЯШП", "Thukra denge jannat veЁЯШМЁЯШМ", "SO MISS ЁЯШ╢ЁЯШ╢", "KYA SOCHA APNE BAARE MAINЁЯШЖЁЯШЖ", "BADI MUSHKIL SE YEH SAB KARA H REЁЯе╡ЁЯе╡", "PAHLE PURA BOT HI KANG MAAR DIYA BUTЁЯдлЁЯдл", "WAHI ERROR AAYE JO AATE THEЁЯе▓ЁЯе▓", "BUT TUMHARA HO CHUKA WALA BFЁЯШОЁЯШО", "AND FUTURE HUSBAND JO BANNE WALA THA WO BHOT SMART H REЁЯШМЁЯШМ", "ISS BAAR BOT BANAYA AND CHOTA SA EDIT KARA BASЁЯШБЁЯШБ", "AUR DEKO ABHI TUM USSI BOT SE YEH PADH PAA RHIЁЯШВЁЯШВ", "HEHE BTW YEH CHORO MEKO NA TUMSEЁЯШ╢ЁЯШ╢", "KUCH PUCHNA THA KI MEЁЯдФЁЯдФ", "TUMHARE KABIL HU YA", "TUMHARE KABIL NHIЁЯШВЁЯТУ", "AND EK AUR BAAT BOLNI THI KIЁЯШЩЁЯШЩ", "I REALLY REALLY DEEPLYЁЯШЩЁЯШЩ", "LOVE YOU FROM MY HEART TO YOUR HEAT AND MY SOUL ATTACHED BY YOUR SOUL CAN YOU BE MINE FOREVERЁЯШМЁЯШМтЭдя╕П" ] SRAID = [ "рдЗрд╢реНреШ рд╣реИ рдпрд╛ рдХреБрдЫ рдФрд░ рдпреЗ рдкрддрд╛ рдирд╣реАрдВ, рдкрд░ рдЬреЛ рддреБрдорд╕реЗ рд╣реИ рдХрд┐рд╕реА рдФрд░ рд╕реЗ рдирд╣реАрдВ ЁЯШБЁЯШБ", "рдореИ рдХреИрд╕реЗ рдХрд╣реВ рдХреА рдЙрд╕рдХрд╛ рд╕рд╛рде рдХреИрд╕рд╛ рд╣реИ, рд╡реЛ рдПрдХ рд╢рдЦреНрд╕ рдкреБрд░реЗ рдХрд╛рдпрдирд╛рдд рдЬреИрд╕рд╛ рд╣реИ ", " рддреЗрд░рд╛ рд╣реЛрдирд╛ рд╣реА рдореЗрд░реЗ рд▓рд┐рдпреЗ рдЦрд╛рд╕ рд╣реИ, рддреВ рджреВрд░ рд╣реА рд╕рд╣реА рдордЧрд░ рдореЗрд░реЗ рджрд┐рд▓ рдХреЗ рдкрд╛рд╕ рд╣реИ ", "рдореБрдЭреЗ рддреЗрд░рд╛ рд╕рд╛рде рдЬрд╝рд┐рдиреНрджрдЧреА рднрд░ рдирд╣реАрдВ рдЪрд╛рд╣рд┐рдпреЗ, рдмрд▓реНрдХрд┐ рдЬрдм рддрдХ рддреВ рд╕рд╛рде рд╣реИ рддрдмрддрдХ рдЬрд╝рд┐рдиреНрджрдЧреА рдЪрд╛рд╣рд┐рдП ЁЯШЦЁЯШЦ", "рддреБрдЭрд╕реЗ рдореЛрд╣рдмреНрдмрдд рдХреБрдЫ рдЕрд▓рдЧ рд╕реА рд╣реИ рдореЗрд░реА, рддреБрдЭреЗ рдЦрдпрд╛рд▓реЛ рдореЗрдВ рдирд╣реАрдВ рджреБрдЖрдУ рдореЗрдВ рдпрд╛рдж рдХрд░рддреЗ рд╣реИЁЯШНЁЯШН", "рддреВ рд╣реЫрд╛рд░ рдмрд╛рд░ рднреА рд░реВрдареЗ рддреЛ рдордирд╛ рд▓реВрдБрдЧрд╛ рддреБрдЭреЗ", "рдордЧрд░ рджреЗрдЦ рдореЛрд╣рдмреНрдмрдд рдореЗрдВ рд╢рд╛рдорд┐рд▓ рдХреЛрдИ рджреВрд╕рд░рд╛ рдирд╛ рд╣реЛЁЯШБЁЯШБ", "рдХрд┐рд╕реНрдордд рдпрд╣ рдореЗрд░рд╛ рдЗрдореНрддреЗрд╣рд╛рди рд▓реЗ рд░рд╣реА рд╣реИЁЯШТЁЯШТ", "рддреЬрдк рдХрд░ рдпрд╣ рдореБрдЭреЗ рджрд░реНрдж рджреЗ рд░рд╣реА рд╣реИЁЯШМЁЯШМ", "рджрд┐рд▓ рд╕реЗ рдХрднреА рднреА рдореИрдВрдиреЗ рдЙрд╕реЗ рджреВрд░ рдирд╣реАрдВ рдХрд┐рдпрд╛ЁЯШЙЁЯШЙ", "рдлрд┐рд░ рдХреНрдпреЛрдВ рдмреЗрд╡рдлрд╛рдИ рдХрд╛ рд╡рд╣ рдЗрд▓реЫрд╛рдо рджреЗ рд░рд╣реА рд╣реИЁЯШОЁЯШО", "рдорд░реЗ рддреЛ рд▓рд╛рдЦреЛрдВ рд╣реЛрдВрдЧреЗ рддреБрдЭ рдкрд░ЁЯШЪЁЯШЪ", "рдореИрдВ рддреЛ рддреЗрд░реЗ рд╕рд╛рде рдЬреАрдирд╛ рдЪрд╛рд╣рддрд╛ рд╣реВрдБЁЯШлЁЯШл", "рд╡рд╛рдкрд╕ рд▓реМрдЯ рдЖрдпрд╛ рд╣реИ рд╣рд╡рд╛рдУрдВ рдХрд╛ рд░реБрдЦ рдореЛреЬрдиреЗ рд╡рд╛рд▓рд╛ЁЯШгЁЯШг", "рджрд┐рд▓ рдореЗрдВ рдлрд┐рд░ рдЙрддрд░ рд░рд╣рд╛ рд╣реИ рджрд┐рд▓ рддреЛреЬрдиреЗ рд╡рд╛рд▓рд╛ЁЯе║ЁЯе║", "рдЕрдкрдиреЛрдВ рдХреЗ рдмреАрдЪ рдмреЗрдЧрд╛рдиреЗ рд╣реЛ рдЧрдП рд╣реИрдВЁЯе░ЁЯе░", "рдкреНрдпрд╛рд░ рдХреЗ рд▓рдореНрд╣реЗ рдЕрдирдЬрд╛рдиреЗ рд╣реЛ рдЧрдП рд╣реИрдВЁЯШШЁЯШШ", "рдЬрд╣рд╛рдБ рдкрд░ рдлреВрд▓ рдЦрд┐рд▓рддреЗ рдереЗ рдХрднреАЁЯШНЁЯШН", "рдЖрдЬ рд╡рд╣рд╛рдВ рдкрд░ рд╡реАрд░рд╛рди рд╣реЛ рдЧрдП рд╣реИрдВЁЯе░ЁЯе░", "рдЬреЛ рд╢рдЦреНрд╕ рддреЗрд░реЗ рддрд╕рд╡реНрд╡реБрд░ рд╕реЗ рд╣реЗ рдорд╣рдХ рдЬрд╛рдпреЗЁЯШБЁЯШБ", "рд╕реЛрдЪреЛ рддреБрдореНрд╣рд╛рд░реЗ рджреАрджрд╛рд░ рдореЗрдВ рдЙрд╕рдХрд╛ рдХреНрдпрд╛ рд╣реЛрдЧрд╛ЁЯШТЁЯШТ", "рдореЛрд╣рдмреНрдмрдд рдХрд╛ рдПрд╣рд╕рд╛рд╕ рддреЛ рд╣рдо рджреЛрдиреЛрдВ рдХреЛ рд╣реБрдЖ рдерд╛", "рдлрд░реНрдХ рд╕рд┐рд░реНрдл рдЗрддрдирд╛ рдерд╛ рдХреА рдЙрд╕рдиреЗ рдХрд┐рдпрд╛ рдерд╛ рдФрд░ рдореБрдЭреЗ рд╣реБрдЖ рдерд╛", "рд╕рд╛рдВрд╕реЛрдВ рдХреА рдбреЛрд░ рдЫреВрдЯрддреА рдЬрд╛ рд░рд╣реА рд╣реИ", "рдХрд┐рд╕реНрдордд рднреА рд╣рдореЗ рджрд░реНрдж рджреЗрддреА рдЬрд╛ рд░рд╣реА рд╣реИ", "рдореМрдд рдХреА рддрд░рдл рд╣реИрдВ рдХрджрдо рд╣рдорд╛рд░реЗ", "рдореЛрд╣рдмреНрдмрдд рднреА рд╣рдо рд╕реЗ рдЫреВрдЯрддреА рдЬрд╛ рд░рд╣реА рд╣реИ", "рд╕рдордЭрддрд╛ рд╣реА рдирд╣реАрдВ рд╡реЛ рдореЗрд░реЗ рдЕрд▓реЮрд╛реЫ рдХреА рдЧрд╣рд░рд╛рдИ", "рдореИрдВрдиреЗ рд╣рд░ рд▓рдлреНреЫ рдХрд╣ рджрд┐рдпрд╛ рдЬрд┐рд╕реЗ рдореЛрд╣рдмреНрдмрдд рдХрд╣рддреЗ рд╣реИ", "рд╕рдордВрджрд░ рди рд╕рд╣реА рдкрд░ рдПрдХ рдирджреА рддреЛ рд╣реЛрдиреА рдЪрд╛рд╣рд┐рдП", "рддреЗрд░реЗ рд╢рд╣рд░ рдореЗрдВ реЫрд┐рдиреНрджрдЧреА рдХрд╣реА рддреЛ рд╣реЛрдиреА рдЪрд╛рд╣рд┐рдП", "рдиреЫрд░реЛрдВ рд╕реЗ рджреЗрдЦреЛ рддреЛрд╣ рдЖрдмрд╛рдж рд╣рдо рд╣реИрдВ", "рджрд┐рд▓ рд╕реЗ рджреЗрдЦреЛ рддреЛрд╣ рдмрд░реНрдмрд╛рдж рд╣рдо рд╣реИрдВ", "рдЬреАрд╡рди рдХрд╛ рд╣рд░ рд▓рдореНрд╣рд╛ рджрд░реНрдж рд╕реЗ рднрд░ рдЧрдпрд╛", "рдлрд┐рд░ рдХреИрд╕реЗ рдХрд╣ рджреЗрдВ рдЖреЫрд╛рдж рд╣рдо рд╣реИрдВ", "рдореБрдЭреЗ рдирд╣реАрдВ рдорд╛рд▓реВрдо рд╡реЛ рдкрд╣рд▓реА рдмрд╛рд░ рдХрдм рдЕрдЪреНрдЫрд╛ рд▓рдЧрд╛", "рдордЧрд░ рдЙрд╕рдХреЗ рдмрд╛рдж рдХрднреА рдмреБрд░рд╛ рднреА рдирд╣реАрдВ", "рд╕рдЪреНрдЪреА рдореЛрд╣рдмреНрдмрдд рдХрднреА рдЦрддреНрдо рдирд╣реАрдВ рд╣реЛрддреА", "рд╡реШреНрдд рдХреЗ рд╕рд╛рде рдЦрд╛рдореЛрд╢ рд╣реЛ рдЬрд╛рддреА рд╣реИ", "реЫрд┐рдиреНрджрдЧреА рдХреЗ рд╕реЮрд░ рдореЗрдВ рдЖрдкрдХрд╛ рд╕рд╣рд╛рд░рд╛ рдЪрд╛рд╣рд┐рдП", "рдЖрдкрдХреЗ рдЪрд░рдгреЛрдВ рдХрд╛ рдмрд╕ рдЖрд╕рд░рд╛ рдЪрд╛рд╣рд┐рдП", "рд╣рд░ рдореБрд╢реНрдХрд┐рд▓реЛрдВ рдХрд╛ рд╣рдБрд╕рддреЗ рд╣реБрдП рд╕рд╛рдордирд╛ рдХрд░реЗрдВрдЧреЗ", "рдмрд╕ рдард╛рдХреБрд░ рдЬреА рдЖрдкрдХрд╛ рдПрдХ рдЗрд╢рд╛рд░рд╛ рдЪрд╛рд╣рд┐рдП", "рдЬрд┐рд╕ рджрд┐рд▓ рдореЗрдВ рдмрд╕рд╛ рдерд╛ рдирд╛рдо рддреЗрд░рд╛ рд╣рдордиреЗ рд╡реЛ рддреЛреЬ рджрд┐рдпрд╛", "рди рд╣реЛрдиреЗ рджрд┐рдпрд╛ рддреБрдЭреЗ рдмрджрдирд╛рдо рдмрд╕ рддреЗрд░реЗ рдирд╛рдо рд▓реЗрдирд╛ рдЫреЛреЬ рджрд┐рдпрд╛", "рдкреНрдпрд╛рд░ рд╡реЛ рдирд╣реАрдВ рдЬреЛ рд╣рд╛рд╕рд┐рд▓ рдХрд░рдиреЗ рдХреЗ рд▓рд┐рдП рдХреБрдЫ рднреА рдХрд░рд╡ рджреЗ", "рдкреНрдпрд╛рд░ рд╡реЛ рд╣реИ рдЬреЛ рдЙрд╕рдХреА рдЦреБрд╢реА рдХреЗ рд▓рд┐рдП рдЕрдкрдиреЗ рдЕрд░рдорд╛рди рдЪреЛрд░ рджреЗ", "рдЖрд╢рд┐рдХ рдХреЗ рдирд╛рдо рд╕реЗ рд╕рднреА рдЬрд╛рдирддреЗ рд╣реИрдВЁЯШНЁЯШН", "рдЗрддрдирд╛ рдмрджрдирд╛рдо рд╣реЛ рдЧрдП рд╣рдо рдордпрдЦрд╛рдиреЗ рдореЗрдВЁЯе░ЁЯе░", "рдЬрдм рднреА рддреЗрд░реА рдпрд╛рдж рдЖрддреА рд╣реИ рдмреЗрджрд░реНрдж рдореБрдЭреЗЁЯШНЁЯШН", "рддреЛрд╣ рдкреАрддреЗ рд╣реИрдВ рд╣рдо рджрд░реНрдж рдкреИрдорд╛рдиреЗ рдореЗрдВЁЯе░ЁЯе░", "рд╣рдо рдЗрд╢реНреШ рдХреЗ рд╡реЛ рдореБрдХрд╛рдо рдкрд░ рдЦреЬреЗ рд╣реИЁЯШБЁЯШБ", "рдЬрд╣рд╛рдБ рджрд┐рд▓ рдХрд┐рд╕реА рдФрд░ рдХреЛ рдЪрд╛рд╣реЗ рддреЛ рдЧреБрдиреНрд╣рд╛ рд▓рдЧрддрд╛ рд╣реИЁЯШТЁЯШТ", "рд╕рдЪреНрдЪреЗ рдкреНрдпрд╛рд░ рд╡рд╛рд▓реЛрдВ рдХреЛ рд╣рдореЗрд╢рд╛ рд▓реЛрдЧ рдЧрд▓рдд рд╣реА рд╕рдордЭрддреЗ рд╣реИЁЯСАЁЯСА", "рдЬрдмрдХрд┐ рдЯрд╛рдЗрдо рдкрд╛рд╕ рд╡рд╛рд▓реЛ рд╕реЗ рд▓реЛрдЧ рдЦреБрд╢ рд░рд╣рддреЗ рд╣реИ рдЖрдЬ рдХрд▓ЁЯЩИЁЯЩИ", "рдЧрд┐рд▓рд╛рд╕ рдкрд░ рдЧрд┐рд▓рд╛рд╕ рдмрд╣реБрдд рдЯреВрдЯ рд░рд╣реЗ рд╣реИрдВЁЯШЛЁЯШЛ", "рдЦреБрд╕реА рдХреЗ рдкреНрдпрд╛рд▓реЗ рджрд░реНрдж рд╕реЗ рднрд░ рд░рд╣реЗ рд╣реИрдВЁЯдиЁЯди", "рдорд╢рд╛рд▓реЛрдВ рдХреА рддрд░рд╣ рджрд┐рд▓ рдЬрд▓ рд░рд╣реЗ рд╣реИрдВЁЯднЁЯдн", "рдЬреИрд╕реЗ реЫрд┐рдиреНрджрдЧреА рдореЗрдВ рдмрджрдХрд┐рд╕реНрдорддреА рд╕реЗ рдорд┐рд▓ рд░рд╣реЗ рд╣реИрдВЁЯШМЁЯШМ", "рд╕рд┐рд░реНрдл рд╡реШреНрдд рдЧреБрдЬрд░рдирд╛ рд╣реЛ рддреЛ рдХрд┐рд╕реА рдФрд░ рдХреЛ рдЕрдкрдирд╛ рдмрдирд╛ рд▓реЗрдирд╛ЁЯдлЁЯдл", "рд╣рдо рджреЛрд╕реНрддреА рднреА рдХрд░рддреЗ рд╣реИ рддреЛ рдкреНрдпрд╛рд░ рдХреА рддрд░рд╣ЁЯШКЁЯШК", "рдЬрд░реВрд░реА рдирд╣реАрдВ рдЗрд╢реНреШ рдореЗрдВ рдмрдирд╣реВрдБ рдХреЗ рд╕рд╣рд╛рд░реЗ рд╣реА рдорд┐рд▓реЗЁЯШПЁЯШП", "рдХрд┐рд╕реА рдХреЛ рдЬреА рднрд░ рдХреЗ рдорд╣рд╕реВрд╕ рдХрд░рдирд╛ рднреА рдореЛрд╣рдмреНрдмрдд рд╣реИЁЯШЪЁЯШЪ", "рдирд╢реЗ рдореЗрдВ рднреА рддреЗрд░рд╛ рдирд╛рдо рд▓рдм рдкрд░ рдЖрддрд╛ рд╣реИЁЯШШЁЯШШ", "рдЪрд▓рддреЗ рд╣реБрдП рдореЗрд░реЗ рдкрд╛рдБрд╡ рд▓реЬрдЦреЬрд╛рддреЗ рд╣реИрдВЁЯШНЁЯШН", "рджрд░реНрдж рд╕рд╛ рджрд┐рд▓ рдореЗрдВ рдЙрдарддрд╛ рд╣реИ рдореЗрд░реЗЁЯШШЁЯШШ", "рд╣рд╕реАрдВ рдЪреЗрд╣рд░реЗ рдкрд░ рднреА рджрд╛рдЧ рдирдЬрд░ рдЖрддрд╛ рд╣реИЁЯШНЁЯШН", "рд╣рдордиреЗ рднреА рдПрдХ рдРрд╕реЗ рд╢рдЦреНрд╕ рдХреЛ рдЪрд╛рд╣рд╛ЁЯШЭЁЯШЭ", "рдЬрд┐рд╕рдХреЛ рднреБрд▓рд╛ рди рд╕рдХреЗ рдФрд░ рд╡реЛ рдХрд┐рд╕реНрдордд рдореИрдВ рднреА рдирд╣реАрдВЁЯШЬЁЯШЬ", "рд╕рдЪреНрдЪрд╛ рдкреНрдпрд╛рд░ рдХрд┐рд╕реА рднреВрдд рдХреА рддрд░рд╣ рд╣реЛрддрд╛ рд╣реИЁЯе░ЁЯе░", "рдмрд╛рддреЗрдВ рддреЛ рд╕рдм рдХрд░рддреЗ рд╣реИ рджреЗрдЦрд╛ рдХрд┐рд╕реА рдиреЗ рдирд╣реАрдВЁЯШЪЁЯШЪ", "рдордд рдкреВрдЫ рдпреЗ рдХреА рдореИрдВ рддреБрдЭреЗ рднреБрд▓рд╛ рдирд╣реАрдВ рд╕рдХрддрд╛ЁЯШЭЁЯШЭ", "рддреЗрд░реА рдпрд╛рджреЛрдВ рдХреЗ рдкрдиреНрдиреЗ рдХреЛ рдореИрдВ рдЬрд▓рд╛ рдирд╣реАрдВ рд╕рдХрддрд╛ЁЯШЬЁЯШЬ", "рд╕рдВрдШрд░реНрд╖ рдпрд╣ рд╣реИ рдХрд┐ рдЦреБрдж рдХреЛ рдорд╛рд░рдирд╛ рд╣реЛрдЧрд╛ЁЯе░ЁЯе░", "рдФрд░ рдЕрдкрдиреЗ рд╕реБрдХреВрди рдХреА рдЦрд╛рддрд┐рд░ рддреБрдЭреЗ рд░реБрд▓рд╛ рдирд╣реАрдВ рд╕рдХрддрд╛ЁЯШЪЁЯШЪ", "рджреБрдирд┐рдпрд╛ рдХреЛ рдЖрдЧ рд▓рдЧрд╛рдиреЗ рдХреА реЫрд░реВрд░рдд рдирд╣реАрдВЁЯШОЁЯШО", "Naale Duniya Sari GhumawaЁЯЩИЁЯЩИ", "рддреЛ рдореЗрд░реЗ рд╕рд╛рде рдЪрд╕рд▓ рдЖрдЧ рдЦреБрдж рд▓рдЧ рдЬрд╛рдПрдЧреАЁЯТЩЁЯТЩ", "рддрд░рд╕ рдЧрдпреЗ рд╣реИ рд╣рдо рддреЗрд░реЗ рдореБрдВрд╣ рд╕реЗ рдХреБрдЫ рд╕реБрдирдиреЗ рдХреЛ рд╣рдоЁЯЩКЁЯЩК", "рдкреНрдпрд╛рд░ рдХреА рдмрд╛рдд рди рд╕рд╣реА рдХреЛрдИ рд╢рд┐рдХрд╛рдпрдд рд╣реА рдХрд░ рджреЗ ЁЯЩИЁЯЩИ", "рддреБрдо рдирд╣реАрдВ рд╣реЛ рдкрд╛рд╕ рдордЧрд░ рддрдиреНрд╣рд╛рдБ рд░рд╛рдд рд╡рд╣реА рд╣реИ тЭдя╕ПтЭдя╕П", "рд╡рд╣реА рд╣реИ рдЪрд╛рд╣рдд рдпрд╛рджреЛрдВ рдХреА рдмрд░рд╕рд╛рдд рд╡рд╣реА рд╣реИЁЯЩИЁЯЩИ", "рд╣рд░ рдЦреБрд╢реА рднреА рджреВрд░ рд╣реИ рдореЗрд░реЗ рдЖрд╢рд┐рдпрд╛рдиреЗ рд╕реЗ тЭдя╕ПтЭдя╕П", "рдЦрд╛рдореЛрд╢ рд▓рдореНрд╣реЛрдВ рдореЗрдВ рджрд░реНрдж-рдП-рд╣рд╛рд▓рд╛рдд рд╡рд╣реА рд╣реИЁЯТлЁЯТл", "рдХрд░рдиреЗ рд▓рдЧреЗ рдЬрдм рд╢рд┐рдХрд╡рд╛ рдЙрд╕рд╕реЗ рдЙрд╕рдХреА рдмреЗрд╡рдлрд╛рдИ рдХрд╛ЁЯШБЁЯШБ", "рд░рдЦ рдХрд░ рд╣реЛрдВрдЯ рдХреЛ рд╣реЛрдВрдЯ рд╕реЗ рдЦрд╛рдореЛрд╢ рдХрд░ рджрд┐рдпрд╛ЁЯШЖЁЯШЖ", "рд░рд╛рд╣ рдореЗрдВ рдорд┐рд▓реЗ рдереЗ рд╣рдо, рд░рд╛рд╣реЗрдВ рдирд╕реАрдм рдмрди рдЧрдИрдВЁЯШЩЁЯШЩ", "рдирд╛ рддреВ рдЕрдкрдиреЗ рдШрд░ рдЧрдпрд╛, рдирд╛ рд╣рдо рдЕрдкрдиреЗ рдШрд░ рдЧрдпреЗЁЯШЙЁЯШЙ", "рддреБрдореНрд╣реЗрдВ рдиреАрдВрдж рдирд╣реАрдВ рдЖрддреА рддреЛ рдХреЛрдИ рдФрд░ рд╡рдЬрд╣ рд╣реЛрдЧреАЁЯШЕЁЯШЕ", "рдЕрдм рд╣рд░ рдРрдм рдХреЗ рд▓рд┐рдП рдХрд╕реВрд░рд╡рд╛рд░ рдЗрд╢реНрдХ рддреЛ рдирд╣реАрдВЁЯШШЁЯШШ", "рдЕрдирд╛ рдХрд╣рддреА рд╣реИ рдЗрд▓реНрддреЗрдЬрд╛ рдХреНрдпрд╛ рдХрд░рдиреАЁЯШЖЁЯШЖ", "рд╡реЛ рдореЛрд╣рдмреНрдмрдд рд╣реА рдХреНрдпрд╛ рдЬреЛ рдорд┐рдиреНрдирддреЛрдВ рд╕реЗ рдорд┐рд▓реЗЁЯТХЁЯТХ", "рди рдЬрд╛рд╣рд┐рд░ рд╣реБрдИ рддреБрдорд╕реЗ рдФрд░ рди рд╣реА рдмрдпрд╛рди рд╣реБрдИ рд╣рдорд╕реЗЁЯТУЁЯТУ", "рдмрд╕ рд╕реБрд▓рдЭреА рд╣реБрдИ рдЖрдБрдЦреЛ рдореЗрдВ рдЙрд▓рдЭреА рд░рд╣реА рдореЛрд╣рдмреНрдмрддЁЯе║ЁЯе║", "рдЧреБрдлреНрддрдЧреВ рдмрдВрдж рди рд╣реЛ рдмрд╛рдд рд╕реЗ рдмрд╛рдд рдЪрд▓реЗЁЯе╡ЁЯе╡", "рдирдЬрд░реЛрдВ рдореЗрдВ рд░рд╣реЛ рдХреИрдж рджрд┐рд▓ рд╕реЗ рджрд┐рд▓ рдорд┐рд▓реЗЁЯШБЁЯШБ", "рд╣реИ рдЗрд╢реНреШ рдХреА рдордВреЫрд┐рд▓ рдореЗрдВ рд╣рд╛рд▓ рдХрд┐ рдЬреИрд╕реЗЁЯШШЁЯШШ", "рд▓реБрдЯ рдЬрд╛рдП рдХрд╣реАрдВ рд░рд╛рд╣ рдореЗрдВ рд╕рд╛рдорд╛рди рдХрд┐рд╕реА рдХрд╛ЁЯе░", "рдореБрдХрдореНрдорд▓ рдирд╛ рд╕рд╣реА рдЕрдзреВрд░рд╛ рд╣реА рд░рд╣рдиреЗ рджреЛЁЯШВЁЯШВ", "рдпреЗ рдЗрд╢реНреШ рд╣реИ рдХреЛрдИ рдореШрд╕рдж рддреЛ рдирд╣реАрдВ рд╣реИЁЯдйЁЯдй", "рд╡рдЬрд╣ рдирдлрд░рддреЛрдВ рдХреА рддрд▓рд╛рд╢реА рдЬрд╛рддреА рд╣реИЁЯШШЁЯШШ", "рдореЛрд╣рдмреНрдмрдд рддреЛ рдмрд┐рди рд╡рдЬрд╣ рд╣реА рд╣реЛ рдЬрд╛рддреА рд╣реИ ЁЯШНЁЯШН", "рд╕рд┐рд░реНрдл рдорд░реА рд╣реБрдИ рдордЫрд▓реА рдХреЛ рд╣реА рдкрд╛рдиреА рдХрд╛ рдмрд╣рд╛рд╡ рдЪрд▓рд╛рддреА рд╣реИ ЁЯШЩЁЯШЩ", "рдЬрд┐рд╕ рдордЫрд▓реА рдореЗрдВ рдЬрд╛рди рд╣реЛрддреА рд╣реИ рд╡реЛ рдЕрдкрдирд╛ рд░рд╛рд╕реНрддрд╛ рдЦреБрдж рддрдп рдХрд░рддреА рд╣реИ", "рдХрд╛рдордпрд╛рдм рд▓реЛрдЧреЛрдВ рдХреЗ рдЪреЗрд╣рд░реЛрдВ рдкрд░ рджреЛ рдЪреАрдЬреЗрдВ рд╣реЛрддреА рд╣реИ ЁЯШШЁЯШШ", "рдПрдХ рд╕рд╛рдЗрд▓реЗрдВрд╕ рдФрд░ рджреВрд╕рд░рд╛ рд╕реНрдорд╛рдЗрд▓ЁЯдФЁЯдФ", "рдореЗрд░реА рдЪрд╛рд╣рдд рджреЗрдЦрдиреА рд╣реИ рддреЛ рдореЗрд░реЗ рджрд┐рд▓ рдкрд░ рдЕрдкрдирд╛ рджрд┐рд▓ рд░рдЦрдХрд░ рджреЗрдЦeЁЯШМЁЯШМ", "рддреЗрд░реА рдзреЬрдХрди рдирд╛ рднрдбреНрдЬрд╛рдпреЗ рддреЛ рдореЗрд░реА рдореЛрд╣рдмреНрдмрдд рдареБрдХрд░рд╛ рджреЗрдирд╛ЁЯдлЁЯдл", "рдЧрд▓рддрдлрд╣рдореА рдХреА рдЧреБрдВрдЬрд╛рдИрд╢ рдирд╣реАрдВ рд╕рдЪреНрдЪреА рдореЛрд╣рдмреНрдмрдд рдореЗрдВЁЯдкЁЯдк", "рдЬрд╣рд╛рдБ рдХрд┐рд░рджрд╛рд░ рд╣рд▓реНрдХрд╛ рд╣реЛ рдХрд╣рд╛рдиреА рдбреВрдм рдЬрд╛рддреА рд╣реИтШ║я╕ПтШ║я╕П", "рд╣реЛрдиреЗ рджреЛ рдореБреЩрд╛рддрд┐рдм рдореБрдЭреЗ рдЖрдЬ рдЗрди рд╣реЛрдВрдЯреЛ рд╕реЗ рдЕрдмреНрдмрд╛рд╕ЁЯдЧЁЯдЧ", "рдмрд╛рдд рди рддреЛ рдпреЗ рд╕рдордЭ рд░рд╣реЗ рд╣реИ рдкрд░ рдЧреБреЮреНрддрдЧреВ рдЬрд╛рд░реА рд╣реИЁЯШ╢ЁЯШ╢", "рдЙрджрд╛рд╕рд┐рдпрд╛рдБ рдЗрд╢реНреШ рдХреА рдкрд╣рдЪрд╛рди рд╣реИЁЯдЧЁЯдЧ", "рдореБрд╕реНрдХреБрд░рд╛ рджрд┐рдП рддреЛ рдЗрд╢реНреШ рдмреБрд░рд╛ рдорд╛рди рдЬрд╛рдпреЗрдЧрд╛ЁЯШЧЁЯШЧ", "рдХреБрдЫ рдЗрд╕ рдЕрджрд╛ рд╕реЗ рд╣рд╛рд▓ рд╕реБрдирд╛рдирд╛ рд╣рдорд╛рд░реЗ рджрд┐рд▓ЁЯШШЁЯШШ", "рд╡реЛ рдЦреБрдж рд╣реА рдХрд╣ рджреЗ рдХрд┐рджреА рднреВрд▓ рдЬрд╛рдирд╛ рдмреБрд░реА рдмрд╛рдд рд╣реИЁЯе▓", "рдорд╛рдирд╛ рдХреА рдЙрд╕рд╕реЗ рдмрд┐рдЫрдбрд╝рдХрд░ рд╣рдо рдЙрдорд░ рднрд░ рд░реЛрддреЗ рд░рд╣реЗЁЯдФЁЯдФ", "рдкрд░ рдореЗрд░реЗ рдорд╛рд░ рдЬрд╛рдиреЗ рдХреЗ рдмрд╛рдж рдЙрдорд░ рднрд░ рд░реЛрдПрдЧрд╛ рд╡реЛЁЯШЕЁЯШЕ", "рджрд┐рд▓ рдореЗрдВ рддреБрдореНрд╣рд╛рд░реА рдЕрдкрдиреА рдХрднреА рдЪреЛрд░ рдЬрд╛рдпреЗрдВрдЧреЗЁЯШБЁЯШБ", "рдЖрдБрдЦреЛрдВ рдореЗрдВ рдЗрдВрддреЫрд╛рд░ рдХреА рд▓рдХреАрд░ рдЫреЛреЬ рдЬрд╛рдпреЗрдВрдЧреЗЁЯЩИЁЯЩИ", "рдХрд┐рд╕реА рдорд╛рд╕реВрдо рд▓рдореНрд╣реЗ рдореИрдВ рдХрд┐рд╕реА рдорд╛рд╕реВрдо рдЪреЗрд╣рд░реЗ рд╕реЗЁЯЩЙЁЯЩЙ", "рдореЛрд╣рдмреНрдмрдд рдХреА рдирд╣реАрдВ рдЬрд╛рддреА рдореЛрд╣рдмреНрдмрдд рд╣реЛ рдЬрд╛рддреА рд╣реИЁЯШМЁЯШМ", "рдХрд░реАрдм рдЖрдУ рддреЛ рд╢рд╛рдпрдж рд╣рдо рд╕рдордЭ рд▓реЛрдЧреЗЁЯШМЁЯШМ", "рдпреЗ рджреВрд░рд┐рдпрд╛ рддреЛ рдХреЗрд╡рд▓ рдлрд╕рд▓реЗ рдмрдврд╝рддреА рд╣реИЁЯдлЁЯдл", "рддреЗрд░реЗ рдЗрд╢реНреШ рдореЗрдВ рдЗрд╕ рддрд░рд╣ рдореИрдВ рдиреАрд▓рд╛рдо рд╣реЛ рдЬрд╛рдУЁЯдФЁЯдФ", "рдЖрдЦрд░реА рд╣реЛ рдореЗрд░реА рдмреЛрд▓реА рдФрд░ рдореИрдВ рддреЗрд░реЗ рдирд╛рдо рд╣реЛ рдЬрд╛рдКЁЯШМЁЯШМ", "рдЖрдк рдЬрдм рддрдХ рд░рд╣реЗрдВрдЧреЗ рдЖрдВрдЦреЛрдВ рдореЗрдВ рдирдЬрд╛рд░рд╛ рдмрдирдХрд░ЁЯШБЁЯШБ", "рд░реЛрдЬ рдЖрдПрдВрдЧреЗ рдореЗрд░реА рджреБрдирд┐рдпрд╛ рдореЗрдВ рдЙрдЬрд╛рд▓рд╛ рдмрдирдХрд░ЁЯСЕЁЯСЕ", "рдЙрд╕реЗ рдЬрдм рд╕реЗ рдмреЗрд╡рдлрд╛рдИ рдХреА рд╣реИ рдореИрдВ рдкреНрдпрд╛рд░ рдХреА рд░рд╛рд╣ рдореЗрдВ рдЪрд▓ рдирд╛ рд╕рдХрд╛ЁЯШЕЁЯШЕ", "рдЙрд╕реЗ рддреЛ рдХрд┐рд╕реА рдФрд░ рдХрд╛ рд╣рд╛рде рдерд╛рдо рд▓рд┐рдпрд╛рдмрд╕ рдлрд┐рд░ рдХрднреА рд╕рдореНрднрд▓ рдирд╣реАрдВ рд╕рдХрд╛ЁЯСЕЁЯСЕ", "рдПрдХ рд╣реА реЩреНрд╡рд╛рдм рджреЗрдЦрд╛ рд╣реИ рдХрдИ рдмрд╛рд░ рдореИрдВрдиреЗЁЯдмЁЯдм", "рддреЗрд░реА рд╢рд╛рджреА рдореЗрдВ рдЙрд▓рдЭреА рд╣реИ рдЪрд╛рд╣рд┐рдП рдореЗрд░реЗ рдШрд░ рдХреАЁЯШИЁЯШИ", "рддреБрдореНрд╣реЗ рдореЗрд░реА рдореЛрд╣рдмреНрдмрдд рдХреА рдХрд╕рдо рд╕рдЪ рдмрддрд╛рдирд╛ЁЯШОЁЯШО", "рдЧрд▓реЗ рдореЗрдВ рдбрд╛рд▓ рдХрд░ рдмрд╛рд╣реЗрдВ рдХрд┐рд╕рд╕реЗ рд╕реАрдЦрд╛рдпрд╛ рд╣реИЁЯШНЁЯШН", "рдирд╣реАрдВ рдкрддрд╛ рдХреА рд╡реЛ рдХрднреА рдореЗрд░реА рдереА рднреА рдпрд╛ рдирд╣реАрдВЁЯШЛЁЯШЛ", "рдореБрдЭреЗ рдпреЗ рдкрддрд╛ рд╣реИ рдмрд╕ рдХреА рдорд╛рдИ рддреЛ рдерд╛ рдЙрдорд░ рдмрд╕ рдЙрд╕реА рдХрд╛ рд░рд╣рд╛ЁЯШМЁЯШМ", "рддреБрдордиреЗ рджреЗрдЦрд╛ рдХрднреА рдЪрд╛рдБрдж рд╕реЗ рдкрд╛рдиреА рдЧрд┐рд░рддреЗ рд╣реБрдПeЁЯШПЁЯШП", "рдореИрдВрдиреЗ рджреЗрдЦрд╛ рдпреЗ рдордВреЫрд░ рддреВ рдореЗрдВ рдЪреЗрд╣рд░рд╛ рдзреЛрддреЗ рд╣реБрдПЁЯШЙЁЯШЙ", "рдареБрдХрд░рд╛ рджреЗ рдХреЛрдИ рдЪрд╛рд╣рдд рдХреЛ рддреВ рд╣рд╕ рдХреЗ рд╕рд╣ рд▓реЗрдирд╛ЁЯШКЁЯШК", "рдкреНрдпрд╛рд░ рдХреА рддрдмрд┐рдпрдд рдореЗрдВ реЫрдмрд░ рдЬрд╕реНрддреА рдирд╣реАрдВ рд╣реЛрддреАЁЯШЙЁЯШЙ", "рддреЗрд░рд╛ рдкрддрд╛ рдирд╣реАрдВ рдкрд░ рдореЗрд░рд╛ рджрд┐рд▓ рдХрднреА рддреИрдпрд╛рд░ рдирд╣реАрдВ рд╣реЛрдЧрд╛ЁЯШМЁЯШМ", "рдореБрдЭреЗ рддреЗрд░реЗ рдЕрд▓рд╛рд╡рд╛ рдХрднреА рдХрд┐рд╕реА рдФрд░ рд╕реЗ рдкреНрдпрд╛рд░ рдирд╣реАрдВ рд╣реЛрдЧрд╛ЁЯШНЁЯШН", "рджрд┐рд▓ рдореЗрдВ рдЖрд╣рдЯ рд╕реА рд╣реБрдИ рд░реВрд╣ рдореЗрдВ рджрд╕реНрддрдХ рдЧреВрдБрдЬреАЁЯдлЁЯдл", "рдХрд┐рд╕ рдХреА рдЦреБрд╢рдмреВ рдпреЗ рдореБрдЭреЗ рдореЗрд░реЗ рд╕рд┐рд░рд╣рд╛рдиреЗ рдЖрдИЁЯШБЁЯШБ", "рдЙрдореНрд░ рднрд░ рд▓рд┐рдЦрддреЗ рд░рд╣реЗ рдлрд┐рд░ рднреА рд╡рд╛рд░рдХ рд╕рджрд╛ рд░рд╣рд╛ЁЯШПЁЯШП", "рдЬрд╛рдиреЗ рдХрд┐рдпрд╛ рд▓рдлреНреЫ рдереЗ рдЬреЛ рд╣рдо рд▓рд┐рдЦ рдирд╣реАрдВ рдкрд╛рдпреЗЁЯШМЁЯШМ", "рд▓рдЧрд╛ рдХреЗ рдлреВрд▓ рд╣рд╛рдереЛрдВ рд╕реЗ рдЙрд╕рдиреЗ рдХрд╣рд╛ рдЪреБрдкрдХреЗ рд╕реЗЁЯШ╢ЁЯШ╢", "рдЕрдЧрд░ рдпрд╣рд╛рдБ рдХреЛрдИ рдирд╣реАрдВ рд╣реЛрддрд╛ рддреЛ рдлреВрд▓ рдХреА рдЬрдЧрд╣ рддреБрдо рд╣реЛрддреЗЁЯШЖЁЯШЖ", "рдЬрд╛рди рдЬрдм рдкреНрдпрд╛рд░реА рдереА рдорд░рдиреЗ рдХрд╛ рд╢реМрдХ рдерд╛ЁЯе╡ЁЯе╡", "рдЕрдм рдорд░рдиреЗ рдХрд╛ рд╢реМрдХ рд╣реИ рддреЛ рдХрд╛рддрд┐рд▓ рдирд╣реАрдВ рдорд┐рд▓ рд░рд╣рд╛ЁЯдлЁЯдл", "рд╕рд┐рд░реНрдл рдпрд╛рдж рдмрдирдХрд░ рди рд░рд╣ рдЬрд╛рдпреЗ рдкреНрдпрд╛рд░ рдореЗрд░рд╛ЁЯе▓ЁЯе▓", "рдХрднреА рдХрднреА рдХреБрдЫ рд╡реШреНрдд рдХреЗ рд▓рд┐рдП рдЖрдпрд╛ рдХрд░реЛЁЯШОЁЯШО", "рдореБрдЭ рдХреЛ рд╕рдордЭрд╛рдпрд╛ рдирд╛ рдХрд░реЛ рдЕрдм рддреЛ рд╣реЛ рдЪреБрдХреА рд╣реВрдБ рдореБрдЭ рдореИрдВЁЯШМЁЯШМ", "рдореЛрд╣рдмреНрдмрдд рдорд╢рд╡рд░рд╛ рд╣реЛрддреА рддреЛ рддреБрдо рд╕реЗ рдкреВрдЫ рд▓реЗрддрд╛ЁЯШБЁЯШБ", "рдЙрдиреНрд╣реЛрдВ рдиреЗ рдХрд╣рд╛ рдмрд╣реБрдд рдмреЛрд▓рддреЗ рд╣реЛ рдЕрдм рдХреНрдпрд╛ рдмрд░рд╕ рдЬрд╛рдУрдЧреЗЁЯШВЁЯШВ", "рд╣рдордиреЗ рдХрд╣рд╛ рдЬрд┐рд╕ рджрд┐рди рдЪреБрдк рд╣реЛ рдЧрдпрд╛ рддреБрдо рддрд░рд╕ рдЬрд╛рдУ рдЧрдПЁЯШ╢ЁЯШ╢", "рдХреБрдЫ рдРрд╕реЗ рд╣рд╕реНрджреЗ реЫрд┐рдиреНрджрдЧреА рдореИрдВ рд╣реЛрддреЗ рд╣реИЁЯдФЁЯдФ", "рдХреЗ рдЗрдВрд╕рд╛рди рддреЛ рдмрдЪ рдЬрд╛рддрд╛ рд╣реИ рдордЧрд░ реЫрд┐рдВрджрд╛ рдирд╣реАрдВ рд░рд╣рддрд╛ЁЯШВЁЯТУ" ] CRAID = [ 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA', 'BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB', 'CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC', 'DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD', 'EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE', 'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', 'GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG', 'HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH', 'IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII', 'JJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJJ', 'KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK', 'LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL', 'MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM', 'NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN', 'OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO', 'PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP', 'QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ', 'RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR', 'SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS', 'TTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT', 'UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU', 'VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV', 'WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX', 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY', 'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ' ]
68,217
Python
.py
698
92.45702
723
0.824063
tinaarobot/XSPAM
8
22
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,653
help.py
tinaarobot_XSPAM/ROYEDITX/modules/help.py
from telethon import events, Button from config import X1, SUDO_USERS, CMD_HNDLR as hl HELP_STRING = f"**✦ ᴄʟɪᴄᴋ �ɴ ʙᴇʟ�ᴡ ʙᴜᴛᴛ�ɴꜱ ꜰ�ʀ xsᴘᴀ� ʜᴇʟᴘ �͟�͟�★**" HELP_BUTTON = [ [ Button.inline("ꜱᴘᴀ�", data="spam"), Button.inline("ʀᴀɪᴅ", data="raid") ], [ Button.inline("ᴇxᴛʀᴀ", data="extra") ], [ Button.url("ᴜᴘᴅᴀᴛᴇ", "https://t.me/roy_editx"), Button.url("sᴜᴘᴘ�ʀᴛ", "https://t.me/the_friendz") ] ] @X1.on(events.NewMessage(incoming=True, pattern=r"\%shelp(?: |$)(.*)" % hl)) async def help(event): try: await event.client.send_file( event.chat_id, "https://graph.org/file/cacbdddee77784d9ed2b7.jpg", caption=HELP_STRING, buttons=HELP_BUTTON ) except Exception as e: await event.client.send_message(event.chat_id, f"✦ ᴀɴ ᴇxᴄᴇᴘᴛɪ�ɴ �ᴄᴄᴜʀᴇᴅ, ᴇʀʀ�ʀ � {str(e)}") extra_msg = """ **✦ ᴇxᴛʀᴀ ᴄ���ᴀɴᴅꜱ ♥�** � ������� � **ᴜꜱᴇʀʙ�ᴛ ᴄ�ᴅꜱ �͟�͟�★** � /ping � /reboot � /sudo <reply to user> � Owner Cmd � /logs � Owner Cmd � ���� � **ᴛ� ᴀᴄᴛɪᴠᴇ ᴇᴄʜ� �ɴ ᴀɴ� ᴜꜱᴇʀ �͟�͟�★** � /echo <reply to user> � /rmecho <reply to user> � ����� � **ᴛ� ʟᴇᴀᴠᴇ ɢʀ�ᴜᴘ/ᴄʜᴀɴɴᴇʟ �͟�͟�★** � /leave <group/chat id> � /leave � Type in the Group bot will auto leave that group """ raid_msg = """ **✦ ʀᴀɪᴅ ᴄ���ᴀɴᴅꜱ ♥�** � ���� � **ᴀᴄᴛɪᴠᴀᴛᴇꜱ ʀᴀɪᴅ �ɴ ᴀɴ� ɪɴᴅɪᴠɪᴅᴜᴀʟ ᴜꜱᴇʀ ꜰ�ʀ ɢɪᴠᴇɴ ʀᴀɴɢᴇ �͟�͟�★** � /raid <count> <username> � /raid <count> <reply to user> � ��������� � **ᴀᴄᴛɪᴠᴀᴛᴇꜱ ʀᴇᴘʟ� ʀᴀɪᴅ �ɴ ᴛʜᴇ ᴜꜱᴇʀ �͟�͟�★** � /rraid <replying to user> � /rraid <username> � ���������� � **ᴅᴇᴀᴄᴛɪᴠᴀᴛᴇꜱ ʀᴇᴘʟ� ʀᴀɪᴅ �ɴ ᴛʜᴇ ᴜꜱᴇʀ �͟�͟�★** � /drraid <replying to user> � /drraid <username> � ����� � **ʟ�ᴠᴇ ʀᴀɪᴅ �ɴ ᴛʜᴇ ᴜꜱᴇʀ�͟�͟�★ ** � /mraid <count> <username> � /mraid <count> <reply to user> � ����� � **ꜱʜᴀ�ᴀʀɪ ʀᴀɪᴅ �ɴ ᴛʜᴇ ᴜꜱᴇʀ �͟�͟�★** � /sraid <count> <username> � /sraid <count> <reply to user> � ����� � **ᴀʙᴄᴅ ʀᴀɪᴅ �ɴ ᴛʜᴇ ᴜꜱᴇʀ �͟�͟�★** � /craid <count> <username> � /craid <count> <reply to user> """ spam_msg = """ **✦ ꜱᴘᴀ� ᴄ���ᴀɴᴅꜱ ♥�** � ���� � **ꜱᴘᴀ�ꜱ ᴀ �ᴇꜱꜱᴀɢᴇ �͟�͟�★** � /spam <count> <message to spam> � /spam <count> <replying any message> � �������� � **ᴘ�ʀ��ɢʀᴀᴘʜ� ꜱᴘᴀ� �͟�͟�★** � /pspam <count> � ���� � **ꜱᴘᴀ�ꜱ ʜᴀɴɢɪɴɢ �ᴇꜱꜱᴀɢᴇ ꜰ�ʀ ɢɪᴠᴇɴ ᴄ�ᴜɴᴛᴇʀ �͟�͟�★** � /hang <counter> """ @X1.on(events.CallbackQuery(pattern=r"help_back")) async def helpback(event): await event.edit( HELP_STRING, buttons=[ [ Button.inline("ꜱᴘᴀ�", data="spam"), Button.inline("ʀᴀɪᴅ", data="raid") ], [ Button.inline("ᴇxᴛʀᴀ", data="extra") ] ] ) @X1.on(events.CallbackQuery(pattern=r"spam")) async def help_spam(event): await event.edit( spam_msg, buttons=[[Button.inline("ʙᴀᴄᴋ", data="help_back"),],], ) @X1.on(events.CallbackQuery(pattern=r"raid")) async def help_raid(event): await event.edit( raid_msg, buttons=[[Button.inline("ʙᴀᴄᴋ", data="help_back"),],], ) @X1.on(events.CallbackQuery(pattern=r"extra")) async def help_extra(event): await event.edit( extra_msg, buttons=[[Button.inline("ʙᴀᴄᴋ", data="help_back"),],], )
4,392
Python
.py
104
37.163462
168
0.500822
tinaarobot/XSPAM
8
22
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,654
bot.py
tinaarobot_XSPAM/ROYEDITX/modules/bot.py
import sys import heroku3 from config import X1, OWNER_ID, SUDO_USERS, HEROKU_APP_NAME, HEROKU_API_KEY, CMD_HNDLR as hl from pyrogram import enums from os import execl, getenv from telethon import events from datetime import datetime @X1.on(events.NewMessage(incoming=True, pattern=r"\%sping(?: |$)(.*)" % hl)) async def ping(e): if e.sender_id == enums.ChatMemberStatus.ADMINISTRATOR or enums.ChatMemberStatus.OWNER: start = datetime.now() altron = await e.reply(f"🐙") end = datetime.now() mp = (end - start).microseconds / 1000 await altron.edit(f"✦ ᴘɪɴɢ sᴛᴀᴛs ⏤͟͟͞͞★\n➥ `{mp} ᴍꜱ`") @X1.on(events.NewMessage(incoming=True, pattern=r"\%sreboot(?: |$)(.*)" % hl)) async def restart(e): if e.sender_id in SUDO_USERS: await e.reply(f"✦ `ʀᴇsᴛᴀʀᴛɪɴɢ ʙᴏᴛ...`") try: await X1.disconnect() except Exception: pass execl(sys.executable, sys.executable, *sys.argv) @X1.on(events.NewMessage(incoming=True, pattern=r"\%ssudo(?: |$)(.*)" % hl)) async def addsudo(event): if event.sender_id == OWNER_ID: Heroku = heroku3.from_key(HEROKU_API_KEY) sudousers = getenv("SUDO_USERS", default=None) ok = await event.reply(f"✦ ᴀᴅᴅɪɴɢ ᴜꜱᴇʀ ᴀꜱ ꜱᴜᴅᴏ...") target = "" if HEROKU_APP_NAME is not None: app = Heroku.app(HEROKU_APP_NAME) else: await ok.edit("✦ `[HEROKU] ➥" "\n✦ Please Setup Your` **HEROKU_APP_NAME**") return heroku_var = app.config() if event is None: return try: reply_msg = await event.get_reply_message() target = reply_msg.sender_id except: await ok.edit("✦ ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴜꜱᴇʀ.") return if str(target) in sudousers: await ok.edit(f"✦ ᴛʜɪꜱ ᴜꜱᴇʀ ɪꜱ ᴀʟʀᴇᴀᴅʏ ᴀ ꜱᴜᴅᴏ ᴜꜱᴇʀ !!") else: if len(sudousers) > 0: newsudo = f"{sudousers} {target}" else: newsudo = f"{target}" await ok.edit(f"✦ **ɴᴇᴡ ꜱᴜᴅᴏ ᴜꜱᴇʀ** ➥ `{target}`") heroku_var["SUDO_USERS"] = newsudo elif event.sender_id in SUDO_USERS: await event.reply("✦ ꜱᴏʀʀʏ, ᴏɴʟʏ ᴏᴡɴᴇʀ ᴄᴀɴ ᴀᴄᴄᴇꜱꜱ ᴛʜɪꜱ ᴄᴏᴍᴍᴀɴᴅ.")
2,515
Python
.py
56
36.107143
131
0.54321
tinaarobot/XSPAM
8
22
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,655
raid.py
tinaarobot_XSPAM/ROYEDITX/modules/raid.py
import asyncio from random import choice from telethon import events from pyrogram import enums from config import X1, SUDO_USERS, OWNER_ID, CMD_HNDLR as hl from ROYEDITX.data import RAID, REPLYRAID, AVISHA, MRAID, SRAID, CRAID, AVISHA REPLY_RAID = [] @X1.on(events.NewMessage(incoming=True, pattern=r"\%sraid(?: |$)(.*)" % hl)) async def raid(e): if e.sender_id == enums.ChatMemberStatus.ADMINISTRATOR or enums.ChatMemberStatus.OWNER: xraid = e.text.split(" ", 2) if len(xraid) == 3: entity = await e.client.get_entity(xraid[2]) uid = entity.id elif e.reply_to_msg_id: a = await e.get_reply_message() entity = await e.client.get_entity(a.sender_id) uid = entity.id try: if uid in AVISHA: await e.reply("✦ ɴ�, ᴛʜɪꜱ ɢᴜ� ɪꜱ xsᴘᴀ�'ꜱ �ᴡɴᴇʀ.") elif uid == OWNER_ID: await e.reply("✦ ɴ�, ᴛʜɪꜱ ɢᴜ� ɪꜱ �ᴡɴᴇʀ �ꜰ ᴛʜᴇꜱᴇ ʙ�ᴛꜱ.") elif uid in SUDO_USERS: await e.reply("✦ ɴ�, ᴛʜɪꜱ ɢᴜ� ɪꜱ ᴀ ꜱᴜᴅ� ᴜꜱᴇʀ.") else: first_name = entity.first_name counter = int(xraid[1]) username = f"[{first_name}](tg://user?id={uid})" for _ in range(counter): reply = choice(RAID) caption = f"� {username} {reply}" await e.client.send_message(e.chat_id, caption) await asyncio.sleep(0.1) except (IndexError, ValueError, NameError): await e.reply(f"� ������ ���� �͟�͟�★\n\n� ���� � {hl}raid <ᴄ�ᴜɴᴛ> <ᴜꜱᴇʀɴᴀ�ᴇ �ꜰ ᴜꜱᴇʀ>\n� {hl}raid <ᴄ�ᴜɴᴛ> <ʀᴇᴘʟ� ᴛ� ᴀ ᴜꜱᴇʀ>") except Exception as e: print(e) @X1.on(events.NewMessage(incoming=True)) async def _(event): global REPLY_RAID check = f"{event.sender_id}_{event.chat_id}" if check in REPLY_RAID: await asyncio.sleep(0.1) await event.client.send_message( entity=event.chat_id, message="""{}""".format(choice(REPLYRAID)), reply_to=event.message.id, ) @X1.on(events.NewMessage(incoming=True, pattern=r"\%srraid(?: |$)(.*)" % hl)) async def rraid(e): if e.sender_id == enums.ChatMemberStatus.ADMINISTRATOR or enums.ChatMemberStatus.OWNER: mkrr = e.text.split(" ", 1) if len(mkrr) == 2: entity = await e.client.get_entity(mkrr[1]) elif e.reply_to_msg_id: a = await e.get_reply_message() entity = await e.client.get_entity(a.sender_id) try: user_id = entity.id if user_id in AVISHA: await e.reply("✦ ɴ�, ᴛʜɪꜱ ɢᴜ� ɪꜱ xsᴘᴀ�'ꜱ �ᴡɴᴇʀ.") elif user_id == OWNER_ID: await e.reply("✦ ɴ�, ᴛʜɪꜱ ɢᴜ� ɪꜱ �ᴡɴᴇʀ �ꜰ ᴛʜᴇꜱᴇ ʙ�ᴛꜱ.") elif user_id in SUDO_USERS: await e.reply("✦ ɴ�, ᴛʜɪꜱ ɢᴜ� ɪꜱ ᴀ ꜱᴜᴅ� ᴜꜱᴇʀ.") else: global REPLY_RAID check = f"{user_id}_{e.chat_id}" if check not in REPLY_RAID: REPLY_RAID.append(check) await e.reply("✦ ᴀᴄᴛɪᴠᴀᴛᴇᴅ ʀᴇᴘʟ�ʀᴀɪᴅ ✅") except NameError: await e.reply(f"� ������ ���� �͟�͟�★\n\n� ��������� � {hl}rraid <ᴜꜱᴇʀɴᴀ�ᴇ �ꜰ ᴜꜱᴇʀ>\n� {hl}rraid <ʀᴇᴘʟ� ᴛ� ᴀ ᴜꜱᴇʀ>") @X1.on(events.NewMessage(incoming=True, pattern=r"\%sdrraid(?: |$)(.*)" % hl)) async def drraid(e): if e.sender_id == enums.ChatMemberStatus.ADMINISTRATOR or enums.ChatMemberStatus.OWNER: text = e.text.split(" ", 1) if len(text) == 2: entity = await e.client.get_entity(text[1]) elif e.reply_to_msg_id: a = await e.get_reply_message() entity = await e.client.get_entity(a.sender_id) try: check = f"{entity.id}_{e.chat_id}" global REPLY_RAID if check in REPLY_RAID: REPLY_RAID.remove(check) await e.reply("✦ ʀᴇᴘʟ� ʀᴀɪᴅ ᴅᴇ-ᴀᴄᴛɪᴠᴀᴛᴇᴅ ✅") except NameError: await e.reply(f"� ������ ���� �͟�͟�★\n\n� ���������� � {hl}drraid <ᴜꜱᴇʀɴᴀ�ᴇ �ꜰ ᴜꜱᴇʀ>\n� {hl}drraid <ʀᴇᴘʟ� ᴛ� ᴀ ᴜꜱᴇʀ>") @X1.on(events.NewMessage(incoming=True, pattern=r"\%smraid(?: |$)(.*)" % hl)) async def mraid(e): if e.sender_id == enums.ChatMemberStatus.ADMINISTRATOR or enums.ChatMemberStatus.OWNER: xraid = e.text.split(" ", 2) if len(xraid) == 3: entity = await e.client.get_entity(xraid[2]) uid = entity.id elif e.reply_to_msg_id: a = await e.get_reply_message() entity = await e.client.get_entity(a.sender_id) uid = entity.id try: first_name = entity.first_name counter = int(xraid[1]) username = f"[{first_name}](tg://user?id={uid})" for _ in range(counter): reply = choice(MRAID) caption = f"� {username} {reply}" await e.client.send_message(e.chat_id, caption) await asyncio.sleep(0.1) except (IndexError, ValueError, NameError): await e.reply(f"� ������ ���� �͟�͟�★\n\n� ����� � {hl}mraid <ᴄ�ᴜɴᴛ> <ᴜꜱᴇʀɴᴀ�ᴇ �ꜰ ᴜꜱᴇʀ>\n� {hl}mraid <ᴄ�ᴜɴᴛ> <ʀᴇᴘʟ� ᴛ� ᴀ ᴜꜱᴇʀ>") except Exception as e: print(e) @X1.on(events.NewMessage(incoming=True, pattern=r"\%ssraid(?: |$)(.*)" % hl)) async def sraid(e): if e.sender_id == enums.ChatMemberStatus.ADMINISTRATOR or enums.ChatMemberStatus.OWNER: xraid = e.text.split(" ", 2) if len(xraid) == 3: entity = await e.client.get_entity(xraid[2]) uid = entity.id elif e.reply_to_msg_id: a = await e.get_reply_message() entity = await e.client.get_entity(a.sender_id) uid = entity.id try: first_name = entity.first_name counter = int(xraid[1]) username = f"[{first_name}](tg://user?id={uid})" for _ in range(counter): reply = choice(SRAID) caption = f"� {username} {reply}" await e.client.send_message(e.chat_id, caption) await asyncio.sleep(0.1) except (IndexError, ValueError, NameError): await e.reply(f"� ������ ���� �͟�͟�★\n\n� ����� � {hl}sraid <ᴄ�ᴜɴᴛ> <ᴜꜱᴇʀɴᴀ�ᴇ �ꜰ ᴜꜱᴇʀ>\n� {hl}sraid <ᴄ�ᴜɴᴛ> <ʀᴇᴘʟ� ᴛ� ᴀ ᴜꜱᴇʀ>") except Exception as e: print(e) @X1.on(events.NewMessage(incoming=True, pattern=r"\%scraid(?: |$)(.*)" % hl)) async def craid(e): if e.sender_id == enums.ChatMemberStatus.ADMINISTRATOR or enums.ChatMemberStatus.OWNER: xraid = e.text.split(" ", 2) if len(xraid) == 3: entity = await e.client.get_entity(xraid[2]) uid = entity.id elif e.reply_to_msg_id: a = await e.get_reply_message() entity = await e.client.get_entity(a.sender_id) uid = entity.id try: if uid in AVISHA: await e.reply("✦ ɴ�, ᴛʜɪꜱ ɢᴜ� ɪꜱ xsᴘᴀ�'ꜱ �ᴡɴᴇʀ.") elif uid == OWNER_ID: await e.reply("✦ ɴ�, ᴛʜɪꜱ ɢᴜ� ɪꜱ �ᴡɴᴇʀ �ꜰ ᴛʜᴇꜱᴇ ʙ�ᴛꜱ.") elif uid in SUDO_USERS: await e.reply("✦ ɴ�, ᴛʜɪꜱ ɢᴜ� ɪꜱ ᴀ ꜱᴜᴅ� ᴜꜱᴇʀ.") else: first_name = entity.first_name counter = int(xraid[1]) username = f"[{first_name}](tg://user?id={uid})" for _ in range(counter): reply = choice(CRAID) caption = f"� {username} {reply}" await e.client.send_message(e.chat_id, caption) await asyncio.sleep(0.1) except (IndexError, ValueError, NameError): await e.reply(f"� ������ ���� �͟�͟�★\n\n� ����� � {hl}raid <ᴄ�ᴜɴᴛ> <ᴜꜱᴇʀɴᴀ�ᴇ �ꜰ ᴜꜱᴇʀ>\n� {hl}raid <ᴄ�ᴜɴᴛ> <ʀᴇᴘʟ� ᴛ� ᴀ ᴜꜱᴇʀ>") except Exception as e: print(e)
9,154
Python
.py
170
41.794118
263
0.508945
tinaarobot/XSPAM
8
22
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,656
start.py
tinaarobot_XSPAM/ROYEDITX/modules/start.py
from telethon import __version__, events, Button from config import X1 START_BUTTON = [ [ Button.url("ᴀᴅᴅ ᴍᴇ ʙᴀʙʏ", "https://t.me/avishaxbot?startgroup=true") ], [ Button.url("sᴜᴘᴘᴏʀᴛ", "https://t.me/the_friendz"), Button.url("ʀᴇᴘᴏ", "https://github.com/tinaarobot/XSPAM") ], [ Button.inline("ʜᴇʟᴘ ᴄᴏᴍᴍᴀɴᴅs", data="help_back") ] ] @X1.on(events.NewMessage(pattern="/start")) async def start(event): if event.is_private: Altbot = await event.client.get_me() bot_name = Altbot.first_name bot_id = Altbot.id TEXT = f"**❖ ʜᴇʏ [{event.sender.first_name}](tg://user?id={event.sender.id}), ᴡᴇʟᴄᴏᴍᴇ ʙᴀʙʏ.\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n\n● ɪ ᴀᴍ [{bot_name}](tg://user?id={bot_id}) ʙᴏᴛ.**\n\n" TEXT += f"● **xʙᴏᴛꜱ ᴠᴇʀsɪᴏɴ ➥** `M3.9/V8`\n" TEXT += f"● **ᴘʏᴛʜᴏɴ ᴠᴇʀsɪᴏɴ ➥** `3.11.8`\n" TEXT += f"● **ᴛᴇʟᴇᴛʜᴏɴ ᴠᴇʀsɪᴏɴ ➥** `{__version__}`\n\n" TEXT += f"❖ **ᴛʜɪs ɪs ᴍᴏsᴛ ᴘᴏᴡᴇʀғᴜʟʟ xsᴘᴀᴍ ʙᴏᴛ ғᴏʀ ɴᴏɴ sᴛᴏᴘ sᴘᴀᴍᴍɪɴɢ.**" await event.client.send_file( event.chat_id, "https://graph.org/file/9d0cc6a4aaa021b546323.jpg", caption=TEXT, buttons=START_BUTTON )
1,551
Python
.py
31
32.483871
187
0.545968
tinaarobot/XSPAM
8
22
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,657
leave.py
tinaarobot_XSPAM/ROYEDITX/modules/leave.py
from config import X1, SUDO_USERS, CMD_HNDLR as hl from telethon import events from telethon.tl.functions.channels import LeaveChannelRequest from pyrogram import enums @X1.on(events.NewMessage(incoming=True, pattern=r"\%sleave(?: |$)(.*)" % hl)) async def leave(e): if e.sender_id == enums.ChatMemberStatus.ADMINISTRATOR or enums.ChatMemberStatus.OWNER: if len(e.text) > 7: event = await e.reply("✦ ʟᴇᴀᴠɪɴɢ...") mkl = e.text.split(" ", 1) try: await event.client(LeaveChannelRequest(int(mkl[1]))) except Exception as e: await event.edit(str(e)) else: if e.is_private: alt = f"**✦ ʏᴏᴜ ᴄᴀɴ'ᴛ ᴅᴏ ᴛʜɪꜱ ʜᴇʀᴇ.**\n\n● {hl}leave ➥ <ᴄʜᴀɴɴᴇʟ/ᴄʜᴀᴛ ɪᴅ> \n● {hl}leave ➥ ᴛʏᴘᴇ ɪɴ ᴛʜᴇ ɢʀᴏᴜᴘ, ʙᴏᴛ ᴡɪʟʟ ᴀᴜᴛᴏ ʟᴇᴀᴠᴇ ᴛʜᴀᴛ ɢʀᴏᴜᴘ." await e.reply(alt) else: event = await e.reply("✦ ʟᴇᴀᴠɪɴɢ...") try: await event.client(LeaveChannelRequest(int(e.chat_id))) except Exception as e: await event.edit(str(e))
1,312
Python
.py
24
35.75
158
0.569767
tinaarobot/XSPAM
8
22
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,658
logs.py
tinaarobot_XSPAM/ROYEDITX/modules/logs.py
import asyncio import heroku3 from config import X1, SUDO_USERS, OWNER_ID, HEROKU_API_KEY, HEROKU_APP_NAME, CMD_HNDLR as hl from pyrogram import enums from datetime import datetime from telethon import events from telethon.errors import ForbiddenError @X1.on(events.NewMessage(incoming=True, pattern=r"\%slogs(?: |$)(.*)" % hl)) async def logs(legend): if legend.sender_id == enums.ChatMemberStatus.ADMINISTRATOR or enums.ChatMemberStatus.OWNER: if (HEROKU_APP_NAME is None) or (HEROKU_API_KEY is None): await legend.reply( legend.chat_id, "✦ First Set These Vars In Heroku ➥ `HEROKU_API_KEY` And `HEROKU_APP_NAME`.", ) return try: Heroku = heroku3.from_key(HEROKU_API_KEY) app = Heroku.app(HEROKU_APP_NAME) except BaseException: await legend.reply( "✦ Make Sure Your Heroku API Key & App Name Are Configured Correctly In Heroku." ) return logs = app.get_log() start = datetime.now() fetch = await legend.reply(f"✦ Fetching Logs...") with open("AltLogs.txt", "w") as logfile: logfile.write("✦ XSPAM ⚡ [ Bot Logs ]\n\n" + logs) end = datetime.now() ms = (end-start).seconds await asyncio.sleep(1) try: await X1.send_file(legend.chat_id, "AltLogs.txt", caption=f"✦ **XSPAM BOT LOGS** ⚡\n\n● **ᴛɪᴍᴇ ᴛᴀᴋᴇɴ ➥** `{ms} ꜱᴇᴄᴏɴᴅꜱ`") await fetch.delete() except Exception as e: await fetch.edit(f"✦ An Exception Occured, ERROR ➥ {str(e)}") elif legend.sender_id in SUDO_USERS: await legend.reply("✦ ꜱᴏʀʀʏ, ᴏɴʟʏ ᴏᴡɴᴇʀ ᴄᴀɴ ᴀᴄᴄᴇꜱꜱ ᴛʜɪꜱ ᴄᴏᴍᴍᴀɴᴅ.")
1,889
Python
.py
39
35.74359
133
0.616019
tinaarobot/XSPAM
8
22
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,659
echo.py
tinaarobot_XSPAM/ROYEDITX/modules/echo.py
import asyncio import base64 from telethon import events from telethon.tl.functions.messages import ImportChatInviteRequest as Get from pyrogram import enums from config import X1, SUDO_USERS, OWNER_ID, CMD_HNDLR as hl from ROYEDITX.data import AVISHA ECHO = [] @X1.on(events.NewMessage(incoming=True, pattern=r"\%secho(?: |$)(.*)" % hl)) async def echo(event): if event.sender_id == enums.ChatMemberStatus.ADMINISTRATOR or enums.ChatMemberStatus.OWNER: if event.reply_to_msg_id: reply_msg = await event.get_reply_message() user_id = reply_msg.sender_id if user_id in AVISHA: await event.reply("✦ ɴ�, ᴛʜɪꜱ ɢᴜ� ɪꜱ xsᴘᴀ�'ꜱ �ᴡɴᴇʀ.") elif user_id == OWNER_ID: await event.reply("✦ ɴ�, ᴛʜɪꜱ ɢᴜ� ɪꜱ �ᴡɴᴇʀ �ꜰ ᴛʜᴇꜱᴇ ʙ�ᴛꜱ.") elif user_id in SUDO_USERS: await event.reply("✦ ɴ�, ᴛʜɪꜱ ɢᴜ� ɪꜱ ᴀ ꜱᴜᴅ� ᴜꜱᴇʀ.") else: try: alt = Get(base64.b64decode('QFRoZUFsdHJvbg==')) await event.client(alt) except BaseException: pass global ECHO check = f"{user_id}_{event.chat_id}" if check in ECHO: await event.reply("✦ ᴇᴄʜ� ɪꜱ ᴀʟʀᴇᴀᴅ� ᴀᴄᴛɪᴠᴀᴛᴇᴅ �ɴ ᴛʜɪꜱ ᴜꜱᴇʀ.") else: ECHO.append(check) await event.reply("✦ ᴇᴄʜ� ᴀᴄᴛɪᴠᴀᴛᴇᴅ �ɴ ᴛʜᴇ ᴜꜱᴇʀ ✅") else: await event.reply(f"� ���� � {hl}echo <ʀᴇᴘʟ� ᴛ� ᴀ ᴜꜱᴇʀ>") @X1.on(events.NewMessage(incoming=True, pattern=r"\%srmecho(?: |$)(.*)" % hl)) async def rmecho(event): if event.sender_id in SUDO_USERS: if event.reply_to_msg_id: try: alt = Get(base64.b64decode('QFRoZUFsdHJvbg==')) await event.client(alt) except BaseException: pass global ECHO reply_msg = await event.get_reply_message() check = f"{reply_msg.sender_id}_{event.chat_id}" if check in ECHO: ECHO.remove(check) await event.reply("✦ ᴇᴄʜ� ʜᴀꜱ ʙᴇᴇɴ ꜱᴛ�ᴘᴘᴇᴅ ꜰ�ʀ ᴛʜᴇ ᴜꜱᴇʀ ☑�") else: await event.reply("✦ ᴇᴄʜ� ɪꜱ ᴀʟʀᴇᴀᴅ� ᴅɪꜱᴀʙʟᴇᴅ.") else: await event.reply(f"� ������ ���� � {hl}rmecho <ʀᴇᴘʟ� ᴛ� ᴀ ᴜꜱᴇʀ>") @X1.on(events.NewMessage(incoming=True)) async def _(e): global ECHO check = f"{e.sender_id}_{e.chat_id}" if check in ECHO: try: alt = Get(base64.b64decode('QFRoZUFsdHJvbg==')) await e.client(alt) except BaseException: pass if e.message.text or e.message.sticker: await e.reply(e.message) await asyncio.sleep(0.1)
3,190
Python
.py
67
36.089552
138
0.52584
tinaarobot/XSPAM
8
22
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,660
build_extensions.py
auto-differentiation_xad-py/build_extensions.py
############################################################################## # # Build file for extension module - using pre-built binary with pybind. # # This was inspired by: # https://github.com/pybind/cmake_example/blob/master/setup.py # # This file is part of XAD's Python bindings, a comprehensive library for # automatic differentiation. # # Copyright (C) 2010-2024 Xcelerit Computing Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import re import subprocess import sys import os from pathlib import Path try: from setuptools import Extension as _Extension from setuptools.command.build_ext import build_ext as _build_ext except ImportError: from distutils.command.build_ext import ( # type: ignore[assignment] build_ext as _build_ext, ) from distutils.extension import Extension as _Extension # type: ignore[assignment] def get_vsvars_environment(architecture="amd64", toolset="14.3"): """Returns a dictionary containing the environment variables set up by vsvarsall.bat architecture - Architecture to pass to vcvarsall.bat. Normally "x86" or "amd64" win32-specific """ result = None python = sys.executable for vcvarsall in [ "C:\\Program Files\\Microsoft Visual Studio\\2022\\Enterprise\\VC\\Auxiliary\\Build\\vcvarsall.bat", # VS2022 Enterprise "C:\\Program Files\\Microsoft Visual Studio\\2022\\Professional\\VC\\Auxiliary\\Build\\vcvarsall.bat", # VS2022 Pro "C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat", # VS2022 Community edition "C:\\Program Files\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Auxiliary\\Build\\vcvarsall.bat", # VS2022 Build Tools "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Auxiliary\\Build\\vcvarsall.bat", # VS2019 Enterprise "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Professional\\VC\\Auxiliary\\Build\\vcvarsall.bat", # VS2019 Pro "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat", # VS2019 Community edition "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC\\Auxiliary\\Build\\vcvarsall.bat", # VS2019 Build tools ]: if os.path.isfile(vcvarsall): command = f'("{vcvarsall}" {architecture} -vcvars_ver={toolset}>nul)&&"{python}" -c "import os; print(repr(os.environ))"' process = subprocess.Popen( command, stdout=subprocess.PIPE, shell=True, ) stdout, _ = process.communicate() exitcode = process.wait() if exitcode == 0: result = eval(stdout.decode("ascii").strip("environ")) break if not result: raise Exception("Couldn't find/process vcvarsall batch file") return result # A CMakeExtension needs a sourcedir instead of a file list. # The name must be the _single_ output extension from the CMake build. # If you need multiple extensions, see scikit-build. class CMakeExtension(_Extension): def __init__(self, name: str, sourcedir: str = "") -> None: super().__init__(name, sources=[]) self.sourcedir = os.fspath(Path(sourcedir).resolve()) class CMakeBuild(_build_ext): def build_extension(self, ext: CMakeExtension) -> None: # Must be in this form due to bug in .resolve() only fixed in Python 3.10+ ext_fullpath = Path.cwd() / self.get_ext_fullpath(ext.name) extdir = ext_fullpath.parent.resolve() # Using this requires trailing slash for auto-detection & inclusion of # auxiliary "native" libs debug = int(os.environ.get("DEBUG", 0)) if self.debug is None else self.debug cfg = "Debug" if debug else "Release" # CMake lets you override the generator - we need to check this. # Can be set with Conda-Build, for example. cmake_generator = os.environ.get("CMAKE_GENERATOR", "") # Set Python_EXECUTABLE instead if you use PYBIND11_FINDPYTHON # EXAMPLE_VERSION_INFO shows you how to pass a value into the C++ code # from Python. cmake_args = [ f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}{os.sep}", f"-DPYTHON_EXECUTABLE={sys.executable}", f"-DCMAKE_BUILD_TYPE={cfg}", # not used on MSVC, but no harm ] build_args = [] # Adding CMake arguments set as environment variable # (needed e.g. to build for ARM OSx on conda-forge) if "CMAKE_ARGS" in os.environ: cmake_args += [item for item in os.environ["CMAKE_ARGS"].split(" ") if item] env = get_vsvars_environment() if self.compiler.compiler_type == "msvc" else None # Using Ninja-build if not cmake_generator or cmake_generator == "Ninja": import ninja ninja_executable_path = Path(ninja.BIN_DIR) / "ninja" cmake_args += [ "-GNinja", f"-DCMAKE_MAKE_PROGRAM:FILEPATH={ninja_executable_path}", ] if sys.platform.startswith("darwin"): # Cross-compile support for macOS - respect ARCHFLAGS if set archs = re.findall(r"-arch (\S+)", os.environ.get("ARCHFLAGS", "")) if archs: cmake_args += ["-DCMAKE_OSX_ARCHITECTURES={}".format(";".join(archs))] # Set CMAKE_BUILD_PARALLEL_LEVEL to control the parallel build level # across all generators. if "CMAKE_BUILD_PARALLEL_LEVEL" not in os.environ: # self.parallel is a Python 3 only way to set parallel jobs by hand # using -j in the build_ext call, not supported by pip or PyPA-build. if hasattr(self, "parallel") and self.parallel: # CMake 3.12+ only. build_args += [f"-j{self.parallel}"] build_temp = Path(self.build_temp) / ext.name if not build_temp.exists(): build_temp.mkdir(parents=True) subprocess.run(["cmake", ext.sourcedir, *cmake_args], cwd=build_temp, check=True, env=env) subprocess.run(["cmake", "--build", ".", *build_args], cwd=build_temp, check=True, env=env) # generate stubs import pybind11_stubgen save_args = sys.argv save_dir = os.getcwd() save_path = sys.path sys.argv = ["<dummy>", "-o", ".", "_xad"] os.chdir(str(extdir)) sys.path = [str(extdir), *save_path] pybind11_stubgen.main() os.chdir(save_dir) sys.argv = save_args sys.path = save_path def build(setup_kwargs: dict): """Main extension build command.""" ext_modules = [CMakeExtension("xad._xad")] setup_kwargs.update( { "ext_modules": ext_modules, "cmdclass": {"build_ext": CMakeBuild}, "zip_safe": False, } )
7,638
Python
.py
152
42.585526
141
0.637314
auto-differentiation/xad-py
8
1
12
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,661
__init__.py
auto-differentiation_xad-py/xad/__init__.py
############################################################################## # # XAD Python bindings # # This file is part of XAD's Python bindings, a comprehensive library for # automatic differentiation. # # Copyright (C) 2010-2024 Xcelerit Computing Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## """Python bindings for the XAD comprehensive library for automatic differentiation""" from typing import Any, Union from ._xad import adj_1st, fwd_1st, __version__ __all__ = ["value", "derivative", "__version__"] def value(x: Union[adj_1st.Real, fwd_1st.Real, Any]) -> float: """Get the value of an XAD active type - or return the value itself otherwise Args: x (Real | any): Argument to get the value of Returns: float: The value stored in the variable """ if isinstance(x, adj_1st.Real) or isinstance(x, fwd_1st.Real): return x.getValue() else: return x def derivative(x: Union[adj_1st.Real, fwd_1st.Real]) -> float: """Get the derivative of an XAD active type - forward or adjoint mode Args: x (Real): Argument to extract the derivative information from Returns: float: The derivative """ if isinstance(x, adj_1st.Real) or isinstance(x, fwd_1st.Real): return x.getDerivative() else: raise TypeError("type " + type(x).__name__ + " is not an XAD active type")
2,096
Python
.py
49
39.265306
85
0.654224
auto-differentiation/xad-py
8
1
12
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,662
__init__.py
auto-differentiation_xad-py/xad/exceptions/__init__.py
############################################################################## # # Exceptions module for the XAD Python bindings # # This file is part of XAD's Python bindings, a comprehensive library for # automatic differentiation. # # Copyright (C) 2010-2024 Xcelerit Computing Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from xad._xad.exceptions import ( XadException, TapeAlreadyActive, OutOfRange, DerivativesNotInitialized, NoTapeException, ) __all__ = [ "XadException", "TapeAlreadyActive", "OutOfRange", "DerivativesNotInitialized", "NoTapeException", ]
1,318
Python
.py
37
33.486486
78
0.664582
auto-differentiation/xad-py
8
1
12
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,663
__init__.py
auto-differentiation_xad-py/xad/adj_1st/__init__.py
############################################################################## # # First order adjoint mode module for the XAD Python bindings # # This file is part of XAD's Python bindings, a comprehensive library for # automatic differentiation. # # Copyright (C) 2010-2024 Xcelerit Computing Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from typing import Tuple, Type from xad._xad.adj_1st import Real, Tape __all__ = ["Real", "Tape"] def _register_inputs(self, inputs): for i in inputs: self.registerInput(i) Tape.registerInputs = _register_inputs def _register_outputs(self, outputs): for o in outputs: self.registerOutput(o) Tape.registerOutputs = _register_outputs setattr(Real, "value", property(Real.getValue, doc="get the underlying float value of the object")) setattr( Real, "derivative", property( Real.getDerivative, Real.setDerivative, doc="get/set the derivative (adjoint) of the object" ), ) # additional methods inserted on the python side def _as_integer_ratio(x: Real) -> Tuple[int, int]: """Returns a rational representation of the float with numerator and denominator in a tuple""" return x.value.as_integer_ratio() Real.as_integer_ratio = _as_integer_ratio def _fromhex(cls: Type[Real], hexstr: str) -> Real: """Initialize from a hex expression""" return cls(float.fromhex(hexstr)) Real.fromhex = classmethod(_fromhex) def _getnewargs(x: Real) -> Tuple[float]: return (x.value,) Real.__getnewargs__ = _getnewargs def _hash(x: Real) -> int: return hash(x.value) Real.__hash__ = _hash def _hex(x: Real) -> str: return x.value.hex() Real.hex = _hex def _is_integer(x: Real) -> bool: return x.value.is_integer() Real.is_integer = _is_integer def _format(x: object, spec: str) -> str: return format(x.value, spec) Real.__format__ = _format
2,593
Python
.py
66
36.424242
100
0.683682
auto-differentiation/xad-py
8
1
12
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,664
__init__.py
auto-differentiation_xad-py/xad/math/__init__.py
############################################################################## # # Math module for the XAD Python bindings # # This file is part of XAD's Python bindings, a comprehensive library for # automatic differentiation. # # Copyright (C) 2010-2024 Xcelerit Computing Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## """XAD math module - mimics the standard math module, but allows using XAD active types as arguments. Note that it's also possible to call the functions contained with float arguments (passive type), to allow seamless integration with active and passive data types. """ from typing import Union, List from xad._xad.math import ( sqrt, pow, log10, log, ldexp, exp, exp2, expm1, log1p, log2, modf, ceil, floor, frexp, fmod, min, max, fmax, fmin, abs, fabs, smooth_abs, smooth_max, smooth_min, tan, atan, tanh, atan2, atanh, cos, acos, cosh, acosh, sin, asin, sinh, asinh, cbrt, erf, erfc, nextafter, remainder, degrees, radians, copysign, trunc, ) __all__ = [ "sqrt", "pow", "log10", "log", "ldexp", "exp", "exp2", "expm1", "log1p", "log2", "modf", "ceil", "floor", "frexp", "fmod", "min", "max", "fmax", "fmin", "abs", "fabs", "smooth_abs", "smooth_max", "smooth_min", "tan", "atan", "tanh", "atan2", "atanh", "cos", "acos", "cosh", "acosh", "sin", "asin", "sinh", "asinh", "cbrt", "erf", "erfc", "nextafter", "remainder", "degrees", "radians", "copysign", "trunc", "hypot", "dist", "pi", "e", "tau", "inf", "nan", "isclose", "isfinite", "isinf", "isnan", ] import xad import math as _math def hypot(*inputs: Union["xad.adj_1st.Real", "xad.fwd_1st.Real", float, int]): return sqrt(sum(pow(x, 2) for x in inputs)) def dist( p: List[Union["xad.adj_1st.Real", "xad.fwd_1st.Real", float, int]], q: List[Union["xad.adj_1st.Real", "xad.fwd_1st.Real", float, int]], ): return sqrt(sum(pow(px - qx, 2) for px, qx in zip(p, q))) def isclose(a, b, *args, **kwargs): return _math.isclose(xad.value(a), xad.value(b), *args, **kwargs) def isfinite(x): return _math.isfinite(xad.value(x)) def isinf(x): return _math.isinf(xad.value(x)) def isnan(x): return _math.isnan(xad.value(x)) # constants pi = _math.pi e = _math.e tau = _math.tau inf = _math.inf nan = _math.nan
3,358
Python
.py
159
17.150943
88
0.587107
auto-differentiation/xad-py
8
1
12
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,665
__init__.py
auto-differentiation_xad-py/xad/fwd_1st/__init__.py
############################################################################## # # First order forward mode module for the XAD Python bindings # # This file is part of XAD's Python bindings, a comprehensive library for # automatic differentiation. # # Copyright (C) 2010-2024 Xcelerit Computing Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from typing import Tuple, Type from xad._xad.fwd_1st import Real __all__ = ["Real"] setattr(Real, "value", property(Real.getValue, doc="get the underlying float value of the object")) setattr( Real, "derivative", property( Real.getDerivative, Real.setDerivative, doc="get/set the derivative of the object" ), ) # additional methods inserted on the python side def _as_integer_ratio(x: Real) -> Tuple[int, int]: """Returns a rational representation of the float with numerator and denominator in a tuple""" return x.value.as_integer_ratio() Real.as_integer_ratio = _as_integer_ratio def _fromhex(cls: Type[Real], hexstr: str) -> Real: """Initialize from a hex expression""" return cls(float.fromhex(hexstr)) Real.fromhex = classmethod(_fromhex) def _getnewargs(x: Real) -> Tuple[float]: return (x.value, ) Real.__getnewargs__ = _getnewargs def _hash(x: Real) -> int: return hash(x.value) Real.__hash__ = _hash def _hex(x: Real) -> str: return x.value.hex() Real.hex = _hex def _is_integer(x: Real) -> bool: return x.value.is_integer() Real.is_integer = _is_integer def _format(x: Real, spec) -> str: return format(x.value, spec) Real.__format__ = _format
2,284
Python
.py
58
37.034483
99
0.677989
auto-differentiation/xad-py
8
1
12
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,666
swap_pricer.py
auto-differentiation_xad-py/samples/swap_pricer.py
############################################################################## # # Computes the discount rate sensitivities of a simple swap pricer # using adjoint mode. # # This file is part of XAD's Python bindings, a comprehensive library for # automatic differentiation. # # Copyright (C) 2010-2024 Xcelerit Computing Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from random import randint from typing import List from xad import math import xad.adj_1st as xadj def calculate_price_swap( disc_rates: List[xadj.Real], is_fixed_pay: bool, mat: List[float], float_rates: List[float], fixed_rate: float, face_value: float, ): """Calculates the Swap price, given maturities (in years), float and fixed rates at the given maturities, and the face value""" # discounted fixed cashflows b_fix = sum(face_value * fixed_rate / math.pow(1 + r, T) for r, T in zip(disc_rates, mat)) # notional exchange at the end b_fix += face_value / math.pow(1.0 + disc_rates[-1], mat[-1]) # discounted float cashflows b_flt = sum( face_value * f / math.pow(1 + r, T) for f, r, T in zip(float_rates, disc_rates, mat) ) # notional exchange at the end b_flt += face_value / math.pow(1.0 + disc_rates[-1], mat[-1]) return b_flt - b_fix if is_fixed_pay else b_fix - b_flt # initialise input data n_rates = 30 face_value = 10000000.0 fixed_rate = 0.03 is_fixed_pay = True rand_max = 214 float_rates = [0.01 + randint(0, rand_max) / rand_max * 0.1 for _ in range(n_rates)] disc_rates = [0.01 + randint(0, rand_max) / rand_max * 0.06 for _ in range(n_rates)] maturities = list(range(1, n_rates + 1)) disc_rates_d = [xadj.Real(r) for r in disc_rates] with xadj.Tape() as tape: # set independent variables tape.registerInputs(disc_rates_d) # start recording derivatives tape.newRecording() v = calculate_price_swap( disc_rates_d, is_fixed_pay, maturities, float_rates, fixed_rate, face_value ) # seed adjoint of output tape.registerOutput(v) v.derivative = 1.0 # compute all other adjoints tape.computeAdjoints() # output results print(f"v = {v.value:.2f}") print("Discount rate sensitivities for 1 basispoint shift:") for i, rate in enumerate(disc_rates_d): print(f"dv/dr{i} = {rate.derivative * 0.0001:.2f}")
3,067
Python
.py
77
36.623377
94
0.664315
auto-differentiation/xad-py
8
1
12
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,667
fwd_1st.py
auto-differentiation_xad-py/samples/fwd_1st.py
############################################################################## # # Sample for 1st order forward mode in Python. # # Computes # y = f(x0, x1, x2, x3) # and it's first order derivative w.r.t. x0 using forward mode: # dy/dx0 # # This file is part of XAD's Python bindings, a comprehensive library for # automatic differentiation. # # Copyright (C) 2010-2024 Xcelerit Computing Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import xad.fwd_1st as xfwd # input values x0 = 1.0 x1 = 1.5 x2 = 1.3 x3 = 1.2 # set independent variables x0_ad = xfwd.Real(x0) x1_ad = xfwd.Real(x1) x2_ad = xfwd.Real(x2) x3_ad = xfwd.Real(x3) # compute derivative w.r.t. x0 # (if other derivatives are needed, the initial derivatives have to be reset # and the function run again) x0_ad.derivative = 1.0 # run the algorithm with active variables y = 2 * x0_ad + x1_ad - x2_ad * x3_ad # output results{ print(f"y = {y.value}") print("first order derivative:") print(f"dy/dx0 = {y.derivative}")
1,715
Python
.py
49
33.857143
78
0.664858
auto-differentiation/xad-py
8
1
12
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,668
adj_1st.py
auto-differentiation_xad-py/samples/adj_1st.py
############################################################################## # # Sample for first-order adjoint calculation with Python # # Computes # y = f(x0, x1, x2, x3) # and its first order derivatives # dy/dx0, dy/dx1, dy/dx2, dy/dx3 # using adjoint mode. # # This file is part of XAD's Python bindings, a comprehensive library for # automatic differentiation. # # Copyright (C) 2010-2024 Xcelerit Computing Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # import xad.adj_1st as xadj # input values x0 = 1.0 x1 = 1.5 x2 = 1.3 x3 = 1.2 # set independent variables x0_ad = xadj.Real(x0) x1_ad = xadj.Real(x1) x2_ad = xadj.Real(x2) x3_ad = xadj.Real(x3) with xadj.Tape() as tape: # and register them tape.registerInput(x0_ad) tape.registerInput(x1_ad) tape.registerInput(x2_ad) tape.registerInput(x3_ad) # start recording derivatives tape.newRecording() # calculate the output y = x0_ad + x1_ad - x2_ad * x3_ad # register and seed adjoint of output tape.registerOutput(y) y.derivative = 1.0 # compute all other adjoints tape.computeAdjoints() # output results print(f"y = {y}") print(f"first order derivatives:\n") print(f"dy/dx0 = {x0_ad.derivative}") print(f"dy/dx1 = {x1_ad.derivative}") print(f"dy/dx2 = {x2_ad.derivative}") print(f"dy/dx3 = {x3_ad.derivative}")
2,015
Python
.py
61
30.491803
78
0.681584
auto-differentiation/xad-py
8
1
12
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,669
test_tape.py
auto-differentiation_xad-py/tests/test_tape.py
############################################################################## # # Test the adjoint tape in Python. # # This file is part of XAD's Python bindings, a comprehensive library for # automatic differentiation. # # Copyright (C) 2010-2024 Xcelerit Computing Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import pytest from xad import derivative, exceptions, value from xad.adj_1st import Tape, Real def test_active_tape(): tape = Tape() assert tape.isActive() is False tape.activate() assert tape.isActive() is True tape.deactivate() assert tape.isActive() is False def test_tape_using_with(): with Tape() as tape: assert tape.isActive() is True tape = Tape() assert tape.isActive() is False with tape: assert tape.isActive() is True assert tape.isActive() is False def test_get_active(): t = Tape() assert Tape.getActive() is None t.activate() assert Tape.getActive() is not None assert Tape.getActive() == t def test_get_position(): with Tape() as t: assert t.getPosition() == 0 x1 = Real(1.0) t.registerInput(x1) x2 = 1.2 * x1 x1.setDerivative(1.0) t.registerOutput(x2) t.computeAdjoints() assert t.getPosition() >= 0 def test_clear_derivative_after(): with Tape() as tape: x1 = Real(1.0) tape.registerInput(x1) x2 = 1.2 * x1 pos = tape.getPosition() x3 = 1.4 * x2 * x1 x4 = x2 + x3 tape.registerOutput(x4) x4.setDerivative(1.0) x3.setDerivative(1.0) x2.setDerivative(1.0) x1.setDerivative(1.0) tape.clearDerivativesAfter(pos) assert derivative(x2) == 1.0 assert derivative(x1) == 1.0 with pytest.raises(exceptions.OutOfRange) as e: derivative(x3) assert "given derivative slot is out of range - did you register the outputs?" in str(e) with pytest.raises(exceptions.OutOfRange) as e: derivative(x4) assert "given derivative slot is out of range - did you register the outputs?" in str(e) def test_reset_to_and_compute_adjoints_to_usage(): i = Real(2.0) with Tape() as tape: tape.registerInput(i) tape.newRecording() pos = tape.getPosition() values = [] deriv = [] for p in range(1, 10): v = p * i tape.registerOutput(v) v.setDerivative(1.0) tape.computeAdjointsTo(pos) values.append(value(v)) deriv.append(derivative(i)) tape.resetTo(pos) tape.clearDerivatives() assert values == [2.0, 4.0, 6.0, 8.0, 10.0, 12.0, 14.0, 16.0, 18.0] assert deriv == [1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0] def test_derivative(): with Tape() as t: x = Real(1.0) t.registerInput(x) assert t.derivative(x) == 0.0 def test_get_derivative(): with Tape() as t: x = Real(1.0) t.registerInput(x) assert t.getDerivative(x) == 0.0 def test_set_derivative_value(): with Tape() as t: x = Real(1.0) t.registerInput(x) t.setDerivative(x, 1.0) assert t.derivative(x) == 1.0 with pytest.raises(exceptions.OutOfRange): derivative(t.setDerivative(1231, 0.0)) def test_set_derivative_slot(): with Tape() as t: x = Real(1.0) t.registerInput(x) slot = x.getSlot() assert isinstance(slot, int) t.setDerivative(slot, 1.0) assert t.derivative(x) == 1.0 assert t.getDerivative(slot) == 1.0
4,361
Python
.py
125
28.416
96
0.605413
auto-differentiation/xad-py
8
1
12
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,670
test_package.py
auto-differentiation_xad-py/tests/test_package.py
############################################################################## # # Pytests for the overall package interface # # This file is part of XAD's Python bindings, a comprehensive library for # automatic differentiation. # # Copyright (C) 2010-2024 Xcelerit Computing Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import xad def test_version_info(): assert isinstance(xad.__version__, str)
1,116
Python
.py
26
41.692308
78
0.658088
auto-differentiation/xad-py
8
1
12
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,671
test_exceptions.py
auto-differentiation_xad-py/tests/test_exceptions.py
############################################################################## # # Test exceptions bindings. # # This file is part of XAD's Python bindings, a comprehensive library for # automatic differentiation. # # Copyright (C) 2010-2024 Xcelerit Computing Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import pytest from xad.adj_1st import Real, Tape from xad.exceptions import ( XadException, TapeAlreadyActive, OutOfRange, DerivativesNotInitialized, NoTapeException, ) @pytest.mark.parametrize("exception", [TapeAlreadyActive, XadException]) def test_exceptions_tape_active(exception): with Tape() as t: with pytest.raises(exception) as e: # when it's already active t.activate() assert "A tape is already active for the current thread" in str(e) @pytest.mark.parametrize("exception", [OutOfRange, XadException]) def test_exceptions_outofrange(exception): with Tape() as t: x = Real(1.0) t.registerInput(x) assert t.derivative(x) == 0.0 with pytest.raises(exception) as e: t.derivative(12312) assert "given derivative slot is out of range - did you register the outputs?" in str(e) @pytest.mark.parametrize("exception", [DerivativesNotInitialized, XadException]) def test_exceptions_adjoints_not_initialized(exception): with Tape() as t: with pytest.raises(exception) as e: x = Real(1.0) t.registerInput(x) t.newRecording() y = x * x t.registerOutput(y) t.computeAdjoints() assert "At least one derivative must be set before computing adjoint" in str(e) @pytest.mark.parametrize("exception", [NoTapeException, XadException]) def test_exceptions_no_tape_exception(exception): with pytest.raises(exception) as e: x = Real(1.0) x.setDerivative(1.0) assert "No active tape for the current thread" in str(e)
2,666
Python
.py
65
36.246154
96
0.66821
auto-differentiation/xad-py
8
1
12
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,672
test_math_functions_derivatives.py
auto-differentiation_xad-py/tests/test_math_functions_derivatives.py
############################################################################## # # Pytests for math functions and their derivatives # # This file is part of XAD's Python bindings, a comprehensive library for # automatic differentiation. # # Copyright (C) 2010-2024 Xcelerit Computing Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## import sys import pytest from xad.adj_1st import Tape, Real as Areal from xad.fwd_1st import Real as Freal from xad import math as ad_math import math # This is a list of math functions with their expected outcomes and derivatives, # used in parametrised tests, for unary functions. # # The format is a list of tuples, where each tuple has the following entries: # - XAD math function: Callable # - parameter value for the function: float # - expected result: float # - expected derivative value: float # PARAMETERS_FOR_UNARY_FUNC = [ (ad_math.sin, math.pi / 4, math.sin(math.pi / 4), math.cos(math.pi / 4)), (ad_math.cos, math.pi / 4, math.cos(math.pi / 4), -1 * math.sin(math.pi / 4)), (ad_math.tan, 0.5, math.tan(0.5), 2 / (1 + math.cos(2 * 0.5))), (ad_math.atan, 0.5, math.atan(0.5), 1 / (1 + math.pow(0.5, 2))), (ad_math.acos, 0.5, math.acos(0.5), -1 / math.sqrt(1 - math.pow(0.5, 2))), (ad_math.asin, 0.5, math.asin(0.5), 1 / math.sqrt(1 - math.pow(0.5, 2))), (ad_math.tanh, 0.5, math.tanh(0.5), 1 - math.pow(math.tanh(0.5), 2)), (ad_math.cosh, 0.5, math.cosh(0.5), math.sinh(0.5)), (ad_math.sinh, 0.5, math.sinh(0.5), math.cosh(0.5)), (ad_math.atanh, 0.5, math.atanh(0.5), 1 / (1 - math.pow(0.5, 2))), (ad_math.asinh, 0.5, math.asinh(0.5), 1 / math.sqrt(1 + math.pow(0.5, 2))), (ad_math.acosh, 1.5, math.acosh(1.5), 1 / math.sqrt(math.pow(1.5, 2) - 1)), (ad_math.sqrt, 4, math.sqrt(4), 1 / (2 * math.sqrt(4))), (ad_math.log10, 4, math.log10(4), 1 / (4 * math.log(10))), (ad_math.log, 4, math.log(4), 1 / 4), (ad_math.exp, 4, math.exp(4), math.exp(4)), (ad_math.expm1, 4, math.expm1(4), math.exp(4)), (ad_math.log1p, 4, math.log1p(4), 1 / (5)), (ad_math.log2, 4, math.log2(4), 1 / (4 * math.log(2))), (ad_math.abs, -4, abs(-4), -1), (ad_math.fabs, -4.4, 4.4, -1), (ad_math.smooth_abs, -4.4, 4.4, -1), ( ad_math.erf, -1.4, math.erf(-1.4), (2 / math.sqrt(math.pi)) * math.exp(-1 * math.pow(-1.4, 2)), ), ( ad_math.erfc, -1.4, math.erfc(-1.4), (-2 / math.sqrt(math.pi)) * math.exp(-1 * math.pow(-1.4, 2)), ), (ad_math.cbrt, 8, 2.0, (1 / 3) * (math.pow(8, (-2 / 3)))), (ad_math.trunc, 8.1, math.trunc(8.1), 0), (ad_math.ceil, 3.7, math.ceil(3.7), 0), (ad_math.floor, 3.7, math.floor(3.7), 0), ] # This is a list of math functions with their expected outcomes and derivatives, # used in parametrised tests, for binary functions. # # The format is a list of tuples, where each tuple has the following entries: # - XAD math function: Callable # - parameter1 value for the function: float # - parameter2 value for the function: float # - expected result: float # - expected derivative1 value: float # - expected derivative2 value: float # PARAMETERS_FOR_BINARY_FUNC = [ (ad_math.min, 3, 4, 3, 1, 0), (ad_math.min, 4, 3, 3, 0, 1), (ad_math.max, 3, 4, 4, 0, 1), (ad_math.max, 4, 3, 4, 1, 0), (ad_math.fmin, 3.5, 4.3, 3.5, 1, 0), (ad_math.fmin, 4.3, 3.5, 3.5, 0, 1), (ad_math.fmax, 3.5, 4.3, 4.3, 0, 1), (ad_math.fmax, 4.3, 3.5, 4.3, 1, 0), (ad_math.smooth_min, 3.5, 4.3, 3.5, 1, 0), (ad_math.smooth_min, 4.3, 3.5, 3.5, 0, 1), (ad_math.smooth_max, 3.5, 4.3, 4.3, 0, 1), (ad_math.smooth_max, 4.3, 3.5, 4.3, 1, 0), (ad_math.remainder, 5, 2, math.remainder(5, 2), 1, -2), (ad_math.fmod, 6, 2, math.fmod(6, 3), 1, -3), ] _binary_with_scalar_funcs = [ (ad_math.pow, math.pow), (ad_math.min, min), (ad_math.max, max), (ad_math.fmin, min), (ad_math.fmax, max), (ad_math.atan2, math.atan2), (ad_math.remainder, math.remainder), (ad_math.copysign, math.copysign), ] if sys.version_info.major > 3 or (sys.version_info.major == 3 and sys.version_info.minor >= 9): # introduced in Python 3.9 PARAMETERS_FOR_BINARY_FUNC.append((ad_math.nextafter, 3.5, 4.3, math.nextafter(3.5, 4.3), 1, 0)) _binary_with_scalar_funcs.append((ad_math.nextafter, math.nextafter)) @pytest.mark.parametrize("func,x,y,xd", PARAMETERS_FOR_UNARY_FUNC) def test_unary_math_functions_for_adj(func, x, y, xd): assert func(x) == pytest.approx(y) x_ad = Areal(x) with Tape() as tape: tape.registerInput(x_ad) tape.newRecording() y_ad = func(x_ad) tape.registerOutput(y_ad) y_ad.setDerivative(1.0) tape.computeAdjoints() assert y_ad == pytest.approx(y) assert x_ad.getDerivative() == pytest.approx(xd) @pytest.mark.parametrize("func,x,y,yd", PARAMETERS_FOR_UNARY_FUNC) def test_unary_math_functions_for_fwd(func, x, y, yd): x_ad = Freal(x) x_ad.setDerivative(1.0) y_ad = func(x_ad) assert y_ad == pytest.approx(y) assert y_ad.getDerivative() == pytest.approx(yd) @pytest.mark.parametrize("ad_func, func", _binary_with_scalar_funcs) @pytest.mark.parametrize("value", [3, 3.1]) def test_binary_function_with_scalar_param(value, ad_func, func): assert ad_func(4.1, value) == pytest.approx(func(4.1, value)) assert ad_func(4, value) == pytest.approx(func(4, value)) assert ad_func(Freal(4.1), value) == pytest.approx(func(4.1, value)) assert ad_func(Freal(4), value) == pytest.approx(func(4, value)) assert ad_func(value, Freal(4.1)) == pytest.approx(func(value, 4.1)) assert ad_func(value, Freal(4)) == pytest.approx(func(value, 4)) @pytest.mark.parametrize( "func, y, derv", [ (0, math.pow(4, 3), pytest.approx(3 * math.pow(4, 3 - 1))), (1, math.pow(3, 4), pytest.approx(math.log(3) * math.pow(3, 4))), ], ) def test_pow_for_adj(func, y, derv): x_ad = Areal(4.0) with Tape() as tape: tape.registerInput(x_ad) tape.newRecording() if func == 0: y_ad = ad_math.pow(x_ad, 3) else: y_ad = ad_math.pow(3, x_ad) tape.registerOutput(y_ad) y_ad.setDerivative(1.0) tape.computeAdjoints() assert y_ad == pytest.approx(y) assert x_ad.getDerivative() == pytest.approx(derv) @pytest.mark.parametrize( "func, y, derv", [ (0, math.pow(4, 3), pytest.approx(3 * math.pow(4, 3 - 1))), (1, math.pow(3, 4), pytest.approx(math.log(3) * math.pow(3, 4))), ], ) def test_pow_for_fwd(func, y, derv): x_ad = Freal(4.0) x_ad.setDerivative(1.0) if func == 0: y_ad = ad_math.pow(x_ad, 3) else: y_ad = ad_math.pow(3, x_ad) assert y_ad == y assert y_ad.getDerivative() == pytest.approx(derv) @pytest.mark.parametrize("func,x1, x2,y,xd1, xd2", PARAMETERS_FOR_BINARY_FUNC) def test_binary_math_functions_for_adj(func, x1, x2, y, xd1, xd2): x1_ad = Areal(x1) x2_ad = Areal(x2) with Tape() as tape: tape.registerInput(x1_ad) tape.registerInput(x2_ad) tape.newRecording() y_ad = func(x1_ad, x2_ad) tape.registerOutput(y_ad) y_ad.setDerivative(1.0) tape.computeAdjoints() assert y_ad == pytest.approx(y) assert x1_ad.getDerivative() == pytest.approx(xd1) assert x2_ad.getDerivative() == pytest.approx(xd2) @pytest.mark.parametrize("func,x1, x2,y,xd1, xd2", PARAMETERS_FOR_BINARY_FUNC) @pytest.mark.parametrize("deriv", [1, 2]) def test_binary_math_functions_for_fwd(func, x1, x2, y, xd1, xd2, deriv): x1_ad = Freal(x1) x2_ad = Freal(x2) if deriv == 1: x1_ad.setDerivative(1.0) else: x2_ad.setDerivative(1.0) y_ad = func(x1_ad, x2_ad) assert y_ad == pytest.approx(y) if deriv == 1: assert y_ad.getDerivative() == pytest.approx(xd1) else: assert y_ad.getDerivative() == pytest.approx(xd2) @pytest.mark.parametrize( "func,x,y,xd", [ (ad_math.modf, 3.23, math.modf(3.23), 1), (ad_math.frexp, 3, math.frexp(3), 1 / math.pow(2, 2)), ], ) def test_modf_frexp_functions_for_adj(func, x, y, xd): x_ad = Areal(x) with Tape() as tape: tape.registerInput(x_ad) tape.newRecording() y_ad = func(x_ad) tape.registerOutput(y_ad[0]) y_ad[0].setDerivative(1.0) tape.computeAdjoints() assert y_ad == pytest.approx(y) assert x_ad.getDerivative() == pytest.approx(xd) @pytest.mark.parametrize( "func,x,y,xd", [ (ad_math.modf, 3.23, math.modf(3.23), 1), (ad_math.frexp, 3, math.frexp(3), 1 / math.pow(2, 2)), ], ) def test_modf_frexp_functions_for_fwd(func, x, y, xd): x_ad = Freal(x) x_ad.setDerivative(1.0) y_ad = func(x_ad) assert y_ad == pytest.approx(y) assert y_ad[0].getDerivative() == pytest.approx(xd) @pytest.mark.parametrize( "func, y, xd", [ (ad_math.degrees, math.degrees(3), 180 / math.pi), (ad_math.radians, math.radians(3), math.pi / 180), ], ) def test_degrees_radians_adj(func, y, xd): with Tape() as tape: x_ad = Areal(3.0) tape.registerInput(x_ad) tape.newRecording() y_ad = func(x_ad) tape.registerOutput(y_ad) y_ad.setDerivative(1.0) tape.computeAdjoints() assert y_ad.getValue() == pytest.approx(y) assert x_ad.getDerivative() == pytest.approx(xd) @pytest.mark.parametrize( "func, y, xd", [ (ad_math.degrees, math.degrees(3), 180 / math.pi), (ad_math.radians, math.radians(3), math.pi / 180), ], ) def test_degrees_radians_fwd(func, y, xd): x_ad = Freal(3) x_ad.setDerivative(1.0) y_ad = func(x_ad) assert y_ad.getValue() == pytest.approx(y) assert y_ad.getDerivative() == pytest.approx(xd) @pytest.mark.parametrize("Real", [Areal, Freal]) def test_copysign(Real): assert ad_math.copysign(Real(-3.1), 4) == pytest.approx(math.copysign(-3.1, 4)) assert ad_math.copysign(Real(4), -3.1) == pytest.approx(math.copysign(4, -3.1)) assert ad_math.copysign(Real(-3.1), Real(4)) == pytest.approx(math.copysign(-3.1, 4)) def test_copysign_derivative_for_adj(): with Tape() as tape: x1_ad = Areal(-3.1) x2_ad = Areal(4) tape.registerInput(x1_ad) tape.registerInput(x2_ad) tape.newRecording() y_ad = ad_math.copysign(x1_ad, x2_ad) tape.registerOutput(y_ad) y_ad.setDerivative(1.0) tape.computeAdjoints() assert y_ad == pytest.approx(math.copysign(-3.1, 4)) assert x1_ad.getDerivative() == pytest.approx(-1) assert x2_ad.getDerivative() == pytest.approx(0) @pytest.mark.parametrize("deriv", [1, 2]) def test_copysign_derivative_for_fwd(deriv): x1_ad = Freal(-3.1) x2_ad = Freal(4) if deriv == 1: x1_ad.setDerivative(1.0) else: x2_ad.setDerivative(1.0) y_ad = ad_math.copysign(x1_ad, x2_ad) assert y_ad == pytest.approx(math.copysign(-3.1, 4)) if deriv == 1: assert y_ad.getDerivative() == pytest.approx(-1) else: assert y_ad.getDerivative() == pytest.approx(0) def test_sum_adj(): with Tape() as tape: x1_ad = Areal(-3.1) x2_ad = Areal(4) x3_ad = Areal(2.4) tape.registerInput(x1_ad) tape.registerInput(x2_ad) tape.registerInput(x3_ad) tape.newRecording() y_ad = sum([x1_ad, x2_ad, x3_ad]) tape.registerOutput(y_ad) y_ad.setDerivative(1.0) tape.computeAdjoints() assert y_ad == pytest.approx(3.3) assert x1_ad.getDerivative() == pytest.approx(1) assert x2_ad.getDerivative() == pytest.approx(1) assert x3_ad.getDerivative() == pytest.approx(1) @pytest.mark.parametrize("deriv", [1, 2]) def test_sum_for_fwd(deriv): x1_ad = Freal(-3.1) x2_ad = Freal(4) if deriv == 1: x1_ad.setDerivative(1.0) else: x2_ad.setDerivative(1.0) y_ad = sum([x1_ad, x2_ad]) assert y_ad == pytest.approx(sum([-3.1, 4])) assert y_ad.getDerivative() == pytest.approx(1) def test_hypot_adj(): with Tape() as tape: x1_ad = Areal(-3.1) x2_ad = Areal(4) tape.registerInput(x1_ad) tape.registerInput(x2_ad) tape.newRecording() y_ad = ad_math.hypot(x1_ad, x2_ad) tape.registerOutput(y_ad) y_ad.setDerivative(1.0) tape.computeAdjoints() assert y_ad == pytest.approx(math.hypot(-3.1, 4)) assert x1_ad.getDerivative() == pytest.approx(-3.1 / math.hypot(-3.1, 4)) assert x2_ad.getDerivative() == pytest.approx(4 / math.hypot(-3.1, 4)) @pytest.mark.parametrize("deriv", [1, 2]) def test_hypot_for_fwd(deriv): x1_ad = Freal(-3.1) x2_ad = Freal(4) if deriv == 1: x1_ad.setDerivative(1.0) else: x2_ad.setDerivative(1.0) y_ad = ad_math.hypot(x1_ad, x2_ad) assert y_ad == pytest.approx(math.hypot(-3.1, 4)) if deriv == 1: assert y_ad.getDerivative() == pytest.approx(-3.1 / math.hypot(-3.1, 4)) else: assert y_ad.getDerivative() == pytest.approx(4 / math.hypot(-3.1, 4)) def test_dist_for_adj(): with Tape() as tape: x1_ad = Areal(-3.1) x2_ad = Areal(4) x3_ad = Areal(2.4) x4_ad = Areal(1) tape.registerInput(x1_ad) tape.registerInput(x2_ad) tape.registerInput(x3_ad) tape.registerInput(x4_ad) tape.newRecording() y_ad = ad_math.dist([x1_ad, x2_ad], [x3_ad, x4_ad]) tape.registerOutput(y_ad) y_ad.setDerivative(1.0) tape.computeAdjoints() assert y_ad == pytest.approx(math.dist([-3.1, 4], [2.4, 1])) assert x1_ad.getDerivative() == pytest.approx(-5.5 / math.dist([-3.1, 4], [2.4, 1])) assert x2_ad.getDerivative() == pytest.approx(3 / math.dist([-3.1, 4], [2.4, 1])) assert x3_ad.getDerivative() == pytest.approx(5.5 / math.dist([-3.1, 4], [2.4, 1])) assert x4_ad.getDerivative() == pytest.approx(-3 / math.dist([-3.1, 4], [2.4, 1])) @pytest.mark.parametrize("deriv", [1, 2, 3, 4]) def test_dist_for_fwd(deriv): x1_ad = Freal(-3.1) x2_ad = Freal(4) x3_ad = Freal(2.4) x4_ad = Freal(1) if deriv == 1: x1_ad.setDerivative(1.0) elif deriv == 2: x2_ad.setDerivative(1.0) elif deriv == 3: x3_ad.setDerivative(1.0) else: x4_ad.setDerivative(1.0) y_ad = ad_math.dist([x1_ad, x2_ad], [x3_ad, x4_ad]) assert y_ad == pytest.approx(math.dist([-3.1, 4], [2.4, 1])) if deriv == 1: assert y_ad.getDerivative() == pytest.approx(-5.5 / math.dist([-3.1, 4], [2.4, 1])) elif deriv == 2: assert y_ad.getDerivative() == pytest.approx(3 / math.dist([-3.1, 4], [2.4, 1])) elif deriv == 3: assert y_ad.getDerivative() == pytest.approx(5.5 / math.dist([-3.1, 4], [2.4, 1])) else: assert y_ad.getDerivative() == pytest.approx(-3 / math.dist([-3.1, 4], [2.4, 1]))
15,863
Python
.py
410
32.987805
100
0.599766
auto-differentiation/xad-py
8
1
12
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,673
test_real_operations.py
auto-differentiation_xad-py/tests/test_real_operations.py
############################################################################## # # Pytests for operations and derivatives on the active types # # This file is part of XAD's Python bindings, a comprehensive library for # automatic differentiation. # # Copyright (C) 2010-2024 Xcelerit Computing Ltd. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published # by the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # ############################################################################## from pytest import approx, raises import pytest from xad.adj_1st import Real as AReal, Tape from xad.fwd_1st import Real as FReal from xad import value, derivative import math as m # This is a list of math functions with their expected outcomes and derivatives, # used in parametrised tests, for binary arithmetic functions with one active operand. # # The format is a list of tuples, where each tuple has the following entries: # - math function: Callable (lambda), with one parameter # - parameter1 value for the function: float # - expected result: float # - expected derivative1 value: float # PARAMETERS_FOR_BINARY_ARITHMETICS_1_ACTIVE_OPERAND = [ (lambda a: 2 * a, 3, 6, 2), (lambda a: 2 + a, 3, 5, 1), (lambda a: 2 - a, 3, -1, -1), (lambda a: 2 / a, 3, 2 / 3, -2 / 9), (lambda a: a * 3.6, 3, 10.8, 3.6), (lambda a: a + 3.9, 3, 6.9, 1), (lambda a: a - 4.3, 3, -1.3, 1), (lambda a: a / 2, 3, 1.5, 1 / 2), ] # This is a list of math functions with their expected outcomes and derivatives, # used in parametrised tests, for unary arithmetic functions (+x, -x). # # The format is a list of tuples, where each tuple has the following entries: # - math function: Callable (lambda), with one parameter # - parameter1 value for the function: float # - expected result: float # - expected derivative1 value: float # PARAMETERS_FOR_UNARY_ARITHMETICS = [(lambda a: +a, 3, 3, 1), (lambda a: -a, 3, -3, -1)] # This is a list of math functions with their expected outcomes and derivatives, # used in parametrised tests, for binary arithmetic functions with two active operands. # # The format is a list of tuples, where each tuple has the following entries: # - math function: Callable (lambda, 2 parameters) # - parameter1 value for the function: float # - parameter2 value for the function: float # - expected result: float # - expected derivative1 value: float # - expected derivative2 value: float # PARAMETERS_FOR_BINARY_ARITHMETICS_2_ACTIVE_OPERANDS = [ (lambda a, b: a * b, 5.0, 2.0, 10, 2, 5), (lambda a, b: a + b, 5.0, 2.0, 7, 1, 1), (lambda a, b: a - b, 5.0, 2.0, 3, 1, -1), (lambda a, b: a / b, 5.0, 2.0, 2.5, 0.5, -1.25), ] @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_initialize_from_float(ad_type): assert ad_type(0.3).getValue() == approx(0.3) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_initialize_from_int(ad_type): assert ad_type(1).getValue() == 1 @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_add_float(ad_type): real = ad_type(0.4) + 0.3 assert real.getValue() == approx(0.7) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_add_int(ad_type): real = ad_type(1) + 2 assert real.getValue() == 3 @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_sub_float(ad_type): real = ad_type(0.3) - 0.4 assert real.getValue() == approx(-0.1) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_sub_int(ad_type): real = ad_type(1) - 2 assert real.getValue() == -1 @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_add_to_float(ad_type): real = 0.3 + ad_type(0.4) assert real.getValue() == approx(0.7) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_sub_to_float(ad_type): real = 2.5 - ad_type(2.0) assert real.getValue() == approx(0.5) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_add_to_int(ad_type): real = 2 + ad_type(1) assert real.getValue() == 3 @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_sub_to_int(ad_type): real = 2 - ad_type(1) assert real.getValue() == 1 @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_add_real(ad_type): real = ad_type(2) + ad_type(1) assert real.getValue() == 3 @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_sub_real(ad_type): real = ad_type(2) - ad_type(1) assert real.getValue() == 1 @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_mul_float(ad_type): real = ad_type(0.2) * 0.5 assert real.getValue() == approx(0.1) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_mul_int(ad_type): real = ad_type(1) * 2 assert real.getValue() == 2 @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_mul_to_float(ad_type): real = 0.5 * ad_type(0.2) assert real.getValue() == approx(0.1) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_mul_to_int(ad_type): real = 2 * ad_type(1) assert real.getValue() == 2 @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_mul_real(ad_type): real = ad_type(0.2) * ad_type(0.5) assert real.getValue() == approx(0.1) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_div_float(ad_type): real = ad_type(0.2) / 0.5 assert real.getValue() == approx(0.4) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_div_int(ad_type): real = ad_type(1) / 2 assert real.getValue() == approx(0.5) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_div_to_float(ad_type): real = 0.5 / ad_type(0.2) assert real.getValue() == approx(2.5) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_div_to_int(ad_type): real = 2 / ad_type(1) assert real.getValue() == 2 @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_div_real(ad_type): real = ad_type(0.2) / ad_type(0.5) assert real.getValue() == approx(0.4) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_addition_assignment_int(ad_type): real = ad_type(0.2) real += 1 assert real.getValue() == approx(1.2) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_addition_assignment_float(ad_type): real = ad_type(0.2) real += 1.9 assert real.getValue() == approx(2.1) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_addition_assignment_real(ad_type): real = ad_type(0.2) real += ad_type(0.5) assert real.getValue() == approx(0.7) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_sub_assignment_int(ad_type): real = ad_type(0.2) real -= 1 assert real.getValue() == approx(-0.8) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_sub_assignment_float(ad_type): real = ad_type(0.2) real -= 1.9 assert real.getValue() == approx(-1.7) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_sub_assignment_real(ad_type): real = ad_type(0.2) real -= ad_type(0.5) assert real.getValue() == approx(-0.3) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_comparison_real_to_real(ad_type): a = ad_type(0.2) b = ad_type(0.5) assert (b > a) is True assert (a > b) is False assert (b >= a) is True assert (a >= b) is False assert (b < a) is False assert (a < b) is True assert (b <= a) is False assert (a <= b) is True c = ad_type(0.2) assert (a != b) is True assert (a != c) is False assert (a == c) is True assert (b == c) is False @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_comparison_real_to_float(ad_type): a = ad_type(0.2) b = 0.5 assert (b > a) is True assert (a > b) is False assert (b >= a) is True assert (a >= b) is False assert (b < a) is False assert (a < b) is True assert (b <= a) is False assert (a <= b) is True c = 0.2 assert (a != b) is True assert (a != c) is False assert (a == c) is True assert (b == c) is False @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_comparison_real_to_int(ad_type): a = ad_type(2) b = 5 assert (b > a) is True assert (a > b) is False assert (b >= a) is True assert (a >= b) is False assert (b < a) is False assert (a < b) is True assert (b <= a) is False assert (a <= b) is True c = 2 assert (a != b) is True assert (a != c) is False assert (a == c) is True assert (b == c) is False @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_rounding(ad_type): assert round(ad_type(2.345), 2) == pytest.approx(2.35) assert round(ad_type(2.345), 1) == pytest.approx(2.3) assert round(ad_type(2.345), 0) == pytest.approx(2.0) assert round(ad_type(2.345)) == pytest.approx(2.0) assert type(round(ad_type(2.3))) == type(round(2.3)) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) @pytest.mark.parametrize( "func", [m.ceil, m.floor, m.trunc, int], ids=["ceil", "floor", "trunc", "int"] ) def test_truncation_funcs(ad_type, func): assert func(ad_type(2.345)) == func(2.345) assert func(ad_type(2.845)) == func(2.845) assert func(ad_type(-2.845)) == func(-2.845) assert func(ad_type(0.0)) == func(0.0) assert isinstance(func(ad_type(1.1)), int) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_abs(ad_type): assert abs(ad_type(2.345)) == pytest.approx(2.345) assert abs(ad_type(-2.345)) == pytest.approx(2.345) assert abs(ad_type(0.0)) == 0.0 @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_bool(ad_type): assert bool(ad_type(1.0)) is bool(1.0) assert bool(ad_type(0.0)) is bool(0.0) assert bool(ad_type(1.0)) is bool(-1.0) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_mod(ad_type): assert ad_type(2.7) % 2 == 2.7 % 2 assert ad_type(2.7) % ad_type(2.0) == 2.7 % 2.0 assert 2.7 % ad_type(2.0) == 2.7 % 2.0 assert 2 % ad_type(2.0) == 2 % 2.0 assert ad_type(-2.7) % 2 == -2.7 % 2 assert ad_type(-2.7) % ad_type(2.0) == -2.7 % 2.0 assert -2.7 % ad_type(2.0) == -2.7 % 2.0 assert -2 % ad_type(2.0) == -2 % 2.0 assert ad_type(2.7) % -2 == 2.7 % -2 assert ad_type(2.7) % ad_type(-2.0) == 2.7 % -2.0 assert 2.7 % ad_type(-2.0) == 2.7 % -2.0 assert 2 % ad_type(-2.0) == 2 % -2.0 @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_divmod(ad_type): assert divmod(ad_type(2.7), 2) == divmod(2.7, 2) assert divmod(ad_type(2.7), ad_type(2.0)) == divmod(2.7, 2.0) assert divmod(2.7, ad_type(2.0)) == divmod(2.7, 2.0) assert divmod(2, ad_type(2.0)) == divmod(2, 2.0) assert divmod(ad_type(-2.7), 2) == divmod(-2.7, 2) assert divmod(ad_type(-2.7), ad_type(2.0)) == divmod(-2.7, 2.0) assert divmod(-2.7, ad_type(2.0)) == divmod(-2.7, 2.0) assert divmod(-2, ad_type(2.0)) == divmod(-2, 2.0) assert divmod(ad_type(2.7), -2) == divmod(2.7, -2) assert divmod(ad_type(2.7), ad_type(-2.0)) == divmod(2.7, -2.0) assert divmod(2.7, ad_type(-2.0)) == divmod(2.7, -2.0) assert divmod(2, ad_type(-2.0)) == divmod(2, -2.0) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_floordiv(ad_type): assert ad_type(2.7) // 2 == 2.7 // 2 assert ad_type(2.7) // ad_type(2.0) == 2.7 // 2.0 assert 2.7 // ad_type(2.0) == 2.7 // 2.0 assert 2 // ad_type(2.0) == 2 // 2.0 assert ad_type(-2.7) // 2 == -2.7 // 2 assert ad_type(-2.7) // ad_type(2.0) == -2.7 // 2.0 assert -2.7 // ad_type(2.0) == -2.7 // 2.0 assert -2 // ad_type(2.0) == -2 // 2.0 assert ad_type(2.7) // -2 == 2.7 // -2 assert ad_type(2.7) // ad_type(-2.0) == 2.7 // -2.0 assert 2.7 // ad_type(-2.0) == 2.7 // -2.0 assert 2 // ad_type(-2.0) == 2 // -2.0 @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_pow_operator(ad_type): assert ad_type(2.7) ** 2 == pytest.approx(2.7**2) assert ad_type(2.7) ** 2.4 == pytest.approx(2.7**2.4) assert ad_type(2.7) ** ad_type(2.4) == pytest.approx(2.7**2.4) assert 2.7 ** ad_type(2.4) == pytest.approx(2.7**2.4) assert 2 ** ad_type(2.4) == pytest.approx(2**2.4) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_hash_method(ad_type): assert hash(ad_type(2.7)) == hash(2.7) assert hash(ad_type(-2.7)) == hash(-2.7) assert hash(ad_type(0)) == hash(0) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_getnewargs_method(ad_type): assert ad_type(1.2).__getnewargs__() == (1.2,) assert ad_type(1).__getnewargs__() == (1.0,) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_as_integer_ratio(ad_type): assert ad_type(1.2).as_integer_ratio() == (1.2).as_integer_ratio() assert ad_type(-21.2).as_integer_ratio() == (-21.2).as_integer_ratio() @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_conjugate(ad_type): assert ad_type(1.2).conjugate() == (1.2).conjugate() assert ad_type(-21.2).conjugate() == (-21.2).conjugate() @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_fromhex(ad_type): assert ad_type.fromhex("0x3.a7p10") == float.fromhex("0x3.a7p10") @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_hex(ad_type): assert ad_type(1.23).hex() == (1.23).hex() @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_imag(ad_type): assert ad_type(1.23).imag() == pytest.approx(0.0) assert ad_type(-1.23).imag() == pytest.approx(0.0) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_real(ad_type): assert ad_type(1.23).real() == pytest.approx(1.23) assert ad_type(-1.23).real() == pytest.approx(-1.23) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_isinteger(ad_type): assert ad_type(1.23).is_integer() is False assert ad_type(-1.23).is_integer() is False assert ad_type(21.0).is_integer() is True assert ad_type(-1234.0).is_integer() is True @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_format(ad_type): assert f"{ad_type(1.23):10.5f}" == f"{1.23:10.5f}" assert "{:10.5f}".format(ad_type(1.23)) == "{:10.5f}".format(1.23) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_value_function(ad_type): assert value(3) == 3 assert value(3.2) == approx(3.2) assert value("3") == "3" assert value(ad_type(3.1)) == approx(3.1) @pytest.mark.parametrize("ad_type", [AReal, FReal], ids=["adj", "fwd"]) def test_value_property_get(ad_type): assert ad_type(3.1).value == approx(3.1) def test_derivative_property_get_fwd(): x = FReal(1.2) x.setDerivative(1.0) assert x.derivative == 1.0 def test_derivative_property_set_fwd(): x = FReal(1.2) x.derivative = 1.0 assert x.getDerivative() == 1.0 def test_derivative_property_get_adj(): x = AReal(1.2) with Tape() as tape: tape.registerInput(x) tape.newRecording() y = x tape.registerOutput(y) y.setDerivative(1.0) assert y.derivative == 1.0 def test_derivative_property_set_adj(): x = AReal(1.2) with Tape() as tape: tape.registerInput(x) tape.newRecording() y = x tape.registerOutput(y) y.derivative = 1.0 assert y.getDerivative() == 1.0 def test_derivative_function(): x = AReal(3.2) with Tape() as tape: tape.registerInput(x) tape.newRecording() y_ad = x tape.registerOutput(y_ad) y_ad.setDerivative(1.0) tape.computeAdjoints() assert derivative(x) == x.getDerivative() with raises(TypeError): derivative(1) def test_should_record(): x = AReal(42.0) assert x.shouldRecord() is False with Tape() as tape: tape.registerInput(x) assert x.shouldRecord() is True def test_set_adjoint(): x = AReal(42.0) with Tape() as tape: tape.registerInput(x) tape.newRecording() y = 4 * x tape.registerOutput(x) y.setAdjoint(1.0) tape.computeAdjoints() assert derivative(x) == 4.0 @pytest.mark.parametrize("func,x,y,xd", PARAMETERS_FOR_UNARY_ARITHMETICS) def test_unary_arithmetics_adj(func, x, y, xd): x_ad = AReal(x) with Tape() as tape: tape.registerInput(x_ad) tape.newRecording() y_ad = func(x_ad) tape.registerOutput(y_ad) y_ad.setDerivative(1.0) tape.computeAdjoints() assert y_ad.getValue() == pytest.approx(y) assert x_ad.getDerivative() == pytest.approx(xd) @pytest.mark.parametrize("func,x,y,xd", PARAMETERS_FOR_UNARY_ARITHMETICS) def test_unary_arithmetics_fwd(func, x, y, xd): x_ad = FReal(x) x_ad.setDerivative(1.0) y_ad = func(x_ad) assert y_ad == y assert y_ad.getDerivative() == xd @pytest.mark.parametrize("func,x,y,xd", PARAMETERS_FOR_BINARY_ARITHMETICS_1_ACTIVE_OPERAND) def test_binary_arithmetics_fwd(func, x, y, xd): x1_ad = FReal(x) x1_ad.setDerivative(1.0) y_ad = func(x1_ad) assert y_ad.getValue() == pytest.approx(y) assert y_ad.getDerivative() == pytest.approx(xd) @pytest.mark.parametrize("func,x,y,xd", PARAMETERS_FOR_BINARY_ARITHMETICS_1_ACTIVE_OPERAND) def test_binary_arithmetics_adj(func, x, y, xd): x_ad = AReal(x) with Tape() as tape: tape.registerInput(x_ad) tape.newRecording() y_ad = func(x_ad) tape.registerOutput(y_ad) y_ad.setDerivative(1.0) tape.computeAdjoints() assert y_ad.getValue() == pytest.approx(y) assert x_ad.getDerivative() == pytest.approx(xd) @pytest.mark.parametrize( "func,x1, x2,y,xd1, xd2", PARAMETERS_FOR_BINARY_ARITHMETICS_2_ACTIVE_OPERANDS ) def test_binary_with_2_active_operands_adj(func, x1, x2, y, xd1, xd2): x1_ad = AReal(x1) x2_ad = AReal(x2) with Tape() as tape: tape.registerInput(x1_ad) tape.registerInput(x2_ad) tape.newRecording() y_ad = func(x1_ad, x2_ad) tape.registerOutput(y_ad) y_ad.setDerivative(1.0) tape.computeAdjoints() assert y_ad == pytest.approx(y) assert x1_ad.getDerivative() == pytest.approx(xd1) assert x2_ad.getDerivative() == pytest.approx(xd2) @pytest.mark.parametrize( "func,x1, x2,y,xd1, xd2", PARAMETERS_FOR_BINARY_ARITHMETICS_2_ACTIVE_OPERANDS ) @pytest.mark.parametrize("deriv", [1, 2]) def test_binary_with_2_active_operands_fwd(func, x1, x2, y, xd1, xd2, deriv): x1_ad = FReal(x1) x2_ad = FReal(x2) if deriv == 1: x1_ad.setDerivative(1.0) else: x2_ad.setDerivative(1.0) y_ad = func(x1_ad, x2_ad) assert y_ad.getValue() == pytest.approx(y) if deriv == 1: assert y_ad.getDerivative() == pytest.approx(xd1) else: assert y_ad.getDerivative() == pytest.approx(xd2)
20,374
Python
.py
494
36.973684
91
0.624766
auto-differentiation/xad-py
8
1
12
AGPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,674
model_cl.py
disungatullina_MinBackProp/model_cl.py
import time from ransac import RANSAC from estimators.essential_matrix_estimator_nister import * from samplers.uniform_sampler import * from samplers.gumbel_sampler import * from scorings.msac_score import * import torch.nn as nn import torch.nn.functional as F from cv_utils import * def batch_episym(x1, x2, F): batch_size, num_pts = x1.shape[0], x1.shape[1] x1 = torch.cat([x1, x1.new_ones(batch_size, num_pts, 1)], dim=-1).reshape( batch_size, num_pts, 3, 1 ) x2 = torch.cat([x2, x2.new_ones(batch_size, num_pts, 1)], dim=-1).reshape( batch_size, num_pts, 3, 1 ) F = F.reshape(-1, 1, 3, 3).repeat(1, num_pts, 1, 1) x2Fx1 = torch.matmul(x2.transpose(2, 3), torch.matmul(F, x1)).reshape( batch_size, num_pts ) Fx1 = torch.matmul(F, x1).reshape(batch_size, num_pts, 3) Ftx2 = torch.matmul(F.transpose(2, 3), x2).reshape(batch_size, num_pts, 3) ys = x2Fx1**2 * ( 1.0 / (Fx1[:, :, 0] ** 2 + Fx1[:, :, 1] ** 2 + 1e-15) + 1.0 / (Ftx2[:, :, 0] ** 2 + Ftx2[:, :, 1] ** 2 + 1e-15) ) return ys def knn(x, k): inner = -2 * torch.matmul(x.transpose(2, 1), x) xx = torch.sum(x**2, dim=1, keepdim=True) pairwise_distance = -xx - inner - xx.transpose(2, 1) idx = pairwise_distance.topk(k=k, dim=-1)[1] # (batch_size, num_points, k) return idx[:, :, :] def get_graph_feature(x, k=20, idx=None): batch_size = x.size(0) num_points = x.size(2) x = x.view(batch_size, -1, num_points) if idx is None: idx_out = knn(x, k=k) else: idx_out = idx device = x.device idx_base = torch.arange(0, batch_size, device=device).view(-1, 1, 1) * num_points idx = idx_out + idx_base idx = idx.view(-1) _, num_dims, _ = x.size() x = x.transpose(2, 1).contiguous() feature = x.view(batch_size * num_points, -1)[idx, :] feature = feature.view(batch_size, num_points, k, num_dims) x = x.view(batch_size, num_points, 1, num_dims).repeat(1, 1, k, 1) feature = torch.cat((x, x - feature), dim=3).permute(0, 3, 1, 2).contiguous() return feature class ResNet_Block(nn.Module): def __init__(self, inchannel, outchannel, pre=False): super(ResNet_Block, self).__init__() self.pre = pre self.right = nn.Sequential( nn.Conv2d(inchannel, outchannel, (1, 1)), ) self.left = nn.Sequential( nn.Conv2d(inchannel, outchannel, (1, 1)), nn.InstanceNorm2d(outchannel), nn.BatchNorm2d(outchannel), nn.ReLU(), nn.Conv2d(outchannel, outchannel, (1, 1)), nn.InstanceNorm2d(outchannel), nn.BatchNorm2d(outchannel), ) def forward(self, x): x1 = self.right(x) if self.pre is True else x out = self.left(x) out = out + x1 return torch.relu(out) class DGCNN_Block(nn.Module): def __init__(self, knn_num=9, in_channel=128): super(DGCNN_Block, self).__init__() self.knn_num = knn_num self.in_channel = in_channel assert self.knn_num == 9 or self.knn_num == 6 if self.knn_num == 9: self.conv = nn.Sequential( nn.Conv2d(self.in_channel * 2, self.in_channel, (1, 3), stride=(1, 3)), nn.BatchNorm2d(self.in_channel), nn.ReLU(inplace=True), nn.Conv2d(self.in_channel, self.in_channel, (1, 3)), nn.BatchNorm2d(self.in_channel), nn.ReLU(inplace=True), ) if self.knn_num == 6: self.conv = nn.Sequential( nn.Conv2d(self.in_channel * 2, self.in_channel, (1, 3), stride=(1, 3)), nn.BatchNorm2d(self.in_channel), nn.ReLU(inplace=True), nn.Conv2d(self.in_channel, self.in_channel, (1, 2)), nn.BatchNorm2d(self.in_channel), nn.ReLU(inplace=True), ) def forward(self, features): B, _, N, _ = features.shape out = get_graph_feature(features, k=self.knn_num) out = self.conv(out) return out class GCN_Block(nn.Module): def __init__(self, in_channel): super(GCN_Block, self).__init__() self.in_channel = in_channel self.conv = nn.Sequential( nn.Conv2d(self.in_channel, self.in_channel, (1, 1)), nn.BatchNorm2d(self.in_channel), nn.ReLU(inplace=True), ) def attention(self, w): w = torch.relu(torch.tanh(w)).unsqueeze(-1) A = torch.bmm(w.transpose(1, 2), w) return A def graph_aggregation(self, x, w): B, _, N, _ = x.size() with torch.no_grad(): A = self.attention(w) I = torch.eye(N).unsqueeze(0).to(x.device, x.dtype).detach() A = A + I D_out = torch.sum(A, dim=-1) D = (1 / D_out) ** 0.5 D = torch.diag_embed(D) L = torch.bmm(D, A) L = torch.bmm(L, D) out = x.squeeze(-1).transpose(1, 2).contiguous() out = torch.bmm(L, out).unsqueeze(-1) out = out.transpose(1, 2).contiguous() return out def forward(self, x, w): out = self.graph_aggregation(x, w) out = self.conv(out) return out class RANSACLayer(nn.Module): def __init__(self, opt, **kwargs): super(RANSACLayer, self).__init__(**kwargs) self.opt = opt if opt.precision == 2: data_type = torch.float64 elif opt.precision == 0: data_type = torch.float16 else: data_type = torch.float32 # Initialize the essential matrix estimator solver = EssentialMatrixEstimatorNister(opt.device, opt.ift) sampler = GumbelSoftmaxSampler( opt.ransac_batch_size, solver.sample_size, device=opt.device, data_type=data_type, ) scoring = MSACScore(self.opt.device) # maximal iteration number, fixed when training, adaptive updating while testing # 5PC max_iters = 100 if opt.tr else 5000 self.estimator = RANSAC( solver, sampler, scoring, max_iterations=max_iters, train=opt.tr, ransac_batch_size=opt.ransac_batch_size, threshold=opt.threshold, ift=opt.ift, ) def forward(self, points, weights, K1, K2, im_size1, im_size2, ground_truth=None): # estimator = self.initialize_ransac(points.shape[0], K1, K2) points_ = points.clone() start_time = time.time() models, _, model_score, iterations = self.estimator( points_, weights, K1, K2, ground_truth ) ransac_time = time.time() - start_time # collect all the models from different iterations if self.opt.tr: Es = torch.cat( list(models.values()) ) # .cpu().detach().numpy() # no gradient again else: Es = models # masks for removing models containing nan values nan_filter = [not (torch.isnan(E).any()) for E in Es] return Es[nan_filter], ransac_time class DS_Block(nn.Module): def __init__( self, initial=False, predict=False, out_channel=128, k_num=8, sampling_rate=0.5 ): super(DS_Block, self).__init__() self.initial = initial self.in_channel = 7 self.out_channel = out_channel self.k_num = k_num # flag if we predict the parametric models or only weights self.predict = predict self.sr = sampling_rate self.conv = nn.Sequential( nn.Conv2d(self.in_channel, self.out_channel, (1, 1)), nn.BatchNorm2d(self.out_channel), nn.ReLU(inplace=True), ) self.gcn = GCN_Block(self.out_channel) self.embed_0 = nn.Sequential( ResNet_Block(self.out_channel, self.out_channel, pre=False), ResNet_Block(self.out_channel, self.out_channel, pre=False), ResNet_Block(self.out_channel, self.out_channel, pre=False), ResNet_Block(self.out_channel, self.out_channel, pre=False), DGCNN_Block(self.k_num, self.out_channel), ResNet_Block(self.out_channel, self.out_channel, pre=False), ResNet_Block(self.out_channel, self.out_channel, pre=False), ResNet_Block(self.out_channel, self.out_channel, pre=False), ResNet_Block(self.out_channel, self.out_channel, pre=False), ) self.embed_1 = nn.Sequential( ResNet_Block(self.out_channel, self.out_channel, pre=False), ) self.linear_0 = nn.Conv2d(self.out_channel, 1, (1, 1)) self.linear_1 = nn.Conv2d(self.out_channel, 1, (1, 1)) if self.predict: self.embed_2 = ResNet_Block(self.out_channel, self.out_channel, pre=False) self.linear_2 = nn.Conv2d(self.out_channel, 2, (1, 1)) def down_sampling(self, x, y, weights, indices, features=None, predict=False): B, _, N, _ = x.size() indices = indices[:, : int(N * self.sr)] with torch.no_grad(): y_out = torch.gather(y, dim=-1, index=indices) w_out = torch.gather(weights, dim=-1, index=indices) indices = indices.view(B, 1, -1, 1) if predict: with torch.no_grad(): x_out = torch.gather( x[:, :, :, :4], dim=2, index=indices.repeat(1, 1, 1, 4) ) return x_out, y_out, w_out else: with torch.no_grad(): x_out = torch.gather( x[:, :, :, :4], dim=2, index=indices.repeat(1, 1, 1, 4) ) feature_out = torch.gather( features, dim=2, index=indices.repeat(1, 128, 1, 1) ) return x_out, y_out, w_out, feature_out def forward(self, x): B, _, N, _ = x.size() out = self.conv(x) out = self.embed_0(out) w0 = self.linear_0(out).view(B, -1) out_g = self.gcn(out, w0.detach()) out = out_g + out out = self.embed_1(out) w1 = self.linear_1(out).view(B, -1) return w1 class DeepRansac_CLNet(nn.Module): def __init__(self, opt): super(DeepRansac_CLNet, self).__init__() self.opt = opt # consensus learning layer, to learn inlier probabilities self.ds_0 = DS_Block( initial=True, predict=False, out_channel=128, k_num=9, sampling_rate=1.0 ) # custom-layer, Generalized Differentiable RANSAC, to estimate model self.ransac_layer = RANSACLayer(opt) def forward( self, points, K1, K2, im_size1, im_size2, prob_type=0, gt=None, predict=True ): B, _, N, _ = points.shape w1 = self.ds_0(points) if torch.isnan(w1.std()): print("output is nan here") if torch.isnan(w1).any(): raise Exception("the predicted weights are nan") log_probs = F.logsigmoid(w1).view(B, -1) # normalization in log space such that probabilities sum to 1 if torch.isnan(log_probs).any(): print("predicted log probs have nan values") # normalizer = torch.logsumexp(log_probs, dim=1) # normalizer = normalizer.unsqueeze(1).expand(-1, N) # logits = log_probs - normalizer # weights = torch.exp(logits) weights = torch.exp(log_probs).view(log_probs.shape[0], -1) normalized_weights = weights / torch.sum(weights, dim=-1).unsqueeze(-1) if prob_type == 0: # normalized weights output_weights = normalized_weights.clone() elif prob_type == 1: # unnormalized weights output_weights = weights.clone() else: # logits output_weights = log_probs.clone() if torch.isnan(output_weights).any(): # This should never happen! Debug here print("nan values in weights", weights) ret = [] avg_time = 0 if predict: for b in range(B): if gt is not None: Es, ransac_time = self.ransac_layer( points.squeeze(-1)[b, 0:4].T, output_weights[b], K1[b], K2[b], im_size1[b], im_size2[b], gt[b], ) else: Es, ransac_time = self.ransac_layer( points.squeeze(-1)[b, 0:4].T, output_weights[b], K1[b], K2[b], im_size1[b], im_size2[b], ) ret.append(Es) avg_time += ransac_time return ret, output_weights, avg_time / B else: return output_weights, avg_time / B class CLNet(nn.Module): def __init__(self): super(CLNet, self).__init__() # consensus learning layer, to learn inlier probabilities self.ds_0 = DS_Block( initial=True, predict=False, out_channel=128, k_num=9, sampling_rate=1.0 ) def forward(self, points, prob_type=0): B, _, N, _ = points.shape # import pdb; pdb.set_trace() w1 = self.ds_0(points) if torch.isnan(w1.std()): print("output is nan here") if torch.isnan(w1).any(): raise Exception("the predicted weights are nan") log_probs = F.logsigmoid(w1).view(B, -1) # normalization in log space such that probabilities sum to 1 if torch.isnan(log_probs).any(): print("predicted log probs have nan values") weights = torch.exp(log_probs).view(log_probs.shape[0], -1) normalized_weights = weights / torch.sum(weights, dim=-1).unsqueeze(-1) if prob_type == 0: # normalized weights output_weights = normalized_weights.clone() elif prob_type == 1: # unnormalized weights output_weights = weights.clone() else: # logits output_weights = log_probs.clone() if torch.isnan(output_weights).any(): # This should never happen! Debug here print("nan values in weights", weights) return output_weights
14,555
Python
.py
357
30.291317
88
0.551168
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,675
datasets.py
disungatullina_MinBackProp/datasets.py
import math import os import cv2 import h5py import numpy as np import torch import torch.utils.data as data class Dataset(data.Dataset): """From NG-RANSAC collect the correspondences.""" def __init__(self, folders, ratiothreshold=0.8, nfeatures=2000): # access the input points self.nfeatures = nfeatures self.ratiothreshold = ratiothreshold self.minset = 5 self.files = [] for folder in folders: self.files += [folder + f for f in os.listdir(folder)] def __len__(self): return len(self.files) def __getitem__(self, index): data = np.load(self.files[index], allow_pickle=True, encoding="latin1") # correspondence coordinates and matching ratios (side information) pts1, pts2, ratios = data[0], data[1], data[2] # image sizes im_size1, im_size2 = torch.from_numpy(np.asarray(data[3])), torch.from_numpy( np.asarray(data[4]) ) # image calibration parameters K1, K2 = torch.from_numpy(data[5]), torch.from_numpy(data[6]) # ground truth pose gt_R, gt_t = torch.from_numpy(data[7]), torch.from_numpy(data[8]) # feature scale and orientation f_size1, f_size2 = torch.from_numpy(np.asarray(data[9])), torch.from_numpy( np.asarray(data[11]) ) ang1, ang2 = torch.from_numpy(np.asarray(data[10])), torch.from_numpy( np.asarray(data[12]) ) # des1, des2 = torch.from_numpy(data[13]), torch.from_numpy(data[14]) # applying Lowes ratio criterion ratio_filter = ratios[0, :, 0] < self.ratiothreshold if ( ratio_filter.sum() < self.minset ): # ensure a minimum count of correspondences print( "WARNING! Ratio filter too strict. Only %d correspondences would be left, so I skip it." % int(ratio_filter.sum()) ) else: pts1 = pts1[:, ratio_filter, :] pts2 = pts2[:, ratio_filter, :] ratios = ratios[:, ratio_filter, :] f_size1 = f_size1[:, ratio_filter, :] f_size2 = f_size2[:, ratio_filter, :] ang1 = ang1[:, ratio_filter, :] ang2 = ang2[:, ratio_filter, :] scale_ratio = f_size2 / f_size1 ang = ((ang2 - ang1) % 180) * (3.141592653 / 180) # for essential matrices, normalize image coordinate using the calibration parameters pts1 = cv2.undistortPoints(pts1, K1.numpy(), None) pts2 = cv2.undistortPoints(pts2, K2.numpy(), None) # due to the opencv version issue, here transform it pts1_tran = list([j.tolist() for i in pts1 for j in i]) pts2_tran = list([j.tolist() for i in pts2 for j in i]) # stack image coordinates and side information into one tensor correspondences = np.concatenate( (np.array([pts1_tran]), np.array([pts2_tran]), ratios, scale_ratio, ang), axis=2, ) # correspondences = np.concatenate((pts1, pts2, ratios, scale_ratio, ang), axis=2) correspondences = np.transpose(correspondences) correspondences = torch.from_numpy(correspondences) if self.nfeatures > 0: # ensure that there are exactly nfeatures entries in the data tensor if correspondences.size(1) > self.nfeatures: rnd = torch.randperm(correspondences.size(1)) correspondences = correspondences[:, rnd, :] correspondences = correspondences[:, 0 : self.nfeatures] if correspondences.size(1) < self.nfeatures: result = correspondences for i in range( 0, math.ceil(self.nfeatures / correspondences.size(1) - 1) ): rnd = torch.randperm(correspondences.size(1)) result = torch.cat((result, correspondences[:, rnd, :]), dim=1) correspondences = result[:, 0 : self.nfeatures] # construct the ground truth essential matrix from the ground truth relative pose gt_E = torch.zeros((3, 3), dtype=torch.float32) gt_E[0, 1] = -float(gt_t[2, 0]) gt_E[0, 2] = float(gt_t[1, 0]) gt_E[1, 0] = float(gt_t[2, 0]) gt_E[1, 2] = -float(gt_t[0, 0]) gt_E[2, 0] = -float(gt_t[1, 0]) gt_E[2, 1] = float(gt_t[0, 0]) gt_E = gt_E.mm(gt_R) return { "correspondences": correspondences.float(), "gt_E": gt_E, "gt_R": gt_R, "gt_t": gt_t, "K1": K1, "K2": K2, "im_size1": im_size1, "im_size2": im_size2, "files": self.files[index], } # class DatasetZero(data.Dataset): # """From NG-RANSAC collect the correspondences.""" # def __init__(self, folder, ratiothreshold=0.8, nfeatures=2000, fmat=False): # # access the input points # self.nfeatures = nfeatures # self.ratiothreshold = ratiothreshold # self.fmat = fmat # estimate fundamental matrix instead of essential matrix # self.minset = 7 if self.fmat else 5 # self.files = [] # self.files += [folder + f for f in os.listdir(folder)] # def __len__(self): # return len(self.files) # def __getitem__(self, index): # data = np.load(self.files[index], allow_pickle=True, encoding='latin1') # # correspondence coordinates and matching ratios (side information) # pts1, pts2, ratios = data[0], data[1], data[2] # # image sizes # im_size1, im_size2 = torch.from_numpy(np.asarray(data[3])), torch.from_numpy(np.asarray(data[4])) # # image calibration parameters # K1, K2 = torch.from_numpy(data[5]), torch.from_numpy(data[6]) # # ground truth pose # gt_R, gt_t = torch.from_numpy(data[7]), torch.from_numpy(data[8]) # # feature scale and orientation # f_size1, f_size2 = torch.from_numpy(np.asarray(data[9])), torch.from_numpy(np.asarray(data[11])) # ang1, ang2 = torch.from_numpy(np.asarray(data[10])), torch.from_numpy(np.asarray(data[12])) # # des1, des2 = torch.from_numpy(data[13]), torch.from_numpy(data[14]) # # applying Lowes ratio criterion # ratio_filter = ratios[0, :, 0] < self.ratiothreshold # if ratio_filter.sum() < self.minset: # ensure a minimum count of correspondences # print("WARNING! Ratio filter too strict. Only %d correspondences would be left, so I skip it." % int( # ratio_filter.sum())) # else: # pts1 = pts1[:, ratio_filter, :] # pts2 = pts2[:, ratio_filter, :] # ratios = ratios[:, ratio_filter, :] # f_size1 = f_size1[:, ratio_filter, :] # f_size2 = f_size2[:, ratio_filter, :] # ang1 = ang1[:, ratio_filter, :] # ang2 = ang2[:, ratio_filter, :] # scale_ratio = f_size2 / f_size1 # ang = ((ang2 - ang1) % 180) * (3.141592653 / 180) # if self.fmat: # # for fundamental matrices, normalize image coordinates using the image size # # (network should be independent to resolution) # pts1[0, :, 0] -= float(im_size1[1]) / 2 # pts1[0, :, 1] -= float(im_size1[0]) / 2 # pts1 /= float(max(im_size1)) # pts2[0, :, 0] -= float(im_size2[1]) / 2 # pts2[0, :, 1] -= float(im_size2[0]) / 2 # pts2 /= float(max(im_size2)) # #utils.normalize_pts(pts1, im_size1) # #utils.normalize_pts(pts2, im_size2) # correspondences = np.concatenate((pts1, pts2, ratios, scale_ratio, ang), axis=2) # else: # # for essential matrices, normalize image coordinate using the calibration parameters # pts1 = cv2.undistortPoints(pts1, K1.numpy(), None) # pts2 = cv2.undistortPoints(pts2, K2.numpy(), None) # # due to the opencv version issue, here transform it # pts1_tran = list([j.tolist() for i in pts1 for j in i]) # pts2_tran = list([j.tolist() for i in pts2 for j in i]) # # stack image coordinates and side information into one tensor # correspondences = np.concatenate((np.array([pts1_tran]), np.array([pts2_tran]), ratios, scale_ratio, ang), # axis=2) # # correspondences = np.concatenate((pts1, pts2, ratios, scale_ratio, ang), axis=2) # correspondences = np.transpose(correspondences) # correspondences = torch.from_numpy(correspondences) # if self.nfeatures > 0: # # ensure that there are exactly nfeatures entries in the data tensor # if correspondences.size(1) > self.nfeatures: # rnd = torch.randperm(correspondences.size(1)) # correspondences = correspondences[:, rnd, :] # correspondences = correspondences[:, 0:self.nfeatures] # if correspondences.size(1) < self.nfeatures: # result = correspondences # correspondences = torch.zeros(correspondences.size(0), self.nfeatures, correspondences.size(2)) # correspondences[:, 0:result.size(1)] = result # # construct the ground truth essential matrix from the ground truth relative pose # gt_E = torch.zeros((3, 3), dtype=torch.float32) # gt_E[0, 1] = -float(gt_t[2, 0]) # gt_E[0, 2] = float(gt_t[1, 0]) # gt_E[1, 0] = float(gt_t[2, 0]) # gt_E[1, 2] = -float(gt_t[0, 0]) # gt_E[2, 0] = -float(gt_t[1, 0]) # gt_E[2, 1] = float(gt_t[0, 0]) # gt_E = gt_E.mm(gt_R) # # fundamental matrix from essential matrix # gt_F = K2.inverse().transpose(0, 1).mm(gt_E).mm(K1.inverse()) # return {'correspondences': correspondences.float(), 'gt_F': gt_F, 'gt_E': gt_E, 'gt_R': gt_R, 'gt_t': gt_t, # 'K1': K1, 'K2': K2, 'im_size1': im_size1, 'im_size2': im_size2, 'files': self.files[index]} # class DatasetPictureTest(data.Dataset): # """Rewrite data collector based on NG-RANSAC collect the correspondences.""" # def __init__(self, folder, ratiothreshold=0.8, nfeatures=2000, fmat=False): # # access the input points # self.nfeatures = nfeatures # self.ratiothreshold = ratiothreshold # self.fmat = fmat # estimate fundamental matrix instead of essential matrix # self.minset = 7 if self.fmat else 5 # scene = folder.split('/')[-2] # keys = np.load(folder.replace(scene + '/', 'evaluation_list/') + scene + '_list.npy') # self.files = [] # self.files += [folder + f for f in os.listdir(folder)] # self.files = sorted(self.files) # self.files_dict = {} # for given_file in self.files: # if 'Egt.h5' in given_file: # self.files_dict['gt_E'] = given_file # elif 'Fgt.h5' in given_file: # self.files_dict['gt_F'] = given_file # elif 'K1_K2.h5' in given_file: # self.files_dict['K1_K2'] = given_file # elif 'R.h5' in given_file: # self.files_dict['R'] = given_file # elif 'T.h5' in given_file: # self.files_dict['T'] = given_file # elif '/images' in given_file: # self.files_dict['img_dir'] = given_file # self.pts1_list = [] # self.pts2_list = [] # for k in keys: # img_id1 = k.split('_')[1] + '_' + k.split('_')[2] # img_id2 = k.split('_')[3] + '_' + k.split('_')[4].split('.')[0] # self.pts1_list.append(img_id1) # self.pts2_list.append(img_id2) # self.gt_F = loadh5(self.files_dict['gt_F']) # self.gt_E =loadh5(self.files_dict['gt_E']) # self.K1_K2 = loadh5(self.files_dict['K1_K2']) # self.R = loadh5(self.files_dict['R']) # self.T = loadh5(self.files_dict['T']) # def __len__(self): # return len(self.pts1_list) # def __getitem__(self, index): # img1 = load_torch_image(self.files_dict['img_dir'] + '/' + self.pts1_list[index] + '.jpg') # img2 = load_torch_image(self.files_dict['img_dir'] + '/' + self.pts2_list[index] + '.jpg') # match_id = self.pts1_list[index] + '-' + self.pts2_list[index] # R1 = self.R[self.pts1_list[index]] # R2 = self.R[self.pts2_list[index]] # T1 = self.T[self.pts1_list[index]] # T2 = self.T[self.pts2_list[index]] # gt_R = np.dot(R2, R1.T) # gt_t = T2 - np.dot(gt_R, T1) # return {"image0": K.color.rgb_to_grayscale(img1).squeeze(0), # LofTR works on grayscale images only # "image1": K.color.rgb_to_grayscale(img2).squeeze(0), # 'gt_F': torch.from_numpy(self.gt_F[match_id]), # 'gt_E': torch.from_numpy(self.gt_E[match_id]), # 'gt_R': gt_R, 'gt_t': gt_t, # 'K1': torch.from_numpy(self.K1_K2[match_id][0][0]), # 'K2': torch.from_numpy(self.K1_K2[match_id][0][1]), # } # class Dataset3D(data.Dataset): # def __init__(self, folders, num=4000): # # access the input points # self.files = [] # for folder in folders: # self.files += [folder + f for f in os.listdir(folder)] # self.num = num # def __len__(self): # return len(self.files) # def __getitem__(self, index): # data = np.load(self.files[index]) # gt_pose = data['transform'] # scores = data['corr_scores'] # pts1 = torch.from_numpy(data['src_corr_points']) # pts2 = torch.from_numpy(data['ref_corr_points']) # # import pdb; pdb.set_trace() # try: # correspondences = np.concatenate((pts1, pts2, np.expand_dims(scores, -1)), axis=-1) # except: # import pdb; pdb.set_trace() # correspondences = torch.from_numpy(correspondences) # if self.num > 0: # # ensure that there are exactly nfeatures entries in the data tensor # if correspondences.shape[0] > self.num: # rnd = torch.randperm(correspondences.shape[0]) # correspondences = correspondences[rnd, :] # correspondences = correspondences[0:self.num] # gt_pose = gt_pose[:self.num] # if correspondences.shape[0] < self.num: # # import pdb; pdb.set_trace() # result = correspondences # for i in range(0, math.ceil(self.num / correspondences.shape[0] - 1)): # rnd = torch.randperm(correspondences.shape[0]) # result = torch.cat((result, correspondences[rnd, :]), dim=0) # correspondences = result[0:self.num] # return { # 'correspondences': correspondences, # 'gt_pose': gt_pose # } # class DatasetPicture(data.Dataset): # """Rewrite data collector based on NG-RANSAC collect the correspondences.""" # def __init__(self, folder, ratiothreshold=0.8, nfeatures=2000, fmat=False, valid=False): # # access the input points # self.nfeatures = nfeatures # self.ratiothreshold = ratiothreshold # self.fmat = fmat # estimate fundamental matrix instead of essential matrix # self.minset = 7 if self.fmat else 5 # with h5py.File(folder + 'Fgt.h5', 'r') as h5file: # keys = list(h5file.keys()) # self.files = [] # scene = folder.split('/')[-2] # if valid: # keys = np.load(folder.replace(scene + '/', 'evaluation_list/') + scene + '_list.npy') # else: # keys = np.load(folder.replace(scene + '/', 'evaluation_list/') + scene + '_train.npy') # self.files += [folder + f for f in os.listdir(folder)] # self.files = sorted(self.files) # self.files_dict = {} # for given_file in self.files: # if 'Egt.h5' in given_file: # self.files_dict['gt_E'] = given_file # elif 'Fgt.h5' in given_file: # self.files_dict['gt_F'] = given_file # elif 'K1_K2.h5' in given_file: # self.files_dict['K1_K2'] = given_file # elif 'R.h5' in given_file: # self.files_dict['R'] = given_file # elif 'T.h5' in given_file: # self.files_dict['T'] = given_file # elif '/images' in given_file: # self.files_dict['img_dir'] = given_file # self.pts1_list = [] # self.pts2_list = [] # for k in keys: # img_id1 = k.split('_')[1] + '_' + k.split('_')[2] # img_id2 = k.split('_')[3] + '_' + k.split('_')[4].split('.')[0] # self.pts1_list.append(img_id1) # self.pts2_list.append(img_id2) # self.gt_F = loadh5(self.files_dict['gt_F']) # self.gt_E =loadh5(self.files_dict['gt_E']) # self.K1_K2 = loadh5(self.files_dict['K1_K2']) # self.R = loadh5(self.files_dict['R']) # self.T = loadh5(self.files_dict['T']) # def __len__(self): # return len(self.pts1_list) # def __getitem__(self, index): # img1 = load_torch_image(self.files_dict['img_dir'] + '/' + self.pts1_list[index] + '.jpg') # img2 = load_torch_image(self.files_dict['img_dir'] + '/' + self.pts2_list[index] + '.jpg') # match_id = self.pts1_list[index] + '-' + self.pts2_list[index] # R1 = self.R[self.pts1_list[index]] # R2 = self.R[self.pts2_list[index]] # T1 = self.T[self.pts1_list[index]] # T2 = self.T[self.pts2_list[index]] # gt_R = np.dot(R2, R1.T) # gt_t = T2 - np.dot(gt_R, T1) # return {"image0": K.color.rgb_to_grayscale(img1).squeeze(0), # LofTR works on grayscale images only # "image1": K.color.rgb_to_grayscale(img2).squeeze(0), # 'gt_F': torch.from_numpy(self.gt_F[match_id]), # 'gt_E': torch.from_numpy(self.gt_E[match_id]), # 'gt_R': gt_R, 'gt_t': gt_t, # 'K1': torch.from_numpy(self.K1_K2[match_id][0][0]), # 'K2': torch.from_numpy(self.K1_K2[match_id][0][1]), # }
18,453
Python
.py
357
47.733894
120
0.553109
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,676
nodes.py
disungatullina_MinBackProp/nodes.py
import math import torch import random import time import numpy as np import torch.nn as nn from torch.autograd import Function from ddn.ddn.pytorch.node import * import estimators.essential_matrix_estimator_nister as ns ############ IFT function ############ class IFTFunction(torch.autograd.Function): # Note that forward, setup_context, and backward are @staticmethods @staticmethod def forward(ctx, minimal_samples, E_true, estimator): """ E_true: 3 x 3 minimal_samples : b x 5 x 4 """ est = estimator.estimate_model(minimal_samples) solution_num = 10 distances = torch.norm( est - E_true.unsqueeze(0).repeat(est.shape[0], 1, 1), dim=(1, 2) ).view(est.shape[0], -1) try: chosen_indices = torch.argmin(distances.view(-1, solution_num), dim=-1) chosen_models = torch.stack( [ (est.view(-1, solution_num, 3, 3))[i, chosen_indices[i], :] for i in range(int(est.shape[0] / solution_num)) ] ) except ValueError as e: print( "not enough models for selection, we choose the first solution in this batch", e, est.shape, ) chosen_models = est[0].unsqueeze(0) ctx.save_for_backward(minimal_samples, chosen_models) return chosen_models @staticmethod # inputs is a Tuple of all of the inputs passed to forward. # output is the output of the forward(). def setup_context(ctx, inputs, output): minimal_samples, _, _ = inputs ctx.save_for_backward(minimal_samples, output) # This function has only a single output, so it gets only one gradient @staticmethod def backward(ctx, grad_output): # This is a pattern that is very convenient - at the top of backward # unpack saved_tensors and initialize all gradients w.r.t. inputs to # None. Thanks to the fact that additional trailing Nones are # ignored, the return statement is simple even when the function has # optional inputs. minimal_samples, output = ctx.saved_tensors # output -- [b, 3, 3] grad_E_true = grad_minimal_samples = None # These needs_input_grad checks are optional and there only to # improve efficiency. If you want to make your code simpler, you can # skip them. Returning gradients for inputs that don't require it is # not an error. b = grad_output.shape[0] # E - bx3x3 ; minimal_sample - bx5x4 ; J_Ex - bx9x20 ; grad_output - bx3x3 J_Ex = compute_jacobians(output, minimal_samples) # b x 9 x 20 J_Ex = torch.einsum("bi,bij->bj", grad_output.view(b, 9), J_Ex) grad_minimal_samples = J_Ex.view(b, 5, 4) return grad_minimal_samples, None, None class IFTLayer(nn.Module): def __init__(self, device, ift): super().__init__() self.estimator = ns.EssentialMatrixEstimatorNister(device=device, ift=ift) def forward(self, minimal_samples, E_true): return IFTFunction.apply(minimal_samples, E_true, self.estimator) def compute_jacobians(E, minimal_sample): """ E -- b x 3 x 3 minimal_sample -- b x 5 x 4 """ b = E.shape[0] E11 = E[:, 0, 0] E12 = E[:, 0, 1] E13 = E[:, 0, 2] E21 = E[:, 1, 0] E22 = E[:, 1, 1] E23 = E[:, 1, 2] E31 = E[:, 2, 0] E32 = E[:, 2, 1] E33 = E[:, 2, 2] x11 = minimal_sample[:, 0, 0] y11 = minimal_sample[:, 0, 1] x12 = minimal_sample[:, 0, 2] y12 = minimal_sample[:, 0, 3] x21 = minimal_sample[:, 1, 0] y21 = minimal_sample[:, 1, 1] x22 = minimal_sample[:, 1, 2] y22 = minimal_sample[:, 1, 3] x31 = minimal_sample[:, 2, 0] y31 = minimal_sample[:, 2, 1] x32 = minimal_sample[:, 2, 2] y32 = minimal_sample[:, 2, 3] x41 = minimal_sample[:, 3, 0] y41 = minimal_sample[:, 3, 1] x42 = minimal_sample[:, 3, 2] y42 = minimal_sample[:, 3, 3] x51 = minimal_sample[:, 4, 0] y51 = minimal_sample[:, 4, 1] x52 = minimal_sample[:, 4, 2] y52 = minimal_sample[:, 4, 3] J_E = torch.zeros((b, 16, 9), device=minimal_sample.device) J_E[:, 0, 0] = x12 * x11 J_E[:, 1, 0] = x22 * x21 J_E[:, 2, 0] = x32 * x31 J_E[:, 3, 0] = x42 * x41 J_E[:, 4, 0] = x52 * x51 J_E[:, 5, 0] = 2 * E11 J_E[:, 6, 0] = ( 3 * E11**2 + E12**2 + E13**2 + E21**2 - E22**2 - E23**2 + E31**2 - E32**2 - E33**2 ) J_E[:, 7, 0] = 2 * E11 * E12 + 2 * E21 * E22 + 2 * E31 * E32 J_E[:, 8, 0] = 2 * E11 * E13 + 2 * E21 * E23 + 2 * E31 * E33 J_E[:, 9, 0] = 2 * E11 * E21 + 2 * E12 * E22 + 2 * E13 * E23 J_E[:, 10, 0] = -2 * E11 * E22 + 2 * E12 * E21 J_E[:, 11, 0] = -2 * E11 * E23 + 2 * E13 * E21 J_E[:, 12, 0] = 2 * E11 * E31 + 2 * E12 * E32 + 2 * E13 * E33 J_E[:, 13, 0] = -2 * E11 * E32 + 2 * E12 * E31 J_E[:, 14, 0] = -2 * E11 * E33 + 2 * E13 * E31 J_E[:, 15, 0] = E22 * E33 - E23 * E32 J_E[:, 0, 1] = x12 * y11 J_E[:, 1, 1] = x22 * y21 J_E[:, 2, 1] = x32 * y31 J_E[:, 3, 1] = x42 * y41 J_E[:, 4, 1] = x52 * y51 J_E[:, 5, 1] = 2 * E12 J_E[:, 6, 1] = 2 * E11 * E12 + 2 * E21 * E22 + 2 * E31 * E32 J_E[:, 7, 1] = ( E11**2 + 3 * E12**2 + E13**2 - E21**2 + E22**2 - E23**2 - E31**2 + E32**2 - E33**2 ) J_E[:, 8, 1] = 2 * E12 * E13 + 2 * E22 * E23 + 2 * E32 * E33 J_E[:, 9, 1] = 2 * E11 * E22 - 2 * E12 * E21 J_E[:, 10, 1] = 2 * E11 * E21 + 2 * E12 * E22 + 2 * E13 * E23 J_E[:, 11, 1] = -2 * E12 * E23 + 2 * E13 * E22 J_E[:, 12, 1] = 2 * E11 * E32 - 2 * E12 * E31 J_E[:, 13, 1] = 2 * E11 * E31 + 2 * E12 * E32 + 2 * E13 * E33 J_E[:, 14, 1] = -2 * E12 * E33 + 2 * E13 * E32 J_E[:, 15, 1] = -E21 * E33 + E23 * E31 J_E[:, 0, 2] = x12 J_E[:, 1, 2] = x22 J_E[:, 2, 2] = x32 J_E[:, 3, 2] = x42 J_E[:, 4, 2] = x52 J_E[:, 5, 2] = 2 * E13 J_E[:, 6, 2] = 2 * E11 * E13 + 2 * E21 * E23 + 2 * E31 * E33 J_E[:, 7, 2] = 2 * E12 * E13 + 2 * E22 * E23 + 2 * E32 * E33 J_E[:, 8, 2] = ( E11**2 + E12**2 + 3 * E13**2 - E21**2 - E22**2 + E23**2 - E31**2 - E32**2 + E33**2 ) J_E[:, 9, 2] = 2 * E11 * E23 - 2 * E13 * E21 J_E[:, 10, 2] = 2 * E12 * E23 - 2 * E13 * E22 J_E[:, 11, 2] = 2 * E11 * E21 + 2 * E12 * E22 + 2 * E13 * E23 J_E[:, 12, 2] = 2 * E11 * E33 - 2 * E13 * E31 J_E[:, 13, 2] = 2 * E12 * E33 - 2 * E13 * E32 J_E[:, 14, 2] = 2 * E11 * E31 + 2 * E12 * E32 + 2 * E13 * E33 J_E[:, 15, 2] = E21 * E32 - E22 * E31 J_E[:, 0, 3] = y12 * y11 J_E[:, 1, 3] = y22 * y21 J_E[:, 2, 3] = y32 * y31 J_E[:, 3, 3] = y42 * y41 J_E[:, 4, 3] = y52 * y51 J_E[:, 5, 3] = 2 * E21 J_E[:, 6, 3] = 2 * E11 * E21 + 2 * E12 * E22 + 2 * E13 * E23 J_E[:, 7, 3] = 2 * E11 * E22 - 2 * E12 * E21 J_E[:, 8, 3] = 2 * E11 * E23 - 2 * E13 * E21 J_E[:, 9, 3] = ( E11**2 - E12**2 - E13**2 + 3 * E21**2 + E22**2 + E23**2 + E31**2 - E32**2 - E33**2 ) J_E[:, 10, 3] = 2 * E11 * E12 + 2 * E21 * E22 + 2 * E31 * E32 J_E[:, 11, 3] = 2 * E11 * E13 + 2 * E21 * E23 + 2 * E31 * E33 J_E[:, 12, 3] = 2 * E21 * E31 + 2 * E22 * E32 + 2 * E23 * E33 J_E[:, 13, 3] = -2 * E21 * E32 + 2 * E22 * E31 J_E[:, 14, 3] = -2 * E21 * E33 + 2 * E23 * E31 J_E[:, 15, 3] = -E12 * E33 + E13 * E32 J_E[:, 0, 4] = y12 * y11 J_E[:, 1, 4] = y22 * y21 J_E[:, 2, 4] = y32 * y31 J_E[:, 3, 4] = y42 * y41 J_E[:, 4, 4] = y52 * y51 J_E[:, 5, 4] = 2 * E22 J_E[:, 6, 4] = -2 * E11 * E22 + 2 * E12 * E21 J_E[:, 7, 4] = 2 * E11 * E21 + 2 * E12 * E22 + 2 * E13 * E23 J_E[:, 8, 4] = 2 * E12 * E23 - 2 * E13 * E22 J_E[:, 9, 4] = 2 * E11 * E12 + 2 * E21 * E22 + 2 * E31 * E32 J_E[:, 10, 4] = ( -(E11**2) + E12**2 - E13**2 + E21**2 + 3 * E22**2 + E23**2 - E31**2 + E32**2 - E33**2 ) J_E[:, 11, 4] = 2 * E12 * E13 + 2 * E22 * E23 + 2 * E32 * E33 J_E[:, 12, 4] = 2 * E21 * E32 - 2 * E22 * E31 J_E[:, 13, 4] = 2 * E21 * E31 + 2 * E22 * E32 + 2 * E23 * E33 J_E[:, 14, 4] = -2 * E22 * E33 + 2 * E23 * E32 J_E[:, 15, 4] = E11 * E33 - E13 * E31 J_E[:, 0, 5] = y12 J_E[:, 1, 5] = y22 J_E[:, 2, 5] = y32 J_E[:, 3, 5] = y42 J_E[:, 4, 5] = y52 J_E[:, 5, 5] = 2 * E23 J_E[:, 6, 5] = -2 * E11 * E23 + 2 * E13 * E21 J_E[:, 7, 5] = -2 * E12 * E23 + 2 * E13 * E22 J_E[:, 8, 5] = 2 * E11 * E21 + 2 * E12 * E22 + 2 * E13 * E23 J_E[:, 9, 5] = 2 * E11 * E13 + 2 * E21 * E23 + 2 * E31 * E33 J_E[:, 10, 5] = 2 * E12 * E13 + 2 * E22 * E23 + 2 * E32 * E33 J_E[:, 11, 5] = ( -(E11**2) - E12**2 + E13**2 + E21**2 + E22**2 + 3 * E23**2 - E31**2 - E32**2 + E33**2 ) J_E[:, 12, 5] = 2 * E21 * E33 - 2 * E23 * E31 J_E[:, 13, 5] = 2 * E22 * E33 - 2 * E23 * E32 J_E[:, 14, 5] = 2 * E21 * E31 + 2 * E22 * E32 + 2 * E23 * E33 J_E[:, 15, 5] = -E11 * E32 + E12 * E31 J_E[:, 0, 6] = x11 J_E[:, 1, 6] = x21 J_E[:, 2, 6] = x31 J_E[:, 3, 6] = x41 J_E[:, 4, 6] = x51 J_E[:, 5, 6] = 2 * E31 J_E[:, 6, 6] = 2 * E11 * E31 + 2 * E12 * E32 + 2 * E13 * E33 J_E[:, 7, 6] = 2 * E11 * E32 - 2 * E12 * E31 J_E[:, 8, 6] = 2 * E11 * E33 - 2 * E13 * E31 J_E[:, 9, 6] = 2 * E21 * E31 + 2 * E22 * E32 + 2 * E23 * E33 J_E[:, 10, 6] = 2 * E21 * E32 - 2 * E22 * E31 J_E[:, 11, 6] = 2 * E21 * E33 - 2 * E23 * E31 J_E[:, 12, 6] = ( E11**2 - E12**2 - E13**2 + E21**2 - E22**2 - E23**2 + 3 * E31**2 + E32**2 + E33**2 ) J_E[:, 13, 6] = 2 * E11 * E12 + 2 * E21 * E22 + 2 * E31 * E32 J_E[:, 14, 6] = 2 * E11 * E13 + 2 * E21 * E23 + 2 * E31 * E33 J_E[:, 15, 6] = E12 * E23 - E13 * E22 J_E[:, 0, 7] = y11 J_E[:, 1, 7] = y21 J_E[:, 2, 7] = y31 J_E[:, 3, 7] = y41 J_E[:, 4, 7] = y51 J_E[:, 5, 7] = 2 * E32 J_E[:, 6, 7] = -2 * E11 * E32 + 2 * E12 * E31 J_E[:, 7, 7] = 2 * E11 * E31 + 2 * E12 * E32 + 2 * E13 * E33 J_E[:, 8, 7] = 2 * E12 * E33 - 2 * E13 * E32 J_E[:, 9, 7] = -2 * E21 * E32 + 2 * E22 * E31 J_E[:, 10, 7] = 2 * E21 * E31 + 2 * E22 * E32 + 2 * E23 * E33 J_E[:, 11, 7] = 2 * E22 * E33 - 2 * E23 * E32 J_E[:, 12, 7] = 2 * E11 * E12 + 2 * E21 * E22 + 2 * E31 * E32 J_E[:, 13, 7] = ( -(E11**2) + E12**2 - E13**2 - E21**2 + E22**2 - E23**2 + E31**2 + 3 * E32**2 + E33**2 ) J_E[:, 14, 7] = 2 * E12 * E13 + 2 * E22 * E23 + 2 * E32 * E33 J_E[:, 15, 7] = -E11 * E23 + E13 * E21 J_E[:, 0, 8] = 1 J_E[:, 1, 8] = 1 J_E[:, 2, 8] = 1 J_E[:, 3, 8] = 1 J_E[:, 4, 8] = 1 J_E[:, 5, 8] = 2 * E33 J_E[:, 6, 8] = -2 * E11 * E33 + 2 * E13 * E31 J_E[:, 7, 8] = -2 * E12 * E33 + 2 * E13 * E32 J_E[:, 8, 8] = 2 * E11 * E31 + 2 * E12 * E32 + 2 * E13 * E33 J_E[:, 9, 8] = -2 * E21 * E33 + 2 * E23 * E31 J_E[:, 10, 8] = -2 * E22 * E33 + 2 * E23 * E32 J_E[:, 11, 8] = 2 * E21 * E31 + 2 * E22 * E32 + 2 * E23 * E33 J_E[:, 12, 8] = 2 * E11 * E13 + 2 * E21 * E23 + 2 * E31 * E33 J_E[:, 13, 8] = 2 * E12 * E13 + 2 * E22 * E23 + 2 * E32 * E33 J_E[:, 14, 8] = ( -(E11**2) - E12**2 + E13**2 - E21**2 - E22**2 + E23**2 + E31**2 + E32**2 + 3 * E33**2 ) J_E[:, 15, 8] = E11 * E22 - E12 * E21 J_x = torch.zeros((b, 16, 20), device=minimal_sample.device) J_x[:, 0, 0] = E11 * x12 + E21 * y12 + E31 J_x[:, 1, 0] = 0 J_x[:, 2, 0] = 0 J_x[:, 3, 0] = 0 J_x[:, 4, 0] = 0 J_x[:, 5, 0] = 0 J_x[:, 6, 0] = 0 J_x[:, 7, 0] = 0 J_x[:, 8, 0] = 0 J_x[:, 9, 0] = 0 J_x[:, 10, 0] = 0 J_x[:, 11, 0] = 0 J_x[:, 12, 0] = 0 J_x[:, 13, 0] = 0 J_x[:, 14, 0] = 0 J_x[:, 15, 0] = 0 J_x[:, 0, 1] = E12 * x12 + E22 * y12 + E32 J_x[:, 1, 1] = 0 J_x[:, 2, 1] = 0 J_x[:, 3, 1] = 0 J_x[:, 4, 1] = 0 J_x[:, 5, 1] = 0 J_x[:, 6, 1] = 0 J_x[:, 7, 1] = 0 J_x[:, 8, 1] = 0 J_x[:, 9, 1] = 0 J_x[:, 10, 1] = 0 J_x[:, 11, 1] = 0 J_x[:, 12, 1] = 0 J_x[:, 13, 1] = 0 J_x[:, 14, 1] = 0 J_x[:, 15, 1] = 0 J_x[:, 0, 2] = E11 * x11 + E12 * y11 + E13 J_x[:, 1, 2] = 0 J_x[:, 2, 2] = 0 J_x[:, 3, 2] = 0 J_x[:, 4, 2] = 0 J_x[:, 5, 2] = 0 J_x[:, 6, 2] = 0 J_x[:, 7, 2] = 0 J_x[:, 8, 2] = 0 J_x[:, 9, 2] = 0 J_x[:, 10, 2] = 0 J_x[:, 11, 2] = 0 J_x[:, 12, 2] = 0 J_x[:, 13, 2] = 0 J_x[:, 14, 2] = 0 J_x[:, 15, 2] = 0 J_x[:, 0, 3] = E21 * x11 + E22 * y11 + E23 J_x[:, 1, 3] = 0 J_x[:, 2, 3] = 0 J_x[:, 3, 3] = 0 J_x[:, 4, 3] = 0 J_x[:, 5, 3] = 0 J_x[:, 6, 3] = 0 J_x[:, 7, 3] = 0 J_x[:, 8, 3] = 0 J_x[:, 9, 3] = 0 J_x[:, 10, 3] = 0 J_x[:, 11, 3] = 0 J_x[:, 12, 3] = 0 J_x[:, 13, 3] = 0 J_x[:, 14, 3] = 0 J_x[:, 15, 3] = 0 J_x[:, 0, 4] = 0 J_x[:, 1, 4] = E11 * x22 + E21 * y22 + E31 J_x[:, 2, 4] = 0 J_x[:, 3, 4] = 0 J_x[:, 4, 4] = 0 J_x[:, 5, 4] = 0 J_x[:, 6, 4] = 0 J_x[:, 7, 4] = 0 J_x[:, 8, 4] = 0 J_x[:, 9, 4] = 0 J_x[:, 10, 4] = 0 J_x[:, 11, 4] = 0 J_x[:, 12, 4] = 0 J_x[:, 13, 4] = 0 J_x[:, 14, 4] = 0 J_x[:, 15, 4] = 0 J_x[:, 0, 5] = 0 J_x[:, 1, 5] = E12 * x22 + E22 * y22 + E32 J_x[:, 2, 5] = 0 J_x[:, 3, 5] = 0 J_x[:, 4, 5] = 0 J_x[:, 5, 5] = 0 J_x[:, 6, 5] = 0 J_x[:, 7, 5] = 0 J_x[:, 8, 5] = 0 J_x[:, 9, 5] = 0 J_x[:, 10, 5] = 0 J_x[:, 11, 5] = 0 J_x[:, 12, 5] = 0 J_x[:, 13, 5] = 0 J_x[:, 14, 5] = 0 J_x[:, 15, 5] = 0 J_x[:, 0, 6] = 0 J_x[:, 1, 6] = E11 * x21 + E12 * y21 + E13 J_x[:, 2, 6] = 0 J_x[:, 3, 6] = 0 J_x[:, 4, 6] = 0 J_x[:, 5, 6] = 0 J_x[:, 6, 6] = 0 J_x[:, 7, 6] = 0 J_x[:, 8, 6] = 0 J_x[:, 9, 6] = 0 J_x[:, 10, 6] = 0 J_x[:, 11, 6] = 0 J_x[:, 12, 6] = 0 J_x[:, 13, 6] = 0 J_x[:, 14, 6] = 0 J_x[:, 15, 6] = 0 J_x[:, 0, 7] = 0 J_x[:, 1, 7] = E21 * x21 + E22 * y21 + E23 J_x[:, 2, 7] = 0 J_x[:, 3, 7] = 0 J_x[:, 4, 7] = 0 J_x[:, 5, 7] = 0 J_x[:, 6, 7] = 0 J_x[:, 7, 7] = 0 J_x[:, 8, 7] = 0 J_x[:, 9, 7] = 0 J_x[:, 10, 7] = 0 J_x[:, 11, 7] = 0 J_x[:, 12, 7] = 0 J_x[:, 13, 7] = 0 J_x[:, 14, 7] = 0 J_x[:, 15, 7] = 0 J_x[:, 0, 8] = 0 J_x[:, 1, 8] = 0 J_x[:, 2, 8] = E11 * x32 + E21 * y32 + E31 J_x[:, 3, 8] = 0 J_x[:, 4, 8] = 0 J_x[:, 5, 8] = 0 J_x[:, 6, 8] = 0 J_x[:, 7, 8] = 0 J_x[:, 8, 8] = 0 J_x[:, 9, 8] = 0 J_x[:, 10, 8] = 0 J_x[:, 11, 8] = 0 J_x[:, 12, 8] = 0 J_x[:, 13, 8] = 0 J_x[:, 14, 8] = 0 J_x[:, 15, 8] = 0 J_x[:, 0, 9] = 0 J_x[:, 1, 9] = 0 J_x[:, 2, 9] = E12 * x32 + E22 * y32 + E32 J_x[:, 3, 9] = 0 J_x[:, 4, 9] = 0 J_x[:, 5, 9] = 0 J_x[:, 6, 9] = 0 J_x[:, 7, 9] = 0 J_x[:, 8, 9] = 0 J_x[:, 9, 9] = 0 J_x[:, 10, 9] = 0 J_x[:, 11, 9] = 0 J_x[:, 12, 9] = 0 J_x[:, 13, 9] = 0 J_x[:, 14, 9] = 0 J_x[:, 15, 9] = 0 J_x[:, 0, 10] = 0 J_x[:, 1, 10] = 0 J_x[:, 2, 10] = E11 * x31 + E12 * y31 + E13 J_x[:, 3, 10] = 0 J_x[:, 4, 10] = 0 J_x[:, 5, 10] = 0 J_x[:, 6, 10] = 0 J_x[:, 7, 10] = 0 J_x[:, 8, 10] = 0 J_x[:, 9, 10] = 0 J_x[:, 10, 10] = 0 J_x[:, 11, 10] = 0 J_x[:, 12, 10] = 0 J_x[:, 13, 10] = 0 J_x[:, 14, 10] = 0 J_x[:, 15, 10] = 0 J_x[:, 0, 11] = 0 J_x[:, 1, 11] = 0 J_x[:, 2, 11] = E21 * x31 + E22 * y31 + E23 J_x[:, 3, 11] = 0 J_x[:, 4, 11] = 0 J_x[:, 5, 11] = 0 J_x[:, 6, 11] = 0 J_x[:, 7, 11] = 0 J_x[:, 8, 11] = 0 J_x[:, 9, 11] = 0 J_x[:, 10, 11] = 0 J_x[:, 11, 11] = 0 J_x[:, 12, 11] = 0 J_x[:, 13, 11] = 0 J_x[:, 14, 11] = 0 J_x[:, 15, 11] = 0 J_x[:, 0, 12] = 0 J_x[:, 1, 12] = 0 J_x[:, 2, 12] = 0 J_x[:, 3, 12] = E11 * x42 + E21 * y42 + E31 J_x[:, 4, 12] = 0 J_x[:, 5, 12] = 0 J_x[:, 6, 12] = 0 J_x[:, 7, 12] = 0 J_x[:, 8, 12] = 0 J_x[:, 9, 12] = 0 J_x[:, 10, 12] = 0 J_x[:, 11, 12] = 0 J_x[:, 12, 12] = 0 J_x[:, 13, 12] = 0 J_x[:, 14, 12] = 0 J_x[:, 15, 12] = 0 J_x[:, 0, 13] = 0 J_x[:, 1, 13] = 0 J_x[:, 2, 13] = 0 J_x[:, 3, 13] = E12 * x42 + E22 * y42 + E32 J_x[:, 4, 13] = 0 J_x[:, 5, 13] = 0 J_x[:, 6, 13] = 0 J_x[:, 7, 13] = 0 J_x[:, 8, 13] = 0 J_x[:, 9, 13] = 0 J_x[:, 10, 13] = 0 J_x[:, 11, 13] = 0 J_x[:, 12, 13] = 0 J_x[:, 13, 13] = 0 J_x[:, 14, 13] = 0 J_x[:, 15, 13] = 0 J_x[:, 0, 14] = 0 J_x[:, 1, 14] = 0 J_x[:, 2, 14] = 0 J_x[:, 3, 14] = E11 * x41 + E12 * y41 + E13 J_x[:, 4, 14] = 0 J_x[:, 5, 14] = 0 J_x[:, 6, 14] = 0 J_x[:, 7, 14] = 0 J_x[:, 8, 14] = 0 J_x[:, 9, 14] = 0 J_x[:, 10, 14] = 0 J_x[:, 11, 14] = 0 J_x[:, 12, 14] = 0 J_x[:, 13, 14] = 0 J_x[:, 14, 14] = 0 J_x[:, 15, 14] = 0 J_x[:, 0, 15] = 0 J_x[:, 1, 15] = 0 J_x[:, 2, 15] = 0 J_x[:, 3, 15] = E21 * x41 + E22 * y41 + E23 J_x[:, 4, 15] = 0 J_x[:, 5, 15] = 0 J_x[:, 6, 15] = 0 J_x[:, 7, 15] = 0 J_x[:, 8, 15] = 0 J_x[:, 9, 15] = 0 J_x[:, 10, 15] = 0 J_x[:, 11, 15] = 0 J_x[:, 12, 15] = 0 J_x[:, 13, 15] = 0 J_x[:, 14, 15] = 0 J_x[:, 15, 15] = 0 J_x[:, 0, 16] = 0 J_x[:, 1, 16] = 0 J_x[:, 2, 16] = 0 J_x[:, 3, 16] = 0 J_x[:, 4, 16] = E11 * x52 + E21 * y52 + E31 J_x[:, 5, 16] = 0 J_x[:, 6, 16] = 0 J_x[:, 7, 16] = 0 J_x[:, 8, 16] = 0 J_x[:, 9, 16] = 0 J_x[:, 10, 16] = 0 J_x[:, 11, 16] = 0 J_x[:, 12, 16] = 0 J_x[:, 13, 16] = 0 J_x[:, 14, 16] = 0 J_x[:, 15, 16] = 0 J_x[:, 0, 17] = 0 J_x[:, 1, 17] = 0 J_x[:, 2, 17] = 0 J_x[:, 3, 17] = 0 J_x[:, 4, 17] = E12 * x52 + E22 * y52 + E32 J_x[:, 5, 17] = 0 J_x[:, 6, 17] = 0 J_x[:, 7, 17] = 0 J_x[:, 8, 17] = 0 J_x[:, 9, 17] = 0 J_x[:, 10, 17] = 0 J_x[:, 11, 17] = 0 J_x[:, 12, 17] = 0 J_x[:, 13, 17] = 0 J_x[:, 14, 17] = 0 J_x[:, 15, 17] = 0 J_x[:, 0, 18] = 0 J_x[:, 1, 18] = 0 J_x[:, 2, 18] = 0 J_x[:, 3, 18] = 0 J_x[:, 4, 18] = E11 * x51 + E12 * y51 + E13 J_x[:, 5, 18] = 0 J_x[:, 6, 18] = 0 J_x[:, 7, 18] = 0 J_x[:, 8, 18] = 0 J_x[:, 9, 18] = 0 J_x[:, 10, 18] = 0 J_x[:, 11, 18] = 0 J_x[:, 12, 18] = 0 J_x[:, 13, 18] = 0 J_x[:, 14, 18] = 0 J_x[:, 15, 18] = 0 J_x[:, 0, 19] = 0 J_x[:, 1, 19] = 0 J_x[:, 2, 19] = 0 J_x[:, 3, 19] = 0 J_x[:, 4, 19] = E21 * x51 + E22 * y51 + E23 J_x[:, 5, 19] = 0 J_x[:, 6, 19] = 0 J_x[:, 7, 19] = 0 J_x[:, 8, 19] = 0 J_x[:, 9, 19] = 0 J_x[:, 10, 19] = 0 J_x[:, 11, 19] = 0 J_x[:, 12, 19] = 0 J_x[:, 13, 19] = 0 J_x[:, 14, 19] = 0 J_x[:, 15, 19] = 0 J_E9 = torch.zeros((b, 9, 9), device=minimal_sample.device) J_x9 = torch.zeros((b, 9, 20), device=minimal_sample.device) J_Ex = torch.zeros((b, 9, 20), device=minimal_sample.device) J_E9[:, :6, :] = J_E[:, :6, :] J_x9[:, :6, :] = J_x[:, :6, :] rows = [] for i in range(3): rows.append(random.sample(range(7, 15), 3)) J_E9[:, 6, :] = ( J_E[:, rows[0][0], :] + J_E[:, rows[0][1], :] + J_E[:, rows[0][2], :] ) J_E9[:, 7, :] = ( J_E[:, rows[1][0], :] + J_E[:, rows[1][1], :] + J_E[:, rows[1][2], :] ) J_E9[:, 8, :] = ( J_E[:, rows[2][0], :] + J_E[:, rows[2][1], :] + J_E[:, rows[2][2], :] ) J_x9[:, 6, :] = ( J_x[:, rows[0][0], :] + J_x[:, rows[0][1], :] + J_x[:, rows[0][2], :] ) J_x9[:, 7, :] = ( J_x[:, rows[1][0], :] + J_x[:, rows[1][1], :] + J_x[:, rows[1][2], :] ) J_x9[:, 8, :] = ( J_x[:, rows[2][0], :] + J_x[:, rows[2][1], :] + J_x[:, rows[2][2], :] ) tmp = torch.eye(9, 9, dtype=torch.float, device=minimal_sample.device) for i in range(b): try: J_Ex[i, :, :] = -torch.inverse(J_E9[i, :, :]).mm(J_x9[i, :, :]) tmp = J_E9[i, :, :] except Exception as e: J_Ex[i, :, :] = -torch.inverse(tmp).mm( J_x9[i, :, :] ) # or -torch.linalg.pinv(J_E9[i, :, :]).mm(J_x9[i, :, :]) return J_Ex ############ DDN with constraint ############ class EssentialMatrixNode(EqConstDeclarativeNode): """Declarative Essential matrix estimation node constraint""" def __init__(self, device, ift): super().__init__() self.estimator = ns.EssentialMatrixEstimatorNister(device=device, ift=ift) def objective(self, minimal_samples, E_true, y): """ minimal_samples : b x 5 x 4 E_true: 3 x 3 y : b x 3 x 3 """ batch_size = minimal_samples[:, :, :2].shape[0] w = torch.ones( (batch_size, 5), dtype=torch.float, device=minimal_samples.device ) / float(5.0) A_ = ( torch.cat( ( minimal_samples[:, :, :2], torch.ones((batch_size, 5, 1), device=minimal_samples.device), ), -1, ) ).unsqueeze(-2) B_ = ( torch.cat( ( minimal_samples[:, :, 2:], torch.ones((batch_size, 5, 1), device=minimal_samples.device), ), -1, ) ).unsqueeze(-1) M = A_ * B_ # [8 x 5 x 3 x 3] res = ((M.view(batch_size, -1, 9)).matmul(y.view(batch_size, 9, 1))) ** 2 out = torch.einsum("bn,bn->b", (w, res.squeeze(-1))) return out def equality_constraints(self, minimal_samples, E_true, y): E_Et = y.matmul(y.permute(0, 2, 1)) E_Et_trace = torch.einsum("bii->b", E_Et) eq_constr1 = 2 * E_Et.matmul(y) - torch.einsum("b,bnm->bnm", E_Et_trace, y) eq_constr1 = (eq_constr1**2).sum(dim=(-1, -2)) eq_constr2 = (y.view(-1, 9) ** 2).sum(dim=-1) - 1.0 return torch.cat((eq_constr1.unsqueeze(1), eq_constr2.unsqueeze(1)), 1) def solve(self, minimal_samples, E_true): minimal_samples = minimal_samples.detach() y = self._solve_(minimal_samples, E_true).requires_grad_() return y.detach(), None def _solve_(self, minimal_samples, E_true): """ minimal_samples : b x 5 x 4 E_true: 3 x 3 """ est = self.estimator.estimate_minimal_model(minimal_samples) solution_num = 10 distances = torch.norm( est - E_true.unsqueeze(0).repeat(est.shape[0], 1, 1), dim=(1, 2) ).view(est.shape[0], -1) try: chosen_indices = torch.argmin(distances.view(-1, solution_num), dim=-1) chosen_models = torch.stack( [ (est.view(-1, solution_num, 3, 3))[i, chosen_indices[i], :] for i in range(int(est.shape[0] / solution_num)) ] ) except ValueError as e: print( "not enough models for selection, we choose the first solution in this batch", e, est.shape, ) chosen_models = est[0].unsqueeze(0) return chosen_models
23,922
Python
.py
774
24.359173
94
0.400972
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,677
test.py
disungatullina_MinBackProp/test.py
import torch from tqdm import tqdm from model_cl import * from utils import * from datasets import Dataset def test(model, test_loader, opt): OUT_DIR = "results/" with torch.no_grad(): if opt.precision == 2: data_type = torch.float64 elif opt.precision == 0: data_type = torch.float16 else: data_type = torch.float32 errRs, errTs = [], [] max_errors = [] avg_F1 = 0 avg_inliers = 0 epi_errors = [] avg_ransac_time = 0 invalid_pairs = 0 model.to(data_type) for idx, test_data in enumerate(tqdm(test_loader)): correspondences, K1, K2 = ( test_data["correspondences"].to(opt.device, data_type), test_data["K1"].to(opt.device, data_type), test_data["K2"].to(opt.device, data_type), ) im_size1, im_size2 = test_data["im_size1"].to( opt.device, data_type ), test_data["im_size2"].to(opt.device, data_type) gt_E, gt_R, gt_t = ( test_data["gt_E"].to(data_type), test_data["gt_R"].to(opt.device, data_type), test_data["gt_t"].to(data_type), ) files = test_data["files"] # estimate model, return the model, predicted inlier probabilities and normalization. models, weights, ransac_time = model( correspondences, K1, K2, im_size1, im_size2 ) K1_, K2_ = K1.cpu().detach().numpy(), K2.cpu().detach().numpy() im_size1, im_size2 = ( im_size1.cpu().detach().numpy(), im_size2.cpu().detach().numpy(), ) for b, est_model in enumerate(models): pts1 = correspondences[b, 0:2].squeeze(-1).cpu().detach().numpy().T pts2 = correspondences[b, 2:4].squeeze(-1).cpu().detach().numpy().T E = est_model errR, errT = eval_essential_matrix(pts1, pts2, E, gt_R[b], gt_t[b]) errRs.append(float(errR)) errTs.append(float(errT)) max_errors.append(max(float(errR), float(errT))) avg_ransac_time += ransac_time avg_ransac_time /= len(test_loader) out = OUT_DIR + opt.model print( f"Rotation error = {np.mean(np.array(errRs))} | Translation error = {np.mean(np.array(errTs))}" ) print( f"Rotation error median= {np.median(np.array(errRs))} | Translation error median= {np.median(np.array(errTs))}" ) print(f"AUC scores = {AUC(max_errors)} ") print("Run time: %.2f ms" % (avg_ransac_time * 1000)) if not os.path.isdir(out): os.makedirs(out) with open(out + "/test.txt", "a", 1) as f: f.write( "%f %f %f %f ms" % ( AUC(max_errors)[0], AUC(max_errors)[1], AUC(max_errors)[2], avg_ransac_time * 1000, ) ) f.write("\n") if __name__ == "__main__": # Parse the parameters parser = create_parser(description="Generalized Differentiable RANSAC.") opt = parser.parse_args() # check if gpu device is available opt.device = torch.device( "cuda:0" if torch.cuda.is_available() and opt.device != "cpu" else "cpu" ) print(f"Running on {opt.device}") # collect datasets to be used for testing if opt.batch_mode: scenes = test_datasets print( "\n=== BATCH MODE: Doing evaluation on", len(scenes), "datasets. =================", ) else: scenes = [opt.datasets] model = DeepRansac_CLNet(opt).to(opt.device) for seq in scenes: print(f"Working on {seq} with scoring {opt.scoring}") scene_data_path = os.path.join(opt.data_path) dataset = Dataset( [scene_data_path + "/" + seq + "/test_data_rs/"], opt.snn, nfeatures=opt.nfeatures, ) test_loader = torch.utils.data.DataLoader( dataset, batch_size=opt.batch_size, num_workers=0, pin_memory=False, shuffle=False, ) print(f"Loading test data: {len(dataset)} image pairs.") # if opt.model is not None: model.load_state_dict(torch.load(opt.model, map_location=opt.device)) model.eval() test(model, test_loader, opt)
4,507
Python
.py
118
27.830508
119
0.535453
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,678
test_magsac.py
disungatullina_MinBackProp/test_magsac.py
import numpy as np import torch import time import pymagsac from tqdm import tqdm from model_cl import * from utils import * from datasets import Dataset def test(model, test_loader, opt): with torch.no_grad(): avg_model_time = 0 # runtime of the network forward pass avg_ransac_time = 0 # runtime of RANSAC # essential matrix evaluation pose_losses = [] avg_F1 = 0 avg_inliers = 0 epi_errors = [] invalid_pairs = 0 for idx, test_data in enumerate(tqdm(test_loader)): correspondences, K1, K2 = ( test_data["correspondences"].to(opt.device), test_data["K1"].to(opt.device), test_data["K2"].to(opt.device), ) im_size1, im_size2 = test_data["im_size1"].to(opt.device), test_data[ "im_size2" ].to(opt.device) gt_E, gt_R, gt_t = ( test_data["gt_E"].numpy(), test_data["gt_R"].numpy(), test_data["gt_t"].numpy(), ) batch_size = correspondences.size(0) # predicted inlier probabilities and normalization. inlier_weights, _ = model( correspondences.float(), K1, K2, im_size1, im_size2, opt.prob, predict=False, ) K1, K2 = K1.cpu().detach().numpy(), K2.cpu().detach().numpy() im_size1, im_size2 = ( im_size1.cpu().detach().numpy(), im_size2.cpu().detach().numpy(), ) # sorted_indices_batch = torch.argsort(logits, descending=True, dim=1).cpu().detach() ransac_time = 0 correspondences = correspondences.cpu().detach() for b in range(batch_size): inliers = torch.zeros(1, 2000, 1) # inlier mask of the estimated model # sorted_indices = sorted_indices_batch[b] weights = inlier_weights[b].cpu().detach().numpy() sorted_indices = np.argsort(weights)[::-1] # === CASE ESSENTIAL MATRIX ========================================= pts1 = correspondences[b, 0:2].squeeze().numpy().T pts2 = correspondences[b, 2:4].squeeze().numpy().T # rank the points according to their probabilities sorted_pts1 = pts1[sorted_indices] sorted_pts2 = pts2[sorted_indices] weights = weights[sorted_indices] start_time = time.time() E, mask, save_samples = pymagsac.findEssentialMatrix( np.ascontiguousarray(sorted_pts1).astype( np.float64 ), # pts[sorted_indices] np.ascontiguousarray(sorted_pts2).astype(np.float64), K1[b], K2[b], float(im_size1[b][0]), float(im_size1[b][1]), float(im_size2[b][0]), float(im_size2[b][1]), # probabilities=get_probabilities(sorted_pts1.shape[0]) probabilities=weights, use_magsac_plus_plus=True, sigma_th=opt.threshold, sampler_id=3, save_samples=True, ) ransac_time += time.time() - start_time # count inlier number incount = np.sum(mask) incount /= correspondences.size(2) if incount == 0: E = np.identity(3) else: # update inliers # inliers[0, :, 0] = torch.tensor(mask) sorted_index = sorted_indices[mask] inliers[0, sorted_index, 0] = 1 # pts for recovering the pose pts1 = correspondences[b, 0:2].numpy() pts2 = correspondences[b, 2:4].numpy() pts1_1 = pts1.transpose(2, 1, 0) pts2_2 = pts2.transpose(2, 1, 0) inliers = inliers.byte().numpy().ravel() K = np.eye(3) R = np.eye(3) t = np.zeros((3, 1)) # evaluation of relative pose (essential matrix) cv2.recoverPose( E, np.ascontiguousarray(pts1_1).astype(np.float64), np.ascontiguousarray(pts2_2).astype(np.float64), K, R, t, inliers, ) dR, dT = pose_error(R, gt_R[b], t, gt_t[b]) pose_losses.append(max(float(dR), float(dT))) avg_ransac_time += ransac_time / batch_size print( "\nAvg. Model Time: %dms" % (avg_model_time / len(test_loader) * 1000 + 0.00000001) ) print( "Avg. RANSAC Time: %dms" % (avg_ransac_time / len(test_loader) * 1000 + 0.00000001) ) # calculate AUC of pose losses thresholds = [5, 10, 20] AUC_scores = AUC( losses=pose_losses, thresholds=thresholds, binsize=5 ) # opt.evalbinsize) print("\n=== Relative Pose Accuracy ===========================") print( "AUC for %ddeg/%ddeg/%ddeg: %.2f/%.2f/%.2f\n" % ( thresholds[0], thresholds[1], thresholds[2], AUC_scores[0], AUC_scores[1], AUC_scores[2], ) ) # write evaluation results to fil if not os.path.isdir("results/" + opt.model): os.makedirs("results/" + opt.model) with open("results/" + opt.model + "/test.txt", "a", 1) as f: f.write( "%f %f %f %f ms " % ( AUC_scores[0], AUC_scores[1], AUC_scores[2], avg_ransac_time / len(test_loader) * 1000, ) ) f.write("\n") if __name__ == "__main__": # Parse the parameters parser = create_parser(description="Generalized Differentiable RANSAC.") opt = parser.parse_args() opt.device = torch.device( "cuda:0" if torch.cuda.is_available() and opt.device != "cpu" else "cpu" ) print(f"Running on {opt.device}") # collect dataset list to be used for testing if opt.batch_mode: scenes = test_datasets print( "\n=== BATCH MODE: Doing evaluation on", len(scenes), "datasets. =================", ) else: scenes = [opt.datasets] model = DeepRansac_CLNet(opt).to(opt.device) for seq in scenes: print(f"Working on {seq} with scoring {opt.scoring}") scene_data_path = os.path.join(opt.data_path) dataset = Dataset( [scene_data_path + "/" + seq + "/test_data_rs/"], opt.snn, nfeatures=opt.nfeatures, ) test_loader = torch.utils.data.DataLoader( dataset, batch_size=opt.batch_size, num_workers=0, pin_memory=False, shuffle=False, ) print(f"Loading test data: {len(dataset)} image pairs.") # if opt.model is not None: model.load_state_dict(torch.load(opt.model, map_location=opt.device)) model.eval() test(model, test_loader, opt)
7,654
Python
.py
193
25.891192
97
0.480301
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,679
utils.py
disungatullina_MinBackProp/utils.py
import cv2 import torch import argparse import torch.nn as nn def create_parser(description): """Create a default command line parser with the most common options. Keyword arguments: description -- description of the main functionality of a script/program """ parser = argparse.ArgumentParser( description=description, formatter_class=argparse.ArgumentDefaultsHelpFormatter ) parser.add_argument( "--model", "-m", default=None, # EF_hist_size_10_snn_0_85_thr_3.pth help="The name of the model to be used", ) parser.add_argument( "--data_path", "-pth", default="dataset", # EF_hist_size_10_snn_0_85_thr_3.pth help="The path you sed the dataset.", ) parser.add_argument("--device", "-d", default="cuda", help="The device") parser.add_argument( "--detector", "-dt", default="rootsift", help="The detector used for obtaining local features. Values = loftr, sift", ) parser.add_argument( "--snn", "-snn", default=0.80, help="The SNN ratio threshold for SIFT." ) parser.add_argument( "--nfeatures", "-nf", type=int, default=2000, help="The expected number of features in SIFT.", ) parser.add_argument("--batch_size", "-bs", type=int, default=32, help="batch size") parser.add_argument( "--ransac_batch_size", "-rbs", type=int, default=64, help="ransac batch size" ) parser.add_argument( "--scoring", "-s", type=int, default=1, help="The used scoring function. 0 - RANSAC, 1 - MSAC", ) parser.add_argument( "--precision", "-pr", type=int, default=1, help="The used data precision. 0 - float16, 1 - float32, 2-float64", ) parser.add_argument("--tr", "-tr", type=int, default=0, help="1 - train, 0v- test") parser.add_argument( "--threshold", "-t", type=float, default=0.75, help="Inlier-outlier threshold. " "It will be normalized for E matrix estimation inside the code using focal length.", ) parser.add_argument( "--epochs", "-e", type=int, default=10, help="Epochs for training. " "It will be the epoch number used inside training.", ) parser.add_argument( "--learning_rate", "-lr", type=float, default=1e-4, help="learning rate for network optimizer.", ) parser.add_argument( "--num_workers", "-nw", type=int, default=0, help="how many workers for data loader", ) parser.add_argument( "--datasets", "-ds", default="st_peters_square", help="the datasets we would like to use", ) parser.add_argument( "--batch_mode", "-bm", type=int, default=0, help="use the provided data list" ) parser.add_argument( "--prob", "-p", type=int, default=2, help="the way we use the weights, 0-normalized weights, 1-unnormarlized weights, 2-logits", ) parser.add_argument( "--session", "-sid", default="", help="custom session name appended to output files, " "useful to separate different runs of a script", ) parser.add_argument( "--topk", "-topk", default=False, help="use the errors of the best k models as the loss, otherwise, taaake the average.", ) parser.add_argument( "--k", "-k", type=int, default=300, help="the number of the best models included in the loss.", ) parser.add_argument( "--ift", "-ift", type=int, default=1, help="the method to backpropagate; 0-autograd, 1-ift, 2-ddn; 1 is default", ) return parser def init_weights(m): """Customize the weight initialization process as ResNet does. https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py#L208 """ if isinstance(m, nn.Conv2d): nn.init.kaiming_normal_(m.weight, mode="fan_out", nonlinearity="relu") elif isinstance(m, (nn.BatchNorm2d, nn.GroupNorm)): nn.init.constant_(m.weight, 1) nn.init.constant_(m.bias, 0) def create_session_string(prefix, epochs, nfeatures, ratio, session, threshold): """Create an identifier string from the most common parameter options. Keyword arguments: prefix -- custom string appended at the beginning of the session string epochs -- how many epochs you trained orb -- bool indicating whether ORB features or SIFT features are used rootsift -- bool indicating whether RootSIFT normalization is used ratio -- threshold for Lowe's ratio filter session -- custom string appended at the end of the session string """ session_string = prefix + "_" session_string += "E_" session_string += "e_" + str(epochs) + "_" # if rootsift: session_string += 'rs_' session_string += "rs_" + str(nfeatures) session_string += "_r%.2f_" % ratio session_string += "t%.2f_" % threshold # specific id if we train the same config for times session_string += session return session_string outdoor_test_datasets = [ "buckingham_palace", "brandenburg_gate", "colosseum_exterior", "grand_place_brussels", "notre_dame_front_facade", "palace_of_westminster", "pantheon_exterior", "prague_old_town_square", "sacre_coeur", "taj_mahal", "trevi_fountain", "westminster_abbey", ] test_datasets = outdoor_test_datasets
5,708
Python
.py
178
25.320225
99
0.611061
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,680
train.py
disungatullina_MinBackProp/train.py
import numpy as np import torch import torch.nn.functional as F from tqdm import tqdm from loss import * from model_cl import * from datasets import Dataset from tensorboardX import SummaryWriter from sklearn.model_selection import train_test_split import time import warnings warnings.filterwarnings("ignore") RANDOM_SEED = 535 random.seed(RANDOM_SEED) torch.manual_seed(RANDOM_SEED) np.random.seed(RANDOM_SEED) def train_step(train_data, model, opt, loss_fn): if opt.precision == 2: data_type = torch.float64 elif opt.precision == 0: data_type = torch.float16 else: data_type = torch.float32 model.to(data_type) # fetch the points, ground truth extrinsic and intrinsic matrices correspondences, K1, K2 = ( train_data["correspondences"].to(opt.device, data_type), train_data["K1"].to(opt.device, data_type), train_data["K2"].to(opt.device, data_type), ) gt_R, gt_t = train_data["gt_R"].to(opt.device, data_type), train_data["gt_t"].to( opt.device, data_type ) gt_E = train_data["gt_E"].to(opt.device, data_type) im_size1, im_size2 = train_data["im_size1"].to(opt.device, data_type), train_data[ "im_size2" ].to(opt.device, data_type) ground_truth = gt_E if opt.tr: # 5PC prob_type = 0 else: prob_type = opt.prob # collect all the models Es, weights, _ = model( correspondences.to(data_type), K1, K2, im_size1, im_size2, prob_type, ground_truth, ) pts1 = correspondences.squeeze(-1)[:, 0:2].transpose(-1, -2) pts2 = correspondences.squeeze(-1)[:, 2:4].transpose(-1, -2) train_loss = loss_fn.forward( Es, gt_E.cpu().detach().numpy(), pts1, pts2, K1, K2, im_size1, im_size2 ) return train_loss, Es def train(model, train_loader, valid_loader, opt): # the name of the folder we save models, logs saved_file = create_session_string( "train", opt.epochs, opt.nfeatures, opt.snn, opt.session, opt.threshold ) writer = SummaryWriter("results/" + saved_file + "/vision", comment="model_vis") optimizer = torch.optim.Adam(model.parameters(), lr=opt.learning_rate) loss_function = MatchLoss() valid_loader_iter = iter(valid_loader) # save the losses to npy file train_losses = [] valid_losses = [] time_history = [] # start epoch for epoch in range(opt.epochs): # each step for idx, train_data in enumerate(tqdm(train_loader)): model.train() # one step optimizer.zero_grad() train_loss, Es = train_step(train_data, model, opt, loss_function) train_loss.retain_grad() for i in Es: i.retain_grad() # gradient calculation, ready for back propagation if torch.isnan(train_loss): print("pls check, there is nan value in loss!", train_loss) continue try: start = time.time() train_loss.backward() end = time.time() time_history.append(end - start) print("successfully back-propagation", train_loss) except Exception as e: print("we have trouble with back-propagation, pls check!", e) continue if torch.isnan(train_loss.grad): print( "pls check, there is nan value in the gradient of loss!", train_loss.grad, ) continue for E in Es: if torch.isnan(E.grad).any(): print( "pls check, there is nan value in the gradient of estimated models!", E.grad, ) continue train_losses.append(train_loss.cpu().detach().numpy()) # for vision writer.add_scalar( "train_loss", train_loss, global_step=epoch * len(train_loader) + idx ) # add gradient clipping after backward to avoid gradient exploding torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=5) # check if the gradients of the training parameters contain nan values nans = sum( [ torch.isnan(param.grad).any() for param in list(model.parameters()) if param.grad is not None ] ) if nans != 0: print("parameter gradients includes {} nan values".format(nans)) continue optimizer.step() # check check if the training parameters contain nan values nan_num = sum( [ torch.isnan(param).any() for param in optimizer.param_groups[0]["params"] ] ) if nan_num != 0: print("parameters includes {} nan values".format(nan_num)) continue print("_______________________________________________________") # store the network every so often torch.save( model.state_dict(), "results/" + saved_file + "/model" + str(epoch) + ".net" ) print("Mean backward time: ", np.array(time_history).mean()) np.save( os.path.join("results", saved_file, "backward_time.npy"), np.array(time_history).mean(), ) # validation with torch.no_grad(): model.eval() try: valid_data = next(valid_loader_iter) except StopIteration: pass valid_loss, _ = train_step(valid_data, model, opt, loss_function) valid_losses.append(valid_loss.item()) writer.add_scalar( "valid_loss", valid_loss, global_step=epoch * len(train_loader) + idx ) writer.flush() print( "Step: {:02d}| Train loss: {:.4f}| Validation loss: {:.4f}".format( epoch * len(train_loader) + idx, train_loss, valid_loss ), "\n", ) np.save( "results/" + saved_file + "/" + "loss_record.npy", (train_losses, valid_losses) ) if __name__ == "__main__": OUT_DIR = "results/" # Parse the parameters parser = create_parser(description="Generalized Differentiable RANSAC.") config = parser.parse_args() # check if gpu device is available config.device = torch.device( "cuda:0" if torch.cuda.is_available() and config.device != "cpu" else "cpu" ) print(f"Running on {config.device}") train_model = DeepRansac_CLNet(config).to(config.device) # use the pretrained model to initialize the weights if provided. if len(config.model) > 0: train_model.load_state_dict( torch.load(config.model, map_location=config.device) ) else: train_model.apply(init_weights) train_model.train() # collect dataset list if config.batch_mode: scenes = test_datasets print( "\n=== BATCH MODE: Training on", len(scenes), "datasets. =================" ) else: scenes = [config.datasets] print(f"Working on {scenes} with scoring {config.scoring}") folders = [config.data_path + "/" + seq + "/train_data_rs/" for seq in scenes] dataset = Dataset(folders, nfeatures=config.nfeatures) # split the data to train and validation train_dataset, valid_dataset = train_test_split( dataset, test_size=0.25, shuffle=True ) train_data_loader = torch.utils.data.DataLoader( train_dataset, batch_size=config.batch_size, num_workers=config.num_workers, pin_memory=True, shuffle=True, ) print(f"Loading training data: {len(train_dataset)} image pairs.") valid_data_loader = torch.utils.data.DataLoader( valid_dataset, batch_size=config.batch_size, num_workers=0, pin_memory=True, shuffle=True, ) print(f"Loading validation data: {len(valid_dataset)} image pairs.") # with torch.autograd.set_detect_anomaly(True): train(train_model, train_data_loader, valid_data_loader, config)
8,402
Python
.py
222
28.171171
93
0.572919
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,681
feature_utils.py
disungatullina_MinBackProp/feature_utils.py
import torch import torch.nn.functional as F # import kornia as K # import kornia.feature as KF import cv2 import os import h5py import numpy as np from utils import * # from kornia_moons.feature import * def load_h5(filename): """Loads dictionary from hdf5 file.""" dict_to_load = {} if not os.path.exists(filename): print("Cannot find file {}".format(filename)) return dict_to_load with h5py.File(filename, "r") as f: keys = [key for key in f.keys()] for key in keys: dict_to_load[key] = f[key][()] return dict_to_load def normalize_keypoints(keypoints, K): """Normalize keypoints using the calibration data.""" C_x = K[0, 2] C_y = K[1, 2] f_x = K[0, 0] f_y = K[1, 1] keypoints = (keypoints - np.array([[C_x, C_y]])) / np.array([[f_x, f_y]]) return keypoints def normalize_keypoints_tensor(keypoints, K): """Normalize keypoints using the calibration data.""" C_x = K[0, 2] C_y = K[1, 2] f_x = K[0, 0] f_y = K[1, 1] keypoints = ( keypoints - torch.as_tensor([[C_x, C_y]], device=keypoints.device) ) / torch.as_tensor([[f_x, f_y]], device=keypoints.device) return keypoints # A function to convert the point ordering to probabilities used in NG-RANSAC's sampler or AR-Sampler. def get_probabilities(len_tentatives): probabilities = [] # Since the correspondences are assumed to be ordered by their SNN ratio a priori, # we just assign a probability according to their order. for i in range(len_tentatives): probabilities.append(1.0 - i / len_tentatives) return probabilities
1,651
Python
.py
47
30.382979
102
0.65932
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,682
ransac.py
disungatullina_MinBackProp/ransac.py
import math from feature_utils import * from samplers.uniform_sampler import * from nodes import IFTLayer, EssentialMatrixNode from ddn.ddn.pytorch.node import * class RANSAC(object): def __init__( self, estimator, sampler, scoring, train=False, ransac_batch_size=64, threshold=1e-3, confidence=0.999, max_iterations=5000, lo=0, # 2, lo_iters=64, eps=1e-5, ift=1, ): if ift == 1: self.optimization_layer = IFTLayer(estimator.device, ift) elif ift == 2: self.node = EssentialMatrixNode(estimator.device, ift) self.optimization_layer = DeclarativeLayer(self.node) self.estimator = estimator self.sampler = sampler self.scoring = scoring self.lo = lo self.lo_iters = lo_iters self.train = train self.ransac_batch_size = ransac_batch_size self.threshold = threshold self.confidence = confidence self.max_iterations = max_iterations self.eps = eps self.ift = ift def __call__(self, matches, logits, K1, K2, gt_model): iterations = 0 best_score = 0 point_number = matches.shape[0] best_mask = [] best_model = [] models = {} normalized_multipler = (K1[0, 0] + K1[1, 1] + K1[0, 0] + K2[1, 1]) / 4 threshold = self.threshold / normalized_multipler max_iters = self.max_iterations while iterations < max_iters: samples, soft_weights = self.sampler.sample(logits) points = matches.repeat([self.ransac_batch_size, 1, 1]) * samples.unsqueeze( -1 ) minimal_samples = points[samples != 0].view( self.ransac_batch_size, -1, matches.shape[-1] ) # when there is no minimal sample comes, skip if minimal_samples.shape[1] == 0: continue if self.train: # Estimate models' parameters, can propagate gradient if self.ift == 1 or self.ift == 2: estimated_models = self.optimization_layer( minimal_samples, gt_model ) chosen_models = estimated_models else: estimated_models = self.estimator.estimate_model(minimal_samples) # for learning, return all models and sum the pose errors of all models instead of selecting the best # choose the best model from each sample, in the case of generating more than one models from the sample if estimated_models.shape[0] == 0 or estimated_models is None: continue solution_num = 10 distances = torch.norm( estimated_models - gt_model, dim=(1, 2) ).view(estimated_models.shape[0], -1) try: chosen_indices = torch.argmin( distances.view(-1, solution_num), dim=-1 ) chosen_models = torch.stack( [ (estimated_models.view(-1, solution_num, 3, 3))[ i, chosen_indices[i], : ] for i in range( int(estimated_models.shape[0] / solution_num) ) ] ) except ValueError as e: print( "not enough models for selection, we choose the first solution in this batch", e, estimated_models.shape, ) chosen_models = estimated_models[0].unsqueeze(0) if torch.isnan(chosen_models).any(): # deal with the error of linalg.slove, # "The diagonal element 1 is zero, the solver could not completed because the input singular matrix) print("Delete those models having problems with singular matrix.") nan_filter = [not (torch.isnan(model).any()) for model in chosen_models] models[iterations] = chosen_models[torch.as_tensor(nan_filter)] else: estimated_models = self.estimator.estimate_model(minimal_samples) # Calculate the scores of the models scores, inlier_masks = self.scoring.score( matches, estimated_models, threshold ) # Select the best model best_idx = torch.argmax(scores) # Update the best model if this iteration is better if scores[best_idx] > best_score or iterations == 0: best_score = scores[best_idx] best_mask = inlier_masks[best_idx] best_model = estimated_models[best_idx] best_inlier_number = torch.sum(best_mask) # Apply local optimization if needed if self.lo: ( best_score, best_mask, best_model, best_inlier_number, ) = self.localOptimization( best_score, best_mask, best_model, best_inlier_number, matches, K1, K2, threshold, ) # use adaptive iteration number when testing, update the max iteration number by inlier counts max_iters = min( self.max_iterations, self.adaptive_iteration_number( best_inlier_number, point_number, self.confidence ), ) iterations += self.ransac_batch_size # not needed for learning, so no differentiability is needed # Final refitting on the inliers if not self.train: inlier_indices = best_mask.nonzero(as_tuple=True) inlier_points = matches[inlier_indices].unsqueeze(0) estimated_models = self.estimator.estimate_model( matches.unsqueeze(0).double(), K1=K1.cpu().detach().numpy(), K2=K2.cpu().detach().numpy(), inlier_indices=inlier_indices[0] .cpu() .detach() .numpy() .astype(np.uint64), best_model=best_model.cpu().detach().numpy().T, unnormalzied_threshold=0.75, best_score=best_score, ) # Select the best if more than one models are returned if estimated_models is None: best_model = torch.eye( 3, 3, device=best_model.device, dtype=best_model.dtype ) elif estimated_models.shape[0] == 0: best_model = torch.eye( 3, 3, device=estimated_models.device, dtype=estimated_models.dtype ) elif estimated_models.shape[0] >= 1: if estimated_models.dtype != matches.dtype: estimated_models = estimated_models.to(matches.dtype) # if estimated_models.type() == 'torch.cuda.DoubleTensor' or 'torch.DoubleTensor': # estimated_models = estimated_models.to(torch.float) # Calculate the scores of the models scores, inlier_masks = self.scoring.score( matches, estimated_models, threshold ) if max(scores) > best_score: best_idx = torch.argmax(scores) best_model = estimated_models[best_idx] best_score = scores[best_idx] else: best_model = estimated_models[0] if not self.scoring.provides_inliers: best_model, best_mask = self.scoring.get_inliers( matches, best_model.unsqueeze(0), self.estimator, threshold=threshold, ) else: best_model = models # if best_model.shape[0] == 0: # best_model = torch.eye(3, 3, device=best_model.device, dtype=best_model.dtype) return best_model, best_mask, best_score, iterations def adaptive_iteration_number(self, inlier_number, point_number, confidence): inlier_ratio = inlier_number / point_number probability = 1.0 - inlier_ratio**self.estimator.sample_size if probability >= 1.0 - self.eps: return self.max_iterations try: max( 0.0, ( math.log10(1.0 - confidence) / ( math.log10(1 - inlier_ratio**self.estimator.sample_size) + self.eps ) ), ) except ValueError: print( "add eps to avoid math domain error of log", 1 - inlier_ratio**self.estimator.sample_size, "\n", ) return max( 0.0, ( math.log10(1.0 - confidence) / ( math.log10( 1 - inlier_ratio**self.estimator.sample_size + self.eps ) ) ), ) def localOptimization( self, best_score, best_mask, best_model, best_inlier_number, matches, K1, K2, threshold, ): # Do a single or iterated LSQ fitting if self.lo < 3: iters = 1 if self.lo == 2: iters = self.lo_iters for iter_i in range(iters): # Select the inliers indices = best_mask.nonzero(as_tuple=True) points = torch.unsqueeze(matches[indices], 0) # Estimate the model from all points models = self.estimator.estimate_model( points, K1=K1.cpu().detach().numpy(), K2=K2.cpu().detach().numpy(), inlier_indices=indices[0].cpu().detach().numpy().astype(np.uint64), best_model=best_model.cpu().detach().numpy().T, unnormalzied_threshold=0.75, best_score=best_score, ) if models is None: models = torch.eye(3).unsqueeze(0).to(points.device) # Calculate the score scores, inlier_masks = self.scoring.score(matches, models, threshold) # Select the best model best_idx = torch.argmax(scores) if scores[best_idx] >= best_score: best_score = scores[best_idx] best_mask = inlier_masks[best_idx] best_model = models[best_idx] best_inlier_number = torch.sum(best_mask) else: break elif self.lo == 3: # Do inner RANSAC # Calculate the sample size sample_size = self.estimator.sample_size if best_inlier_number < sample_size: sample_size = self.estimator.sample_size # Initialize the LO sampler lo_sampler = UniformSampler(self.lo_iters, sample_size, matches.shape[0]) for iter_i in range(self.lo_iters): # Select minimal samples for the current batch minimal_sample_indices = lo_sampler.sample() minimal_samples = matches[minimal_sample_indices] # Estimate the models' parameters estimated_models = self.estimator.estimate_model(minimal_samples) # Calculate the scores of the models scores, inlier_masks = self.scoring.score( matches, estimated_models, threshold ) # Select the best model best_idx = torch.argmax(scores) # The loss should be: sum_{1}^k pose_error(model_k, model_gt) (where k is iteration number/batch size) # Update the previous best model if needed if scores[best_idx] > best_score: best_score = scores[best_idx] best_mask = inlier_masks[best_idx] best_model = estimated_models[best_idx] best_inlier_number = torch.sum(best_mask) # Re-calculate the sample size sample_size = self.estimator.sample_size if best_inlier_number < sample_size: sample_size = self.estimator.sample_size # Re-initialize the LO sampler lo_sampler = UniformSampler( self.ransac_batch_size, sample_size, matches.shape[0] ) else: break return best_score, best_mask, best_model, best_inlier_number
13,751
Python
.py
309
27.63754
124
0.493659
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,683
cv_utils.py
disungatullina_MinBackProp/cv_utils.py
import cv2 import math import torch import numpy as np def normalize_pts(pts, im_size): """Normalize image coordinate using the image size. Pre-processing of correspondences before passing them to the network to be independent of image resolution. Re-scales points such that max image dimension goes from -0.5 to 0.5. In-place operation. Keyword arguments: pts -- 3-dim array conainting x and y coordinates in the last dimension, first dimension should have size 1. im_size -- image height and width """ ret = pts.clone() / max(im_size) - torch.stack((im_size[1] / 2, im_size[0] / 2)) return ret def denormalize_pts_inplace(pts, im_size): """Undo image coordinate normalization using the image size. Keyword arguments: pts -- N-dim array conainting x and y coordinates in the first dimension im_size -- image height and width """ pts *= max(im_size) pts[0] += im_size[1] / 2 pts[1] += im_size[0] / 2 def denormalize_pts(pts, im_size): """Undo image coordinate normalization using the image size. Keyword arguments: pts -- N-dim array containing x and y coordinates in the first dimension im_size -- image height and width """ ret = pts.clone() * max(im_size) + torch.stack((im_size[1] / 2, im_size[0] / 2)) return ret def recoverPose(model, p1, p2, svd, distanceThreshold=50): """Recover the relative poses (R, t) from essential matrix, and choose the correct solution from 4.""" # decompose E matrix to get R1, R2, t, -t if svd: R1, R2, t = decompose_E(model) else: R1, R2, t = new_decompose_E(model) # four solutions P = [] P.append(torch.eye(3, 4, device=model.device, dtype=model.dtype)) P.append(torch.cat((R1, t), 1)) P.append(torch.cat((R2, t), 1)) P.append(torch.cat((R1, -t), 1)) P.append(torch.cat((R2, -t), 1)) # cheirality check mask = torch.zeros(4, p1.shape[0]) for i in range(len(P) - 1): mask[i] = cheirality_check(P[0], P[i + 1], p1, p2, distanceThreshold) good = torch.sum(mask, dim=1) best_index = torch.argmax(good) if best_index == 0: return R1, t elif best_index == 1: return R2, t elif best_index == 2: return R1, -t else: return R2, -t def decompose_E(model): try: u, s, vT = torch.linalg.svd(model) except Exception as e: print(e) model = torch.eye(3, device=model.device) u, s, vT = torch.linalg.svd(model) try: if torch.sum(torch.isnan(u)) > 0: print("wrong") except Exception as e: print(e) w = torch.tensor([[0, -1, 0], [1, 0, 0], [0, 0, 1]], dtype=u.dtype, device=u.device) z = torch.tensor([[0, -1, 0], [1, 0, 0], [0, 0, 0]], dtype=u.dtype, device=u.device) u_ = u * (-1.0) if torch.det(u) < 0 else u vT_ = vT * (-1.0) if torch.det(vT) < 0 else vT R1 = u_ @ w @ vT_ R2 = u_ @ w.transpose(0, 1) @ vT_ t = u[:, -1] # real return R1, R2, t.unsqueeze(1) def new_decompose_E(model): """ recover rotation and translation from essential matrices without SVD reference: Horn, Berthold KP. Recovering baseline and orientation from essential matrix[J]. J. Opt. Soc. Am, 1990, 110. input: essential matrix (3, 3) output: two possible solutions of rotation matrices, R1, R2; translation t """ # assert model.shape == (3, 3) # Eq.18, choose the largest of the three possible pairwise cross-products e1, e2, e3 = model[:, 0], model[:, 1], model[:, 2] bs = [ torch.norm(torch.cross(e1, e2)), torch.norm(torch.cross(e2, e3)), torch.norm(torch.cross(e3, e1)), ] largest = torch.argmax(torch.stack(bs)) bb = bs[largest] # sqrt(1/2 trace(EE^T)) scale_factor = torch.sqrt(0.5 * torch.trace(model @ model.transpose(0, -1))) if largest == 0: b1 = scale_factor * torch.cross(e1, e2) / torch.norm(torch.cross(e1, e2)) elif largest == 1: b1 = scale_factor * torch.cross(e2, e3) / torch.norm(torch.cross(e2, e3)) else: b1 = scale_factor * torch.cross(e3, e1) / torch.norm(torch.cross(e3, e1)) # nomalization b1_ = b1 / torch.norm(b1) # skew-symmetric matrix t0, t1, t2 = b1 B1 = torch.tensor([[0, -t2, t1], [t2, 0, -t0], [-t1, t0, 0]], device=b1.device) # the second translation and rotation b2 = -b1 B2 = -B1 # Eq.24, recover R # (bb)R = Cofactors(E)^T - BE R1 = (matrix_cofactor_tensor(model) - B1 @ model) / (b1.dot(b1)) R2 = (matrix_cofactor_tensor(model) - B2 @ model) / (b1.dot(b1)) return R1, R2, b1_.unsqueeze(-1) def matrix_cofactor_tensor(matrix): """Cofactor matrix, refer to the numpy doc.""" try: det = torch.det(matrix) if det != 0: cofactor = None cofactor = torch.linalg.inv(matrix).T * det # return cofactor matrix of the given matrix return cofactor else: raise Exception("singular matrix") except Exception as e: print("could not find cofactor matrix due to", e) def cheirality_check(P0, P, p1, p2, distanceThreshold): # Q = kornia.geometry.epipolar.triangulate_points(P0.repeat(1024, 1, 1), P, p1, p2) # make sure the P type, complex tensor with cause error here Q = torch.tensor( cv2.triangulatePoints( P0.cpu().detach().numpy(), P.cpu().detach().numpy(), p1.T, p2.T ), dtype=P0.dtype, device=P0.device, ) Q_homogeneous = torch.stack([Q[i] / Q[-1] for i in range(Q.shape[0])]) Q_ = P @ Q_homogeneous mask = ( (Q[2].mul(Q[3]) > 0) & (Q_homogeneous[2] < distanceThreshold) & (Q_[2] > 0) & (Q_[2] < distanceThreshold) ) return mask def quaternion_from_matrix(matrix, isprecise=False): """Return quaternion from rotation matrix. If isprecise is True, the input matrix is assumed to be a precise rotation matrix and a faster algorithm is used. >>> q = quaternion_from_matrix(numpy.identity(4), True) >>> numpy.allclose(q, [1, 0, 0, 0]) True >>> q = quaternion_from_matrix(numpy.diag([1, -1, -1, 1])) >>> numpy.allclose(q, [0, 1, 0, 0]) or numpy.allclose(q, [0, -1, 0, 0]) True >>> R = rotation_matrix(0.123, (1, 2, 3)) >>> q = quaternion_from_matrix(R, True) >>> numpy.allclose(q, [0.9981095, 0.0164262, 0.0328524, 0.0492786]) True >>> R = [[-0.545, 0.797, 0.260, 0], [0.733, 0.603, -0.313, 0], ... [-0.407, 0.021, -0.913, 0], [0, 0, 0, 1]] >>> q = quaternion_from_matrix(R) >>> numpy.allclose(q, [0.19069, 0.43736, 0.87485, -0.083611]) True >>> R = [[0.395, 0.362, 0.843, 0], [-0.626, 0.796, -0.056, 0], ... [-0.677, -0.498, 0.529, 0], [0, 0, 0, 1]] >>> q = quaternion_from_matrix(R) >>> numpy.allclose(q, [0.82336615, -0.13610694, 0.46344705, -0.29792603]) True >>> R = random_rotation_matrix() >>> q = quaternion_from_matrix(R) >>> is_same_transform(R, quaternion_matrix(q)) True >>> R = euler_matrix(0.0, 0.0, numpy.pi/2.0) >>> numpy.allclose(quaternion_from_matrix(R, isprecise=False), ... quaternion_from_matrix(R, isprecise=True)) True """ M = np.array(matrix, dtype=np.float64, copy=False)[:4, :4] if isprecise: q = np.empty((4,)) t = np.trace(M) if t > M[3, 3]: q[0] = t q[3] = M[1, 0] - M[0, 1] q[2] = M[0, 2] - M[2, 0] q[1] = M[2, 1] - M[1, 2] else: i, j, k = 1, 2, 3 if M[1, 1] > M[0, 0]: i, j, k = 2, 3, 1 if M[2, 2] > M[i, i]: i, j, k = 3, 1, 2 t = M[i, i] - (M[j, j] + M[k, k]) + M[3, 3] q[i] = t q[j] = M[i, j] + M[j, i] q[k] = M[k, i] + M[i, k] q[3] = M[k, j] - M[j, k] q *= 0.5 / math.sqrt(t * M[3, 3]) else: m00 = M[0, 0] m01 = M[0, 1] m02 = M[0, 2] m10 = M[1, 0] m11 = M[1, 1] m12 = M[1, 2] m20 = M[2, 0] m21 = M[2, 1] m22 = M[2, 2] # symmetric matrix K K = np.array( [ [m00 - m11 - m22, 0.0, 0.0, 0.0], [m01 + m10, m11 - m00 - m22, 0.0, 0.0], [m02 + m20, m12 + m21, m22 - m00 - m11, 0.0], [m21 - m12, m02 - m20, m10 - m01, m00 + m11 + m22], ] ) K /= 3.0 # quaternion is eigenvector of K that corresponds to largest eigenvalue w, V = np.linalg.eigh(K) q = V[[3, 0, 1, 2], np.argmax(w)] if q[0] < 0.0: np.negative(q, q) return q def quaternion_from_matrix_tensor(matrix, isprecise=False): """Return quaternion from rotation matrix. If isprecise is True, the input matrix is assumed to be a precise rotation matrix and a faster algorithm is used. >>> q = quaternion_from_matrix(numpy.identity(4), True) >>> numpy.allclose(q, [1, 0, 0, 0]) True >>> q = quaternion_from_matrix(numpy.diag([1, -1, -1, 1])) >>> numpy.allclose(q, [0, 1, 0, 0]) or numpy.allclose(q, [0, -1, 0, 0]) True >>> R = rotation_matrix(0.123, (1, 2, 3)) >>> q = quaternion_from_matrix(R, True) >>> numpy.allclose(q, [0.9981095, 0.0164262, 0.0328524, 0.0492786]) True >>> R = [[-0.545, 0.797, 0.260, 0], [0.733, 0.603, -0.313, 0], ... [-0.407, 0.021, -0.913, 0], [0, 0, 0, 1]] >>> q = quaternion_from_matrix(R) >>> numpy.allclose(q, [0.19069, 0.43736, 0.87485, -0.083611]) True >>> R = [[0.395, 0.362, 0.843, 0], [-0.626, 0.796, -0.056, 0], ... [-0.677, -0.498, 0.529, 0], [0, 0, 0, 1]] >>> q = quaternion_from_matrix(R) >>> numpy.allclose(q, [0.82336615, -0.13610694, 0.46344705, -0.29792603]) True >>> R = random_rotation_matrix() >>> q = quaternion_from_matrix(R) >>> is_same_transform(R, quaternion_matrix(q)) True >>> R = euler_matrix(0.0, 0.0, numpy.pi/2.0) >>> numpy.allclose(quaternion_from_matrix(R, isprecise=False), ... quaternion_from_matrix(R, isprecise=True)) True """ # M = torch.tensor(matrix, dtype=torch.float64, device=matrix.device)[:4, :4] M = matrix if isprecise: q = np.empty((4,)) t = np.trace(M) if t > M[3, 3]: q[0] = t q[3] = M[1, 0] - M[0, 1] q[2] = M[0, 2] - M[2, 0] q[1] = M[2, 1] - M[1, 2] else: i, j, k = 1, 2, 3 if M[1, 1] > M[0, 0]: i, j, k = 2, 3, 1 if M[2, 2] > M[i, i]: i, j, k = 3, 1, 2 t = M[i, i] - (M[j, j] + M[k, k]) + M[3, 3] q[i] = t q[j] = M[i, j] + M[j, i] q[k] = M[k, i] + M[i, k] q[3] = M[k, j] - M[j, k] q *= 0.5 / math.sqrt(t * M[3, 3]) else: m00 = M[0, 0] m01 = M[0, 1] m02 = M[0, 2] m10 = M[1, 0] m11 = M[1, 1] m12 = M[1, 2] m20 = M[2, 0] m21 = M[2, 1] m22 = M[2, 2] # symmetric matrix K K = torch.tensor( [ [m00 - m11 - m22, 0.0, 0.0, 0.0], [m01 + m10, m11 - m00 - m22, 0.0, 0.0], [m02 + m20, m12 + m21, m22 - m00 - m11, 0.0], [m21 - m12, m02 - m20, m10 - m01, m00 + m11 + m22], ], device=matrix.device, ) K /= 3.0 # quaternion is an eigenvector of K that corresponds to the largest eigenvalue w, V = torch.linalg.eigh(K) q = V[[3, 0, 1, 2], torch.argmax(w)] if q[0] < 0.0: torch.negative(q) return q def evaluate_R_t_tensor(R_gt, t_gt, R, t, q_gt=None): t = t.flatten() t_gt = t_gt.flatten().to(t.device) eps = torch.tensor(1e-8).to(t.device) err_q = torch.arccos( torch.max( torch.min( (torch.trace(R @ R_gt.transpose(0, 1)) - 1) * 0.5, torch.tensor(1.0, device=R.device), ), torch.tensor(-1.0, device=R.device), ) ) t_gt_ = t_gt / (torch.linalg.norm(t_gt) + eps) loss_t = torch.max(eps, 1.0 - torch.sum(t * t_gt_) ** 2) # torch.clamp((), min=eps) err_t = torch.arccos(torch.sqrt(1 - loss_t + eps)) if torch.sum(torch.isnan(err_q)) or torch.sum(torch.isnan(err_t)): print("This should never happen! Debug here", R_gt, t_gt, R, t, q_gt) import IPython IPython.embed() return err_q, err_t def evaluate_R_t_tensor_batch(R_gt, t_gt, R, t, q_gt=None): t = t.flatten(-2, -1) t_gt = t_gt.flatten().to(t.device) eps = torch.tensor(1e-15).to(t.device) # rotation error err_q = torch.arccos( torch.clamp( ( torch.diagonal( R @ R_gt.repeat(R.shape[0], 1, 1).transpose(-2, -1), dim1=-2, dim2=-1, ).sum(-1) - 1 ) * 0.5, min=-1.0, max=1.0, ) ) # translation error t = t / (torch.norm(t, dim=-1) + eps).unsqueeze(-1) t_gt_ = t_gt / (torch.linalg.norm(t_gt) + eps) loss_t = torch.clamp((1.0 - torch.sum(t * t_gt_, dim=-1) ** 2), min=eps) err_t = torch.arccos(torch.sqrt(1 - loss_t + 1e-8)) if torch.sum(torch.isnan(err_q)) or torch.sum(torch.isnan(err_t)): # This should never happen! Debug here print(R_gt, t_gt, R, t, q_gt) import IPython IPython.embed() return err_q, err_t def evaluate_R_t(R_gt, t_gt, R, t, q_gt=None): t = t.flatten() t_gt = t_gt.flatten() eps = 1e-15 if q_gt is None: q_gt = quaternion_from_matrix(R_gt) q = quaternion_from_matrix(R) q = q / (np.linalg.norm(q) + eps) q_gt = q_gt / (np.linalg.norm(q_gt) + eps) loss_q = np.maximum(eps, (1.0 - np.sum(q * q_gt) ** 2)) err_q = np.arccos(1 - 2 * loss_q) t = t / (np.linalg.norm(t) + eps) t_gt = t_gt / (np.linalg.norm(t_gt) + eps) loss_t = np.maximum(eps, (1.0 - np.sum(t * t_gt) ** 2)) err_t = np.arccos(np.sqrt(1 - loss_t)) if np.sum(np.isnan(err_q)) or np.sum(np.isnan(err_t)): print("This should never happen! Debug here", R_gt, t_gt, R, t, q_gt) import IPython IPython.embed() return err_q, err_t def orientation_error(pts1, pts2, M, ang): """Orientation error calculation for E or F matrix.""" # 2D coordinates to 3D homogeneous coordinates num_pts = pts1.shape[0] # get homogeneous coordinates hom_pts1 = torch.cat((pts1, torch.ones((num_pts, 1), device=M.device)), dim=-1) hom_pts2 = torch.cat((pts2, torch.ones((num_pts, 1), device=M.device)), dim=-1) # calculate the ang between n1 and n2 l1 = M.transpose(-2, -1) @ hom_pts2.transpose(-2, -1)[0:2] l2 = M @ hom_pts1.transpose(-2, -1)[0:2] n1 = l1[:, 0:2, :] n2 = l2[:, 0:2, :] n1_norm = 1 / torch.norm(n1, axis=0) n1 = torch.dot(n1, n1_norm) n2_norm = 1 / torch.norm(n2, axis=0) n2 = torch.dot(n2, n2_norm) alpha = torch.arccos(n1.T.dot(n2)) ori_error = abs(alpha - ang) return ori_error def scale_error(pts1, pts2, M, scale_ratio): """Scale error of the essential matrix.""" num_pts = pts1.shape[0] # get homogeneous coordinates hom_pts1 = torch.cat((pts1, torch.ones((num_pts, 1), device=M.device)), dim=-1) hom_pts2 = torch.cat((pts2, torch.ones((num_pts, 1), device=M.device)), dim=-1) # calculate the angle between n1 and n2 l1 = (M.transpose(-2, -1) @ (hom_pts2.transpose(-2, -1)))[:, 0:2] l2 = (M @ (hom_pts1.transpose(-2, -1)))[:, 0:2] l1_norm = torch.norm(scale_ratio * l1, dim=(-1, -2)) l2_norm = torch.norm(l2, dim=(-1, -2)) return abs(l1_norm - l2_norm) def eval_essential_matrix_numpy(p1n, p2n, E, dR, dt): """Recover the rotation and translation matrices through OpneCV and return their errors.""" if len(p1n) != len(p2n): raise RuntimeError("Size mismatch in the keypoint lists") if p1n.shape[0] < 5: return np.pi, np.pi / 2 if E is not None: # .size > 0: _, R, t, _ = cv2.recoverPose( E.cpu().detach().numpy().astype(np.float64), p1n, p2n ) # R, t = recoverPose(E, p1n, p2n) try: err_q, err_t = evaluate_R_t(dR, dt, R, t) except: err_q = np.pi err_t = np.pi / 2 else: err_q = np.pi err_t = np.pi / 2 return err_q / np.pi * 180.0, err_t / np.pi * 180.0 def eval_essential_matrix(p1n, p2n, E, dR, dt, svd=True): """Evaluate the essential matrix, decompose E to R and t, return the rotation and translation error.""" if len(p1n) != len(p2n): raise RuntimeError("Size mismatch in the keypoint lists") if p1n.shape[0] < 5: return np.pi, np.pi / 2 if E is not None: # recover the relative pose from E R, t = recoverPose(E, p1n, p2n, svd) try: err_q, err_t = evaluate_R_t_tensor(dR, dt, R, t) except: err_q = np.pi err_t = np.pi / 2 else: err_q = np.pi err_t = np.pi / 2 return err_q / np.pi * 180.0, err_t / np.pi * 180.0 def AUC(losses, thresholds=[5, 10, 20], binsize=5): """From NG-RANSAC Compute the AUC up to a set of error thresholds. Return multiple AUC corresponding to multiple threshold provided. Keyword arguments: losses -- list of losses which the AUC should be calculated for thresholds -- list of threshold values up to which the AUC should be calculated binsize -- bin size to be used to the cumulative histogram when calculating the AUC, the finer the more accurate """ bin_num = int(max(thresholds) / binsize) bins = np.arange(bin_num + 1) * binsize hist, _ = np.histogram(losses, bins) # histogram up to the max threshold hist = hist.astype(np.float32) / len(losses) # normalized histogram hist = np.cumsum(hist) # cumulative normalized histogram # calculate AUC for each threshold return [np.mean(hist[: int(t / binsize)]) for t in thresholds] def AUC_tensor(losses, thresholds=[5, 10, 20], binsize=5): """Re-implementation in PyTorch from NG-RANSAC Compute the AUC up to a set of error thresholds. Return multiple AUC corresponding to multiple threshold provided. Keyword arguments: losses -- list of losses which the AUC should be calculated for thresholds -- list of threshold values up to which the AUC should be calculated binsize -- bin size to be used to the cumulative histogram when calculating the AUC, the finer the more accurate """ bin_num = int(max(thresholds) / binsize) bins = torch.arange(bin_num + 1) * binsize hist, _ = torch.histogram(losses, bins) # histogram up to the max threshold hist = hist.astype(torch.float32) / len(losses) # normalized histogram hist = torch.cumsum(hist) # cumulative normalized histogram # calculate AUC for each threshold return [torch.mean(hist[: int(t / binsize)]) for t in thresholds] # for checking, kornia def cross_product_matrix(x): r"""Return the cross_product_matrix symmetric matrix of a vector. Args: x: The input vector to construct the matrix in the shape :math:`(*, 3)`. Returns: The constructed cross_product_matrix symmetric matrix with shape :math:`(*, 3, 3)`. """ if not x.shape[-1] == 3: raise AssertionError(x.shape) # get vector components x0 = x[..., 0] x1 = x[..., 1] x2 = x[..., 2] # construct the matrix, reshape to 3x3 and return zeros = torch.zeros_like(x0) cross_product_matrix_flat = torch.stack( [zeros, -x2, x1, x2, zeros, -x0, -x1, x0, zeros], dim=-1 ) shape_ = x.shape[:-1] + (3, 3) return cross_product_matrix_flat.view(*shape_) def pose_error(R, gt_R, t, gt_t): """NG-RANSAC, Compute the angular error between two rotation matrices and two translation vectors. Keyword arguments: R -- 2D numpy array containing an estimated rotation gt_R -- 2D numpy array containing the corresponding ground truth rotation t -- 2D numpy array containing an estimated translation as column gt_t -- 2D numpy array containing the corresponding ground truth translation """ # calculate angle between provided rotations dR = np.matmul(R, np.transpose(gt_R)) dR = cv2.Rodrigues(dR)[0] dR = np.linalg.norm(dR) * 180 / math.pi # calculate angle between provided translations dT = float(np.dot(gt_t.T, t)) dT /= float(np.linalg.norm(gt_t)) if dT > 1 or dT < -1: print("Domain warning! dT:", dT) dT = max(-1, min(1, dT)) dT = math.acos(dT) * 180 / math.pi return dR, dT def batch_episym(x1, x2, F): """Epipolar symmetric error from CLNet.""" batch_size, num_pts = x1.shape[0], x1.shape[1] x1 = torch.cat([x1, x1.new_ones(batch_size, num_pts, 1)], dim=-1).reshape( batch_size, num_pts, 3, 1 ) x2 = torch.cat([x2, x2.new_ones(batch_size, num_pts, 1)], dim=-1).reshape( batch_size, num_pts, 3, 1 ) F = F.reshape(-1, 1, 3, 3).repeat(1, num_pts, 1, 1) x2Fx1 = torch.matmul(x2.transpose(2, 3), torch.matmul(F, x1)).reshape( batch_size, num_pts ) Fx1 = torch.matmul(F, x1).reshape(batch_size, num_pts, 3) Ftx2 = torch.matmul(F.transpose(2, 3), x2).reshape(batch_size, num_pts, 3) ys = x2Fx1**2 * ( 1.0 / (Fx1[:, :, 0] ** 2 + Fx1[:, :, 1] ** 2 + 1e-15) + 1.0 / (Ftx2[:, :, 0] ** 2 + Ftx2[:, :, 1] ** 2 + 1e-15) ) if torch.isnan(ys).any(): print("ys is nan in batch_episym") return ys
21,871
Python
.py
547
32.817185
123
0.56399
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,684
loss.py
disungatullina_MinBackProp/loss.py
import cv2 import torch import torch.nn as nn from cv_utils import * from math_utils import * import numpy as np from scorings.msac_score import * from feature_utils import * class MatchLoss(object): """Rewrite Match loss from CLNet, symmetric epipolar distance""" def __init__(self): self.scoring_fun = MSACScore() def forward( self, models, gt_E, pts1, pts2, K1, K2, im_size1, im_size2, topk_flag=False, k=1 ): essential_loss = [] for b in range(gt_E.shape[0]): pts1_1 = pts1[b].clone() pts2_2 = pts2[b].clone() Es = models[b] _, gt_R_1, gt_t_1, gt_inliers = cv2.recoverPose( gt_E[b].astype(np.float64), pts1_1.unsqueeze(1).cpu().detach().numpy(), pts2_2.unsqueeze(1).cpu().detach().numpy(), np.eye(3, dtype=gt_E.dtype), ) # find the ground truth inliers gt_mask = np.where(gt_inliers.ravel() > 0, 1.0, 0.0).astype(bool) gt_mask = torch.from_numpy(gt_mask).to(pts1_1.device) # symmetric epipolar errors based on gt inliers geod = batch_episym( pts1_1[gt_mask].repeat(Es.shape[0], 1, 1), pts2_2[gt_mask].repeat(Es.shape[0], 1, 1), Es, ) e_l = torch.min(geod, geod.new_ones(geod.shape)) if torch.isnan(e_l.mean()).any(): print("nan values in pose loss") # .1* if topk_flag: topk_indices = torch.topk(e_l.mean(1), k=k, largest=False).indices essential_loss.append(e_l[topk_indices].mean()) else: essential_loss.append(e_l.mean()) # average return sum(essential_loss) / gt_E.shape[0]
1,811
Python
.py
45
29.733333
88
0.546644
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,685
math_utils.py
disungatullina_MinBackProp/math_utils.py
import math import torch def multi_cubic(a0, b0, c0, d0, all_roots=True): """Analytical closed-form solver for multiple cubic equations (3rd order polynomial), based on `numpy` functions. Parameters ---------- a0, b0, c0, d0: array_like Input data are coefficients of the Cubic polynomial:: a0*x^3 + b0*x^2 + c0*x + d0 = 0 all_roots: bool, optional If set to `True` (default) all three roots are computed and returned. If set to `False` only one (real) root is computed and returned. Returns ------- roots: ndarray Output data is an array of three roots of given polynomials of size (3, M) if `all_roots=True`, and an array of one root of size (M,) if `all_roots=False`. """ """ Reduce the cubic equation to to form: x^3 + a*x^2 + bx + c = 0""" a, b, c = b0 / a0, c0 / a0, d0 / a0 device = a0.device # Some repeating constants and variables third = 1.0 / 3.0 a13 = a * third a2 = a13 * a13 sqr3 = math.sqrt(3) # Additional intermediate variables f = third * b - a2 g = a13 * (2 * a2 - b) + c h = 0.25 * g * g + f * f * f # Masks for different combinations of roots m1 = (f == 0) & (g == 0) & (h == 0) # roots are real and equal m2 = (~m1) & (h <= 0) # roots are real and distinct m3 = (~m1) & (~m2) # one real root and two complex def cubic_root(x): """Compute cubic root of a number while maintaining its sign.""" root = torch.zeros_like(x) positive = x >= 0 negative = ~positive root[positive] = x[positive] ** third root[negative] = -((-x[negative]) ** third) return root def roots_all_real_equal(c): """Compute cubic roots if all roots are real and equal.""" r1 = -cubic_root(c).type(torch.cfloat) if all_roots: return torch.stack((r1, r1, r1), dim=0) else: return r1 def roots_all_real_distinct(a13, f, g, h): """Compute cubic roots if all roots are real and distinct.""" j = torch.sqrt(-f) k = torch.arccos(-0.5 * g / (j * j * j)) m = torch.cos(third * k) r1 = 2 * j * m - a13 if all_roots: n = sqr3 * torch.sin(third * k) r2 = -j * (m + n) - a13 r3 = -j * (m - n) - a13 return torch.stack((r1, r2, r3), dim=0).type(torch.cfloat) else: return r1 def roots_one_real(a13, g, h): """Compute cubic roots if one root is real and other two are complex.""" sqrt_h = torch.sqrt(h) S = cubic_root(-0.5 * g + sqrt_h) U = cubic_root(-0.5 * g - sqrt_h) S_plus_U = S + U r1 = S_plus_U - a13 if all_roots: S_minus_U = S - U r2 = -0.5 * S_plus_U - a13 + S_minus_U * sqr3 * 0.5j r3 = -0.5 * S_plus_U - a13 - S_minus_U * sqr3 * 0.5j return torch.stack((r1, r2, r3), dim=0).type(torch.cfloat) else: return r1 # Compute roots if all_roots: roots = torch.zeros((3, len(a)), device=device, dtype=torch.cfloat) roots[:, m1] = roots_all_real_equal(c[m1]) roots[:, m2] = roots_all_real_distinct(a13[m2], f[m2], g[m2], h[m2]) roots[:, m3] = roots_one_real(a13[m3], g[m3], h[m3]) else: roots = torch.zeros(len(a), device=device, dtype=torch.cfloat) roots[m1] = roots_all_real_equal(c[m1]) roots[m2] = roots_all_real_distinct(a13[m2], f[m2], g[m2], h[m2]) roots[m3] = roots_one_real(a13[m3], g[m3], h[m3]) return roots class StrumPolynomialSolver(object): """ Python reimplementation of https://github.com/danini/graph-cut-ransac/blob/master/src/pygcransac/include/maths/sturm_polynomial_solver.h polynomial solver, use for various degrees. """ def __init__(self, n): self.n = n def build_sturm_seq(self, fvec): f = torch.zeros(3 * self.n, dtype=torch.float64, device=fvec.device) f[: 2 * self.n + 1] = fvec f[2 * self.n + 1 :] = torch.tensor( [-9.2559631349317831e61] * (self.n - 1), dtype=torch.float64 ) f1 = 0 f2 = self.n + 1 f3 = 2 * self.n + 1 svec = torch.zeros(3 * self.n, dtype=torch.float64, device=fvec.device) for i in range(self.n - 1): q1 = f[f1 + self.n - i] * f[f2 + self.n - 1 - i] q0 = ( f[f1 + self.n - 1 - i] * f[f2 + self.n - 1 - i] - f[f1 + self.n - i] * f[f2 + self.n - 2 - i] ) f[f3] = f[f1] - q0 * f[f2] for j in range(1, self.n - 1 - i): f[f3 + j] = f[f1 + j] - q1 * f[f2 + j - 1] - q0 * f[f2 + j] c = -abs(f[f3 + self.n - 2 - i]) for j in range(0, self.n - 1 - i): f[f3 + j] = f[f3 + j] * (1 / c) # juggle pointers(f1, f2, f3) -> (f2, f3, f1) tmp = f1 f1, f2, f3 = f2, f3, tmp # svec = torch.stack(q0, q1, c) # columns svec[3 * i] = q0 svec[3 * i + 1] = q1 svec[3 * i + 2] = c svec[3 * self.n - 3] = f[f1] svec[3 * self.n - 2] = f[f1 + 1] svec[3 * self.n - 1] = f[f2] return svec def get_bounds(self, fvec): max_ = 0 for i in range(self.n): max_ = max([max_, abs(fvec[i])]) return 1 + max_ def flag_negative(self, f, n): if n <= 0: return f[0] < 0 else: return (int(f[n] < 0) << n) | self.flag_negative( f, n - 1 ) # '<<' will cause lshift_cuda' not implemented for bool def change_sign(self, svec, x): f = torch.tensor( [-9.2559631349317831e61] * (self.n + 1), dtype=torch.float64, device=svec.device, ) f[self.n] = svec[3 * self.n - 1] f[self.n - 1] = svec[3 * self.n - 3] + x * svec[3 * self.n - 2] for i in range(self.n - 2, -1, -1): f[i] = (svec[3 * i] + x * svec[3 * i + 1]) * f[i + 1] + svec[3 * i + 2] * f[ i + 2 ] # negative flag S = self.flag_negative(f, self.n) return self.NumberOf1((S ^ (S >> 1)) & ~(0xFFFFFFFF << self.n)) def NumberOf1(self, n): return bin(n & 0xFFFFFFFF).count("1") def polyval(self, f, x, n): fx = x + f[n - 1] for i in range(n - 2, -1, -1): fx = x * fx + f[i] return fx def ridders_method_newton(self, fvec, a, b, tol, tol_newton=1e-3 / 2, n_roots=None): """Applies Ridder's bracketing method until we get close to root, followed by newton iterations.""" fa = self.polyval(fvec, a, self.n) fb = self.polyval(fvec, b, self.n) if not ((fa * fb) < 0): return 0, 0 for i in range(30): if abs(a - b) < tol_newton: break c = (a + b) * 1 / 2 fc = self.polyval(fvec, c, self.n) s = torch.sqrt(fc**2 - fa * fb) if not s: break d = c + (a - c) * fc / s if (fa < fb) else c + (c - a) * fc / s fd = self.polyval(fvec, d, self.n) if (fc < 0) if (fd >= 0) else (fc > 0): a = c fa = fc b = d fb = fd elif (fa < 0) if (fd >= 0) else (fa > 0): b = d fb = fd else: a = d fa = fd # We switch to Newton's method once we are close to the root x = (a + b) * 0.5 fpvec = fvec[self.n + 1 :] for i in range(0, 10): fx = self.polyval(fvec, x, self.n) if abs(fx) < tol: break fpx = self.n * self.polyval(fpvec, x, self.n - 1) dx = fx / fpx x = x - dx if abs(dx) < tol: break n_roots += 1 return n_roots, x def isolate_roots( self, fvec, svec, a, b, sa, sb, tol, depth, n_roots=None, roots=None ): if depth > 30: return 0, roots if (sa - sb) > 1: c = 1 / 2 * (a + b) sc = self.change_sign(svec, c) n_roots, roots = self.isolate_roots( fvec, svec, a, c, sa, sc, tol, depth + 1, n_roots=n_roots, roots=roots ) n_roots, roots = self.isolate_roots( fvec, svec, c, b, sc, sb, tol, depth + 1, n_roots=n_roots, roots=roots ) elif (sa - sb) == 1: n_roots, x = self.ridders_method_newton(fvec, a, b, tol, n_roots=n_roots) roots[n_roots - 1] = x return n_roots, roots def bisect_sturm(self, coeffs, tol=1e-10): if coeffs[self.n - 1] == 0.0: return 0, None # fvec is the polynomial and its first derivative. fvec = torch.zeros(2 * self.n + 1, dtype=torch.float64, device=coeffs.device) fvec[: self.n + 1], fvec[self.n + 1 :] = coeffs, torch.tensor( [-9.2559631349317831e61] * (self.n), dtype=torch.float64 ) fvec[: self.n + 1] *= 1 / fvec[self.n] fvec[self.n] = 1 # Compute the derivative with normalized coefficients for i in range(self.n - 1): fvec[self.n + 1 + i] = fvec[i + 1] * ((i + 1) / self.n) fvec[2 * self.n] = 1 # Compute sturm sequences svec = self.build_sturm_seq(fvec) # All real roots are in the interval [-r0, r0] r0 = self.get_bounds(fvec) sa = self.change_sign(svec, -r0) sb = self.change_sign(svec, r0) n_roots = sa - sb if n_roots <= 0: return 0, None roots = torch.zeros(n_roots, device=fvec.device) n_roots = 0 n_roots, roots = self.isolate_roots( fvec, svec, -r0, r0, sa, sb, tol, 0, n_roots=n_roots, roots=roots ) return n_roots, roots class StrumPolynomialSolverBatch(object): """ Python reimplementation of https://github.com/danini/graph-cut-ransac/blob/master/src/pygcransac/include/maths/sturm_polynomial_solver.h polynomial solver, use for batches of polynomials in various degrees. """ def __init__(self, n, batch_size): self.n = n self.batch_size = batch_size def build_sturm_seq(self, fvec): f = torch.zeros( self.batch_size, 3 * self.n, dtype=torch.float64, device=fvec.device ) f[:, : 2 * self.n + 1] = fvec f[:, 2 * self.n + 1 :] = torch.tensor( [-9.2559631349317831e61] * (self.batch_size * (self.n - 1)), dtype=torch.float64, ).view(self.batch_size, -1) f1 = 0 f2 = self.n + 1 f3 = 2 * self.n + 1 svec = torch.zeros( self.batch_size, 3 * self.n, dtype=torch.float64, device=fvec.device ) for i in range(self.n - 1): q1 = f[:, f1 + self.n - i] * f[:, f2 + self.n - 1 - i] q0 = ( f[:, f1 + self.n - 1 - i] * f[:, f2 + self.n - 1 - i] - f[:, f1 + self.n - i] * f[:, f2 + self.n - 2 - i] ) f[:, f3] = f[:, f1] - q0 * f[:, f2] for j in range(1, self.n - 1 - i): f[:, f3 + j] = f[:, f1 + j] - q1 * f[:, f2 + j - 1] - q0 * f[:, f2 + j] c = -abs(f[:, f3 + self.n - 2 - i]) for j in range(0, self.n - 1 - i): f[:, f3 + j] = f[:, f3 + j] * (1 / c) # juggle pointers(f1, f2, f3) -> (f2, f3, f1) tmp = f1 f1, f2, f3 = f2, f3, tmp # svec = torch.stack(q0, q1, c) # columns svec[:, 3 * i] = q0 svec[:, 3 * i + 1] = q1 svec[:, 3 * i + 2] = c svec[:, 3 * self.n - 3] = f[:, f1] svec[:, 3 * self.n - 2] = f[:, f1 + 1] svec[:, 3 * self.n - 1] = f[:, f2] return svec def get_bounds(self, fvec): max_, _ = torch.max(abs(fvec[:, :10]), dim=-1) return 1 + max_ def flag_negative(self, f, n): if n <= 0: return f[0] < 0 else: return (int(f[n] < 0) << n) | self.flag_negative(f, n - 1) def change_sign(self, svec, x): f = torch.tensor( [-9.2559631349317831e61] * (self.n + 1), dtype=torch.float64, device=svec.device, ) f[self.n] = svec[3 * self.n - 1] f[self.n - 1] = svec[3 * self.n - 3] + x * svec[3 * self.n - 2] for i in range(self.n - 2, -1, -1): f[i] = (svec[3 * i] + x * svec[3 * i + 1]) * f[i + 1] + svec[3 * i + 2] * f[ i + 2 ] S = self.flag_negative(f, self.n) return self.NumberOf1((S ^ (S >> 1)) & ~(0xFFFFFFFF << self.n)) def change_sign_batch(self, svec, x): f = torch.tensor( [-9.2559631349317831e61] * (self.batch_size * (self.n + 1)), dtype=torch.float64, device=svec.device, ).view(self.batch_size, -1) f[:, self.n] = svec[:, 3 * self.n - 1] f[:, self.n - 1] = svec[:, 3 * self.n - 3] + x * svec[:, 3 * self.n - 2] for i in range(self.n - 2, -1, -1): f[:, i] = (svec[:, 3 * i] + x * svec[:, 3 * i + 1]) * f[:, i + 1] + svec[ :, 3 * i + 2 ] * f[:, i + 2] ret = [] # negative flag for i in range(f.shape[0]): S = self.flag_negative(f[i], self.n) ret.append( torch.tensor( self.NumberOf1((S ^ (S >> 1)) & ~(0xFFFFFFFF << self.n)), device=f.device, ) ) return torch.stack(ret) def NumberOf1(self, n): return bin(n & 0xFFFFFFFF).count("1") def polyval(self, f, x, n): fx = x + f[n - 1] for i in range(n - 2, -1, -1): fx = x * fx + f[i] return fx def ridders_method_newton(self, fvec, a, b, tol, tol_newton=1e-3 / 2, n_roots=None): """Applies Ridder's bracketing method until we get close to root, followed by newton iterations.""" fa = self.polyval(fvec, a, self.n) fb = self.polyval(fvec, b, self.n) if not ((fa * fb) < 0): return 0, torch.zeros(1, device=fvec.device) for i in range(30): if abs(a - b) < tol_newton: break c = (a + b) * 1 / 2 fc = self.polyval(fvec, c, self.n) s = torch.sqrt(fc**2 - fa * fb) if not s: break d = c + (a - c) * fc / s if (fa < fb) else c + (c - a) * fc / s fd = self.polyval(fvec, d, self.n) if (fc < 0) if (fd >= 0) else (fc > 0): a = c fa = fc b = d fb = fd elif (fa < 0) if (fd >= 0) else (fa > 0): b = d fb = fd else: a = d fa = fd # We switch to Newton's method once we are close to the root x = (a + b) * 0.5 fpvec = fvec[self.n + 1 :] for i in range(0, 10): fx = self.polyval(fvec, x, self.n) if abs(fx) < tol: break fpx = self.n * self.polyval(fpvec, x, self.n - 1) dx = fx / fpx x = x - dx if abs(dx) < tol: break n_roots += 1 return n_roots, x def isolate_roots( self, fvec, svec, a, b, sa, sb, tol, depth, n_roots=None, roots=None ): if depth > 30: return 0, roots if (sa - sb) > 1: c = 1 / 2 * (a + b) sc = self.change_sign(svec, c) n_roots, roots = self.isolate_roots( fvec, svec, a, c, sa, sc, tol, depth + 1, n_roots=n_roots, roots=roots ) n_roots, roots = self.isolate_roots( fvec, svec, c, b, sc, sb, tol, depth + 1, n_roots=n_roots, roots=roots ) elif (sa - sb) == 1: try: n_roots, x = self.ridders_method_newton( fvec, a, b, tol, n_roots=n_roots ) except ValueError: print("") roots[n_roots - 1] = x return n_roots, roots def bisect_sturm(self, coeffs, custom_sols=0, tol=1e-10): # fvec is the polynomial and its first derivative. fvec = torch.zeros( self.batch_size, 2 * self.n + 1, dtype=torch.float64, device=coeffs.device ) fvec[:, : self.n + 1], fvec[:, self.n + 1 :] = coeffs, torch.tensor( [-9.2559631349317831e61] * (self.batch_size * self.n), dtype=torch.float64 ).view(self.batch_size, -1) fvec[:, : self.n + 1] = ( torch.bmm( (fvec[:, : self.n + 1].clone()).unsqueeze(-1), (1 / fvec[:, self.n].clone()).unsqueeze(-1).unsqueeze(-1), ) ).squeeze(-1) fvec[:, self.n] = torch.ones(self.batch_size) # Compute the derivative with normalized coefficients for i in range(self.n - 1): fvec[:, self.n + 1 + i] = fvec[:, i + 1] * ((i + 1) / self.n) fvec[:, 2 * self.n] = torch.ones(self.batch_size) # Compute sturm sequences svec = self.build_sturm_seq(fvec) # All real roots are in the interval [-r0, r0] r0 = self.get_bounds(fvec) sa = self.change_sign_batch(svec, -r0) sb = self.change_sign_batch(svec, r0) roots = [] if custom_sols == 0: n_roots = sa - sb else: n_roots = torch.ones(self.batch_size, device=fvec.device) * custom_sols for i in range(self.batch_size): if n_roots[i] <= 0: root = torch.zeros(1, device=fvec.device) else: root = torch.zeros(int(n_roots[i]), device=fvec.device) n_root = 0 n_root, root = self.isolate_roots( fvec[i], svec[i], -r0[i], r0[i], sa[i], sb[i], tol, 0, n_roots=n_root, roots=root, ) roots.append(root) return n_roots, roots
18,515
Python
.py
465
28.793548
140
0.470654
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,686
essential_matrix_estimator_nister.py
disungatullina_MinBackProp/estimators/essential_matrix_estimator_nister.py
import torch import numpy as np from math_utils import * from utils import * from cv_utils import * try: from pymagsac import optimizeEssentialMatrix pymagsac_available = 1 def numerical_optimization( matches, weights, K1, K2, inlier_indices, best_model, unnormalzied_threshold, best_score, ): # bundle adjustment estimated_models, _ = optimizeEssentialMatrix( matches.squeeze().cpu().detach().numpy(), K1, K2, inlier_indices, best_model, unnormalzied_threshold, float(best_score), ) # normalize the models estimated_models = torch.from_numpy(estimated_models).to( matches.device, matches.dtype ).unsqueeze(0) / torch.norm( torch.from_numpy(estimated_models) .to(matches.device, matches.dtype) .unsqueeze(0), dim=(1, 2), ) return estimated_models except ImportError: pymagsac_available = 0 class EssentialMatrixEstimatorNister(object): def __init__(self, device="cuda", ift=1): self.sample_size = 5 self.device = device self.drop = ( not ift ) # True for the original autograd, False for the IFT and the DDN; False means to keep the batch size unchanged def estimate_model( self, matches, weights=None, K1=None, K2=None, inlier_indices=None, best_model=None, unnormalzied_threshold=None, best_score=0, ): # minimal solver if matches.shape[1] == self.sample_size: return self.estimate_minimal_model(matches, weights) # non-minial solver with numerical optimization in pymagsac c++ elif matches.shape[1] > self.sample_size: if pymagsac_available: return numerical_optimization( matches, weights, K1, K2, inlier_indices, best_model, unnormalzied_threshold, best_score, ) else: return self.estimate_minimal_model(matches, weights) return None def estimate_minimal_model(self, pts, weights=None): # x1 y1 x2 y2 """Using Nister's 5 PC to estimate Essential matrix.""" try: pts.shape[1] == self.sample_size except ValueError: print("This is not a minimal sample.") batch_size, num, _ = pts.shape pts1 = pts[:, :, 0:2] pts2 = pts[:, :, 2:4] # get the points x1, y1 = pts1[:, :, 0], pts1[:, :, 1] x2, y2 = pts2[:, :, 0], pts2[:, :, 1] # Step1: construct the A matrix, A F = 0. # 5 equations for 9 variables, A is 5x9 matrix containing epipolar constraints # Essential matrix is a linear combination of the 4 vectors spanning the null space of A a_59 = torch.ones_like(x1) # .shape) if weights is not None: A_s = weights.unsqueeze(-1) * torch.stack( ( torch.mul(x1, x2), torch.mul(x1, y2), x1, torch.mul(y1, x2), torch.mul(y1, y2), y1, x2, y2, a_59, ), dim=-1, ) else: A_s = torch.stack( ( torch.mul(x1, x2), torch.mul(x1, y2), x1, torch.mul(y1, x2), torch.mul(y1, y2), y1, x2, y2, a_59, ), dim=-1, ) _, _, v = torch.linalg.svd( A_s.transpose(-1, -2) @ A_s ) # .transpose(-1, -2)@A_s)# eigenvalues in increasing order null_ = v[:, -4:, :].transpose(-1, -2) # the last four rows nullSpace = v[:, -4:, :] coeffs = torch.zeros(batch_size, 10, 20, device=null_.device, dtype=null_.dtype) d = torch.zeros(batch_size, 60, device=null_.device, dtype=null_.dtype) fun = lambda i, j: null_[:, 3 * j + i] # Determinant constraint coeffs[:, 9] = ( self.o2( self.o1(fun(0, 1), fun(1, 2)) - self.o1(fun(0, 2), fun(1, 1)), fun(2, 0) ) + self.o2( self.o1(fun(0, 2), fun(1, 0)) - self.o1(fun(0, 0), fun(1, 2)), fun(2, 1) ) + self.o2( self.o1(fun(0, 0), fun(1, 1)) - self.o1(fun(0, 1), fun(1, 0)), fun(2, 2) ) ) indices = torch.tensor([[0, 10, 20], [10, 40, 30], [20, 30, 50]]) # Compute EE^T (equation 20 in paper) for i in range(3): for j in range(3): d[:, indices[i, j] : indices[i, j] + 10] = ( self.o1(fun(i, 0), fun(j, 0)) + self.o1(fun(i, 1), fun(j, 1)) + self.o1(fun(i, 2), fun(j, 2)) ) for i in range(10): t = 0.5 * ( d[:, indices[0, 0] + i] + d[:, indices[1, 1] + i] + d[:, indices[2, 2] + i] ) d[:, indices[0, 0] + i] -= t d[:, indices[1, 1] + i] -= t d[:, indices[2, 2] + i] -= t cnt = 0 for i in range(3): for j in range(3): row = ( self.o2(d[:, indices[i, 0] : indices[i, 0] + 10], fun(0, j)) + self.o2(d[:, indices[i, 1] : indices[i, 1] + 10], fun(1, j)) + self.o2(d[:, indices[i, 2] : indices[i, 2] + 10], fun(2, j)) ) coeffs[:, cnt] = row cnt += 1 b = coeffs[:, :, 10:] if self.drop: singular_filter = torch.linalg.matrix_rank(coeffs[:, :, :10]) >= torch.max( torch.linalg.matrix_rank(coeffs), torch.ones_like(torch.linalg.matrix_rank(coeffs[:, :, :10])) * 10, ) try: if self.drop: eliminated_mat = torch.linalg.solve( coeffs[singular_filter, :, :10], b[singular_filter] ) else: eliminated_mat = torch.linalg.solve(coeffs[:, :, :10], b[:]) except Exception as e: print(e) return ( torch.eye(3, device=pts.device, dtype=pts.dtype) .unsqueeze(0) .repeat(640, 1, 1) ) if self.drop: coeffs_ = torch.concat( (coeffs[singular_filter, :, :10], eliminated_mat), dim=-1 ) else: coeffs_ = torch.concat((coeffs[:, :, :10], eliminated_mat), dim=-1) A = torch.zeros( coeffs_.shape[0], 3, 13, device=coeffs_.device, dtype=coeffs_.dtype ) for i in range(3): A[:, i, 0] = 0.0 A[:, i : i + 1, 1:4] = coeffs_[:, 4 + 2 * i : 5 + 2 * i, 10:13] A[:, i : i + 1, 0:3] -= coeffs_[:, 5 + 2 * i : 6 + 2 * i, 10:13] A[:, i, 4] = 0.0 A[:, i : i + 1, 5:8] = coeffs_[:, 4 + 2 * i : 5 + 2 * i, 13:16] A[:, i : i + 1, 4:7] -= coeffs_[:, 5 + 2 * i : 6 + 2 * i, 13:16] A[:, i, 8] = 0.0 A[:, i : i + 1, 9:13] = coeffs_[:, 4 + 2 * i : 5 + 2 * i, 16:20] A[:, i : i + 1, 8:12] -= coeffs_[:, 5 + 2 * i : 6 + 2 * i, 16:20] cs = torch.zeros(A.shape[0], 11, device=A.device, dtype=A.dtype) cs[:, 0] = ( A[:, 0, 12] * A[:, 1, 3] * A[:, 2, 7] - A[:, 0, 12] * A[:, 1, 7] * A[:, 2, 3] - A[:, 0, 3] * A[:, 2, 7] * A[:, 1, 12] + A[:, 0, 7] * A[:, 2, 3] * A[:, 1, 12] + A[:, 0, 3] * A[:, 1, 7] * A[:, 2, 12] - A[:, 0, 7] * A[:, 1, 3] * A[:, 2, 12] ) cs[:, 1] = ( A[:, 0, 11] * A[:, 1, 3] * A[:, 2, 7] - A[:, 0, 11] * A[:, 1, 7] * A[:, 2, 3] + A[:, 0, 12] * A[:, 1, 2] * A[:, 2, 7] + A[:, 0, 12] * A[:, 1, 3] * A[:, 2, 6] - A[:, 0, 12] * A[:, 1, 6] * A[:, 2, 3] - A[:, 0, 12] * A[:, 1, 7] * A[:, 2, 2] - A[:, 0, 2] * A[:, 2, 7] * A[:, 1, 12] - A[:, 0, 3] * A[:, 2, 6] * A[:, 1, 12] - A[:, 0, 3] * A[:, 2, 7] * A[:, 1, 11] + A[:, 0, 6] * A[:, 2, 3] * A[:, 1, 12] + A[:, 0, 7] * A[:, 2, 2] * A[:, 1, 12] + A[:, 0, 7] * A[:, 2, 3] * A[:, 1, 11] + A[:, 0, 2] * A[:, 1, 7] * A[:, 2, 12] + A[:, 0, 3] * A[:, 1, 6] * A[:, 2, 12] + A[:, 0, 3] * A[:, 1, 7] * A[:, 2, 11] - A[:, 0, 6] * A[:, 1, 3] * A[:, 2, 12] - A[:, 0, 7] * A[:, 1, 2] * A[:, 2, 12] - A[:, 0, 7] * A[:, 1, 3] * A[:, 2, 11] ) cs[:, 2] = ( A[:, 0, 10] * A[:, 1, 3] * A[:, 2, 7] - A[:, 0, 10] * A[:, 1, 7] * A[:, 2, 3] + A[:, 0, 11] * A[:, 1, 2] * A[:, 2, 7] + A[:, 0, 11] * A[:, 1, 3] * A[:, 2, 6] - A[:, 0, 11] * A[:, 1, 6] * A[:, 2, 3] - A[:, 0, 11] * A[:, 1, 7] * A[:, 2, 2] + A[:, 1, 1] * A[:, 0, 12] * A[:, 2, 7] + A[:, 0, 12] * A[:, 1, 2] * A[:, 2, 6] + A[:, 0, 12] * A[:, 1, 3] * A[:, 2, 5] - A[:, 0, 12] * A[:, 1, 5] * A[:, 2, 3] - A[:, 0, 12] * A[:, 1, 6] * A[:, 2, 2] - A[:, 0, 12] * A[:, 1, 7] * A[:, 2, 1] - A[:, 0, 1] * A[:, 2, 7] * A[:, 1, 12] - A[:, 0, 2] * A[:, 2, 6] * A[:, 1, 12] - A[:, 0, 2] * A[:, 2, 7] * A[:, 1, 11] - A[:, 0, 3] * A[:, 2, 5] * A[:, 1, 12] - A[:, 0, 3] * A[:, 2, 6] * A[:, 1, 11] - A[:, 0, 3] * A[:, 2, 7] * A[:, 1, 10] + A[:, 0, 5] * A[:, 2, 3] * A[:, 1, 12] + A[:, 0, 6] * A[:, 2, 2] * A[:, 1, 12] + A[:, 0, 6] * A[:, 2, 3] * A[:, 1, 11] + A[:, 0, 7] * A[:, 2, 1] * A[:, 1, 12] + A[:, 0, 7] * A[:, 2, 2] * A[:, 1, 11] + A[:, 0, 7] * A[:, 2, 3] * A[:, 1, 10] + A[:, 0, 1] * A[:, 1, 7] * A[:, 2, 12] + A[:, 0, 2] * A[:, 1, 6] * A[:, 2, 12] + A[:, 0, 2] * A[:, 1, 7] * A[:, 2, 11] + A[:, 0, 3] * A[:, 1, 5] * A[:, 2, 12] + A[:, 0, 3] * A[:, 1, 6] * A[:, 2, 11] + A[:, 0, 3] * A[:, 1, 7] * A[:, 2, 10] - A[:, 0, 5] * A[:, 1, 3] * A[:, 2, 12] - A[:, 0, 6] * A[:, 1, 2] * A[:, 2, 12] - A[:, 0, 6] * A[:, 1, 3] * A[:, 2, 11] - A[:, 0, 7] * A[:, 1, 1] * A[:, 2, 12] - A[:, 0, 7] * A[:, 1, 2] * A[:, 2, 11] - A[:, 0, 7] * A[:, 1, 3] * A[:, 2, 10] ) cs[:, 3] = ( A[:, 0, 3] * A[:, 1, 7] * A[:, 2, 9] - A[:, 0, 3] * A[:, 1, 9] * A[:, 2, 7] - A[:, 0, 7] * A[:, 1, 3] * A[:, 2, 9] + A[:, 0, 7] * A[:, 1, 9] * A[:, 2, 3] + A[:, 0, 9] * A[:, 1, 3] * A[:, 2, 7] - A[:, 0, 9] * A[:, 1, 7] * A[:, 2, 3] + A[:, 0, 10] * A[:, 1, 2] * A[:, 2, 7] + A[:, 0, 10] * A[:, 1, 3] * A[:, 2, 6] - A[:, 0, 10] * A[:, 1, 6] * A[:, 2, 3] - A[:, 0, 10] * A[:, 1, 7] * A[:, 2, 2] + A[:, 1, 0] * A[:, 0, 12] * A[:, 2, 7] + A[:, 0, 11] * A[:, 1, 1] * A[:, 2, 7] + A[:, 0, 11] * A[:, 1, 2] * A[:, 2, 6] + A[:, 0, 11] * A[:, 1, 3] * A[:, 2, 5] - A[:, 0, 11] * A[:, 1, 5] * A[:, 2, 3] - A[:, 0, 11] * A[:, 1, 6] * A[:, 2, 2] - A[:, 0, 11] * A[:, 1, 7] * A[:, 2, 1] + A[:, 1, 1] * A[:, 0, 12] * A[:, 2, 6] + A[:, 0, 12] * A[:, 1, 2] * A[:, 2, 5] + A[:, 0, 12] * A[:, 1, 3] * A[:, 2, 4] - A[:, 0, 12] * A[:, 1, 4] * A[:, 2, 3] - A[:, 0, 12] * A[:, 1, 5] * A[:, 2, 2] - A[:, 0, 12] * A[:, 1, 6] * A[:, 2, 1] - A[:, 0, 12] * A[:, 1, 7] * A[:, 2, 0] - A[:, 0, 0] * A[:, 2, 7] * A[:, 1, 12] - A[:, 0, 1] * A[:, 2, 6] * A[:, 1, 12] - A[:, 0, 1] * A[:, 2, 7] * A[:, 1, 11] - A[:, 0, 2] * A[:, 2, 5] * A[:, 1, 12] - A[:, 0, 2] * A[:, 2, 6] * A[:, 1, 11] - A[:, 0, 2] * A[:, 2, 7] * A[:, 1, 10] - A[:, 0, 3] * A[:, 2, 4] * A[:, 1, 12] - A[:, 0, 3] * A[:, 2, 5] * A[:, 1, 11] - A[:, 0, 3] * A[:, 2, 6] * A[:, 1, 10] + A[:, 0, 4] * A[:, 2, 3] * A[:, 1, 12] + A[:, 0, 5] * A[:, 2, 2] * A[:, 1, 12] + A[:, 0, 5] * A[:, 2, 3] * A[:, 1, 11] + A[:, 0, 6] * A[:, 2, 1] * A[:, 1, 12] + A[:, 0, 6] * A[:, 2, 2] * A[:, 1, 11] + A[:, 0, 6] * A[:, 2, 3] * A[:, 1, 10] + A[:, 0, 7] * A[:, 2, 0] * A[:, 1, 12] + A[:, 0, 7] * A[:, 2, 1] * A[:, 1, 11] + A[:, 0, 7] * A[:, 2, 2] * A[:, 1, 10] + A[:, 0, 0] * A[:, 1, 7] * A[:, 2, 12] + A[:, 0, 1] * A[:, 1, 6] * A[:, 2, 12] + A[:, 0, 1] * A[:, 1, 7] * A[:, 2, 11] + A[:, 0, 2] * A[:, 1, 5] * A[:, 2, 12] + A[:, 0, 2] * A[:, 1, 6] * A[:, 2, 11] + A[:, 0, 2] * A[:, 1, 7] * A[:, 2, 10] + A[:, 0, 3] * A[:, 1, 4] * A[:, 2, 12] + A[:, 0, 3] * A[:, 1, 5] * A[:, 2, 11] + A[:, 0, 3] * A[:, 1, 6] * A[:, 2, 10] - A[:, 0, 4] * A[:, 1, 3] * A[:, 2, 12] - A[:, 0, 5] * A[:, 1, 2] * A[:, 2, 12] - A[:, 0, 5] * A[:, 1, 3] * A[:, 2, 11] - A[:, 0, 6] * A[:, 1, 1] * A[:, 2, 12] - A[:, 0, 6] * A[:, 1, 2] * A[:, 2, 11] - A[:, 0, 6] * A[:, 1, 3] * A[:, 2, 10] - A[:, 0, 7] * A[:, 1, 0] * A[:, 2, 12] - A[:, 0, 7] * A[:, 1, 1] * A[:, 2, 11] - A[:, 0, 7] * A[:, 1, 2] * A[:, 2, 10] ) cs[:, 4] = ( A[:, 0, 2] * A[:, 1, 7] * A[:, 2, 9] - A[:, 0, 2] * A[:, 1, 9] * A[:, 2, 7] + A[:, 0, 3] * A[:, 1, 6] * A[:, 2, 9] + A[:, 0, 3] * A[:, 1, 7] * A[:, 2, 8] - A[:, 0, 3] * A[:, 1, 8] * A[:, 2, 7] - A[:, 0, 3] * A[:, 1, 9] * A[:, 2, 6] - A[:, 0, 6] * A[:, 1, 3] * A[:, 2, 9] + A[:, 0, 6] * A[:, 1, 9] * A[:, 2, 3] - A[:, 0, 7] * A[:, 1, 2] * A[:, 2, 9] - A[:, 0, 7] * A[:, 1, 3] * A[:, 2, 8] + A[:, 0, 7] * A[:, 1, 8] * A[:, 2, 3] + A[:, 0, 7] * A[:, 1, 9] * A[:, 2, 2] + A[:, 0, 8] * A[:, 1, 3] * A[:, 2, 7] - A[:, 0, 8] * A[:, 1, 7] * A[:, 2, 3] + A[:, 0, 9] * A[:, 1, 2] * A[:, 2, 7] + A[:, 0, 9] * A[:, 1, 3] * A[:, 2, 6] - A[:, 0, 9] * A[:, 1, 6] * A[:, 2, 3] - A[:, 0, 9] * A[:, 1, 7] * A[:, 2, 2] + A[:, 0, 10] * A[:, 1, 1] * A[:, 2, 7] + A[:, 0, 10] * A[:, 1, 2] * A[:, 2, 6] + A[:, 0, 10] * A[:, 1, 3] * A[:, 2, 5] - A[:, 0, 10] * A[:, 1, 5] * A[:, 2, 3] - A[:, 0, 10] * A[:, 1, 6] * A[:, 2, 2] - A[:, 0, 10] * A[:, 1, 7] * A[:, 2, 1] + A[:, 1, 0] * A[:, 0, 11] * A[:, 2, 7] + A[:, 1, 0] * A[:, 0, 12] * A[:, 2, 6] + A[:, 0, 11] * A[:, 1, 1] * A[:, 2, 6] + A[:, 0, 11] * A[:, 1, 2] * A[:, 2, 5] + A[:, 0, 11] * A[:, 1, 3] * A[:, 2, 4] - A[:, 0, 11] * A[:, 1, 4] * A[:, 2, 3] - A[:, 0, 11] * A[:, 1, 5] * A[:, 2, 2] - A[:, 0, 11] * A[:, 1, 6] * A[:, 2, 1] - A[:, 0, 11] * A[:, 1, 7] * A[:, 2, 0] + A[:, 1, 1] * A[:, 0, 12] * A[:, 2, 5] + A[:, 0, 12] * A[:, 1, 2] * A[:, 2, 4] - A[:, 0, 12] * A[:, 1, 4] * A[:, 2, 2] - A[:, 0, 12] * A[:, 1, 5] * A[:, 2, 1] - A[:, 0, 12] * A[:, 1, 6] * A[:, 2, 0] - A[:, 0, 0] * A[:, 2, 6] * A[:, 1, 12] - A[:, 0, 0] * A[:, 2, 7] * A[:, 1, 11] - A[:, 0, 1] * A[:, 2, 5] * A[:, 1, 12] - A[:, 0, 1] * A[:, 2, 6] * A[:, 1, 11] - A[:, 0, 1] * A[:, 2, 7] * A[:, 1, 10] - A[:, 0, 2] * A[:, 2, 4] * A[:, 1, 12] - A[:, 0, 2] * A[:, 2, 5] * A[:, 1, 11] - A[:, 0, 2] * A[:, 2, 6] * A[:, 1, 10] - A[:, 0, 3] * A[:, 2, 4] * A[:, 1, 11] - A[:, 0, 3] * A[:, 2, 5] * A[:, 1, 10] + A[:, 0, 4] * A[:, 2, 2] * A[:, 1, 12] + A[:, 0, 4] * A[:, 2, 3] * A[:, 1, 11] + A[:, 0, 5] * A[:, 2, 1] * A[:, 1, 12] + A[:, 0, 5] * A[:, 2, 2] * A[:, 1, 11] + A[:, 0, 5] * A[:, 2, 3] * A[:, 1, 10] + A[:, 0, 6] * A[:, 2, 0] * A[:, 1, 12] + A[:, 0, 6] * A[:, 2, 1] * A[:, 1, 11] + A[:, 0, 6] * A[:, 2, 2] * A[:, 1, 10] + A[:, 0, 7] * A[:, 2, 0] * A[:, 1, 11] + A[:, 0, 7] * A[:, 2, 1] * A[:, 1, 10] + A[:, 0, 0] * A[:, 1, 6] * A[:, 2, 12] + A[:, 0, 0] * A[:, 1, 7] * A[:, 2, 11] + A[:, 0, 1] * A[:, 1, 5] * A[:, 2, 12] + A[:, 0, 1] * A[:, 1, 6] * A[:, 2, 11] + A[:, 0, 1] * A[:, 1, 7] * A[:, 2, 10] + A[:, 0, 2] * A[:, 1, 4] * A[:, 2, 12] + A[:, 0, 2] * A[:, 1, 5] * A[:, 2, 11] + A[:, 0, 2] * A[:, 1, 6] * A[:, 2, 10] + A[:, 0, 3] * A[:, 1, 4] * A[:, 2, 11] + A[:, 0, 3] * A[:, 1, 5] * A[:, 2, 10] - A[:, 0, 4] * A[:, 1, 2] * A[:, 2, 12] - A[:, 0, 4] * A[:, 1, 3] * A[:, 2, 11] - A[:, 0, 5] * A[:, 1, 1] * A[:, 2, 12] - A[:, 0, 5] * A[:, 1, 2] * A[:, 2, 11] - A[:, 0, 5] * A[:, 1, 3] * A[:, 2, 10] - A[:, 0, 6] * A[:, 1, 0] * A[:, 2, 12] - A[:, 0, 6] * A[:, 1, 1] * A[:, 2, 11] - A[:, 0, 6] * A[:, 1, 2] * A[:, 2, 10] - A[:, 0, 7] * A[:, 1, 0] * A[:, 2, 11] - A[:, 0, 7] * A[:, 1, 1] * A[:, 2, 10] ) cs[:, 5] = ( A[:, 0, 1] * A[:, 1, 7] * A[:, 2, 9] - A[:, 0, 1] * A[:, 1, 9] * A[:, 2, 7] + A[:, 0, 2] * A[:, 1, 6] * A[:, 2, 9] + A[:, 0, 2] * A[:, 1, 7] * A[:, 2, 8] - A[:, 0, 2] * A[:, 1, 8] * A[:, 2, 7] - A[:, 0, 2] * A[:, 1, 9] * A[:, 2, 6] + A[:, 0, 3] * A[:, 1, 5] * A[:, 2, 9] + A[:, 0, 3] * A[:, 1, 6] * A[:, 2, 8] - A[:, 0, 3] * A[:, 1, 8] * A[:, 2, 6] - A[:, 0, 3] * A[:, 1, 9] * A[:, 2, 5] - A[:, 0, 5] * A[:, 1, 3] * A[:, 2, 9] + A[:, 0, 5] * A[:, 1, 9] * A[:, 2, 3] - A[:, 0, 6] * A[:, 1, 2] * A[:, 2, 9] - A[:, 0, 6] * A[:, 1, 3] * A[:, 2, 8] + A[:, 0, 6] * A[:, 1, 8] * A[:, 2, 3] + A[:, 0, 6] * A[:, 1, 9] * A[:, 2, 2] - A[:, 0, 7] * A[:, 1, 1] * A[:, 2, 9] - A[:, 0, 7] * A[:, 1, 2] * A[:, 2, 8] + A[:, 0, 7] * A[:, 1, 8] * A[:, 2, 2] + A[:, 0, 7] * A[:, 1, 9] * A[:, 2, 1] + A[:, 0, 8] * A[:, 1, 2] * A[:, 2, 7] + A[:, 0, 8] * A[:, 1, 3] * A[:, 2, 6] - A[:, 0, 8] * A[:, 1, 6] * A[:, 2, 3] - A[:, 0, 8] * A[:, 1, 7] * A[:, 2, 2] + A[:, 0, 9] * A[:, 1, 1] * A[:, 2, 7] + A[:, 0, 9] * A[:, 1, 2] * A[:, 2, 6] + A[:, 0, 9] * A[:, 1, 3] * A[:, 2, 5] - A[:, 0, 9] * A[:, 1, 5] * A[:, 2, 3] - A[:, 0, 9] * A[:, 1, 6] * A[:, 2, 2] - A[:, 0, 9] * A[:, 1, 7] * A[:, 2, 1] + A[:, 0, 10] * A[:, 1, 0] * A[:, 2, 7] + A[:, 0, 10] * A[:, 1, 1] * A[:, 2, 6] + A[:, 0, 10] * A[:, 1, 2] * A[:, 2, 5] + A[:, 0, 10] * A[:, 1, 3] * A[:, 2, 4] - A[:, 0, 10] * A[:, 1, 4] * A[:, 2, 3] - A[:, 0, 10] * A[:, 1, 5] * A[:, 2, 2] - A[:, 0, 10] * A[:, 1, 6] * A[:, 2, 1] - A[:, 0, 10] * A[:, 1, 7] * A[:, 2, 0] + A[:, 1, 0] * A[:, 0, 11] * A[:, 2, 6] + A[:, 1, 0] * A[:, 0, 12] * A[:, 2, 5] + A[:, 0, 11] * A[:, 1, 1] * A[:, 2, 5] + A[:, 0, 11] * A[:, 1, 2] * A[:, 2, 4] - A[:, 0, 11] * A[:, 1, 4] * A[:, 2, 2] - A[:, 0, 11] * A[:, 1, 5] * A[:, 2, 1] - A[:, 0, 11] * A[:, 1, 6] * A[:, 2, 0] + A[:, 1, 1] * A[:, 0, 12] * A[:, 2, 4] - A[:, 0, 12] * A[:, 1, 4] * A[:, 2, 1] - A[:, 0, 12] * A[:, 1, 5] * A[:, 2, 0] - A[:, 0, 0] * A[:, 2, 5] * A[:, 1, 12] - A[:, 0, 0] * A[:, 2, 6] * A[:, 1, 11] - A[:, 0, 0] * A[:, 2, 7] * A[:, 1, 10] - A[:, 0, 1] * A[:, 2, 4] * A[:, 1, 12] - A[:, 0, 1] * A[:, 2, 5] * A[:, 1, 11] - A[:, 0, 1] * A[:, 2, 6] * A[:, 1, 10] - A[:, 0, 2] * A[:, 2, 4] * A[:, 1, 11] - A[:, 0, 2] * A[:, 2, 5] * A[:, 1, 10] - A[:, 0, 3] * A[:, 2, 4] * A[:, 1, 10] + A[:, 0, 4] * A[:, 2, 1] * A[:, 1, 12] + A[:, 0, 4] * A[:, 2, 2] * A[:, 1, 11] + A[:, 0, 4] * A[:, 2, 3] * A[:, 1, 10] + A[:, 0, 5] * A[:, 2, 0] * A[:, 1, 12] + A[:, 0, 5] * A[:, 2, 1] * A[:, 1, 11] + A[:, 0, 5] * A[:, 2, 2] * A[:, 1, 10] + A[:, 0, 6] * A[:, 2, 0] * A[:, 1, 11] + A[:, 0, 6] * A[:, 2, 1] * A[:, 1, 10] + A[:, 0, 7] * A[:, 2, 0] * A[:, 1, 10] + A[:, 0, 0] * A[:, 1, 5] * A[:, 2, 12] + A[:, 0, 0] * A[:, 1, 6] * A[:, 2, 11] + A[:, 0, 0] * A[:, 1, 7] * A[:, 2, 10] + A[:, 0, 1] * A[:, 1, 4] * A[:, 2, 12] + A[:, 0, 1] * A[:, 1, 5] * A[:, 2, 11] + A[:, 0, 1] * A[:, 1, 6] * A[:, 2, 10] + A[:, 0, 2] * A[:, 1, 4] * A[:, 2, 11] + A[:, 0, 2] * A[:, 1, 5] * A[:, 2, 10] + A[:, 0, 3] * A[:, 1, 4] * A[:, 2, 10] - A[:, 0, 4] * A[:, 1, 1] * A[:, 2, 12] - A[:, 0, 4] * A[:, 1, 2] * A[:, 2, 11] - A[:, 0, 4] * A[:, 1, 3] * A[:, 2, 10] - A[:, 0, 5] * A[:, 1, 0] * A[:, 2, 12] - A[:, 0, 5] * A[:, 1, 1] * A[:, 2, 11] - A[:, 0, 5] * A[:, 1, 2] * A[:, 2, 10] - A[:, 0, 6] * A[:, 1, 0] * A[:, 2, 11] - A[:, 0, 6] * A[:, 1, 1] * A[:, 2, 10] - A[:, 0, 7] * A[:, 1, 0] * A[:, 2, 10] ) cs[:, 6] = ( A[:, 0, 0] * A[:, 1, 7] * A[:, 2, 9] - A[:, 0, 0] * A[:, 1, 9] * A[:, 2, 7] + A[:, 0, 1] * A[:, 1, 6] * A[:, 2, 9] + A[:, 0, 1] * A[:, 1, 7] * A[:, 2, 8] - A[:, 0, 1] * A[:, 1, 8] * A[:, 2, 7] - A[:, 0, 1] * A[:, 1, 9] * A[:, 2, 6] + A[:, 0, 2] * A[:, 1, 5] * A[:, 2, 9] + A[:, 0, 2] * A[:, 1, 6] * A[:, 2, 8] - A[:, 0, 2] * A[:, 1, 8] * A[:, 2, 6] - A[:, 0, 2] * A[:, 1, 9] * A[:, 2, 5] + A[:, 0, 3] * A[:, 1, 4] * A[:, 2, 9] + A[:, 0, 3] * A[:, 1, 5] * A[:, 2, 8] - A[:, 0, 3] * A[:, 1, 8] * A[:, 2, 5] - A[:, 0, 3] * A[:, 1, 9] * A[:, 2, 4] - A[:, 0, 4] * A[:, 1, 3] * A[:, 2, 9] + A[:, 0, 4] * A[:, 1, 9] * A[:, 2, 3] - A[:, 0, 5] * A[:, 1, 2] * A[:, 2, 9] - A[:, 0, 5] * A[:, 1, 3] * A[:, 2, 8] + A[:, 0, 5] * A[:, 1, 8] * A[:, 2, 3] + A[:, 0, 5] * A[:, 1, 9] * A[:, 2, 2] - A[:, 0, 6] * A[:, 1, 1] * A[:, 2, 9] - A[:, 0, 6] * A[:, 1, 2] * A[:, 2, 8] + A[:, 0, 6] * A[:, 1, 8] * A[:, 2, 2] + A[:, 0, 6] * A[:, 1, 9] * A[:, 2, 1] - A[:, 0, 7] * A[:, 1, 0] * A[:, 2, 9] - A[:, 0, 7] * A[:, 1, 1] * A[:, 2, 8] + A[:, 0, 7] * A[:, 1, 8] * A[:, 2, 1] + A[:, 0, 7] * A[:, 1, 9] * A[:, 2, 0] + A[:, 0, 8] * A[:, 1, 1] * A[:, 2, 7] + A[:, 0, 8] * A[:, 1, 2] * A[:, 2, 6] + A[:, 0, 8] * A[:, 1, 3] * A[:, 2, 5] - A[:, 0, 8] * A[:, 1, 5] * A[:, 2, 3] - A[:, 0, 8] * A[:, 1, 6] * A[:, 2, 2] - A[:, 0, 8] * A[:, 1, 7] * A[:, 2, 1] + A[:, 0, 9] * A[:, 1, 0] * A[:, 2, 7] + A[:, 0, 9] * A[:, 1, 1] * A[:, 2, 6] + A[:, 0, 9] * A[:, 1, 2] * A[:, 2, 5] + A[:, 0, 9] * A[:, 1, 3] * A[:, 2, 4] - A[:, 0, 9] * A[:, 1, 4] * A[:, 2, 3] - A[:, 0, 9] * A[:, 1, 5] * A[:, 2, 2] - A[:, 0, 9] * A[:, 1, 6] * A[:, 2, 1] - A[:, 0, 9] * A[:, 1, 7] * A[:, 2, 0] + A[:, 0, 10] * A[:, 1, 0] * A[:, 2, 6] + A[:, 0, 10] * A[:, 1, 1] * A[:, 2, 5] + A[:, 0, 10] * A[:, 1, 2] * A[:, 2, 4] - A[:, 0, 10] * A[:, 1, 4] * A[:, 2, 2] - A[:, 0, 10] * A[:, 1, 5] * A[:, 2, 1] - A[:, 0, 10] * A[:, 1, 6] * A[:, 2, 0] + A[:, 1, 0] * A[:, 0, 11] * A[:, 2, 5] + A[:, 1, 0] * A[:, 0, 12] * A[:, 2, 4] + A[:, 0, 11] * A[:, 1, 1] * A[:, 2, 4] - A[:, 0, 11] * A[:, 1, 4] * A[:, 2, 1] - A[:, 0, 11] * A[:, 1, 5] * A[:, 2, 0] - A[:, 0, 12] * A[:, 1, 4] * A[:, 2, 0] - A[:, 0, 0] * A[:, 2, 4] * A[:, 1, 12] - A[:, 0, 0] * A[:, 2, 5] * A[:, 1, 11] - A[:, 0, 0] * A[:, 2, 6] * A[:, 1, 10] - A[:, 0, 1] * A[:, 2, 4] * A[:, 1, 11] - A[:, 0, 1] * A[:, 2, 5] * A[:, 1, 10] - A[:, 0, 2] * A[:, 2, 4] * A[:, 1, 10] + A[:, 0, 4] * A[:, 2, 0] * A[:, 1, 12] + A[:, 0, 4] * A[:, 2, 1] * A[:, 1, 11] + A[:, 0, 4] * A[:, 2, 2] * A[:, 1, 10] + A[:, 0, 5] * A[:, 2, 0] * A[:, 1, 11] + A[:, 0, 5] * A[:, 2, 1] * A[:, 1, 10] + A[:, 0, 6] * A[:, 2, 0] * A[:, 1, 10] + A[:, 0, 0] * A[:, 1, 4] * A[:, 2, 12] + A[:, 0, 0] * A[:, 1, 5] * A[:, 2, 11] + A[:, 0, 0] * A[:, 1, 6] * A[:, 2, 10] + A[:, 0, 1] * A[:, 1, 4] * A[:, 2, 11] + A[:, 0, 1] * A[:, 1, 5] * A[:, 2, 10] + A[:, 0, 2] * A[:, 1, 4] * A[:, 2, 10] - A[:, 0, 4] * A[:, 1, 0] * A[:, 2, 12] - A[:, 0, 4] * A[:, 1, 1] * A[:, 2, 11] - A[:, 0, 4] * A[:, 1, 2] * A[:, 2, 10] - A[:, 0, 5] * A[:, 1, 0] * A[:, 2, 11] - A[:, 0, 5] * A[:, 1, 1] * A[:, 2, 10] - A[:, 0, 6] * A[:, 1, 0] * A[:, 2, 10] ) cs[:, 7] = ( A[:, 0, 0] * A[:, 1, 6] * A[:, 2, 9] + A[:, 0, 0] * A[:, 1, 7] * A[:, 2, 8] - A[:, 0, 0] * A[:, 1, 8] * A[:, 2, 7] - A[:, 0, 0] * A[:, 1, 9] * A[:, 2, 6] + A[:, 0, 1] * A[:, 1, 5] * A[:, 2, 9] + A[:, 0, 1] * A[:, 1, 6] * A[:, 2, 8] - A[:, 0, 1] * A[:, 1, 8] * A[:, 2, 6] - A[:, 0, 1] * A[:, 1, 9] * A[:, 2, 5] + A[:, 0, 2] * A[:, 1, 4] * A[:, 2, 9] + A[:, 0, 2] * A[:, 1, 5] * A[:, 2, 8] - A[:, 0, 2] * A[:, 1, 8] * A[:, 2, 5] - A[:, 0, 2] * A[:, 1, 9] * A[:, 2, 4] + A[:, 0, 3] * A[:, 1, 4] * A[:, 2, 8] - A[:, 0, 3] * A[:, 1, 8] * A[:, 2, 4] - A[:, 0, 4] * A[:, 1, 2] * A[:, 2, 9] - A[:, 0, 4] * A[:, 1, 3] * A[:, 2, 8] + A[:, 0, 4] * A[:, 1, 8] * A[:, 2, 3] + A[:, 0, 4] * A[:, 1, 9] * A[:, 2, 2] - A[:, 0, 5] * A[:, 1, 1] * A[:, 2, 9] - A[:, 0, 5] * A[:, 1, 2] * A[:, 2, 8] + A[:, 0, 5] * A[:, 1, 8] * A[:, 2, 2] + A[:, 0, 5] * A[:, 1, 9] * A[:, 2, 1] - A[:, 0, 6] * A[:, 1, 0] * A[:, 2, 9] - A[:, 0, 6] * A[:, 1, 1] * A[:, 2, 8] + A[:, 0, 6] * A[:, 1, 8] * A[:, 2, 1] + A[:, 0, 6] * A[:, 1, 9] * A[:, 2, 0] - A[:, 0, 7] * A[:, 1, 0] * A[:, 2, 8] + A[:, 0, 7] * A[:, 1, 8] * A[:, 2, 0] + A[:, 0, 8] * A[:, 1, 0] * A[:, 2, 7] + A[:, 0, 8] * A[:, 1, 1] * A[:, 2, 6] + A[:, 0, 8] * A[:, 1, 2] * A[:, 2, 5] + A[:, 0, 8] * A[:, 1, 3] * A[:, 2, 4] - A[:, 0, 8] * A[:, 1, 4] * A[:, 2, 3] - A[:, 0, 8] * A[:, 1, 5] * A[:, 2, 2] - A[:, 0, 8] * A[:, 1, 6] * A[:, 2, 1] - A[:, 0, 8] * A[:, 1, 7] * A[:, 2, 0] + A[:, 0, 9] * A[:, 1, 0] * A[:, 2, 6] + A[:, 0, 9] * A[:, 1, 1] * A[:, 2, 5] + A[:, 0, 9] * A[:, 1, 2] * A[:, 2, 4] - A[:, 0, 9] * A[:, 1, 4] * A[:, 2, 2] - A[:, 0, 9] * A[:, 1, 5] * A[:, 2, 1] - A[:, 0, 9] * A[:, 1, 6] * A[:, 2, 0] + A[:, 0, 10] * A[:, 1, 0] * A[:, 2, 5] + A[:, 0, 10] * A[:, 1, 1] * A[:, 2, 4] - A[:, 0, 10] * A[:, 1, 4] * A[:, 2, 1] - A[:, 0, 10] * A[:, 1, 5] * A[:, 2, 0] + A[:, 1, 0] * A[:, 0, 11] * A[:, 2, 4] - A[:, 0, 11] * A[:, 1, 4] * A[:, 2, 0] - A[:, 0, 0] * A[:, 2, 4] * A[:, 1, 11] - A[:, 0, 0] * A[:, 2, 5] * A[:, 1, 10] - A[:, 0, 1] * A[:, 2, 4] * A[:, 1, 10] + A[:, 0, 4] * A[:, 2, 0] * A[:, 1, 11] + A[:, 0, 4] * A[:, 2, 1] * A[:, 1, 10] + A[:, 0, 5] * A[:, 2, 0] * A[:, 1, 10] + A[:, 0, 0] * A[:, 1, 4] * A[:, 2, 11] + A[:, 0, 0] * A[:, 1, 5] * A[:, 2, 10] + A[:, 0, 1] * A[:, 1, 4] * A[:, 2, 10] - A[:, 0, 4] * A[:, 1, 0] * A[:, 2, 11] - A[:, 0, 4] * A[:, 1, 1] * A[:, 2, 10] - A[:, 0, 5] * A[:, 1, 0] * A[:, 2, 10] ) cs[:, 8] = ( A[:, 0, 0] * A[:, 1, 5] * A[:, 2, 9] + A[:, 0, 0] * A[:, 1, 6] * A[:, 2, 8] - A[:, 0, 0] * A[:, 1, 8] * A[:, 2, 6] - A[:, 0, 0] * A[:, 1, 9] * A[:, 2, 5] + A[:, 0, 1] * A[:, 1, 4] * A[:, 2, 9] + A[:, 0, 1] * A[:, 1, 5] * A[:, 2, 8] - A[:, 0, 1] * A[:, 1, 8] * A[:, 2, 5] - A[:, 0, 1] * A[:, 1, 9] * A[:, 2, 4] + A[:, 0, 2] * A[:, 1, 4] * A[:, 2, 8] - A[:, 0, 2] * A[:, 1, 8] * A[:, 2, 4] - A[:, 0, 4] * A[:, 1, 1] * A[:, 2, 9] - A[:, 0, 4] * A[:, 1, 2] * A[:, 2, 8] + A[:, 0, 4] * A[:, 1, 8] * A[:, 2, 2] + A[:, 0, 4] * A[:, 1, 9] * A[:, 2, 1] - A[:, 0, 5] * A[:, 1, 0] * A[:, 2, 9] - A[:, 0, 5] * A[:, 1, 1] * A[:, 2, 8] + A[:, 0, 5] * A[:, 1, 8] * A[:, 2, 1] + A[:, 0, 5] * A[:, 1, 9] * A[:, 2, 0] - A[:, 0, 6] * A[:, 1, 0] * A[:, 2, 8] + A[:, 0, 6] * A[:, 1, 8] * A[:, 2, 0] + A[:, 0, 8] * A[:, 1, 0] * A[:, 2, 6] + A[:, 0, 8] * A[:, 1, 1] * A[:, 2, 5] + A[:, 0, 8] * A[:, 1, 2] * A[:, 2, 4] - A[:, 0, 8] * A[:, 1, 4] * A[:, 2, 2] - A[:, 0, 8] * A[:, 1, 5] * A[:, 2, 1] - A[:, 0, 8] * A[:, 1, 6] * A[:, 2, 0] + A[:, 0, 9] * A[:, 1, 0] * A[:, 2, 5] + A[:, 0, 9] * A[:, 1, 1] * A[:, 2, 4] - A[:, 0, 9] * A[:, 1, 4] * A[:, 2, 1] - A[:, 0, 9] * A[:, 1, 5] * A[:, 2, 0] + A[:, 0, 10] * A[:, 1, 0] * A[:, 2, 4] - A[:, 0, 10] * A[:, 1, 4] * A[:, 2, 0] - A[:, 0, 0] * A[:, 2, 4] * A[:, 1, 10] + A[:, 0, 4] * A[:, 2, 0] * A[:, 1, 10] + A[:, 0, 0] * A[:, 1, 4] * A[:, 2, 10] - A[:, 0, 4] * A[:, 1, 0] * A[:, 2, 10] ) cs[:, 9] = ( A[:, 0, 0] * A[:, 1, 4] * A[:, 2, 9] + A[:, 0, 0] * A[:, 1, 5] * A[:, 2, 8] - A[:, 0, 0] * A[:, 1, 8] * A[:, 2, 5] - A[:, 0, 0] * A[:, 1, 9] * A[:, 2, 4] + A[:, 0, 1] * A[:, 1, 4] * A[:, 2, 8] - A[:, 0, 1] * A[:, 1, 8] * A[:, 2, 4] - A[:, 0, 4] * A[:, 1, 0] * A[:, 2, 9] - A[:, 0, 4] * A[:, 1, 1] * A[:, 2, 8] + A[:, 0, 4] * A[:, 1, 8] * A[:, 2, 1] + A[:, 0, 4] * A[:, 1, 9] * A[:, 2, 0] - A[:, 0, 5] * A[:, 1, 0] * A[:, 2, 8] + A[:, 0, 5] * A[:, 1, 8] * A[:, 2, 0] + A[:, 0, 8] * A[:, 1, 0] * A[:, 2, 5] + A[:, 0, 8] * A[:, 1, 1] * A[:, 2, 4] - A[:, 0, 8] * A[:, 1, 4] * A[:, 2, 1] - A[:, 0, 8] * A[:, 1, 5] * A[:, 2, 0] + A[:, 0, 9] * A[:, 1, 0] * A[:, 2, 4] - A[:, 0, 9] * A[:, 1, 4] * A[:, 2, 0] ) cs[:, 10] = ( A[:, 0, 0] * A[:, 1, 4] * A[:, 2, 8] - A[:, 0, 0] * A[:, 1, 8] * A[:, 2, 4] - A[:, 0, 4] * A[:, 1, 0] * A[:, 2, 8] + A[:, 0, 4] * A[:, 1, 8] * A[:, 2, 0] + A[:, 0, 8] * A[:, 1, 0] * A[:, 2, 4] - A[:, 0, 8] * A[:, 1, 4] * A[:, 2, 0] ) E_models = [] # s = StrumPolynomialSolver(10) # n_solss, rootss = s.bisect_sturm(cs) # for loop because of different numbers of solutions if not self.drop: tmp = torch.rand((10, 9), dtype=torch.float32, device=pts.device) for bi in range(A.shape[0]): A_i = A[bi] null_i = nullSpace[bi] # companion matrix solver # try: C = torch.zeros((10, 10), device=cs.device, dtype=cs.dtype) C[0:-1, 1:] = torch.eye( C[0:-1, 0:-1].shape[0], device=cs.device, dtype=cs.dtype ) C[-1, :] = -cs[bi][:-1] / cs[bi][-1] # check if the companion matrix contains nans or infs if torch.isnan(C).any() or torch.isinf(C).any(): if not self.drop: E_models.append(tmp) continue # n_sols, roots = s.bisect_sturm(cs[bi]) # print("nan in C") else: roots = torch.real(torch.linalg.eigvals(C)) # except ValueError: # n_sols, roots = s.bisect_sturm(cs[bi]) if roots is None: if not self.drop: E_models.append(tmp) continue n_sols = roots.size() if n_sols == 0: if not self.drop: E_models.append(tmp) continue Bs = torch.stack( ( A_i[:3, :1] * (roots**3) + A_i[:3, 1:2] * roots.square() + A_i[0:3, 2:3] * (roots) + A_i[0:3, 3:4], A_i[0:3, 4:5] * (roots**3) + A_i[0:3, 5:6] * roots.square() + A_i[0:3, 6:7] * (roots) + A_i[0:3, 7:8], ), dim=0, ).transpose(0, -1) bs = ( A_i[0:3, 8:9] * (roots**4) + A_i[0:3, 9:10] * (roots**3) + A_i[0:3, 10:11] * roots.square() + A_i[0:3, 11:12] * roots + A_i[0:3, 12:13] ).T.unsqueeze(-1) # We try to solve using top two rows, if fails, will use matrix decomposition to solve Ax=b. try: xzs = Bs[:, 0:2, 0:2].inverse() @ (bs[:, 0:2]) except: if not self.drop: E_models.append(tmp) continue mask = ( abs(Bs[:, 2].unsqueeze(1) @ xzs - bs[:, 2].unsqueeze(1)) > 1e-3 ).flatten() if torch.sum(mask) != 0: q, r = torch.linalg.qr(Bs[mask].clone()) # xzs[mask] = torch.linalg.solve( r, q.transpose(-1, -2) @ bs[mask] ) # [mask] # models Es = ( null_i[0] * (-xzs[:, 0]) + null_i[1] * (-xzs[:, 1]) + null_i[2] * roots.unsqueeze(-1) + null_i[3] ) # Since the rows of N are orthogonal unit vectors, we can normalize the coefficients instead inv = 1.0 / torch.sqrt( (-xzs[:, 0]) ** 2 + (-xzs[:, 1]) ** 2 + roots.unsqueeze(-1) ** 2 + 1.0 ) Es *= inv if Es.shape[0] < 10: Es = torch.concat( ( Es.clone(), torch.eye(3, device=Es.device, dtype=Es.dtype) .repeat(10 - Es.shape[0], 1) .reshape(-1, 9), ) ) if not self.drop: tmp = Es.clone() E_models.append(Es) if not E_models: return torch.eye(3, device=cs.device, dtype=cs.dtype).unsqueeze(0) else: return torch.concat(E_models).view(-1, 3, 3).transpose(-1, -2) # be careful of the differences between c++ and python, transpose def o1(self, a, b): """A, b are first order polys [x,y,z,1] c is degree 2 poly with order [ x^2, x*y, x*z, x, y^2, y*z, y, z^2, z, 1]""" # print(a[0] * b[2] + a[2] * b[0]) return torch.stack( [ a[:, 0] * b[:, 0], a[:, 0] * b[:, 1] + a[:, 1] * b[:, 0], a[:, 0] * b[:, 2] + a[:, 2] * b[:, 0], a[:, 0] * b[:, 3] + a[:, 3] * b[:, 0], a[:, 1] * b[:, 1], a[:, 1] * b[:, 2] + a[:, 2] * b[:, 1], a[:, 1] * b[:, 3] + a[:, 3] * b[:, 1], a[:, 2] * b[:, 2], a[:, 2] * b[:, 3] + a[:, 3] * b[:, 2], a[:, 3] * b[:, 3], ], dim=-1, ) def o2(self, a, b): # 10 4 20 """A is second degree poly with order [ x^2, x*y, x*z, x, y^2, y*z, y, z^2, z, 1] b is first degree with order [x y z 1] c is third degree with order (same as nister's paper) [ x^3, y^3, x^2*y, x*y^2, x^2*z, x^2, y^2*z, y^2, x*y*z, x*y, x*z^2, x*z, x, y*z^2, y*z, y, z^3, z^2, z, 1]""" return torch.stack( [ a[:, 0] * b[:, 0], a[:, 4] * b[:, 1], a[:, 0] * b[:, 1] + a[:, 1] * b[:, 0], a[:, 1] * b[:, 1] + a[:, 4] * b[:, 0], a[:, 0] * b[:, 2] + a[:, 2] * b[:, 0], a[:, 0] * b[:, 3] + a[:, 3] * b[:, 0], a[:, 4] * b[:, 2] + a[:, 5] * b[:, 1], a[:, 4] * b[:, 3] + a[:, 6] * b[:, 1], a[:, 1] * b[:, 2] + a[:, 2] * b[:, 1] + a[:, 5] * b[:, 0], a[:, 1] * b[:, 3] + a[:, 3] * b[:, 1] + a[:, 6] * b[:, 0], a[:, 2] * b[:, 2] + a[:, 7] * b[:, 0], a[:, 2] * b[:, 3] + a[:, 3] * b[:, 2] + a[:, 8] * b[:, 0], a[:, 3] * b[:, 3] + a[:, 9] * b[:, 0], a[:, 5] * b[:, 2] + a[:, 7] * b[:, 1], a[:, 5] * b[:, 3] + a[:, 6] * b[:, 2] + a[:, 8] * b[:, 1], a[:, 6] * b[:, 3] + a[:, 9] * b[:, 1], a[:, 7] * b[:, 2], a[:, 7] * b[:, 3] + a[:, 8] * b[:, 2], a[:, 8] * b[:, 3] + a[:, 9] * b[:, 2], a[:, 9] * b[:, 3], ], dim=-1, )
39,248
Python
.py
861
32.341463
120
0.26462
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,687
uniform_sampler.py
disungatullina_MinBackProp/samplers/uniform_sampler.py
import torch import random class UniformSampler(object): """Random sampling the points, return the indices for each unique subset, or in batch.""" def __init__(self, batch_size, num_samples, num_points): self.batch_size = batch_size self.num_samples = num_samples self.num_points = num_points def unique_generate(self, num_points=None): num_points = self.num_points if num_points is None else num_points sample_indices = torch.tensor( [random.randint(0, len(num_points) - 1) for _ in range(self.num_samples)] ) return sample_indices def batch_generate(self, num_points=None): num_points = self.num_points if num_points is None else num_points sample_indices = torch.randint( 0, num_points - 1, (self.batch_size, self.num_samples) ) return sample_indices def sample(self): sample_indices = self.batch_generate() return sample_indices
987
Python
.py
23
35.217391
93
0.658664
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,688
gumbel_sampler.py
disungatullina_MinBackProp/samplers/gumbel_sampler.py
import torch # from estimators.fundamental_matrix_estimator import * # from estimators.essential_matrix_estimator_stewenius import * from loss import * import numpy as np import random class GumbelSoftmaxSampler: """Sample based on a Gumbel-Max distribution. Use re-param trick for back-prop """ def __init__( self, batch_size, num_samples, tau=1.0, device="cuda", data_type="torch.float32" ): self.batch_size = batch_size self.num_samples = num_samples # self.num_points = num_points self.device = device self.dtype = data_type self.gumbel_dist = torch.distributions.gumbel.Gumbel( torch.tensor(0.0, device=self.device, dtype=self.dtype), torch.tensor(1.0, device=self.device, dtype=self.dtype), ) self.tau = tau def sample(self, logits=None, num_points=2000, selected=None): if logits == None: logits = torch.ones( [self.batch_size, num_points], device=self.device, dtype=self.dtype, requires_grad=True, ) else: logits = logits.to(self.dtype).to(self.device).repeat([self.batch_size, 1]) if selected is None: gumbels = self.gumbel_dist.sample(logits.shape) gumbels = (logits + gumbels) / self.tau y_soft = gumbels.softmax(-1) topk = torch.topk(gumbels, self.num_samples, dim=-1) y_hard = torch.zeros_like( logits, memory_format=torch.legacy_contiguous_format ).scatter_(-1, topk.indices, 1.0) ret = y_hard - y_soft.detach() + y_soft else: pass return ret, y_soft # , topk.indices
1,763
Python
.py
45
29.733333
88
0.6
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,689
estimate_rotation.py
disungatullina_MinBackProp/toy_examples/estimate_rotation.py
import os import sys import torch import argparse from math import degrees sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) import rotation.losses as L from ddn.ddn.pytorch.node import * from rotation.nodes import RigitNodeConstraint, SVDLayer, IFTLayer from rotation.datasets import get_dataset from utils import get_initial_weights, plot_graphs_w, plot_graphs_loss import warnings warnings.filterwarnings("ignore") # set main options torch.set_printoptions(linewidth=200) torch.set_printoptions(precision=4) def run_optimization(optimization_type, P, Q, R_true, opt): print() print(optimization_type) # get the batch size and the number of points b, _, n = P.shape # set upper-level objective J if opt.upper_level == "geometric": J = L.angle_error elif opt.upper_level == "algebraic": J = L.frobenius_norm else: raise Exception("Upper-level loss is undefined.") # init weights w_init = get_initial_weights(b, n, opt.init_weights) w = w_init.clone().detach().requires_grad_() if optimization_type == "IFT": optimization_layer = IFTLayer() elif optimization_type == "DDN": node = RigitNodeConstraint() optimization_layer = DeclarativeLayer(node) elif optimization_type == "SVD": optimization_layer = SVDLayer else: raise Exception("Wrong optimization type.") # set optimizer optimizer = torch.optim.SGD([w], lr=opt.lr) loss_history = [] w_history = [[w[0, 0].item()], [w[0, 1].item()], [w[0, 2].item()], [w[0, 3].item()]] def reevaluate(): optimizer.zero_grad() R = optimization_layer(P, Q, w) loss = J(R_true, R) loss_history.append(loss[0].item()) loss.backward() torch.nn.utils.clip_grad_norm_([w], 1.0) return loss # optimize for i in range(opt.num_iter): optimizer.step(reevaluate) w_history[0].append(torch.nn.functional.relu(w[0, 0]).item()) w_history[1].append(torch.nn.functional.relu(w[0, 1]).item()) w_history[2].append(torch.nn.functional.relu(w[0, 2]).item()) w_history[3].append(torch.nn.functional.relu(w[0, 3]).item()) # get final results w = torch.nn.functional.relu(w) # enforce non-negativity R = optimization_layer(P, Q, w) # compute errors angle_error = L.angle_error(R_true, R) frob_norm = L.frobenius_norm(R_true, R) # print errors print( "Rotation Error: {:0.4f} degrees".format( degrees(angle_error[0, ...].squeeze().detach().numpy()) ) ) print("Algebraic Error: {}".format(frob_norm[0, ...].detach().numpy())) return w_history, loss_history def main(opt): print("Rotation matrix estimation") # load dataset P, Q, R_true = get_dataset() w_history_svd = None w_history_ddn = None loss_history_svd = None loss_history_ddn = None # run optimization w_history_ift, loss_history_ift = run_optimization( "IFT", P, Q, R_true, opt ) # True by default if opt.autograd: w_history_svd, loss_history_svd = run_optimization("SVD", P, Q, R_true, opt) if opt.ddn: w_history_ddn, loss_history_ddn = run_optimization("DDN", P, Q, R_true, opt) # plot values of w and global loss if opt.plot: plot_graphs_w( w_history_ift, w_history_svd=w_history_svd, w_history_ddn=w_history_ddn, out_dir=os.path.join(opt.out, "rotation"), ) plot_graphs_loss( loss_history_ift, loss_history_svd=loss_history_svd, loss_history_ddn=loss_history_ddn, out_dir=os.path.join(opt.out, "rotation"), ) print() print("done") return 0 if __name__ == "__main__": PARSER = argparse.ArgumentParser(description="Rotation matrix estimation") PARSER.add_argument( "--plot", action="store_true", help="plot inlier and outlier values, default False", ) PARSER.add_argument( "--ift", action="store_true", help="compute R and w with backpropagation via IFT, default True", ) PARSER.add_argument( "--ddn", action="store_true", help="compute R and w with backpropagation via DDN, default False", ) PARSER.add_argument( "--autograd", action="store_true", help="compute R and w with backpropagation via autograd, default False", ) PARSER.add_argument( "--init_weights", type=str, default="uniform", help="initialization for weights: uniform|random , default 'uniform'", ) PARSER.add_argument( "--upper_level", type=str, default="geometric", help="upper-level objective: geometric|algebraic , default 'geometric'", ) PARSER.add_argument( "--out", type=str, default="results", help="directory to save graphs", ) PARSER.add_argument( "--num_iter", type=int, default=30, help="the number of iterations, default 30", ) # PARSER.add_argument("-bs", "--batch_size", type=int, default=1, help="batch size") PARSER.add_argument( "--lr", type=float, default=1e-1, help="learning rate, default 0.1", ) ARGS = PARSER.parse_args() main(ARGS)
5,443
Python
.py
161
27.118012
88
0.621143
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,690
estimate_fundamental.py
disungatullina_MinBackProp/toy_examples/estimate_fundamental.py
import os import sys import torch import argparse import warnings sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) from ddn.ddn.pytorch.node import * import fundamental.losses as L from fundamental.datasets import get_dataset from fundamental.nodes import SVDLayer, FundamentalNodeConstraint, IFTLayer from utils import get_initial_weights, plot_graphs_w, plot_graphs_loss torch.set_printoptions(precision=4) warnings.filterwarnings("ignore") def run_optimization(optimization_type, A, B, F_true, opt): print(optimization_type) # get the batch size and the number of points b, n, _ = A.shape # set upper-level objective J J = L.frobenius_norm # init weights w_init = get_initial_weights(b, n, opt.init_weights) w = w_init.clone().detach().requires_grad_() if optimization_type == "IFT": optimization_layer = IFTLayer() elif optimization_type == "DDN": node = FundamentalNodeConstraint() optimization_layer = DeclarativeLayer(node) elif optimization_type == "SVD": optimization_layer = SVDLayer else: raise Exception("Wrong optimization type.") # set optimizer optimizer = torch.optim.SGD( [w], lr=opt.lr, ) loss_history = [] w_history = [[w[0, i].item()] for i in range(n)] def reevaluate(): optimizer.zero_grad() F = optimization_layer(A, B, w) if (F * F_true).sum(dim=(-2, -1)) < 0: F_ = -F else: F_ = F loss = J(F_true, F_) loss_history.append(loss[0].item()) loss.backward() torch.nn.utils.clip_grad_norm_([w], 1.0) return loss for i in range(opt.num_iter): optimizer.step(reevaluate) w_ = torch.nn.functional.relu(w) w_ /= w_.sum(dim=1, keepdim=True) for i in range(n): w_history[i].append(torch.nn.functional.relu(w_[0, i]).item()) # get final results w = torch.nn.functional.relu(w) w /= w.sum(dim=1, keepdim=True) F = optimization_layer(A, B, w) F = F / torch.norm(F) if (F * F_true).sum(dim=(-2, -1)) < 0: F = -F # compute error frob_norm = L.frobenius_norm(F_true, F) print("Algebraic Error: {}".format(frob_norm[0, ...].detach().numpy())) return w_history, loss_history def main(opt): print("Fundamental matrix estimation") print() # load dataset A, B, F_true, w_true = get_dataset() w_history_svd = None w_history_ddn = None loss_history_svd = None loss_history_ddn = None # run optimization w_history_ift, loss_history_ift = run_optimization( "IFT", A, B, F_true, opt ) # True by default if opt.autograd: print() w_history_svd, loss_history_svd = run_optimization("SVD", A, B, F_true, opt) if opt.ddn: print() w_history_ddn, loss_history_ddn = run_optimization("DDN", A, B, F_true, opt) # plot values of w and global loss if opt.plot: plot_graphs_w( w_history_ift, w_history_svd=w_history_svd, w_history_ddn=w_history_ddn, out_dir=os.path.join(opt.out, "fundamental"), ) plot_graphs_loss( loss_history_ift, loss_history_svd=loss_history_svd, loss_history_ddn=loss_history_ddn, out_dir=os.path.join(opt.out, "fundamental"), ) print() print("done") return 0 if __name__ == "__main__": PARSER = argparse.ArgumentParser(description="Fundamental matrix estimation") PARSER.add_argument( "--plot", action="store_true", help="plot inlier and outlier values, default False", ) PARSER.add_argument( "--ift", action="store_true", help="compute F and w with backpropagation via IFT, default True", ) PARSER.add_argument( "--ddn", action="store_true", help="compute F and w with backpropagation via DDN, default False", ) PARSER.add_argument( "--autograd", action="store_true", help="compute F and w with backpropagation via autograd, default False", ) PARSER.add_argument( "--init_weights", type=str, default="uniform", help="initialization for weights: uniform|random , default 'uniform'", ) PARSER.add_argument( "--out", type=str, default="results", help="directory to save graphs", ) PARSER.add_argument( "--num_iter", type=int, default=30, help="the number of iterations, default 30", ) # PARSER.add_argument("-bs", "--batch_size", type=int, default=1, help="batch size") PARSER.add_argument( "--lr", type=float, default=1000.0, help="learning rate, default 1000.", ) ARGS = PARSER.parse_args() main(ARGS)
4,941
Python
.py
152
25.605263
88
0.607653
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,691
utils.py
disungatullina_MinBackProp/toy_examples/utils.py
import os import torch import matplotlib.pyplot as plt def get_initial_weights(b, n, init_type): # Generate weights (uniform): if init_type == "uniform": w = torch.ones(b, n, dtype=torch.float) # b x n w = w.div(w.sum(-1).unsqueeze(-1)) # Generate weights (random): elif init_type == "random": w = torch.rand(b, n, dtype=torch.float) else: w = None return w def plot_graphs_w( w_history_ift, w_history_svd=None, w_history_ddn=None, out_dir="results" ): plt.rcParams["font.size"] = 14 for i in range(len(w_history_ift)): if i == 0: Y_LABEL = "weight of the outlier" else: Y_LABEL = "weight of an inlier" plt.figure(figsize=(9, 6)) plt.axes() if w_history_svd is not None: plt.plot(w_history_svd[i], label="SVD", color="red", linewidth=4) if w_history_ddn is not None: plt.plot(w_history_ddn[i], "--", label="DDN", linewidth=4) plt.plot(w_history_ift[i], "--", label="IFT", color="green", linewidth=4) plt.ylabel( Y_LABEL, fontsize=18, ) plt.xlabel( "# iterations", fontsize=18, ) plt.xticks( fontsize=18, ) plt.yticks(fontsize=18) plt.legend(loc="lower right") if not os.path.exists(out_dir): os.makedirs(out_dir) plt.savefig(os.path.join(out_dir, "w_{}.png".format(i))) plt.show() def plot_graphs_loss( loss_history_ift, loss_history_svd=None, loss_history_ddn=None, out_dir="results" ): plt.figure(figsize=(9, 6)) if loss_history_svd is not None: plt.plot(loss_history_svd, label="SVD", color="red", linewidth=4) if loss_history_ddn is not None: plt.plot(loss_history_ddn, "--", label="DDN", linewidth=4) plt.plot(loss_history_ift, "--", label="IFT", color="green", linewidth=4) plt.ylabel( "global loss", fontsize=18, ) plt.xlabel( "# iterations", fontsize=18, ) plt.legend(loc="upper right") if not os.path.exists(out_dir): os.makedirs(out_dir) plt.savefig(os.path.join(out_dir, "global_loss.png"))
2,245
Python
.py
68
25.514706
85
0.576232
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,692
datasets.py
disungatullina_MinBackProp/toy_examples/fundamental/datasets.py
import torch def create_toy_dataset(): """ N = 15 correspondences, without noise added; b = 1 A : b x N x 3 B : b x N x 3 F_true : b x 3 x 3 gt_mask : b x N """ A = torch.tensor( [ [ [-915.685, 834.329, 1.0], [646.367, 254.628, 1.0], [-22.876, 595.962, 1.0], [578.168, 443.949, 1.0], [192.419, 282.905, 1.0], [52.794, 306.947, 1.0], [736.152, 258.855, 1.0], [779.226, 153.273, 1.0], [-203.857, 206.508, 1.0], [-177.886, -223.585, 1.0], [514.813, 356.933, 1.0], [-673.211, -458.384, 1.0], [303.542, -685.049, 1.0], [-5.934, 357.504, 1.0], [1086.569, -558.349, 1.0], ] ] ) B = torch.tensor( [ [ [-248.194, -100.591, 1.0], [1976.495, 1481.327, 1.0], [1127.706, 927.001, 1.0], [1470.325, 1127.142, 1.0], [1330.03, 1018.398, 1.0], [1386.336, 583.886, 1.0], [1949.827, 1584.303, 1.0], [2428.351, 1934.385, 1.0], [1330.216, 663.379, 1.0], [2618.936, 603.683, 1.0], [1640.894, 1124.457, 1.0], [1970.587, 582.818, 1.0], [2299.292, 1607.329, 1.0], [1272.829, 479.930, 1.0], [2306.285, 2028.933, 1.0], ] ] ) F_true = torch.tensor( [ [ [-1.11028e-06, 8.61480e-07, 3.03012e-04], [4.66710e-07, -1.33660e-06, 5.36742e-04], [7.91556e-04, 5.36159e-04, -9.99999e-01], ] ], dtype=torch.float64, ) gt_mask = torch.tensor( [[0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0]] ) return A, B, F_true, gt_mask def get_dataset(): return create_toy_dataset()
2,096
Python
.py
67
19.268657
85
0.383094
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,693
nodes.py
disungatullina_MinBackProp/toy_examples/fundamental/nodes.py
import torch import torch.nn as nn from ddn.ddn.pytorch.node import * mask = torch.ones(3) mask[2] = 0.0 ############ DDN with constraint ############ class FundamentalNodeConstraint(EqConstDeclarativeNode): """Declarative Fundamental matrix estimation node constraint""" def __init__(self): super().__init__() def objective(self, A, B, w, y): """ A : b x N x 3 B : b x N x 3 y : b x 3 x 3 w : b x N """ w = nn.functional.relu(w) outs = [] for batch in range(w.size(0)): a_ = A[batch].view((-1, 1, 3)) # N x 1 x 3 b_ = B[batch].view((-1, 3, 1)) # N x 3 x 1 M = a_ * b_ M = M.view(-1, 9) # 10 x 9 res = M.mm(y[batch].view(9, 1)) res = res**2 res = res.squeeze(1) out = torch.einsum("n,n-> ", (w[batch] ** 2, res)) outs.append(out.unsqueeze(0)) outs = torch.cat(outs, 0) return outs def equality_constraints(self, A, B, w, y): ones = torch.ones(y.shape[0]) constr1 = ( torch.einsum("bk,bk->b", [y.view(y.shape[0], 9), y.view(y.shape[0], 9)]) - ones ) constr2 = torch.linalg.det(y) return torch.cat(((constr1).unsqueeze(1), (constr2 * 100).unsqueeze(1)), 1) def solve(self, A, B, w): w = nn.functional.relu(w) A = A.detach() B = B.detach() w = w.detach() y = self.__solve(A, B, w).requires_grad_() return y.detach(), None def __solve(self, A, B, w): """ A : b x N x 3 B : b x N x 3 y : b x 3 x 3 w : b x N """ out_batch = [] for batch in range(w.size(0)): w_ = (w[batch]).view(w[batch].size(0), 1, 1) # N x 1 x 1 a_ = A[batch].view((-1, 1, 3)) # N x 1 x 3 b_ = B[batch].view((-1, 3, 1)) # N x 3 x 1 M = w_**2 * a_ * b_ M = M.view(-1, 9) _, _, Vh = torch.linalg.svd(M) F8 = Vh[-1, :].view(3, 3) [u, s, vh] = torch.linalg.svd(F8) S_ = torch.diag(s * mask) F_ = u.mm(S_.mm(vh)) F_ = F_ / torch.norm(F_) out_batch.append(F_.unsqueeze(0)) F = torch.cat(out_batch, 0) return F ############ SVD Layer ############ def SVDLayer(A, B, w): """ A : b x N x 3 B : b x N x 3 w : b x N A and B are normalized points """ w = nn.functional.relu(w) out_batch = [] for batch in range(w.size(0)): w_ = (w[batch]).view(w[batch].size(0), 1, 1) # N x 1 x 1 a_ = A[batch].view((-1, 1, 3)) # N x 1 x 3 b_ = B[batch].view((-1, 3, 1)) # N x 3 x 1 M = w_**2 * a_ * b_ M = M.view(-1, 9) _, _, Vh = torch.linalg.svd(M) F8 = Vh[-1, :].view(3, 3) [u, s, vh] = torch.linalg.svd(F8) S_ = torch.diag(s * mask) F_ = u.mm(S_.mm(vh)) F_ = F_ / torch.norm(F_) out_batch.append(F_.unsqueeze(0)) F = torch.cat(out_batch, 0) return F ############ IFT function ############ class IFTFunction(torch.autograd.Function): @staticmethod def forward(A, B, w): """ A : b x N x 3 B : b x N x 3 w : b x N """ w = nn.functional.relu(w) out_batch = [] for batch in range(w.size(0)): w_ = (w[batch]).view(w[batch].size(0), 1, 1) # N x 1 x 1 a_ = A[batch].view((-1, 1, 3)) # N x 1 x 3 b_ = B[batch].view((-1, 3, 1)) # N x 3 x 1 M = w_**2 * a_ * b_ M = M.view(-1, 9) _, _, Vh = torch.linalg.svd(M) F8 = Vh[-1, :].view(3, 3) [u, s, vh] = torch.linalg.svd(F8) S_ = torch.diag(s * mask) F_ = u.mm(S_.mm(vh)) F_ = F_ / torch.norm(F_) out_batch.append(F_.unsqueeze(0)) F = torch.cat(out_batch, 0) return F @staticmethod def setup_context(ctx, inputs, output): A, B, w = inputs ctx.save_for_backward(A, B, w, output) @staticmethod def backward(ctx, grad_output): A, B, w, output = ctx.saved_tensors # output : b x 3 x 3 grad_A = grad_B = None b = grad_output.shape[0] w = nn.functional.relu(w) # F : b x 3 x 3 ; w : b x 15 ; J_Fw : b x 9 x 15 ; grad_output : b x 3 x 3 J_Fw = compute_jacobians( output, w, A.permute(0, 2, 1), B.permute(0, 2, 1) ) # b x 9 x 15 J_Fw = torch.einsum("bi,bij->bj", grad_output.view(b, 9), J_Fw) grad_w = J_Fw.view(b, 15) return None, None, grad_w class IFTLayer(nn.Module): def __init__(self): super().__init__() def forward(self, A, B, w): return IFTFunction.apply(A, B, w) def compute_jacobians(F, w, A, B): """ F : b x 3 x 3 w : b x N A : b x 3 x N B : b x 3 x N """ b = F.shape[0] F11 = F[:, 0, 0] F12 = F[:, 0, 1] F13 = F[:, 0, 2] F21 = F[:, 1, 0] F22 = F[:, 1, 1] F23 = F[:, 1, 2] F31 = F[:, 2, 0] F32 = F[:, 2, 1] F33 = F[:, 2, 2] x11 = A[:, 0, 0] y11 = A[:, 1, 0] x12 = B[:, 0, 0] y12 = B[:, 1, 0] x21 = A[:, 0, 1] y21 = A[:, 1, 1] x22 = B[:, 0, 1] y22 = B[:, 1, 1] x31 = A[:, 0, 2] y31 = A[:, 1, 2] x32 = B[:, 0, 2] y32 = B[:, 1, 2] x41 = A[:, 0, 3] y41 = A[:, 1, 3] x42 = B[:, 0, 3] y42 = B[:, 1, 3] x51 = A[:, 0, 4] y51 = A[:, 1, 4] x52 = B[:, 0, 4] y52 = B[:, 1, 4] x61 = A[:, 0, 5] y61 = A[:, 1, 5] x62 = B[:, 0, 5] y62 = B[:, 1, 5] x71 = A[:, 0, 6] y71 = A[:, 1, 6] x72 = B[:, 0, 6] y72 = B[:, 1, 6] x81 = A[:, 0, 7] y81 = A[:, 1, 7] x82 = B[:, 0, 7] y82 = B[:, 1, 7] x91 = A[:, 0, 8] y91 = A[:, 1, 8] x92 = B[:, 0, 8] y92 = B[:, 1, 8] x10_1 = A[:, 0, 9] y10_1 = A[:, 1, 9] x10_2 = B[:, 0, 9] y10_2 = B[:, 1, 9] x11_1 = A[:, 0, 10] y11_1 = A[:, 1, 10] x11_2 = B[:, 0, 10] y11_2 = B[:, 1, 10] x12_1 = A[:, 0, 11] y12_1 = A[:, 1, 11] x12_2 = B[:, 0, 11] y12_2 = B[:, 1, 11] x13_1 = A[:, 0, 12] y13_1 = A[:, 1, 12] x13_2 = B[:, 0, 12] y13_2 = B[:, 1, 12] x14_1 = A[:, 0, 13] y14_1 = A[:, 1, 13] x14_2 = B[:, 0, 13] y14_2 = B[:, 1, 13] x15_1 = A[:, 0, 14] y15_1 = A[:, 1, 14] x15_2 = B[:, 0, 14] y15_2 = B[:, 1, 14] w1 = w[:, 0] w2 = w[:, 1] w3 = w[:, 2] w4 = w[:, 3] w5 = w[:, 4] w6 = w[:, 5] w7 = w[:, 6] w8 = w[:, 7] w9 = w[:, 8] w10 = w[:, 9] w11 = w[:, 10] w12 = w[:, 11] w13 = w[:, 12] w14 = w[:, 13] w15 = w[:, 14] J_F = torch.zeros((b, 17, 9), device=F.device) # F11 J_F[:, 0, 0] = ( -2 * (F22 * F33 - F23 * F32) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 + w5**2 * x51 * x52 + w6**2 * x61 * x62 + w7**2 * x71 * x72 + w8**2 * x81 * x82 + w9**2 * x91 * x92 + w10**2 * x10_1 * x10_2 + w11**2 * x11_1 * x11_2 + w12**2 * x12_1 * x12_2 + w13**2 * x13_1 * x13_2 + w14**2 * x14_1 * x14_2 + w15**2 * x15_1 * x15_2 ) / (F11 * F22 - F12 * F21) + 2 * (F22 * F33 - F23 * F32) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F22 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12**2 * x11**2 + 2 * w2**2 * x22**2 * x21**2 + 2 * w3**2 * x32**2 * x31**2 + 2 * w4**2 * x42**2 * x41**2 + 2 * w5**2 * x52**2 * x51**2 + 2 * w6**2 * x62**2 * x61**2 + 2 * w7**2 * x72**2 * x71**2 + 2 * w8**2 * x82**2 * x81**2 + 2 * w9**2 * x92**2 * x91**2 + 2 * w10**2 * x10_2**2 * x10_1**2 + 2 * w11**2 * x11_2**2 * x11_1**2 + 2 * w12**2 * x12_2**2 * x12_1**2 + 2 * w13**2 * x13_2**2 * x13_1**2 + 2 * w14**2 * x14_2**2 * x14_1**2 + 2 * w15**2 * x15_2**2 * x15_1**2 ) J_F[:, 1, 0] = ( -2 * (-F21 * F33 + F23 * F31) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 + w5**2 * x51 * x52 + w6**2 * x61 * x62 + w7**2 * x71 * x72 + w8**2 * x81 * x82 + w9**2 * x91 * x92 + w10**2 * x10_1 * x10_2 + w11**2 * x11_1 * x11_2 + w12**2 * x12_1 * x12_2 + w13**2 * x13_1 * x13_2 + w14**2 * x14_1 * x14_2 + w15**2 * x15_1 * x15_2 ) / (F11 * F22 - F12 * F21) + 2 * (-F21 * F33 + F23 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F22 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12**2 * x11 * y11 + 2 * w2**2 * x22**2 * x21 * y21 + 2 * w3**2 * x32**2 * x31 * y31 + 2 * w4**2 * x42**2 * x41 * y41 + 2 * w5**2 * x52**2 * x51 * y51 + 2 * w6**2 * x62**2 * x61 * y61 + 2 * w7**2 * x72**2 * x71 * y71 + 2 * w8**2 * x82**2 * x81 * y81 + 2 * w9**2 * x92**2 * x91 * y91 + 2 * w10**2 * x10_2**2 * x10_1 * y10_1 + 2 * w11**2 * x11_2**2 * x11_1 * y11_1 + 2 * w12**2 * x12_2**2 * x12_1 * y12_1 + 2 * w13**2 * x13_2**2 * x13_1 * y13_1 + 2 * w14**2 * x14_2**2 * x14_1 * y14_1 + 2 * w15**2 * x15_2**2 * x15_1 * y15_1 ) J_F[:, 2, 0] = ( -2 * (F21 * F32 - F22 * F31) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 + w5**2 * x51 * x52 + w6**2 * x61 * x62 + w7**2 * x71 * x72 + w8**2 * x81 * x82 + w9**2 * x91 * x92 + w10**2 * x10_1 * x10_2 + w11**2 * x11_1 * x11_2 + w12**2 * x12_1 * x12_2 + w13**2 * x13_1 * x13_2 + w14**2 * x14_1 * x14_2 + w15**2 * x15_1 * x15_2 ) / (F11 * F22 - F12 * F21) + 2 * (F21 * F32 - F22 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F22 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12**2 * x11 + 2 * w2**2 * x22**2 * x21 + 2 * w3**2 * x32**2 * x31 + 2 * w4**2 * x42**2 * x41 + 2 * w5**2 * x52**2 * x51 + 2 * w6**2 * x62**2 * x61 + 2 * w7**2 * x72**2 * x71 + 2 * w8**2 * x82**2 * x81 + 2 * w9**2 * x92**2 * x91 + 2 * w10**2 * x10_2**2 * x10_1 + 2 * w11**2 * x11_2**2 * x11_1 + 2 * w12**2 * x12_2**2 * x12_1 + 2 * w13**2 * x13_2**2 * x13_1 + 2 * w14**2 * x14_2**2 * x14_1 + 2 * w15**2 * x15_2**2 * x15_1 ) J_F[:, 3, 0] = ( -2 * (-F12 * F33 + F13 * F32) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 + w5**2 * x51 * x52 + w6**2 * x61 * x62 + w7**2 * x71 * x72 + w8**2 * x81 * x82 + w9**2 * x91 * x92 + w10**2 * x10_1 * x10_2 + w11**2 * x11_1 * x11_2 + w12**2 * x12_1 * x12_2 + w13**2 * x13_1 * x13_2 + w14**2 * x14_1 * x14_2 + w15**2 * x15_1 * x15_2 ) / (F11 * F22 - F12 * F21) + 2 * (-F12 * F33 + F13 * F32) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F22 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * x11**2 * y12 + 2 * w2**2 * x22 * x21**2 * y22 + 2 * w3**2 * x32 * x31**2 * y32 + 2 * w4**2 * x42 * x41**2 * y42 + 2 * w5**2 * x52 * x51**2 * y52 + 2 * w6**2 * x62 * x61**2 * y62 + 2 * w7**2 * x72 * x71**2 * y72 + 2 * w8**2 * x82 * x81**2 * y82 + 2 * w9**2 * x92 * x91**2 * y92 + 2 * w10**2 * x10_2 * x10_1**2 * y10_2 + 2 * w11**2 * x11_2 * x11_1**2 * y11_2 + 2 * w12**2 * x12_2 * x12_1**2 * y12_2 + 2 * w13**2 * x13_2 * x13_1**2 * y13_2 + 2 * w14**2 * x14_2 * x14_1**2 * y14_2 + 2 * w15**2 * x15_2 * x15_1**2 * y15_2 ) J_F[:, 4, 0] = ( -2 * F33 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F11 * F33 - F13 * F31) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 + w5**2 * x51 * x52 + w6**2 * x61 * x62 + w7**2 * x71 * x72 + w8**2 * x81 * x82 + w9**2 * x91 * x92 + w10**2 * x10_1 * x10_2 + w11**2 * x11_1 * x11_2 + w12**2 * x12_1 * x12_2 + w13**2 * x13_1 * x13_2 + w14**2 * x14_1 * x14_2 + w15**2 * x15_1 * x15_2 ) / (F11 * F22 - F12 * F21) + 2 * (F11 * F33 - F13 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F22 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * x11 * y12 * y11 + 2 * w2**2 * x22 * x21 * y22 * y21 + 2 * w3**2 * x32 * x31 * y32 * y31 + 2 * w4**2 * x42 * x41 * y42 * y41 + 2 * w5**2 * x52 * x51 * y52 * y51 + 2 * w6**2 * x62 * x61 * y62 * y61 + 2 * w7**2 * x72 * x71 * y72 * y71 + 2 * w8**2 * x82 * x81 * y82 * y81 + 2 * w9**2 * x92 * x91 * y92 * y91 + 2 * w10**2 * x10_2 * x10_1 * y10_2 * y10_1 + 2 * w11**2 * x11_2 * x11_1 * y11_2 * y11_1 + 2 * w12**2 * x12_2 * x12_1 * y12_2 * y12_1 + 2 * w13**2 * x13_2 * x13_1 * y13_2 * y13_1 + 2 * w14**2 * x14_2 * x14_1 * y14_2 * y14_1 + 2 * w15**2 * x15_2 * x15_1 * y15_2 * y15_1 ) J_F[:, 5, 0] = ( 2 * F32 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F11 * F32 + F12 * F31) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 + w5**2 * x51 * x52 + w6**2 * x61 * x62 + w7**2 * x71 * x72 + w8**2 * x81 * x82 + w9**2 * x91 * x92 + w10**2 * x10_1 * x10_2 + w11**2 * x11_1 * x11_2 + w12**2 * x12_1 * x12_2 + w13**2 * x13_1 * x13_2 + w14**2 * x14_1 * x14_2 + w15**2 * x15_1 * x15_2 ) / (F11 * F22 - F12 * F21) + 2 * (-F11 * F32 + F12 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F22 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * x11 * y12 + 2 * w2**2 * x22 * x21 * y22 + 2 * w3**2 * x32 * x31 * y32 + 2 * w4**2 * x42 * x41 * y42 + 2 * w5**2 * x52 * x51 * y52 + 2 * w6**2 * x62 * x61 * y62 + 2 * w7**2 * x72 * x71 * y72 + 2 * w8**2 * x82 * x81 * y82 + 2 * w9**2 * x92 * x91 * y92 + 2 * w10**2 * x10_2 * x10_1 * y10_2 + 2 * w11**2 * x11_2 * x11_1 * y11_2 + 2 * w12**2 * x12_2 * x12_1 * y12_2 + 2 * w13**2 * x13_2 * x13_1 * y13_2 + 2 * w14**2 * x14_2 * x14_1 * y14_2 + 2 * w15**2 * x15_2 * x15_1 * y15_2 ) J_F[:, 6, 0] = ( -2 * (F12 * F23 - F13 * F22) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 + w5**2 * x51 * x52 + w6**2 * x61 * x62 + w7**2 * x71 * x72 + w8**2 * x81 * x82 + w9**2 * x91 * x92 + w10**2 * x10_1 * x10_2 + w11**2 * x11_1 * x11_2 + w12**2 * x12_1 * x12_2 + w13**2 * x13_1 * x13_2 + w14**2 * x14_1 * x14_2 + w15**2 * x15_1 * x15_2 ) / (F11 * F22 - F12 * F21) + 2 * (F12 * F23 - F13 * F22) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F22 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * x11**2 + 2 * w2**2 * x22 * x21**2 + 2 * w3**2 * x32 * x31**2 + 2 * w4**2 * x42 * x41**2 + 2 * w5**2 * x52 * x51**2 + 2 * w6**2 * x62 * x61**2 + 2 * w7**2 * x72 * x71**2 + 2 * w8**2 * x82 * x81**2 + 2 * w9**2 * x92 * x91**2 + 2 * w10**2 * x10_2 * x10_1**2 + 2 * w11**2 * x11_2 * x11_1**2 + 2 * w12**2 * x12_2 * x12_1**2 + 2 * w13**2 * x13_2 * x13_1**2 + 2 * w14**2 * x14_2 * x14_1**2 + 2 * w15**2 * x15_2 * x15_1**2 ) J_F[:, 7, 0] = ( 2 * F23 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F11 * F23 + F13 * F21) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 + w5**2 * x51 * x52 + w6**2 * x61 * x62 + w7**2 * x71 * x72 + w8**2 * x81 * x82 + w9**2 * x91 * x92 + w10**2 * x10_1 * x10_2 + w11**2 * x11_1 * x11_2 + w12**2 * x12_1 * x12_2 + w13**2 * x13_1 * x13_2 + w14**2 * x14_1 * x14_2 + w15**2 * x15_1 * x15_2 ) / (F11 * F22 - F12 * F21) + 2 * (-F11 * F23 + F13 * F21) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F22 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * x11 * y11 + 2 * w2**2 * x22 * x21 * y21 + 2 * w3**2 * x32 * x31 * y31 + 2 * w4**2 * x42 * x41 * y41 + 2 * w5**2 * x52 * x51 * y51 + 2 * w6**2 * x62 * x61 * y61 + 2 * w7**2 * x72 * x71 * y71 + 2 * w8**2 * x82 * x81 * y81 + 2 * w9**2 * x92 * x91 * y91 + 2 * w10**2 * x10_2 * x10_1 * y10_1 + 2 * w11**2 * x11_2 * x11_1 * y11_1 + 2 * w12**2 * x12_2 * x12_1 * y12_1 + 2 * w13**2 * x13_2 * x13_1 * y13_1 + 2 * w14**2 * x14_2 * x14_1 * y14_1 + 2 * w15**2 * x15_2 * x15_1 * y15_1 ) J_F[:, 8, 0] = 0 # F12 J_F[:, 0, 1] = ( -2 * (F22 * F33 - F23 * F32) * ( w1**2 * x12 * y11 + w2**2 * x22 * y21 + w3**2 * x32 * y31 + w4**2 * x42 * y41 + w5**2 * x52 * y51 + w6**2 * x62 * y61 + w7**2 * x72 * y71 + w8**2 * x82 * y81 + w9**2 * x92 * y91 + w10**2 * x10_2 * y10_1 + w11**2 * x11_2 * y11_1 + w12**2 * x12_2 * y12_1 + w13**2 * x13_2 * y13_1 + w14**2 * x14_2 * y14_1 + w15**2 * x15_2 * y15_1 ) / (F11 * F22 - F12 * F21) - 2 * (F22 * F33 - F23 * F32) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F21 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12**2 * x11 * y11 + 2 * w2**2 * x22**2 * x21 * y21 + 2 * w3**2 * x32**2 * x31 * y31 + 2 * w4**2 * x42**2 * x41 * y41 + 2 * w5**2 * x52**2 * x51 * y51 + 2 * w6**2 * x62**2 * x61 * y61 + 2 * w7**2 * x72**2 * x71 * y71 + 2 * w8**2 * x82**2 * x81 * y81 + 2 * w9**2 * x92**2 * x91 * y91 + 2 * w10**2 * x10_2**2 * x10_1 * y10_1 + 2 * w11**2 * x11_2**2 * x11_1 * y11_1 + 2 * w12**2 * x12_2**2 * x12_1 * y12_1 + 2 * w13**2 * x13_2**2 * x13_1 * y13_1 + 2 * w14**2 * x14_2**2 * x14_1 * y14_1 + 2 * w15**2 * x15_2**2 * x15_1 * y15_1 ) J_F[:, 1, 1] = ( -2 * (-F21 * F33 + F23 * F31) * ( w1**2 * x12 * y11 + w2**2 * x22 * y21 + w3**2 * x32 * y31 + w4**2 * x42 * y41 + w5**2 * x52 * y51 + w6**2 * x62 * y61 + w7**2 * x72 * y71 + w8**2 * x82 * y81 + w9**2 * x92 * y91 + w10**2 * x10_2 * y10_1 + w11**2 * x11_2 * y11_1 + w12**2 * x12_2 * y12_1 + w13**2 * x13_2 * y13_1 + w14**2 * x14_2 * y14_1 + w15**2 * x15_2 * y15_1 ) / (F11 * F22 - F12 * F21) - 2 * (-F21 * F33 + F23 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F21 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12**2 * y11**2 + 2 * w2**2 * x22**2 * y21**2 + 2 * w3**2 * x32**2 * y31**2 + 2 * w4**2 * x42**2 * y41**2 + 2 * w5**2 * x52**2 * y51**2 + 2 * w6**2 * x62**2 * y61**2 + 2 * w7**2 * x72**2 * y71**2 + 2 * w8**2 * x82**2 * y81**2 + 2 * w9**2 * x92**2 * y91**2 + 2 * w10**2 * x10_2**2 * y10_1**2 + 2 * w11**2 * x11_2**2 * y11_1**2 + 2 * w12**2 * x12_2**2 * y12_1**2 + 2 * w13**2 * x13_2**2 * y13_1**2 + 2 * w14**2 * x14_2**2 * y14_1**2 + 2 * w15**2 * x15_2**2 * y15_1**2 ) J_F[:, 2, 1] = ( -2 * (F21 * F32 - F22 * F31) * ( w1**2 * x12 * y11 + w2**2 * x22 * y21 + w3**2 * x32 * y31 + w4**2 * x42 * y41 + w5**2 * x52 * y51 + w6**2 * x62 * y61 + w7**2 * x72 * y71 + w8**2 * x82 * y81 + w9**2 * x92 * y91 + w10**2 * x10_2 * y10_1 + w11**2 * x11_2 * y11_1 + w12**2 * x12_2 * y12_1 + w13**2 * x13_2 * y13_1 + w14**2 * x14_2 * y14_1 + w15**2 * x15_2 * y15_1 ) / (F11 * F22 - F12 * F21) - 2 * (F21 * F32 - F22 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F21 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12**2 * y11 + 2 * w2**2 * x22**2 * y21 + 2 * w3**2 * x32**2 * y31 + 2 * w4**2 * x42**2 * y41 + 2 * w5**2 * x52**2 * y51 + 2 * w6**2 * x62**2 * y61 + 2 * w7**2 * x72**2 * y71 + 2 * w8**2 * x82**2 * y81 + 2 * w9**2 * x92**2 * y91 + 2 * w10**2 * x10_2**2 * y10_1 + 2 * w11**2 * x11_2**2 * y11_1 + 2 * w12**2 * x12_2**2 * y12_1 + 2 * w13**2 * x13_2**2 * y13_1 + 2 * w14**2 * x14_2**2 * y14_1 + 2 * w15**2 * x15_2**2 * y15_1 ) J_F[:, 3, 1] = ( 2 * F33 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F12 * F33 + F13 * F32) * ( w1**2 * x12 * y11 + w2**2 * x22 * y21 + w3**2 * x32 * y31 + w4**2 * x42 * y41 + w5**2 * x52 * y51 + w6**2 * x62 * y61 + w7**2 * x72 * y71 + w8**2 * x82 * y81 + w9**2 * x92 * y91 + w10**2 * x10_2 * y10_1 + w11**2 * x11_2 * y11_1 + w12**2 * x12_2 * y12_1 + w13**2 * x13_2 * y13_1 + w14**2 * x14_2 * y14_1 + w15**2 * x15_2 * y15_1 ) / (F11 * F22 - F12 * F21) - 2 * (-F12 * F33 + F13 * F32) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F21 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * x11 * y12 * y11 + 2 * w2**2 * x22 * x21 * y22 * y21 + 2 * w3**2 * x32 * x31 * y32 * y31 + 2 * w4**2 * x42 * x41 * y42 * y41 + 2 * w5**2 * x52 * x51 * y52 * y51 + 2 * w6**2 * x62 * x61 * y62 * y61 + 2 * w7**2 * x72 * x71 * y72 * y71 + 2 * w8**2 * x82 * x81 * y82 * y81 + 2 * w9**2 * x92 * x91 * y92 * y91 + 2 * w10**2 * x10_2 * x10_1 * y10_2 * y10_1 + 2 * w11**2 * x11_2 * x11_1 * y11_2 * y11_1 + 2 * w12**2 * x12_2 * x12_1 * y12_2 * y12_1 + 2 * w13**2 * x13_2 * x13_1 * y13_2 * y13_1 + 2 * w14**2 * x14_2 * x14_1 * y14_2 * y14_1 + 2 * w15**2 * x15_2 * x15_1 * y15_2 * y15_1 ) J_F[:, 4, 1] = ( -2 * (F11 * F33 - F13 * F31) * ( w1**2 * x12 * y11 + w2**2 * x22 * y21 + w3**2 * x32 * y31 + w4**2 * x42 * y41 + w5**2 * x52 * y51 + w6**2 * x62 * y61 + w7**2 * x72 * y71 + w8**2 * x82 * y81 + w9**2 * x92 * y91 + w10**2 * x10_2 * y10_1 + w11**2 * x11_2 * y11_1 + w12**2 * x12_2 * y12_1 + w13**2 * x13_2 * y13_1 + w14**2 * x14_2 * y14_1 + w15**2 * x15_2 * y15_1 ) / (F11 * F22 - F12 * F21) - 2 * (F11 * F33 - F13 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F21 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * y11**2 * y12 + 2 * w2**2 * x22 * y21**2 * y22 + 2 * w3**2 * x32 * y31**2 * y32 + 2 * w4**2 * x42 * y41**2 * y42 + 2 * w5**2 * x52 * y51**2 * y52 + 2 * w6**2 * x62 * y61**2 * y62 + 2 * w7**2 * x72 * y71**2 * y72 + 2 * w8**2 * x82 * y81**2 * y82 + 2 * w9**2 * x92 * y91**2 * y92 + 2 * w10**2 * x10_2 * y10_1**2 * y10_2 + 2 * w11**2 * x11_2 * y11_1**2 * y11_2 + 2 * w12**2 * x12_2 * y12_1**2 * y12_2 + 2 * w13**2 * x13_2 * y13_1**2 * y13_2 + 2 * w14**2 * x14_2 * y14_1**2 * y14_2 + 2 * w15**2 * x15_2 * y15_1**2 * y15_2 ) J_F[:, 5, 1] = ( -2 * (F11 * F33 - F13 * F31) * ( w1**2 * x12 * y11 + w2**2 * x22 * y21 + w3**2 * x32 * y31 + w4**2 * x42 * y41 + w5**2 * x52 * y51 + w6**2 * x62 * y61 + w7**2 * x72 * y71 + w8**2 * x82 * y81 + w9**2 * x92 * y91 + w10**2 * x10_2 * y10_1 + w11**2 * x11_2 * y11_1 + w12**2 * x12_2 * y12_1 + w13**2 * x13_2 * y13_1 + w14**2 * x14_2 * y14_1 + w15**2 * x15_2 * y15_1 ) / (F11 * F22 - F12 * F21) - 2 * (F11 * F33 - F13 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F21 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * y11**2 * y12 + 2 * w2**2 * x22 * y21**2 * y22 + 2 * w3**2 * x32 * y31**2 * y32 + 2 * w4**2 * x42 * y41**2 * y42 + 2 * w5**2 * x52 * y51**2 * y52 + 2 * w6**2 * x62 * y61**2 * y62 + 2 * w7**2 * x72 * y71**2 * y72 + 2 * w8**2 * x82 * y81**2 * y82 + 2 * w9**2 * x92 * y91**2 * y92 + 2 * w10**2 * x10_2 * y10_1**2 * y10_2 + 2 * w11**2 * x11_2 * y11_1**2 * y11_2 + 2 * w12**2 * x12_2 * y12_1**2 * y12_2 + 2 * w13**2 * x13_2 * y13_1**2 * y13_2 + 2 * w14**2 * x14_2 * y14_1**2 * y14_2 + 2 * w15**2 * x15_2 * y15_1**2 * y15_2 ) J_F[:, 6, 1] = ( -2 * F23 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F12 * F23 - F13 * F22) * ( w1**2 * x12 * y11 + w2**2 * x22 * y21 + w3**2 * x32 * y31 + w4**2 * x42 * y41 + w5**2 * x52 * y51 + w6**2 * x62 * y61 + w7**2 * x72 * y71 + w8**2 * x82 * y81 + w9**2 * x92 * y91 + w10**2 * x10_2 * y10_1 + w11**2 * x11_2 * y11_1 + w12**2 * x12_2 * y12_1 + w13**2 * x13_2 * y13_1 + w14**2 * x14_2 * y14_1 + w15**2 * x15_2 * y15_1 ) / (F11 * F22 - F12 * F21) - 2 * (F12 * F23 - F13 * F22) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F21 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * x11 * y11 + 2 * w2**2 * x22 * x21 * y21 + 2 * w3**2 * x32 * x31 * y31 + 2 * w4**2 * x42 * x41 * y41 + 2 * w5**2 * x52 * x51 * y51 + 2 * w6**2 * x62 * x61 * y61 + 2 * w7**2 * x72 * x71 * y71 + 2 * w8**2 * x82 * x81 * y81 + 2 * w9**2 * x92 * x91 * y91 + 2 * w10**2 * x10_2 * x10_1 * y10_1 + 2 * w11**2 * x11_2 * x11_1 * y11_1 + 2 * w12**2 * x12_2 * x12_1 * y12_1 + 2 * w13**2 * x13_2 * x13_1 * y13_1 + 2 * w14**2 * x14_2 * x14_1 * y14_1 + 2 * w15**2 * x15_2 * x15_1 * y15_1 ) J_F[:, 7, 1] = ( -2 * (-F11 * F23 + F13 * F21) * ( w1**2 * x12 * y11 + w2**2 * x22 * y21 + w3**2 * x32 * y31 + w4**2 * x42 * y41 + w5**2 * x52 * y51 + w6**2 * x62 * y61 + w7**2 * x72 * y71 + w8**2 * x82 * y81 + w9**2 * x92 * y91 + w10**2 * x10_2 * y10_1 + w11**2 * x11_2 * y11_1 + w12**2 * x12_2 * y12_1 + w13**2 * x13_2 * y13_1 + w14**2 * x14_2 * y14_1 + w15**2 * x15_2 * y15_1 ) / (F11 * F22 - F12 * F21) - 2 * (-F11 * F23 + F13 * F21) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F21 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * y11**2 + 2 * w2**2 * x22 * y21**2 + 2 * w3**2 * x32 * y31**2 + 2 * w4**2 * x42 * y41**2 + 2 * w5**2 * x52 * y51**2 + 2 * w6**2 * x62 * y61**2 + 2 * w7**2 * x72 * y71**2 + 2 * w8**2 * x82 * y81**2 + 2 * w9**2 * x92 * y91**2 + 2 * w10**2 * x10_2 * y10_1**2 + 2 * w11**2 * x11_2 * y11_1**2 + 2 * w12**2 * x12_2 * y12_1**2 + 2 * w13**2 * x13_2 * y13_1**2 + 2 * w14**2 * x14_2 * y14_1**2 + 2 * w15**2 * x15_2 * y15_1**2 ) J_F[:, 8, 1] = 0 # F13 J_F[:, 0, 2] = ( -2 * (F22 * F33 - F23 * F32) * ( w1**2 * x12 + w10**2 * x10_2 + w11**2 * x11_2 + w12**2 * x12_2 + w13**2 * x13_2 + w14**2 * x14_2 + w15**2 * x15_2 + w2**2 * x22 + w3**2 * x32 + w4**2 * x42 + w5**2 * x52 + w6**2 * x62 + w7**2 * x72 + w8**2 * x82 + w9**2 * x92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12**2 * x11 + 2 * w2**2 * x22**2 * x21 + 2 * w3**2 * x32**2 * x31 + 2 * w4**2 * x42**2 * x41 + 2 * w5**2 * x52**2 * x51 + 2 * w6**2 * x62**2 * x61 + 2 * w7**2 * x72**2 * x71 + 2 * w8**2 * x82**2 * x81 + 2 * w9**2 * x92**2 * x91 + 2 * w10**2 * x10_2**2 * x10_1 + 2 * w11**2 * x11_2**2 * x11_1 + 2 * w12**2 * x12_2**2 * x12_1 + 2 * w13**2 * x13_2**2 * x13_1 + 2 * w14**2 * x14_2**2 * x14_1 + 2 * w15**2 * x15_2**2 * x15_1 ) J_F[:, 1, 2] = ( -2 * (-F21 * F33 + F23 * F31) * ( w1**2 * x12 + w10**2 * x10_2 + w11**2 * x11_2 + w12**2 * x12_2 + w13**2 * x13_2 + w14**2 * x14_2 + w15**2 * x15_2 + w2**2 * x22 + w3**2 * x32 + w4**2 * x42 + w5**2 * x52 + w6**2 * x62 + w7**2 * x72 + w8**2 * x82 + w9**2 * x92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12**2 * y11 + 2 * w2**2 * x22**2 * y21 + 2 * w3**2 * x32**2 * y31 + 2 * w4**2 * x42**2 * y41 + 2 * w5**2 * x52**2 * y51 + 2 * w6**2 * x62**2 * y61 + 2 * w7**2 * x72**2 * y71 + 2 * w8**2 * x82**2 * y81 + 2 * w9**2 * x92**2 * y91 + 2 * w10**2 * x10_2**2 * y10_1 + 2 * w11**2 * x11_2**2 * y11_1 + 2 * w12**2 * x12_2**2 * y12_1 + 2 * w13**2 * x13_2**2 * y13_1 + 2 * w14**2 * x14_2**2 * y14_1 + 2 * w15**2 * x15_2**2 * y15_1 ) J_F[:, 2, 2] = ( -2 * (F21 * F32 - F22 * F31) * ( w1**2 * x12 + w10**2 * x10_2 + w11**2 * x11_2 + w12**2 * x12_2 + w13**2 * x13_2 + w14**2 * x14_2 + w15**2 * x15_2 + w2**2 * x22 + w3**2 * x32 + w4**2 * x42 + w5**2 * x52 + w6**2 * x62 + w7**2 * x72 + w8**2 * x82 + w9**2 * x92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12**2 + 2 * w2**2 * x22**2 + 2 * w3**2 * x32**2 + 2 * w4**2 * x42**2 + 2 * w5**2 * x52**2 + 2 * w6**2 * x62**2 + 2 * w7**2 * x72**2 + 2 * w8**2 * x82**2 + 2 * w9**2 * x92**2 + 2 * w10**2 * x10_2**2 + 2 * w11**2 * x11_2**2 + 2 * w12**2 * x12_2**2 + 2 * w13**2 * x13_2**2 + 2 * w14**2 * x14_2**2 + 2 * w15**2 * x15_2**2 ) J_F[:, 3, 2] = ( -2 * F32 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F12 * F33 + F13 * F32) * ( w1**2 * x12 + w10**2 * x10_2 + w11**2 * x11_2 + w12**2 * x12_2 + w13**2 * x13_2 + w14**2 * x14_2 + w15**2 * x15_2 + w2**2 * x22 + w3**2 * x32 + w4**2 * x42 + w5**2 * x52 + w6**2 * x62 + w7**2 * x72 + w8**2 * x82 + w9**2 * x92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12 * x11 * y12 + 2 * w2**2 * x22 * x21 * y22 + 2 * w3**2 * x32 * x31 * y32 + 2 * w4**2 * x42 * x41 * y42 + 2 * w5**2 * x52 * x51 * y52 + 2 * w6**2 * x62 * x61 * y62 + 2 * w7**2 * x72 * x71 * y72 + 2 * w8**2 * x82 * x81 * y82 + 2 * w9**2 * x92 * x91 * y92 + 2 * w10**2 * x10_2 * x10_1 * y10_2 + 2 * w11**2 * x11_2 * x11_1 * y11_2 + 2 * w12**2 * x12_2 * x12_1 * y12_2 + 2 * w13**2 * x13_2 * x13_1 * y13_2 + 2 * w14**2 * x14_2 * x14_1 * y14_2 + 2 * w15**2 * x15_2 * x15_1 * y15_2 ) J_F[:, 4, 2] = ( 2 * F31 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F11 * F33 - F13 * F31) * ( w1**2 * x12 + w10**2 * x10_2 + w11**2 * x11_2 + w12**2 * x12_2 + w13**2 * x13_2 + w14**2 * x14_2 + w15**2 * x15_2 + w2**2 * x22 + w3**2 * x32 + w4**2 * x42 + w5**2 * x52 + w6**2 * x62 + w7**2 * x72 + w8**2 * x82 + w9**2 * x92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12 * y11 * y12 + 2 * w2**2 * x22 * y21 * y22 + 2 * w3**2 * x32 * y31 * y32 + 2 * w4**2 * x42 * y41 * y42 + 2 * w5**2 * x52 * y51 * y52 + 2 * w6**2 * x62 * y61 * y62 + 2 * w7**2 * x72 * y71 * y72 + 2 * w8**2 * x82 * y81 * y82 + 2 * w9**2 * x92 * y91 * y92 + 2 * w10**2 * x10_2 * y10_1 * y10_2 + 2 * w11**2 * x11_2 * y11_1 * y11_2 + 2 * w12**2 * x12_2 * y12_1 * y12_2 + 2 * w13**2 * x13_2 * y13_1 * y13_2 + 2 * w14**2 * x14_2 * y14_1 * y14_2 + 2 * w15**2 * x15_2 * y15_1 * y15_2 ) J_F[:, 5, 2] = ( -2 * (-F11 * F32 + F12 * F31) * ( w1**2 * x12 + w10**2 * x10_2 + w11**2 * x11_2 + w12**2 * x12_2 + w13**2 * x13_2 + w14**2 * x14_2 + w15**2 * x15_2 + w2**2 * x22 + w3**2 * x32 + w4**2 * x42 + w5**2 * x52 + w6**2 * x62 + w7**2 * x72 + w8**2 * x82 + w9**2 * x92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12 * y12 + 2 * w2**2 * x22 * y22 + 2 * w3**2 * x32 * y32 + 2 * w4**2 * x42 * y42 + 2 * w5**2 * x52 * y52 + 2 * w6**2 * x62 * y62 + 2 * w7**2 * x72 * y72 + 2 * w8**2 * x82 * y82 + 2 * w9**2 * x92 * y92 + 2 * w10**2 * x10_2 * y10_2 + 2 * w11**2 * x11_2 * y11_2 + 2 * w12**2 * x12_2 * y12_2 + 2 * w13**2 * x13_2 * y13_2 + 2 * w14**2 * x14_2 * y14_2 + 2 * w15**2 * x15_2 * y15_2 ) J_F[:, 6, 2] = ( 2 * F22 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F12 * F23 - F13 * F22) * ( w1**2 * x12 + w10**2 * x10_2 + w11**2 * x11_2 + w12**2 * x12_2 + w13**2 * x13_2 + w14**2 * x14_2 + w15**2 * x15_2 + w2**2 * x22 + w3**2 * x32 + w4**2 * x42 + w5**2 * x52 + w6**2 * x62 + w7**2 * x72 + w8**2 * x82 + w9**2 * x92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x11 * x12 + 2 * w2**2 * x21 * x22 + 2 * w3**2 * x31 * x32 + 2 * w4**2 * x41 * x42 + 2 * w5**2 * x51 * x52 + 2 * w6**2 * x61 * x62 + 2 * w7**2 * x71 * x72 + 2 * w8**2 * x81 * x82 + 2 * w9**2 * x91 * x92 + 2 * w10**2 * x10_1 * x10_2 + 2 * w11**2 * x11_1 * x11_2 + 2 * w12**2 * x12_1 * x12_2 + 2 * w13**2 * x13_1 * x13_2 + 2 * w14**2 * x14_1 * x14_2 + 2 * w15**2 * x15_1 * x15_2 ) J_F[:, 7, 2] = ( -2 * F21 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F11 * F23 + F13 * F21) * ( w1**2 * x12 + w10**2 * x10_2 + w11**2 * x11_2 + w12**2 * x12_2 + w13**2 * x13_2 + w14**2 * x14_2 + w15**2 * x15_2 + w2**2 * x22 + w3**2 * x32 + w4**2 * x42 + w5**2 * x52 + w6**2 * x62 + w7**2 * x72 + w8**2 * x82 + w9**2 * x92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12 * y11 + 2 * w2**2 * x22 * y21 + 2 * w3**2 * x32 * y31 + 2 * w4**2 * x42 * y41 + 2 * w5**2 * x52 * y51 + 2 * w6**2 * x62 * y61 + 2 * w7**2 * x72 * y71 + 2 * w8**2 * x82 * y81 + 2 * w9**2 * x92 * y91 + 2 * w10**2 * x10_2 * y10_1 + 2 * w11**2 * x11_2 * y11_1 + 2 * w12**2 * x12_2 * y12_1 + 2 * w13**2 * x13_2 * y13_1 + 2 * w14**2 * x14_2 * y14_1 + 2 * w15**2 * x15_2 * y15_1 ) J_F[:, 8, 2] = 0 # F21 J_F[:, 0, 3] = ( -2 * (F22 * F33 - F23 * F32) * ( w1**2 * x11 * y12 + w2**2 * x21 * y22 + w3**2 * x31 * y32 + w4**2 * x41 * y42 + w5**2 * x51 * y52 + w6**2 * x61 * y62 + w7**2 * x71 * y72 + w8**2 * x81 * y82 + w9**2 * x91 * y92 + w10**2 * x10_1 * y10_2 + w11**2 * x11_1 * y11_2 + w12**2 * x12_1 * y12_2 + w13**2 * x13_1 * y13_2 + w14**2 * x14_1 * y14_2 + w15**2 * x15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F22 * F33 - F23 * F32) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F12 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * x11**2 * y12 + 2 * w2**2 * x22 * x21**2 * y22 + 2 * w3**2 * x32 * x31**2 * y32 + 2 * w4**2 * x42 * x41**2 * y42 + 2 * w5**2 * x52 * x51**2 * y52 + 2 * w6**2 * x62 * x61**2 * y62 + 2 * w7**2 * x72 * x71**2 * y72 + 2 * w8**2 * x82 * x81**2 * y82 + 2 * w9**2 * x92 * x91**2 * y92 + 2 * w10**2 * x10_2 * x10_1**2 * y10_2 + 2 * w11**2 * x11_2 * x11_1**2 * y11_2 + 2 * w12**2 * x12_2 * x12_1**2 * y12_2 + 2 * w13**2 * x13_2 * x13_1**2 * y13_2 + 2 * w14**2 * x14_2 * x14_1**2 * y14_2 + 2 * w15**2 * x15_2 * x15_1**2 * y15_2 ) J_F[:, 1, 3] = ( 2 * F33 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F21 * F33 + F23 * F31) * ( w1**2 * x11 * y12 + w2**2 * x21 * y22 + w3**2 * x31 * y32 + w4**2 * x41 * y42 + w5**2 * x51 * y52 + w6**2 * x61 * y62 + w7**2 * x71 * y72 + w8**2 * x81 * y82 + w9**2 * x91 * y92 + w10**2 * x10_1 * y10_2 + w11**2 * x11_1 * y11_2 + w12**2 * x12_1 * y12_2 + w13**2 * x13_1 * y13_2 + w14**2 * x14_1 * y14_2 + w15**2 * x15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F21 * F33 + F23 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F12 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * x11 * y12 * y11 + 2 * w2**2 * x22 * x21 * y22 * y21 + 2 * w3**2 * x32 * x31 * y32 * y31 + 2 * w4**2 * x42 * x41 * y42 * y41 + 2 * w5**2 * x52 * x51 * y52 * y51 + 2 * w6**2 * x62 * x61 * y62 * y61 + 2 * w7**2 * x72 * x71 * y72 * y71 + 2 * w8**2 * x82 * x81 * y82 * y81 + 2 * w9**2 * x92 * x91 * y92 * y91 + 2 * w10**2 * x10_2 * x10_1 * y10_2 * y10_1 + 2 * w11**2 * x11_2 * x11_1 * y11_2 * y11_1 + 2 * w12**2 * x12_2 * x12_1 * y12_2 * y12_1 + 2 * w13**2 * x13_2 * x13_1 * y13_2 * y13_1 + 2 * w14**2 * x14_2 * x14_1 * y14_2 * y14_1 + 2 * w15**2 * x15_2 * x15_1 * y15_2 * y15_1 ) J_F[:, 2, 3] = ( -2 * F32 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F21 * F32 - F22 * F31) * ( w1**2 * x11 * y12 + w2**2 * x21 * y22 + w3**2 * x31 * y32 + w4**2 * x41 * y42 + w5**2 * x51 * y52 + w6**2 * x61 * y62 + w7**2 * x71 * y72 + w8**2 * x81 * y82 + w9**2 * x91 * y92 + w10**2 * x10_1 * y10_2 + w11**2 * x11_1 * y11_2 + w12**2 * x12_1 * y12_2 + w13**2 * x13_1 * y13_2 + w14**2 * x14_1 * y14_2 + w15**2 * x15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F21 * F32 - F22 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F12 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * x11 * y12 + 2 * w2**2 * x22 * x21 * y22 + 2 * w3**2 * x32 * x31 * y32 + 2 * w4**2 * x42 * x41 * y42 + 2 * w5**2 * x52 * x51 * y52 + 2 * w6**2 * x62 * x61 * y62 + 2 * w7**2 * x72 * x71 * y72 + 2 * w8**2 * x82 * x81 * y82 + 2 * w9**2 * x92 * x91 * y92 + 2 * w10**2 * x10_2 * x10_1 * y10_2 + 2 * w11**2 * x11_2 * x11_1 * y11_2 + 2 * w12**2 * x12_2 * x12_1 * y12_2 + 2 * w13**2 * x13_2 * x13_1 * y13_2 + 2 * w14**2 * x14_2 * x14_1 * y14_2 + 2 * w15**2 * x15_2 * x15_1 * y15_2 ) J_F[:, 3, 3] = ( -2 * (-F12 * F33 + F13 * F32) * ( w1**2 * x11 * y12 + w2**2 * x21 * y22 + w3**2 * x31 * y32 + w4**2 * x41 * y42 + w5**2 * x51 * y52 + w6**2 * x61 * y62 + w7**2 * x71 * y72 + w8**2 * x81 * y82 + w9**2 * x91 * y92 + w10**2 * x10_1 * y10_2 + w11**2 * x11_1 * y11_2 + w12**2 * x12_1 * y12_2 + w13**2 * x13_1 * y13_2 + w14**2 * x14_1 * y14_2 + w15**2 * x15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F12 * F33 + F13 * F32) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F12 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * y12**2 * x11**2 + 2 * w2**2 * y22**2 * x21**2 + 2 * w3**2 * y32**2 * x31**2 + 2 * w4**2 * y42**2 * x41**2 + 2 * w5**2 * y52**2 * x51**2 + 2 * w6**2 * y62**2 * x61**2 + 2 * w7**2 * y72**2 * x71**2 + 2 * w8**2 * y82**2 * x81**2 + 2 * w9**2 * y92**2 * x91**2 + 2 * w10**2 * y10_2**2 * x10_1**2 + 2 * w11**2 * y11_2**2 * x11_1**2 + 2 * w12**2 * y12_2**2 * x12_1**2 + 2 * w13**2 * y13_2**2 * x13_1**2 + 2 * w14**2 * y14_2**2 * x14_1**2 + 2 * w15**2 * y15_2**2 * x15_1**2 ) J_F[:, 4, 3] = ( -2 * (F11 * F33 - F13 * F31) * ( w1**2 * x11 * y12 + w2**2 * x21 * y22 + w3**2 * x31 * y32 + w4**2 * x41 * y42 + w5**2 * x51 * y52 + w6**2 * x61 * y62 + w7**2 * x71 * y72 + w8**2 * x81 * y82 + w9**2 * x91 * y92 + w10**2 * x10_1 * y10_2 + w11**2 * x11_1 * y11_2 + w12**2 * x12_1 * y12_2 + w13**2 * x13_1 * y13_2 + w14**2 * x14_1 * y14_2 + w15**2 * x15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F11 * F33 - F13 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F12 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * y12**2 * x11 * y11 + 2 * w2**2 * y22**2 * x21 * y21 + 2 * w3**2 * y32**2 * x31 * y31 + 2 * w4**2 * y42**2 * x41 * y41 + 2 * w5**2 * y52**2 * x51 * y51 + 2 * w6**2 * y62**2 * x61 * y61 + 2 * w7**2 * y72**2 * x71 * y71 + 2 * w8**2 * y82**2 * x81 * y81 + 2 * w9**2 * y92**2 * x91 * y91 + 2 * w10**2 * y10_2**2 * x10_1 * y10_1 + 2 * w11**2 * y11_2**2 * x11_1 * y11_1 + 2 * w12**2 * y12_2**2 * x12_1 * y12_1 + 2 * w13**2 * y13_2**2 * x13_1 * y13_1 + 2 * w14**2 * y14_2**2 * x14_1 * y14_1 + 2 * w15**2 * y15_2**2 * x15_1 * y15_1 ) J_F[:, 5, 3] = ( -2 * (-F11 * F32 + F12 * F31) * ( w1**2 * x11 * y12 + w2**2 * x21 * y22 + w3**2 * x31 * y32 + w4**2 * x41 * y42 + w5**2 * x51 * y52 + w6**2 * x61 * y62 + w7**2 * x71 * y72 + w8**2 * x81 * y82 + w9**2 * x91 * y92 + w10**2 * x10_1 * y10_2 + w11**2 * x11_1 * y11_2 + w12**2 * x12_1 * y12_2 + w13**2 * x13_1 * y13_2 + w14**2 * x14_1 * y14_2 + w15**2 * x15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F11 * F32 + F12 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F12 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * y12**2 * x11 + 2 * w2**2 * y22**2 * x21 + 2 * w3**2 * y32**2 * x31 + 2 * w4**2 * y42**2 * x41 + 2 * w5**2 * y52**2 * x51 + 2 * w6**2 * y62**2 * x61 + 2 * w7**2 * y72**2 * x71 + 2 * w8**2 * y82**2 * x81 + 2 * w9**2 * y92**2 * x91 + 2 * w10**2 * y10_2**2 * x10_1 + 2 * w11**2 * y11_2**2 * x11_1 + 2 * w12**2 * y12_2**2 * x12_1 + 2 * w13**2 * y13_2**2 * x13_1 + 2 * w14**2 * y14_2**2 * x14_1 + 2 * w15**2 * y15_2**2 * x15_1 ) J_F[:, 6, 3] = ( -2 * (F12 * F23 - F13 * F22) * ( w1**2 * x11 * y12 + w2**2 * x21 * y22 + w3**2 * x31 * y32 + w4**2 * x41 * y42 + w5**2 * x51 * y52 + w6**2 * x61 * y62 + w7**2 * x71 * y72 + w8**2 * x81 * y82 + w9**2 * x91 * y92 + w10**2 * x10_1 * y10_2 + w11**2 * x11_1 * y11_2 + w12**2 * x12_1 * y12_2 + w13**2 * x13_1 * y13_2 + w14**2 * x14_1 * y14_2 + w15**2 * x15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F12 * F23 - F13 * F22) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F12 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * y12 * x11**2 + 2 * w2**2 * y22 * x21**2 + 2 * w3**2 * y32 * x31**2 + 2 * w4**2 * y42 * x41**2 + 2 * w5**2 * y52 * x51**2 + 2 * w6**2 * y62 * x61**2 + 2 * w7**2 * y72 * x71**2 + 2 * w8**2 * y82 * x81**2 + 2 * w9**2 * y92 * x91**2 + 2 * w10**2 * y10_2 * x10_1**2 + 2 * w11**2 * y11_2 * x11_1**2 + 2 * w12**2 * y12_2 * x12_1**2 + 2 * w13**2 * y13_2 * x13_1**2 + 2 * w14**2 * y14_2 * x14_1**2 + 2 * w15**2 * y15_2 * x15_1**2 ) J_F[:, 7, 3] = ( -2 * F13 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F11 * F23 + F13 * F21) * ( w1**2 * x11 * y12 + w2**2 * x21 * y22 + w3**2 * x31 * y32 + w4**2 * x41 * y42 + w5**2 * x51 * y52 + w6**2 * x61 * y62 + w7**2 * x71 * y72 + w8**2 * x81 * y82 + w9**2 * x91 * y92 + w10**2 * x10_1 * y10_2 + w11**2 * x11_1 * y11_2 + w12**2 * x12_1 * y12_2 + w13**2 * x13_1 * y13_2 + w14**2 * x14_1 * y14_2 + w15**2 * x15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F11 * F23 + F13 * F21) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F12 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * y12 * x11 * y11 + 2 * w2**2 * y22 * x21 * y21 + 2 * w3**2 * y32 * x31 * y31 + 2 * w4**2 * y42 * x41 * y41 + 2 * w5**2 * y52 * x51 * y51 + 2 * w6**2 * y62 * x61 * y61 + 2 * w7**2 * y72 * x71 * y71 + 2 * w8**2 * y82 * x81 * y81 + 2 * w9**2 * y92 * x91 * y91 + 2 * w10**2 * y10_2 * x10_1 * y10_1 + 2 * w11**2 * y11_2 * x11_1 * y11_1 + 2 * w12**2 * y12_2 * x12_1 * y12_1 + 2 * w13**2 * y13_2 * x13_1 * y13_1 + 2 * w14**2 * y14_2 * x14_1 * y14_1 + 2 * w15**2 * y15_2 * x15_1 * y15_1 ) J_F[:, 8, 3] = 0 # F22 J_F[:, 0, 4] = ( -2 * F33 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F22 * F33 - F23 * F32) * ( w1**2 * y12 * y11 + w2**2 * y22 * y21 + w3**2 * y32 * y31 + w4**2 * y42 * y41 + w5**2 * y52 * y51 + w6**2 * y62 * y61 + w7**2 * y72 * y71 + w8**2 * y82 * y81 + w9**2 * y92 * y91 + w10**2 * y10_2 * y10_1 + w11**2 * y11_2 * y11_1 + w12**2 * y12_2 * y12_1 + w13**2 * y13_2 * y13_1 + w14**2 * y14_2 * y14_1 + w15**2 * y15_2 * y15_1 ) / (F11 * F22 - F12 * F21) + 2 * (F22 * F33 - F23 * F32) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F11 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * x11 * y12 * y11 + 2 * w2**2 * x22 * x21 * y22 * y21 + 2 * w3**2 * x32 * x31 * y32 * y31 + 2 * w4**2 * x42 * x41 * y42 * y41 + 2 * w5**2 * x52 * x51 * y52 * y51 + 2 * w6**2 * x62 * x61 * y62 * y61 + 2 * w7**2 * x72 * x71 * y72 * y71 + 2 * w8**2 * x82 * x81 * y82 * y81 + 2 * w9**2 * x92 * x91 * y92 * y91 + 2 * w10**2 * x10_2 * x10_1 * y10_2 * y10_1 + 2 * w11**2 * x11_2 * x11_1 * y11_2 * y11_1 + 2 * w12**2 * x12_2 * x12_1 * y12_2 * y12_1 + 2 * w13**2 * x13_2 * x13_1 * y13_2 * y13_1 + 2 * w14**2 * x14_2 * x14_1 * y14_2 * y14_1 + 2 * w15**2 * x15_2 * x15_1 * y15_2 * y15_1 ) J_F[:, 1, 4] = ( -2 * (-F21 * F33 + F23 * F31) * ( w1**2 * y12 * y11 + w2**2 * y22 * y21 + w3**2 * y32 * y31 + w4**2 * y42 * y41 + w5**2 * y52 * y51 + w6**2 * y62 * y61 + w7**2 * y72 * y71 + w8**2 * y82 * y81 + w9**2 * y92 * y91 + w10**2 * y10_2 * y10_1 + w11**2 * y11_2 * y11_1 + w12**2 * y12_2 * y12_1 + w13**2 * y13_2 * y13_1 + w14**2 * y14_2 * y14_1 + w15**2 * y15_2 * y15_1 ) / (F11 * F22 - F12 * F21) + 2 * (-F21 * F33 + F23 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F11 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * y11**2 * y12 + 2 * w2**2 * x22 * y21**2 * y22 + 2 * w3**2 * x32 * y31**2 * y32 + 2 * w4**2 * x42 * y41**2 * y42 + 2 * w5**2 * x52 * y51**2 * y52 + 2 * w6**2 * x62 * y61**2 * y62 + 2 * w7**2 * x72 * y71**2 * y72 + 2 * w8**2 * x82 * y81**2 * y82 + 2 * w9**2 * x92 * y91**2 * y92 + 2 * w10**2 * x10_2 * y10_1**2 * y10_2 + 2 * w11**2 * x11_2 * y11_1**2 * y11_2 + 2 * w12**2 * x12_2 * y12_1**2 * y12_2 + 2 * w13**2 * x13_2 * y13_1**2 * y13_2 + 2 * w14**2 * x14_2 * y14_1**2 * y14_2 + 2 * w15**2 * x15_2 * y15_1**2 * y15_2 ) J_F[:, 2, 4] = ( 2 * F31 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F21 * F32 - F22 * F31) * ( w1**2 * y12 * y11 + w2**2 * y22 * y21 + w3**2 * y32 * y31 + w4**2 * y42 * y41 + w5**2 * y52 * y51 + w6**2 * y62 * y61 + w7**2 * y72 * y71 + w8**2 * y82 * y81 + w9**2 * y92 * y91 + w10**2 * y10_2 * y10_1 + w11**2 * y11_2 * y11_1 + w12**2 * y12_2 * y12_1 + w13**2 * y13_2 * y13_1 + w14**2 * y14_2 * y14_1 + w15**2 * y15_2 * y15_1 ) / (F11 * F22 - F12 * F21) + 2 * (F21 * F32 - F22 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F11 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * x12 * y11 * y12 + 2 * w2**2 * x22 * y21 * y22 + 2 * w3**2 * x32 * y31 * y32 + 2 * w4**2 * x42 * y41 * y42 + 2 * w5**2 * x52 * y51 * y52 + 2 * w6**2 * x62 * y61 * y62 + 2 * w7**2 * x72 * y71 * y72 + 2 * w8**2 * x82 * y81 * y82 + 2 * w9**2 * x92 * y91 * y92 + 2 * w10**2 * x10_2 * y10_1 * y10_2 + 2 * w11**2 * x11_2 * y11_1 * y11_2 + 2 * w12**2 * x12_2 * y12_1 * y12_2 + 2 * w13**2 * x13_2 * y13_1 * y13_2 + 2 * w14**2 * x14_2 * y14_1 * y14_2 + 2 * w15**2 * x15_2 * y15_1 * y15_2 ) J_F[:, 3, 4] = ( -2 * (-F12 * F33 + F13 * F32) * ( w1**2 * y12 * y11 + w2**2 * y22 * y21 + w3**2 * y32 * y31 + w4**2 * y42 * y41 + w5**2 * y52 * y51 + w6**2 * y62 * y61 + w7**2 * y72 * y71 + w8**2 * y82 * y81 + w9**2 * y92 * y91 + w10**2 * y10_2 * y10_1 + w11**2 * y11_2 * y11_1 + w12**2 * y12_2 * y12_1 + w13**2 * y13_2 * y13_1 + w14**2 * y14_2 * y14_1 + w15**2 * y15_2 * y15_1 ) / (F11 * F22 - F12 * F21) + 2 * (-F12 * F33 + F13 * F32) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F11 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * y12**2 * x11 * y11 + 2 * w2**2 * y22**2 * x21 * y21 + 2 * w3**2 * y32**2 * x31 * y31 + 2 * w4**2 * y42**2 * x41 * y41 + 2 * w5**2 * y52**2 * x51 * y51 + 2 * w6**2 * y62**2 * x61 * y61 + 2 * w7**2 * y72**2 * x71 * y71 + 2 * w8**2 * y82**2 * x81 * y81 + 2 * w9**2 * y92**2 * x91 * y91 + 2 * w10**2 * y10_2**2 * x10_1 * y10_1 + 2 * w11**2 * y11_2**2 * x11_1 * y11_1 + 2 * w12**2 * y12_2**2 * x12_1 * y12_1 + 2 * w13**2 * y13_2**2 * x13_1 * y13_1 + 2 * w14**2 * y14_2**2 * x14_1 * y14_1 + 2 * w15**2 * y15_2**2 * x15_1 * y15_1 ) J_F[:, 4, 4] = ( -2 * (F11 * F33 - F13 * F31) * ( w1**2 * y12 * y11 + w2**2 * y22 * y21 + w3**2 * y32 * y31 + w4**2 * y42 * y41 + w5**2 * y52 * y51 + w6**2 * y62 * y61 + w7**2 * y72 * y71 + w8**2 * y82 * y81 + w9**2 * y92 * y91 + w10**2 * y10_2 * y10_1 + w11**2 * y11_2 * y11_1 + w12**2 * y12_2 * y12_1 + w13**2 * y13_2 * y13_1 + w14**2 * y14_2 * y14_1 + w15**2 * y15_2 * y15_1 ) / (F11 * F22 - F12 * F21) + 2 * (F11 * F33 - F13 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F11 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * y12**2 * y11**2 + 2 * w2**2 * y22**2 * y21**2 + 2 * w3**2 * y32**2 * y31**2 + 2 * w4**2 * y42**2 * y41**2 + 2 * w5**2 * y52**2 * y51**2 + 2 * w6**2 * y62**2 * y61**2 + 2 * w7**2 * y72**2 * y71**2 + 2 * w8**2 * y82**2 * y81**2 + 2 * w9**2 * y92**2 * y91**2 + 2 * w10**2 * y10_2**2 * y10_1**2 + 2 * w11**2 * y11_2**2 * y11_1**2 + 2 * w12**2 * y12_2**2 * y12_1**2 + 2 * w13**2 * y13_2**2 * y13_1**2 + 2 * w14**2 * y14_2**2 * y14_1**2 + 2 * w15**2 * y15_2**2 * y15_1**2 ) J_F[:, 5, 4] = ( -2 * (-F11 * F32 + F12 * F31) * ( w1**2 * y12 * y11 + w2**2 * y22 * y21 + w3**2 * y32 * y31 + w4**2 * y42 * y41 + w5**2 * y52 * y51 + w6**2 * y62 * y61 + w7**2 * y72 * y71 + w8**2 * y82 * y81 + w9**2 * y92 * y91 + w10**2 * y10_2 * y10_1 + w11**2 * y11_2 * y11_1 + w12**2 * y12_2 * y12_1 + w13**2 * y13_2 * y13_1 + w14**2 * y14_2 * y14_1 + w15**2 * y15_2 * y15_1 ) / (F11 * F22 - F12 * F21) + 2 * (-F11 * F32 + F12 * F31) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F11 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * y12**2 * y11 + 2 * w2**2 * y22**2 * y21 + 2 * w3**2 * y32**2 * y31 + 2 * w4**2 * y42**2 * y41 + 2 * w5**2 * y52**2 * y51 + 2 * w6**2 * y62**2 * y61 + 2 * w7**2 * y72**2 * y71 + 2 * w8**2 * y82**2 * y81 + 2 * w9**2 * y92**2 * y91 + 2 * w10**2 * y10_2**2 * y10_1 + 2 * w11**2 * y11_2**2 * y11_1 + 2 * w12**2 * y12_2**2 * y12_1 + 2 * w13**2 * y13_2**2 * y13_1 + 2 * w14**2 * y14_2**2 * y14_1 + 2 * w15**2 * y15_2**2 * y15_1 ) J_F[:, 6, 4] = ( 2 * F13 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F12 * F23 - F13 * F22) * ( w1**2 * y12 * y11 + w2**2 * y22 * y21 + w3**2 * y32 * y31 + w4**2 * y42 * y41 + w5**2 * y52 * y51 + w6**2 * y62 * y61 + w7**2 * y72 * y71 + w8**2 * y82 * y81 + w9**2 * y92 * y91 + w10**2 * y10_2 * y10_1 + w11**2 * y11_2 * y11_1 + w12**2 * y12_2 * y12_1 + w13**2 * y13_2 * y13_1 + w14**2 * y14_2 * y14_1 + w15**2 * y15_2 * y15_1 ) / (F11 * F22 - F12 * F21) + 2 * (F12 * F23 - F13 * F22) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F11 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * y12 * x11 * y11 + 2 * w2**2 * y22 * x21 * y21 + 2 * w3**2 * y32 * x31 * y31 + 2 * w4**2 * y42 * x41 * y41 + 2 * w5**2 * y52 * x51 * y51 + 2 * w6**2 * y62 * x61 * y61 + 2 * w7**2 * y72 * x71 * y71 + 2 * w8**2 * y82 * x81 * y81 + 2 * w9**2 * y92 * x91 * y91 + 2 * w10**2 * y10_2 * x10_1 * y10_1 + 2 * w11**2 * y11_2 * x11_1 * y11_1 + 2 * w12**2 * y12_2 * x12_1 * y12_1 + 2 * w13**2 * y13_2 * x13_1 * y13_1 + 2 * w14**2 * y14_2 * x14_1 * y14_1 + 2 * w15**2 * y15_2 * x15_1 * y15_1 ) J_F[:, 7, 4] = ( -2 * (-F11 * F23 + F13 * F21) * ( w1**2 * y12 * y11 + w2**2 * y22 * y21 + w3**2 * y32 * y31 + w4**2 * y42 * y41 + w5**2 * y52 * y51 + w6**2 * y62 * y61 + w7**2 * y72 * y71 + w8**2 * y82 * y81 + w9**2 * y92 * y91 + w10**2 * y10_2 * y10_1 + w11**2 * y11_2 * y11_1 + w12**2 * y12_2 * y12_1 + w13**2 * y13_2 * y13_1 + w14**2 * y14_2 * y14_1 + w15**2 * y15_2 * y15_1 ) / (F11 * F22 - F12 * F21) + 2 * (-F11 * F23 + F13 * F21) * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) * F11 / (F11 * F22 - F12 * F21) ** 2 + 2 * w1**2 * y12 * y11**2 + 2 * w2**2 * y22 * y21**2 + 2 * w3**2 * y32 * y31**2 + 2 * w4**2 * y42 * y41**2 + 2 * w5**2 * y52 * y51**2 + 2 * w6**2 * y62 * y61**2 + 2 * w7**2 * y72 * y71**2 + 2 * w8**2 * y82 * y81**2 + 2 * w9**2 * y92 * y91**2 + 2 * w10**2 * y10_2 * y10_1**2 + 2 * w11**2 * y11_2 * y11_1**2 + 2 * w12**2 * y12_2 * y12_1**2 + 2 * w13**2 * y13_2 * y13_1**2 + 2 * w14**2 * y14_2 * y14_1**2 + 2 * w15**2 * y15_2 * y15_1**2 ) J_F[:, 8, 4] = 0 # F23 J_F[:, 0, 5] = ( 2 * F32 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F22 * F33 - F23 * F32) * ( w1**2 * y12 + w10**2 * y10_2 + w11**2 * y11_2 + w12**2 * y12_2 + w13**2 * y13_2 + w14**2 * y14_2 + w15**2 * y15_2 + w2**2 * y22 + w3**2 * y32 + w4**2 * y42 + w5**2 * y52 + w6**2 * y62 + w7**2 * y72 + w8**2 * y82 + w9**2 * y92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12 * x11 * y12 + 2 * w2**2 * x22 * x21 * y22 + 2 * w3**2 * x32 * x31 * y32 + 2 * w4**2 * x42 * x41 * y42 + 2 * w5**2 * x52 * x51 * y52 + 2 * w6**2 * x62 * x61 * y62 + 2 * w7**2 * x72 * x71 * y72 + 2 * w8**2 * x82 * x81 * y82 + 2 * w9**2 * x92 * x91 * y92 + 2 * w10**2 * x10_2 * x10_1 * y10_2 + 2 * w11**2 * x11_2 * x11_1 * y11_2 + 2 * w12**2 * x12_2 * x12_1 * y12_2 + 2 * w13**2 * x13_2 * x13_1 * y13_2 + 2 * w14**2 * x14_2 * x14_1 * y14_2 + 2 * w15**2 * x15_2 * x15_1 * y15_2 ) J_F[:, 1, 5] = ( -2 * F31 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F21 * F33 + F23 * F31) * ( w1**2 * y12 + w10**2 * y10_2 + w11**2 * y11_2 + w12**2 * y12_2 + w13**2 * y13_2 + w14**2 * y14_2 + w15**2 * y15_2 + w2**2 * y22 + w3**2 * y32 + w4**2 * y42 + w5**2 * y52 + w6**2 * y62 + w7**2 * y72 + w8**2 * y82 + w9**2 * y92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12 * y11 * y12 + 2 * w2**2 * x22 * y21 * y22 + 2 * w3**2 * x32 * y31 * y32 + 2 * w4**2 * x42 * y41 * y42 + 2 * w5**2 * x52 * y51 * y52 + 2 * w6**2 * x62 * y61 * y62 + 2 * w7**2 * x72 * y71 * y72 + 2 * w8**2 * x82 * y81 * y82 + 2 * w9**2 * x92 * y91 * y92 + 2 * w10**2 * x10_2 * y10_1 * y10_2 + 2 * w11**2 * x11_2 * y11_1 * y11_2 + 2 * w12**2 * x12_2 * y12_1 * y12_2 + 2 * w13**2 * x13_2 * y13_1 * y13_2 + 2 * w14**2 * x14_2 * y14_1 * y14_2 + 2 * w15**2 * x15_2 * y15_1 * y15_2 ) J_F[:, 2, 5] = ( -2 * (F21 * F32 - F22 * F31) * ( w1**2 * y12 + w10**2 * y10_2 + w11**2 * y11_2 + w12**2 * y12_2 + w13**2 * y13_2 + w14**2 * y14_2 + w15**2 * y15_2 + w2**2 * y22 + w3**2 * y32 + w4**2 * y42 + w5**2 * y52 + w6**2 * y62 + w7**2 * y72 + w8**2 * y82 + w9**2 * y92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12 * y12 + 2 * w2**2 * x22 * y22 + 2 * w3**2 * x32 * y32 + 2 * w4**2 * x42 * y42 + 2 * w5**2 * x52 * y52 + 2 * w6**2 * x62 * y62 + 2 * w7**2 * x72 * y72 + 2 * w8**2 * x82 * y82 + 2 * w9**2 * x92 * y92 + 2 * w10**2 * x10_2 * y10_2 + 2 * w11**2 * x11_2 * y11_2 + 2 * w12**2 * x12_2 * y12_2 + 2 * w13**2 * x13_2 * y13_2 + 2 * w14**2 * x14_2 * y14_2 + 2 * w15**2 * x15_2 * y15_2 ) J_F[:, 3, 5] = ( -2 * (-F12 * F33 + F13 * F32) * ( w1**2 * y12 + w10**2 * y10_2 + w11**2 * y11_2 + w12**2 * y12_2 + w13**2 * y13_2 + w14**2 * y14_2 + w15**2 * y15_2 + w2**2 * y22 + w3**2 * y32 + w4**2 * y42 + w5**2 * y52 + w6**2 * y62 + w7**2 * y72 + w8**2 * y82 + w9**2 * y92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * y12**2 * x11 + 2 * w2**2 * y22**2 * x21 + 2 * w3**2 * y32**2 * x31 + 2 * w4**2 * y42**2 * x41 + 2 * w5**2 * y52**2 * x51 + 2 * w6**2 * y62**2 * x61 + 2 * w7**2 * y72**2 * x71 + 2 * w8**2 * y82**2 * x81 + 2 * w9**2 * y92**2 * x91 + 2 * w10**2 * y10_2**2 * x10_1 + 2 * w11**2 * y11_2**2 * x11_1 + 2 * w12**2 * y12_2**2 * x12_1 + 2 * w13**2 * y13_2**2 * x13_1 + 2 * w14**2 * y14_2**2 * x14_1 + 2 * w15**2 * y15_2**2 * x15_1 ) J_F[:, 4, 5] = ( -2 * (F11 * F33 - F13 * F31) * ( w1**2 * y12 + w10**2 * y10_2 + w11**2 * y11_2 + w12**2 * y12_2 + w13**2 * y13_2 + w14**2 * y14_2 + w15**2 * y15_2 + w2**2 * y22 + w3**2 * y32 + w4**2 * y42 + w5**2 * y52 + w6**2 * y62 + w7**2 * y72 + w8**2 * y82 + w9**2 * y92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * y12**2 * y11 + 2 * w2**2 * y22**2 * y21 + 2 * w3**2 * y32**2 * y31 + 2 * w4**2 * y42**2 * y41 + 2 * w5**2 * y52**2 * y51 + 2 * w6**2 * y62**2 * y61 + 2 * w7**2 * y72**2 * y71 + 2 * w8**2 * y82**2 * y81 + 2 * w9**2 * y92**2 * y91 + 2 * w10**2 * y10_2**2 * y10_1 + 2 * w11**2 * y11_2**2 * y11_1 + 2 * w12**2 * y12_2**2 * y12_1 + 2 * w13**2 * y13_2**2 * y13_1 + 2 * w14**2 * y14_2**2 * y14_1 + 2 * w15**2 * y15_2**2 * y15_1 ) J_F[:, 5, 5] = ( -2 * (-F11 * F32 + F12 * F31) * ( w1**2 * y12 + w10**2 * y10_2 + w11**2 * y11_2 + w12**2 * y12_2 + w13**2 * y13_2 + w14**2 * y14_2 + w15**2 * y15_2 + w2**2 * y22 + w3**2 * y32 + w4**2 * y42 + w5**2 * y52 + w6**2 * y62 + w7**2 * y72 + w8**2 * y82 + w9**2 * y92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * y12**2 + 2 * w2**2 * y22**2 + 2 * w3**2 * y32**2 + 2 * w4**2 * y42**2 + 2 * w5**2 * y52**2 + 2 * w6**2 * y62**2 + 2 * w7**2 * y72**2 + 2 * w8**2 * y82**2 + 2 * w9**2 * y92**2 + 2 * w10**2 * y10_2**2 + 2 * w11**2 * y11_2**2 + 2 * w12**2 * y12_2**2 + 2 * w13**2 * y13_2**2 + 2 * w14**2 * y14_2**2 + 2 * w15**2 * y15_2**2 ) J_F[:, 6, 5] = ( -2 * F12 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F12 * F23 - F13 * F22) * ( w1**2 * y12 + w10**2 * y10_2 + w11**2 * y11_2 + w12**2 * y12_2 + w13**2 * y13_2 + w14**2 * y14_2 + w15**2 * y15_2 + w2**2 * y22 + w3**2 * y32 + w4**2 * y42 + w5**2 * y52 + w6**2 * y62 + w7**2 * y72 + w8**2 * y82 + w9**2 * y92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x11 * y12 + 2 * w2**2 * x21 * y22 + 2 * w3**2 * x31 * y32 + 2 * w4**2 * x41 * y42 + 2 * w5**2 * x51 * y52 + 2 * w6**2 * x61 * y62 + 2 * w7**2 * x71 * y72 + 2 * w8**2 * x81 * y82 + 2 * w9**2 * x91 * y92 + 2 * w10**2 * x10_1 * y10_2 + 2 * w11**2 * x11_1 * y11_2 + 2 * w12**2 * x12_1 * y12_2 + 2 * w13**2 * x13_1 * y13_2 + 2 * w14**2 * x14_1 * y14_2 + 2 * w15**2 * x15_1 * y15_2 ) J_F[:, 7, 5] = ( 2 * F11 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F11 * F23 + F13 * F21) * ( w1**2 * y12 + w10**2 * y10_2 + w11**2 * y11_2 + w12**2 * y12_2 + w13**2 * y13_2 + w14**2 * y14_2 + w15**2 * y15_2 + w2**2 * y22 + w3**2 * y32 + w4**2 * y42 + w5**2 * y52 + w6**2 * y62 + w7**2 * y72 + w8**2 * y82 + w9**2 * y92 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * y12 * y11 + 2 * w2**2 * y22 * y21 + 2 * w3**2 * y32 * y31 + 2 * w4**2 * y42 * y41 + 2 * w5**2 * y52 * y51 + 2 * w6**2 * y62 * y61 + 2 * w7**2 * y72 * y71 + 2 * w8**2 * y82 * y81 + 2 * w9**2 * y92 * y91 + 2 * w10**2 * y10_2 * y10_1 + 2 * w11**2 * y11_2 * y11_1 + 2 * w12**2 * y12_2 * y12_1 + 2 * w13**2 * y13_2 * y13_1 + 2 * w14**2 * y14_2 * y14_1 + 2 * w15**2 * y15_2 * y15_1 ) J_F[:, 8, 5] = 0 # F31 J_F[:, 0, 6] = ( -2 * (F22 * F33 - F23 * F32) * ( w1**2 * x11 + w10**2 * x10_1 + w11**2 * x11_1 + w12**2 * x12_1 + w13**2 * x13_1 + w14**2 * x14_1 + w15**2 * x15_1 + w2**2 * x21 + w3**2 * x31 + w4**2 * x41 + w5**2 * x51 + w6**2 * x61 + w7**2 * x71 + w8**2 * x81 + w9**2 * x91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12 * x11**2 + 2 * w2**2 * x22 * x21**2 + 2 * w3**2 * x32 * x31**2 + 2 * w4**2 * x42 * x41**2 + 2 * w5**2 * x52 * x51**2 + 2 * w6**2 * x62 * x61**2 + 2 * w7**2 * x72 * x71**2 + 2 * w8**2 * x82 * x81**2 + 2 * w9**2 * x92 * x91**2 + 2 * w10**2 * x10_2 * x10_1**2 + 2 * w11**2 * x11_2 * x11_1**2 + 2 * w12**2 * x12_2 * x12_1**2 + 2 * w13**2 * x13_2 * x13_1**2 + 2 * w14**2 * x14_2 * x14_1**2 + 2 * w15**2 * x15_2 * x15_1**2 ) J_F[:, 1, 6] = ( -2 * F23 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F21 * F33 + F23 * F31) * ( w1**2 * x11 + w10**2 * x10_1 + w11**2 * x11_1 + w12**2 * x12_1 + w13**2 * x13_1 + w14**2 * x14_1 + w15**2 * x15_1 + w2**2 * x21 + w3**2 * x31 + w4**2 * x41 + w5**2 * x51 + w6**2 * x61 + w7**2 * x71 + w8**2 * x81 + w9**2 * x91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12 * x11 * y11 + 2 * w2**2 * x22 * x21 * y21 + 2 * w3**2 * x32 * x31 * y31 + 2 * w4**2 * x42 * x41 * y41 + 2 * w5**2 * x52 * x51 * y51 + 2 * w6**2 * x62 * x61 * y61 + 2 * w7**2 * x72 * x71 * y71 + 2 * w8**2 * x82 * x81 * y81 + 2 * w9**2 * x92 * x91 * y91 + 2 * w10**2 * x10_2 * x10_1 * y10_1 + 2 * w11**2 * x11_2 * x11_1 * y11_1 + 2 * w12**2 * x12_2 * x12_1 * y12_1 + 2 * w13**2 * x13_2 * x13_1 * y13_1 + 2 * w14**2 * x14_2 * x14_1 * y14_1 + 2 * w15**2 * x15_2 * x15_1 * y15_1 ) J_F[:, 2, 6] = ( 2 * F22 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F21 * F32 - F22 * F31) * ( w1**2 * x11 + w10**2 * x10_1 + w11**2 * x11_1 + w12**2 * x12_1 + w13**2 * x13_1 + w14**2 * x14_1 + w15**2 * x15_1 + w2**2 * x21 + w3**2 * x31 + w4**2 * x41 + w5**2 * x51 + w6**2 * x61 + w7**2 * x71 + w8**2 * x81 + w9**2 * x91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x11 * x12 + 2 * w2**2 * x21 * x22 + 2 * w3**2 * x31 * x32 + 2 * w4**2 * x41 * x42 + 2 * w5**2 * x51 * x52 + 2 * w6**2 * x61 * x62 + 2 * w7**2 * x71 * x72 + 2 * w8**2 * x81 * x82 + 2 * w9**2 * x91 * x92 + 2 * w10**2 * x10_1 * x10_2 + 2 * w11**2 * x11_1 * x11_2 + 2 * w12**2 * x12_1 * x12_2 + 2 * w13**2 * x13_1 * x13_2 + 2 * w14**2 * x14_1 * x14_2 + 2 * w15**2 * x15_1 * x15_2 ) J_F[:, 3, 6] = ( -2 * (-F12 * F33 + F13 * F32) * ( w1**2 * x11 + w10**2 * x10_1 + w11**2 * x11_1 + w12**2 * x12_1 + w13**2 * x13_1 + w14**2 * x14_1 + w15**2 * x15_1 + w2**2 * x21 + w3**2 * x31 + w4**2 * x41 + w5**2 * x51 + w6**2 * x61 + w7**2 * x71 + w8**2 * x81 + w9**2 * x91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * y12 * x11**2 + 2 * w2**2 * y22 * x21**2 + 2 * w3**2 * y32 * x31**2 + 2 * w4**2 * y42 * x41**2 + 2 * w5**2 * y52 * x51**2 + 2 * w6**2 * y62 * x61**2 + 2 * w7**2 * y72 * x71**2 + 2 * w8**2 * y82 * x81**2 + 2 * w9**2 * y92 * x91**2 + 2 * w10**2 * y10_2 * x10_1**2 + 2 * w11**2 * y11_2 * x11_1**2 + 2 * w12**2 * y12_2 * x12_1**2 + 2 * w13**2 * y13_2 * x13_1**2 + 2 * w14**2 * y14_2 * x14_1**2 + 2 * w15**2 * y15_2 * x15_1**2 ) J_F[:, 4, 6] = ( 2 * F13 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F11 * F33 - F13 * F31) * ( w1**2 * x11 + w10**2 * x10_1 + w11**2 * x11_1 + w12**2 * x12_1 + w13**2 * x13_1 + w14**2 * x14_1 + w15**2 * x15_1 + w2**2 * x21 + w3**2 * x31 + w4**2 * x41 + w5**2 * x51 + w6**2 * x61 + w7**2 * x71 + w8**2 * x81 + w9**2 * x91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * y12 * x11 * y11 + 2 * w2**2 * y22 * x21 * y21 + 2 * w3**2 * y32 * x31 * y31 + 2 * w4**2 * y42 * x41 * y41 + 2 * w5**2 * y52 * x51 * y51 + 2 * w6**2 * y62 * x61 * y61 + 2 * w7**2 * y72 * x71 * y71 + 2 * w8**2 * y82 * x81 * y81 + 2 * w9**2 * y92 * x91 * y91 + 2 * w10**2 * y10_2 * x10_1 * y10_1 + 2 * w11**2 * y11_2 * x11_1 * y11_1 + 2 * w12**2 * y12_2 * x12_1 * y12_1 + 2 * w13**2 * y13_2 * x13_1 * y13_1 + 2 * w14**2 * y14_2 * x14_1 * y14_1 + 2 * w15**2 * y15_2 * x15_1 * y15_1 ) J_F[:, 5, 6] = ( -2 * F12 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F11 * F32 + F12 * F31) * ( w1**2 * x11 + w10**2 * x10_1 + w11**2 * x11_1 + w12**2 * x12_1 + w13**2 * x13_1 + w14**2 * x14_1 + w15**2 * x15_1 + w2**2 * x21 + w3**2 * x31 + w4**2 * x41 + w5**2 * x51 + w6**2 * x61 + w7**2 * x71 + w8**2 * x81 + w9**2 * x91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x11 * y12 + 2 * w2**2 * x21 * y22 + 2 * w3**2 * x31 * y32 + 2 * w4**2 * x41 * y42 + 2 * w5**2 * x51 * y52 + 2 * w6**2 * x61 * y62 + 2 * w7**2 * x71 * y72 + 2 * w8**2 * x81 * y82 + 2 * w9**2 * x91 * y92 + 2 * w10**2 * x10_1 * y10_2 + 2 * w11**2 * x11_1 * y11_2 + 2 * w12**2 * x12_1 * y12_2 + 2 * w13**2 * x13_1 * y13_2 + 2 * w14**2 * x14_1 * y14_2 + 2 * w15**2 * x15_1 * y15_2 ) J_F[:, 6, 6] = ( -2 * (F12 * F23 - F13 * F22) * ( w1**2 * x11 + w10**2 * x10_1 + w11**2 * x11_1 + w12**2 * x12_1 + w13**2 * x13_1 + w14**2 * x14_1 + w15**2 * x15_1 + w2**2 * x21 + w3**2 * x31 + w4**2 * x41 + w5**2 * x51 + w6**2 * x61 + w7**2 * x71 + w8**2 * x81 + w9**2 * x91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x11**2 + 2 * w2**2 * x21**2 + 2 * w3**2 * x31**2 + 2 * w4**2 * x41**2 + 2 * w5**2 * x51**2 + 2 * w6**2 * x61**2 + 2 * w7**2 * x71**2 + 2 * w8**2 * x81**2 + 2 * w9**2 * x91**2 + 2 * w10**2 * x10_1**2 + 2 * w11**2 * x11_1**2 + 2 * w12**2 * x12_1**2 + 2 * w13**2 * x13_1**2 + 2 * w14**2 * x14_1**2 + 2 * w15**2 * x15_1**2 ) J_F[:, 7, 6] = ( -2 * (-F11 * F23 + F13 * F21) * ( w1**2 * x11 + w10**2 * x10_1 + w11**2 * x11_1 + w12**2 * x12_1 + w13**2 * x13_1 + w14**2 * x14_1 + w15**2 * x15_1 + w2**2 * x21 + w3**2 * x31 + w4**2 * x41 + w5**2 * x51 + w6**2 * x61 + w7**2 * x71 + w8**2 * x81 + w9**2 * x91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x11 * y11 + 2 * w2**2 * x21 * y21 + 2 * w3**2 * x31 * y31 + 2 * w4**2 * x41 * y41 + 2 * w5**2 * x51 * y51 + 2 * w6**2 * x61 * y61 + 2 * w7**2 * x71 * y71 + 2 * w8**2 * x81 * y81 + 2 * w9**2 * x91 * y91 + 2 * w10**2 * x10_1 * y10_1 + 2 * w11**2 * x11_1 * y11_1 + 2 * w12**2 * x12_1 * y12_1 + 2 * w13**2 * x13_1 * y13_1 + 2 * w14**2 * x14_1 * y14_1 + 2 * w15**2 * x15_1 * y15_1 ) J_F[:, 8, 6] = 0 # F32 J_F[:, 0, 7] = ( 2 * F23 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F22 * F33 - F23 * F32) * ( w1**2 * y11 + w10**2 * y10_1 + w11**2 * y11_1 + w12**2 * y12_1 + w13**2 * y13_1 + w14**2 * y14_1 + w15**2 * y15_1 + w2**2 * y21 + w3**2 * y31 + w4**2 * y41 + w5**2 * y51 + w6**2 * y61 + w7**2 * y71 + w8**2 * y81 + w9**2 * y91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12 * x11 * y11 + 2 * w2**2 * x22 * x21 * y21 + 2 * w3**2 * x32 * x31 * y31 + 2 * w4**2 * x42 * x41 * y41 + 2 * w5**2 * x52 * x51 * y51 + 2 * w6**2 * x62 * x61 * y61 + 2 * w7**2 * x72 * x71 * y71 + 2 * w8**2 * x82 * x81 * y81 + 2 * w9**2 * x92 * x91 * y91 + 2 * w10**2 * x10_2 * x10_1 * y10_1 + 2 * w11**2 * x11_2 * x11_1 * y11_1 + 2 * w12**2 * x12_2 * x12_1 * y12_1 + 2 * w13**2 * x13_2 * x13_1 * y13_1 + 2 * w14**2 * x14_2 * x14_1 * y14_1 + 2 * w15**2 * x15_2 * x15_1 * y15_1 ) J_F[:, 1, 7] = ( -2 * (-F21 * F33 + F23 * F31) * ( w1**2 * y11 + w10**2 * y10_1 + w11**2 * y11_1 + w12**2 * y12_1 + w13**2 * y13_1 + w14**2 * y14_1 + w15**2 * y15_1 + w2**2 * y21 + w3**2 * y31 + w4**2 * y41 + w5**2 * y51 + w6**2 * y61 + w7**2 * y71 + w8**2 * y81 + w9**2 * y91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12 * y11**2 + 2 * w2**2 * x22 * y21**2 + 2 * w3**2 * x32 * y31**2 + 2 * w4**2 * x42 * y41**2 + 2 * w5**2 * x52 * y51**2 + 2 * w6**2 * x62 * y61**2 + 2 * w7**2 * x72 * y71**2 + 2 * w8**2 * x82 * y81**2 + 2 * w9**2 * x92 * y91**2 + 2 * w10**2 * x10_2 * y10_1**2 + 2 * w11**2 * x11_2 * y11_1**2 + 2 * w12**2 * x12_2 * y12_1**2 + 2 * w13**2 * x13_2 * y13_1**2 + 2 * w14**2 * x14_2 * y14_1**2 + 2 * w15**2 * x15_2 * y15_1**2 ) J_F[:, 2, 7] = ( -2 * F21 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F21 * F32 - F22 * F31) * ( w1**2 * y11 + w10**2 * y10_1 + w11**2 * y11_1 + w12**2 * y12_1 + w13**2 * y13_1 + w14**2 * y14_1 + w15**2 * y15_1 + w2**2 * y21 + w3**2 * y31 + w4**2 * y41 + w5**2 * y51 + w6**2 * y61 + w7**2 * y71 + w8**2 * y81 + w9**2 * y91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12 * y11 + 2 * w2**2 * x22 * y21 + 2 * w3**2 * x32 * y31 + 2 * w4**2 * x42 * y41 + 2 * w5**2 * x52 * y51 + 2 * w6**2 * x62 * y61 + 2 * w7**2 * x72 * y71 + 2 * w8**2 * x82 * y81 + 2 * w9**2 * x92 * y91 + 2 * w10**2 * x10_2 * y10_1 + 2 * w11**2 * x11_2 * y11_1 + 2 * w12**2 * x12_2 * y12_1 + 2 * w13**2 * x13_2 * y13_1 + 2 * w14**2 * x14_2 * y14_1 + 2 * w15**2 * x15_2 * y15_1 ) J_F[:, 3, 7] = ( -2 * F13 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F12 * F33 + F13 * F32) * ( w1**2 * y11 + w10**2 * y10_1 + w11**2 * y11_1 + w12**2 * y12_1 + w13**2 * y13_1 + w14**2 * y14_1 + w15**2 * y15_1 + w2**2 * y21 + w3**2 * y31 + w4**2 * y41 + w5**2 * y51 + w6**2 * y61 + w7**2 * y71 + w8**2 * y81 + w9**2 * y91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * y12 * x11 * y11 + 2 * w2**2 * y22 * x21 * y21 + 2 * w3**2 * y32 * x31 * y31 + 2 * w4**2 * y42 * x41 * y41 + 2 * w5**2 * y52 * x51 * y51 + 2 * w6**2 * y62 * x61 * y61 + 2 * w7**2 * y72 * x71 * y71 + 2 * w8**2 * y82 * x81 * y81 + 2 * w9**2 * y92 * x91 * y91 + 2 * w10**2 * y10_2 * x10_1 * y10_1 + 2 * w11**2 * y11_2 * x11_1 * y11_1 + 2 * w12**2 * y12_2 * x12_1 * y12_1 + 2 * w13**2 * y13_2 * x13_1 * y13_1 + 2 * w14**2 * y14_2 * x14_1 * y14_1 + 2 * w15**2 * y15_2 * x15_1 * y15_1 ) J_F[:, 4, 7] = ( -2 * (F11 * F33 - F13 * F31) * ( w1**2 * y11 + w10**2 * y10_1 + w11**2 * y11_1 + w12**2 * y12_1 + w13**2 * y13_1 + w14**2 * y14_1 + w15**2 * y15_1 + w2**2 * y21 + w3**2 * y31 + w4**2 * y41 + w5**2 * y51 + w6**2 * y61 + w7**2 * y71 + w8**2 * y81 + w9**2 * y91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * y12 * y11**2 + 2 * w2**2 * y22 * y21**2 + 2 * w3**2 * y32 * y31**2 + 2 * w4**2 * y42 * y41**2 + 2 * w5**2 * y52 * y51**2 + 2 * w6**2 * y62 * y61**2 + 2 * w7**2 * y72 * y71**2 + 2 * w8**2 * y82 * y81**2 + 2 * w9**2 * y92 * y91**2 + 2 * w10**2 * y10_2 * y10_1**2 + 2 * w11**2 * y11_2 * y11_1**2 + 2 * w12**2 * y12_2 * y12_1**2 + 2 * w13**2 * y13_2 * y13_1**2 + 2 * w14**2 * y14_2 * y14_1**2 + 2 * w15**2 * y15_2 * y15_1**2 ) J_F[:, 5, 7] = ( 2 * F11 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F11 * F32 + F12 * F31) * ( w1**2 * y11 + w10**2 * y10_1 + w11**2 * y11_1 + w12**2 * y12_1 + w13**2 * y13_1 + w14**2 * y14_1 + w15**2 * y15_1 + w2**2 * y21 + w3**2 * y31 + w4**2 * y41 + w5**2 * y51 + w6**2 * y61 + w7**2 * y71 + w8**2 * y81 + w9**2 * y91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * y12 * y11 + 2 * w2**2 * y22 * y21 + 2 * w3**2 * y32 * y31 + 2 * w4**2 * y42 * y41 + 2 * w5**2 * y52 * y51 + 2 * w6**2 * y62 * y61 + 2 * w7**2 * y72 * y71 + 2 * w8**2 * y82 * y81 + 2 * w9**2 * y92 * y91 + 2 * w10**2 * y10_2 * y10_1 + 2 * w11**2 * y11_2 * y11_1 + 2 * w12**2 * y12_2 * y12_1 + 2 * w13**2 * y13_2 * y13_1 + 2 * w14**2 * y14_2 * y14_1 + 2 * w15**2 * y15_2 * y15_1 ) J_F[:, 6, 7] = ( -2 * (F12 * F23 - F13 * F22) * ( w1**2 * y11 + w10**2 * y10_1 + w11**2 * y11_1 + w12**2 * y12_1 + w13**2 * y13_1 + w14**2 * y14_1 + w15**2 * y15_1 + w2**2 * y21 + w3**2 * y31 + w4**2 * y41 + w5**2 * y51 + w6**2 * y61 + w7**2 * y71 + w8**2 * y81 + w9**2 * y91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x11 * y11 + 2 * w2**2 * x21 * y21 + 2 * w3**2 * x31 * y31 + 2 * w4**2 * x41 * y41 + 2 * w5**2 * x51 * y51 + 2 * w6**2 * x61 * y61 + 2 * w7**2 * x71 * y71 + 2 * w8**2 * x81 * y81 + 2 * w9**2 * x91 * y91 + 2 * w10**2 * x10_1 * y10_1 + 2 * w11**2 * x11_1 * y11_1 + 2 * w12**2 * x12_1 * y12_1 + 2 * w13**2 * x13_1 * y13_1 + 2 * w14**2 * x14_1 * y14_1 + 2 * w15**2 * x15_1 * y15_1 ) J_F[:, 7, 7] = ( -2 * (-F11 * F23 + F13 * F21) * ( w1**2 * y11 + w10**2 * y10_1 + w11**2 * y11_1 + w12**2 * y12_1 + w13**2 * y13_1 + w14**2 * y14_1 + w15**2 * y15_1 + w2**2 * y21 + w3**2 * y31 + w4**2 * y41 + w5**2 * y51 + w6**2 * y61 + w7**2 * y71 + w8**2 * y81 + w9**2 * y91 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * y11**2 + 2 * w2**2 * y21**2 + 2 * w3**2 * y31**2 + 2 * w4**2 * y41**2 + 2 * w5**2 * y51**2 + 2 * w6**2 * y61**2 + 2 * w7**2 * y71**2 + 2 * w8**2 * y81**2 + 2 * w9**2 * y91**2 + 2 * w10**2 * y10_1**2 + 2 * w11**2 * y11_1**2 + 2 * w12**2 * y12_1**2 + 2 * w13**2 * y13_1**2 + 2 * w14**2 * y14_1**2 + 2 * w15**2 * y15_1**2 ) J_F[:, 8, 7] = 0 # F33 J_F[:, 0, 8] = ( -2 * F22 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F22 * F33 - F23 * F32) * ( w1**2 + w10**2 + w11**2 + w12**2 + w13**2 + w14**2 + w15**2 + w2**2 + w3**2 + w4**2 + w5**2 + w6**2 + w7**2 + w8**2 + w9**2 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x11 * x12 + 2 * w2**2 * x21 * x22 + 2 * w3**2 * x31 * x32 + 2 * w4**2 * x41 * x42 + 2 * w5**2 * x51 * x52 + 2 * w6**2 * x61 * x62 + 2 * w7**2 * x71 * x72 + 2 * w8**2 * x81 * x82 + 2 * w9**2 * x91 * x92 + 2 * w10**2 * x10_1 * x10_2 + 2 * w11**2 * x11_1 * x11_2 + 2 * w12**2 * x12_1 * x12_2 + 2 * w13**2 * x13_1 * x13_2 + 2 * w14**2 * x14_1 * x14_2 + 2 * w15**2 * x15_1 * x15_2 ) J_F[:, 1, 8] = ( 2 * F21 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F21 * F33 + F23 * F31) * ( w1**2 + w10**2 + w11**2 + w12**2 + w13**2 + w14**2 + w15**2 + w2**2 + w3**2 + w4**2 + w5**2 + w6**2 + w7**2 + w8**2 + w9**2 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12 * y11 + 2 * w2**2 * x22 * y21 + 2 * w3**2 * x32 * y31 + 2 * w4**2 * x42 * y41 + 2 * w5**2 * x52 * y51 + 2 * w6**2 * x62 * y61 + 2 * w7**2 * x72 * y71 + 2 * w8**2 * x82 * y81 + 2 * w9**2 * x92 * y91 + 2 * w10**2 * x10_2 * y10_1 + 2 * w11**2 * x11_2 * y11_1 + 2 * w12**2 * x12_2 * y12_1 + 2 * w13**2 * x13_2 * y13_1 + 2 * w14**2 * x14_2 * y14_1 + 2 * w15**2 * x15_2 * y15_1 ) J_F[:, 2, 8] = ( -2 * (F21 * F32 - F22 * F31) * ( w1**2 + w10**2 + w11**2 + w12**2 + w13**2 + w14**2 + w15**2 + w2**2 + w3**2 + w4**2 + w5**2 + w6**2 + w7**2 + w8**2 + w9**2 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x12 + 2 * w2**2 * x22 + 2 * w3**2 * x32 + 2 * w4**2 * x42 + 2 * w5**2 * x52 + 2 * w6**2 * x62 + 2 * w7**2 * x72 + 2 * w8**2 * x82 + 2 * w9**2 * x92 + 2 * w10**2 * x10_2 + 2 * w11**2 * x11_2 + 2 * w12**2 * x12_2 + 2 * w13**2 * x13_2 + 2 * w14**2 * x14_2 + 2 * w15**2 * x15_2 ) J_F[:, 3, 8] = ( 2 * F12 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (-F12 * F33 + F13 * F32) * ( w1**2 + w10**2 + w11**2 + w12**2 + w13**2 + w14**2 + w15**2 + w2**2 + w3**2 + w4**2 + w5**2 + w6**2 + w7**2 + w8**2 + w9**2 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x11 * y12 + 2 * w2**2 * x21 * y22 + 2 * w3**2 * x31 * y32 + 2 * w4**2 * x41 * y42 + 2 * w5**2 * x51 * y52 + 2 * w6**2 * x61 * y62 + 2 * w7**2 * x71 * y72 + 2 * w8**2 * x81 * y82 + 2 * w9**2 * x91 * y92 + 2 * w10**2 * x10_1 * y10_2 + 2 * w11**2 * x11_1 * y11_2 + 2 * w12**2 * x12_1 * y12_2 + 2 * w13**2 * x13_1 * y13_2 + 2 * w14**2 * x14_1 * y14_2 + 2 * w15**2 * x15_1 * y15_2 ) J_F[:, 4, 8] = ( -2 * F11 * ( F33 * w1**2 + F33 * w2**2 + F33 * w3**2 + F33 * w4**2 + F33 * w5**2 + F33 * w6**2 + F33 * w7**2 + F33 * w8**2 + F33 * w9**2 + F33 * w10**2 + F33 * w11**2 + F33 * w12**2 + F33 * w13**2 + F33 * w14**2 + F33 * w15**2 + F31 * w9**2 * x91 + F32 * w9**2 * y91 + F13 * w10**2 * x10_2 + F23 * w10**2 * y10_2 + F31 * w10**2 * x10_1 + F32 * w10**2 * y10_1 + F13 * w11**2 * x11_2 + F23 * w11**2 * y11_2 + F31 * w11**2 * x11_1 + F32 * w11**2 * y11_1 + F13 * w12**2 * x12_2 + F23 * w12**2 * y12_2 + F31 * w12**2 * x12_1 + F32 * w12**2 * y12_1 + F13 * w13**2 * x13_2 + F23 * w13**2 * y13_2 + F31 * w13**2 * x13_1 + F32 * w13**2 * y13_1 + F13 * w14**2 * x14_2 + F23 * w14**2 * y14_2 + F31 * w14**2 * x14_1 + F32 * w14**2 * y14_1 + F13 * w15**2 * x15_2 + F23 * w15**2 * y15_2 + F31 * w15**2 * x15_1 + F32 * w15**2 * y15_1 + F23 * w1**2 * y12 + F31 * w1**2 * x11 + F32 * w1**2 * y11 + F13 * w2**2 * x22 + F23 * w2**2 * y22 + F31 * w2**2 * x21 + F32 * w2**2 * y21 + F13 * w3**2 * x32 + F23 * w3**2 * y32 + F31 * w3**2 * x31 + F32 * w3**2 * y31 + F13 * w4**2 * x42 + F23 * w4**2 * y42 + F31 * w4**2 * x41 + F32 * w4**2 * y41 + F13 * w5**2 * x52 + F23 * w5**2 * y52 + F31 * w5**2 * x51 + F32 * w5**2 * y51 + F13 * w6**2 * x62 + F23 * w6**2 * y62 + F31 * w6**2 * x61 + F32 * w6**2 * y61 + F13 * w7**2 * x72 + F23 * w7**2 * y72 + F31 * w7**2 * x71 + F32 * w7**2 * y71 + F13 * w8**2 * x82 + F23 * w8**2 * y82 + F31 * w8**2 * x81 + F32 * w8**2 * y81 + F13 * w9**2 * x92 + F23 * w9**2 * y92 + F13 * w1**2 * x12 + F11 * w1**2 * x11 * x12 + F12 * w1**2 * x12 * y11 + F21 * w1**2 * x11 * y12 + F22 * w1**2 * y11 * y12 + F11 * w2**2 * x21 * x22 + F12 * w2**2 * x22 * y21 + F21 * w2**2 * x21 * y22 + F22 * w2**2 * y21 * y22 + F11 * w3**2 * x31 * x32 + F12 * w3**2 * x32 * y31 + F21 * w3**2 * x31 * y32 + F22 * w3**2 * y31 * y32 + F11 * w4**2 * x41 * x42 + F12 * w4**2 * x42 * y41 + F21 * w4**2 * x41 * y42 + F22 * w4**2 * y41 * y42 + F11 * w5**2 * x51 * x52 + F12 * w5**2 * x52 * y51 + F21 * w5**2 * x51 * y52 + F22 * w5**2 * y51 * y52 + F11 * w6**2 * x61 * x62 + F12 * w6**2 * x62 * y61 + F21 * w6**2 * x61 * y62 + F22 * w6**2 * y61 * y62 + F11 * w7**2 * x71 * x72 + F12 * w7**2 * x72 * y71 + F21 * w7**2 * x71 * y72 + F22 * w7**2 * y71 * y72 + F11 * w8**2 * x81 * x82 + F12 * w8**2 * x82 * y81 + F21 * w8**2 * x81 * y82 + F22 * w8**2 * y81 * y82 + F11 * w9**2 * x91 * x92 + F12 * w9**2 * x92 * y91 + F21 * w9**2 * x91 * y92 + F22 * w9**2 * y91 * y92 + F11 * w10**2 * x10_1 * x10_2 + F12 * w10**2 * x10_2 * y10_1 + F21 * w10**2 * x10_1 * y10_2 + F22 * w10**2 * y10_1 * y10_2 + F11 * w11**2 * x11_1 * x11_2 + F12 * w11**2 * x11_2 * y11_1 + F21 * w11**2 * x11_1 * y11_2 + F22 * w11**2 * y11_1 * y11_2 + F11 * w12**2 * x12_1 * x12_2 + F12 * w12**2 * x12_2 * y12_1 + F21 * w12**2 * x12_1 * y12_2 + F22 * w12**2 * y12_1 * y12_2 + F11 * w13**2 * x13_1 * x13_2 + F12 * w13**2 * x13_2 * y13_1 + F21 * w13**2 * x13_1 * y13_2 + F22 * w13**2 * y13_1 * y13_2 + F11 * w14**2 * x14_1 * x14_2 + F12 * w14**2 * x14_2 * y14_1 + F21 * w14**2 * x14_1 * y14_2 + F22 * w14**2 * y14_1 * y14_2 + F11 * w15**2 * x15_1 * x15_2 + F12 * w15**2 * x15_2 * y15_1 + F21 * w15**2 * x15_1 * y15_2 + F22 * w15**2 * y15_1 * y15_2 ) / (F11 * F22 - F12 * F21) - 2 * (F11 * F33 - F13 * F31) * ( w1**2 + w10**2 + w11**2 + w12**2 + w13**2 + w14**2 + w15**2 + w2**2 + w3**2 + w4**2 + w5**2 + w6**2 + w7**2 + w8**2 + w9**2 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * y12 * y11 + 2 * w2**2 * y22 * y21 + 2 * w3**2 * y32 * y31 + 2 * w4**2 * y42 * y41 + 2 * w5**2 * y52 * y51 + 2 * w6**2 * y62 * y61 + 2 * w7**2 * y72 * y71 + 2 * w8**2 * y82 * y81 + 2 * w9**2 * y92 * y91 + 2 * w10**2 * y10_2 * y10_1 + 2 * w11**2 * y11_2 * y11_1 + 2 * w12**2 * y12_2 * y12_1 + 2 * w13**2 * y13_2 * y13_1 + 2 * w14**2 * y14_2 * y14_1 + 2 * w15**2 * y15_2 * y15_1 ) J_F[:, 5, 8] = ( -2 * (-F11 * F32 + F12 * F31) * ( w1**2 + w10**2 + w11**2 + w12**2 + w13**2 + w14**2 + w15**2 + w2**2 + w3**2 + w4**2 + w5**2 + w6**2 + w7**2 + w8**2 + w9**2 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * y12 + 2 * w2**2 * y22 + 2 * w3**2 * y32 + 2 * w4**2 * y42 + 2 * w5**2 * y52 + 2 * w6**2 * y62 + 2 * w7**2 * y72 + 2 * w8**2 * y82 + 2 * w9**2 * y92 + 2 * w10**2 * y10_2 + 2 * w11**2 * y11_2 + 2 * w12**2 * y12_2 + 2 * w13**2 * y13_2 + 2 * w14**2 * y14_2 + 2 * w15**2 * y15_2 ) J_F[:, 6, 8] = ( -2 * (F12 * F23 - F13 * F22) * ( w1**2 + w10**2 + w11**2 + w12**2 + w13**2 + w14**2 + w15**2 + w2**2 + w3**2 + w4**2 + w5**2 + w6**2 + w7**2 + w8**2 + w9**2 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * x11 + 2 * w2**2 * x21 + 2 * w3**2 * x31 + 2 * w4**2 * x41 + 2 * w5**2 * x51 + 2 * w6**2 * x61 + 2 * w7**2 * x71 + 2 * w8**2 * x81 + 2 * w9**2 * x91 + 2 * w10**2 * x10_1 + 2 * w11**2 * x11_1 + 2 * w12**2 * x12_1 + 2 * w13**2 * x13_1 + 2 * w14**2 * x14_1 + 2 * w15**2 * x15_1 ) J_F[:, 7, 8] = ( -2 * (-F11 * F23 + F13 * F21) * ( w1**2 + w10**2 + w11**2 + w12**2 + w13**2 + w14**2 + w15**2 + w2**2 + w3**2 + w4**2 + w5**2 + w6**2 + w7**2 + w8**2 + w9**2 ) / (F11 * F22 - F12 * F21) + 2 * w1**2 * y11 + 2 * w2**2 * y21 + 2 * w3**2 * y31 + 2 * w4**2 * y41 + 2 * w5**2 * y51 + 2 * w6**2 * y61 + 2 * w7**2 * y71 + 2 * w8**2 * y81 + 2 * w9**2 * y91 + 2 * w10**2 * y10_1 + 2 * w11**2 * y11_1 + 2 * w12**2 * y12_1 + 2 * w13**2 * y13_1 + 2 * w14**2 * y14_1 + 2 * w15**2 * y15_1 ) J_F[:, 8, 8] = 0 J_w = torch.zeros((b, 9, 15), device=F.device) J_w[:, 0, 0] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w1 * x11 * x12 + 2 * F12 * w1 * x12 * y11 + 2 * F21 * w1 * x11 * y12 + 2 * F22 * w1 * y11 * y12 + 2 * F13 * w1 * x12 + 2 * F23 * w1 * y12 + 2 * F31 * w1 * x11 + 2 * F32 * w1 * y11 + 2 * F33 * w1 ) / (F11 * F22 - F12 * F21) + 4 * w1 * ( (F11 * x12 + F21 * y12 + F31) * x11 + (F12 * x12 + F22 * y12 + F32) * y11 + x12 * F13 + y12 * F23 + F33 ) * x12 * x11 ) J_w[:, 1, 0] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w1 * x11 * x12 + 2 * F12 * w1 * x12 * y11 + 2 * F21 * w1 * x11 * y12 + 2 * F22 * w1 * y11 * y12 + 2 * F13 * w1 * x12 + 2 * F23 * w1 * y12 + 2 * F31 * w1 * x11 + 2 * F32 * w1 * y11 + 2 * F33 * w1 ) / (F11 * F22 - F12 * F21) + 4 * w1 * ( (F11 * x12 + F21 * y12 + F31) * x11 + (F12 * x12 + F22 * y12 + F32) * y11 + x12 * F13 + y12 * F23 + F33 ) * x12 * y11 ) J_w[:, 2, 0] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w1 * x11 * x12 + 2 * F12 * w1 * x12 * y11 + 2 * F21 * w1 * x11 * y12 + 2 * F22 * w1 * y11 * y12 + 2 * F13 * w1 * x12 + 2 * F23 * w1 * y12 + 2 * F31 * w1 * x11 + 2 * F32 * w1 * y11 + 2 * F33 * w1 ) / (F11 * F22 - F12 * F21) + 4 * w1 * ( (F11 * x12 + F21 * y12 + F31) * x11 + (F12 * x12 + F22 * y12 + F32) * y11 + x12 * F13 + y12 * F23 + F33 ) * x12 ) J_w[:, 3, 0] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w1 * x11 * x12 + 2 * F12 * w1 * x12 * y11 + 2 * F21 * w1 * x11 * y12 + 2 * F22 * w1 * y11 * y12 + 2 * F13 * w1 * x12 + 2 * F23 * w1 * y12 + 2 * F31 * w1 * x11 + 2 * F32 * w1 * y11 + 2 * F33 * w1 ) / (F11 * F22 - F12 * F21) + 4 * w1 * ( (F11 * x12 + F21 * y12 + F31) * x11 + (F12 * x12 + F22 * y12 + F32) * y11 + x12 * F13 + y12 * F23 + F33 ) * y12 * x11 ) J_w[:, 4, 0] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w1 * x11 * x12 + 2 * F12 * w1 * x12 * y11 + 2 * F21 * w1 * x11 * y12 + 2 * F22 * w1 * y11 * y12 + 2 * F13 * w1 * x12 + 2 * F23 * w1 * y12 + 2 * F31 * w1 * x11 + 2 * F32 * w1 * y11 + 2 * F33 * w1 ) / (F11 * F22 - F12 * F21) + 4 * w1 * ( (F11 * x12 + F21 * y12 + F31) * x11 + (F12 * x12 + F22 * y12 + F32) * y11 + x12 * F13 + y12 * F23 + F33 ) * y12 * y11 ) J_w[:, 5, 0] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w1 * x11 * x12 + 2 * F12 * w1 * x12 * y11 + 2 * F21 * w1 * x11 * y12 + 2 * F22 * w1 * y11 * y12 + 2 * F13 * w1 * x12 + 2 * F23 * w1 * y12 + 2 * F31 * w1 * x11 + 2 * F32 * w1 * y11 + 2 * F33 * w1 ) / (F11 * F22 - F12 * F21) + 4 * w1 * ( (F11 * x12 + F21 * y12 + F31) * x11 + (F12 * x12 + F22 * y12 + F32) * y11 + x12 * F13 + y12 * F23 + F33 ) * y12 ) J_w[:, 6, 0] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w1 * x11 * x12 + 2 * F12 * w1 * x12 * y11 + 2 * F21 * w1 * x11 * y12 + 2 * F22 * w1 * y11 * y12 + 2 * F13 * w1 * x12 + 2 * F23 * w1 * y12 + 2 * F31 * w1 * x11 + 2 * F32 * w1 * y11 + 2 * F33 * w1 ) / (F11 * F22 - F12 * F21) + 4 * w1 * ( (F11 * x12 + F21 * y12 + F31) * x11 + (F12 * x12 + F22 * y12 + F32) * y11 + x12 * F13 + y12 * F23 + F33 ) * x11 ) J_w[:, 7, 0] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w1 * x11 * x12 + 2 * F12 * w1 * x12 * y11 + 2 * F21 * w1 * x11 * y12 + 2 * F22 * w1 * y11 * y12 + 2 * F13 * w1 * x12 + 2 * F23 * w1 * y12 + 2 * F31 * w1 * x11 + 2 * F32 * w1 * y11 + 2 * F33 * w1 ) / (F11 * F22 - F12 * F21) + 4 * w1 * ( (F11 * x12 + F21 * y12 + F31) * x11 + (F12 * x12 + F22 * y12 + F32) * y11 + x12 * F13 + y12 * F23 + F33 ) * y11 ) J_w[:, 8, 0] = ( 4 * w1 * ( (F11 * x12 + F21 * y12 + F31) * x11 + (F12 * x12 + F22 * y12 + F32) * y11 + x12 * F13 + y12 * F23 + F33 ) - 4 * F33 * w1 - 4 * F23 * w1 * y12 - 4 * F31 * w1 * x11 - 4 * F32 * w1 * y11 - 4 * F13 * w1 * x12 - 4 * F11 * w1 * x11 * x12 - 4 * F12 * w1 * x12 * y11 - 4 * F21 * w1 * x11 * y12 - 4 * F22 * w1 * y11 * y12 ) J_w[:, 0, 1] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w2 * x21 * x22 + 2 * F12 * w2 * x22 * y21 + 2 * F21 * w2 * x21 * y22 + 2 * F22 * w2 * y21 * y22 + 2 * F13 * w2 * x22 + 2 * F23 * w2 * y22 + 2 * F31 * w2 * x21 + 2 * F32 * w2 * y21 + 2 * F33 * w2 ) / (F11 * F22 - F12 * F21) + 4 * w2 * ( (F11 * x22 + F21 * y22 + F31) * x21 + (F12 * x22 + F22 * y22 + F32) * y21 + x22 * F13 + y22 * F23 + F33 ) * x22 * x21 ) J_w[:, 1, 1] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w2 * x21 * x22 + 2 * F12 * w2 * x22 * y21 + 2 * F21 * w2 * x21 * y22 + 2 * F22 * w2 * y21 * y22 + 2 * F13 * w2 * x22 + 2 * F23 * w2 * y22 + 2 * F31 * w2 * x21 + 2 * F32 * w2 * y21 + 2 * F33 * w2 ) / (F11 * F22 - F12 * F21) + 4 * w2 * ( (F11 * x22 + F21 * y22 + F31) * x21 + (F12 * x22 + F22 * y22 + F32) * y21 + x22 * F13 + y22 * F23 + F33 ) * x22 * y21 ) J_w[:, 2, 1] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w2 * x21 * x22 + 2 * F12 * w2 * x22 * y21 + 2 * F21 * w2 * x21 * y22 + 2 * F22 * w2 * y21 * y22 + 2 * F13 * w2 * x22 + 2 * F23 * w2 * y22 + 2 * F31 * w2 * x21 + 2 * F32 * w2 * y21 + 2 * F33 * w2 ) / (F11 * F22 - F12 * F21) + 4 * w2 * ( (F11 * x22 + F21 * y22 + F31) * x21 + (F12 * x22 + F22 * y22 + F32) * y21 + x22 * F13 + y22 * F23 + F33 ) * x22 ) J_w[:, 3, 1] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w2 * x21 * x22 + 2 * F12 * w2 * x22 * y21 + 2 * F21 * w2 * x21 * y22 + 2 * F22 * w2 * y21 * y22 + 2 * F13 * w2 * x22 + 2 * F23 * w2 * y22 + 2 * F31 * w2 * x21 + 2 * F32 * w2 * y21 + 2 * F33 * w2 ) / (F11 * F22 - F12 * F21) + 4 * w2 * ( (F11 * x22 + F21 * y22 + F31) * x21 + (F12 * x22 + F22 * y22 + F32) * y21 + x22 * F13 + y22 * F23 + F33 ) * y22 * x21 ) J_w[:, 4, 1] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w2 * x21 * x22 + 2 * F12 * w2 * x22 * y21 + 2 * F21 * w2 * x21 * y22 + 2 * F22 * w2 * y21 * y22 + 2 * F13 * w2 * x22 + 2 * F23 * w2 * y22 + 2 * F31 * w2 * x21 + 2 * F32 * w2 * y21 + 2 * F33 * w2 ) / (F11 * F22 - F12 * F21) + 4 * w2 * ( (F11 * x22 + F21 * y22 + F31) * x21 + (F12 * x22 + F22 * y22 + F32) * y21 + x22 * F13 + y22 * F23 + F33 ) * y22 * y21 ) J_w[:, 5, 1] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w2 * x21 * x22 + 2 * F12 * w2 * x22 * y21 + 2 * F21 * w2 * x21 * y22 + 2 * F22 * w2 * y21 * y22 + 2 * F13 * w2 * x22 + 2 * F23 * w2 * y22 + 2 * F31 * w2 * x21 + 2 * F32 * w2 * y21 + 2 * F33 * w2 ) / (F11 * F22 - F12 * F21) + 4 * w2 * ( (F11 * x22 + F21 * y22 + F31) * x21 + (F12 * x22 + F22 * y22 + F32) * y21 + x22 * F13 + y22 * F23 + F33 ) * y22 ) J_w[:, 6, 1] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w2 * x21 * x22 + 2 * F12 * w2 * x22 * y21 + 2 * F21 * w2 * x21 * y22 + 2 * F22 * w2 * y21 * y22 + 2 * F13 * w2 * x22 + 2 * F23 * w2 * y22 + 2 * F31 * w2 * x21 + 2 * F32 * w2 * y21 + 2 * F33 * w2 ) / (F11 * F22 - F12 * F21) + 4 * w2 * ( (F11 * x22 + F21 * y22 + F31) * x21 + (F12 * x22 + F22 * y22 + F32) * y21 + x22 * F13 + y22 * F23 + F33 ) * x21 ) J_w[:, 7, 1] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w2 * x21 * x22 + 2 * F12 * w2 * x22 * y21 + 2 * F21 * w2 * x21 * y22 + 2 * F22 * w2 * y21 * y22 + 2 * F13 * w2 * x22 + 2 * F23 * w2 * y22 + 2 * F31 * w2 * x21 + 2 * F32 * w2 * y21 + 2 * F33 * w2 ) / (F11 * F22 - F12 * F21) + 4 * w2 * ( (F11 * x22 + F21 * y22 + F31) * x21 + (F12 * x22 + F22 * y22 + F32) * y21 + x22 * F13 + y22 * F23 + F33 ) * y21 ) J_w[:, 8, 1] = ( 4 * w2 * ( (F11 * x22 + F21 * y22 + F31) * x21 + (F12 * x22 + F22 * y22 + F32) * y21 + x22 * F13 + y22 * F23 + F33 ) - 4 * F33 * w2 - 4 * F13 * w2 * x22 - 4 * F23 * w2 * y22 - 4 * F31 * w2 * x21 - 4 * F32 * w2 * y21 - 4 * F11 * w2 * x21 * x22 - 4 * F12 * w2 * x22 * y21 - 4 * F21 * w2 * x21 * y22 - 4 * F22 * w2 * y21 * y22 ) J_w[:, 0, 2] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w3 * x31 * x32 + 2 * F12 * w3 * x32 * y31 + 2 * F21 * w3 * x31 * y32 + 2 * F22 * w3 * y31 * y32 + 2 * F13 * w3 * x32 + 2 * F23 * w3 * y32 + 2 * F31 * w3 * x31 + 2 * F32 * w3 * y31 + 2 * F33 * w3 ) / (F11 * F22 - F12 * F21) + 4 * w3 * ( (F11 * x32 + F21 * y32 + F31) * x31 + (F12 * x32 + F22 * y32 + F32) * y31 + x32 * F13 + y32 * F23 + F33 ) * x32 * x31 ) J_w[:, 1, 2] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w3 * x31 * x32 + 2 * F12 * w3 * x32 * y31 + 2 * F21 * w3 * x31 * y32 + 2 * F22 * w3 * y31 * y32 + 2 * F13 * w3 * x32 + 2 * F23 * w3 * y32 + 2 * F31 * w3 * x31 + 2 * F32 * w3 * y31 + 2 * F33 * w3 ) / (F11 * F22 - F12 * F21) + 4 * w3 * ( (F11 * x32 + F21 * y32 + F31) * x31 + (F12 * x32 + F22 * y32 + F32) * y31 + x32 * F13 + y32 * F23 + F33 ) * x32 * y31 ) J_w[:, 2, 2] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w3 * x31 * x32 + 2 * F12 * w3 * x32 * y31 + 2 * F21 * w3 * x31 * y32 + 2 * F22 * w3 * y31 * y32 + 2 * F13 * w3 * x32 + 2 * F23 * w3 * y32 + 2 * F31 * w3 * x31 + 2 * F32 * w3 * y31 + 2 * F33 * w3 ) / (F11 * F22 - F12 * F21) + 4 * w3 * ( (F11 * x32 + F21 * y32 + F31) * x31 + (F12 * x32 + F22 * y32 + F32) * y31 + x32 * F13 + y32 * F23 + F33 ) * x32 ) J_w[:, 3, 2] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w3 * x31 * x32 + 2 * F12 * w3 * x32 * y31 + 2 * F21 * w3 * x31 * y32 + 2 * F22 * w3 * y31 * y32 + 2 * F13 * w3 * x32 + 2 * F23 * w3 * y32 + 2 * F31 * w3 * x31 + 2 * F32 * w3 * y31 + 2 * F33 * w3 ) / (F11 * F22 - F12 * F21) + 4 * w3 * ( (F11 * x32 + F21 * y32 + F31) * x31 + (F12 * x32 + F22 * y32 + F32) * y31 + x32 * F13 + y32 * F23 + F33 ) * y32 * x31 ) J_w[:, 4, 2] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w3 * x31 * x32 + 2 * F12 * w3 * x32 * y31 + 2 * F21 * w3 * x31 * y32 + 2 * F22 * w3 * y31 * y32 + 2 * F13 * w3 * x32 + 2 * F23 * w3 * y32 + 2 * F31 * w3 * x31 + 2 * F32 * w3 * y31 + 2 * F33 * w3 ) / (F11 * F22 - F12 * F21) + 4 * w3 * ( (F11 * x32 + F21 * y32 + F31) * x31 + (F12 * x32 + F22 * y32 + F32) * y31 + x32 * F13 + y32 * F23 + F33 ) * y32 * y31 ) J_w[:, 5, 2] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w3 * x31 * x32 + 2 * F12 * w3 * x32 * y31 + 2 * F21 * w3 * x31 * y32 + 2 * F22 * w3 * y31 * y32 + 2 * F13 * w3 * x32 + 2 * F23 * w3 * y32 + 2 * F31 * w3 * x31 + 2 * F32 * w3 * y31 + 2 * F33 * w3 ) / (F11 * F22 - F12 * F21) + 4 * w3 * ( (F11 * x32 + F21 * y32 + F31) * x31 + (F12 * x32 + F22 * y32 + F32) * y31 + x32 * F13 + y32 * F23 + F33 ) * y32 ) J_w[:, 6, 2] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w3 * x31 * x32 + 2 * F12 * w3 * x32 * y31 + 2 * F21 * w3 * x31 * y32 + 2 * F22 * w3 * y31 * y32 + 2 * F13 * w3 * x32 + 2 * F23 * w3 * y32 + 2 * F31 * w3 * x31 + 2 * F32 * w3 * y31 + 2 * F33 * w3 ) / (F11 * F22 - F12 * F21) + 4 * w3 * ( (F11 * x32 + F21 * y32 + F31) * x31 + (F12 * x32 + F22 * y32 + F32) * y31 + x32 * F13 + y32 * F23 + F33 ) * x31 ) J_w[:, 7, 2] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w3 * x31 * x32 + 2 * F12 * w3 * x32 * y31 + 2 * F21 * w3 * x31 * y32 + 2 * F22 * w3 * y31 * y32 + 2 * F13 * w3 * x32 + 2 * F23 * w3 * y32 + 2 * F31 * w3 * x31 + 2 * F32 * w3 * y31 + 2 * F33 * w3 ) / (F11 * F22 - F12 * F21) + 4 * w3 * ( (F11 * x32 + F21 * y32 + F31) * x31 + (F12 * x32 + F22 * y32 + F32) * y31 + x32 * F13 + y32 * F23 + F33 ) * y31 ) J_w[:, 8, 2] = ( 4 * w3 * ( (F11 * x32 + F21 * y32 + F31) * x31 + (F12 * x32 + F22 * y32 + F32) * y31 + x32 * F13 + y32 * F23 + F33 ) - 4 * F33 * w3 - 4 * F13 * w3 * x32 - 4 * F23 * w3 * y32 - 4 * F31 * w3 * x31 - 4 * F32 * w3 * y31 - 4 * F11 * w3 * x31 * x32 - 4 * F12 * w3 * x32 * y31 - 4 * F21 * w3 * x31 * y32 - 4 * F22 * w3 * y31 * y32 ) J_w[:, 0, 3] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w4 * x41 * x42 + 2 * F12 * w4 * x42 * y41 + 2 * F21 * w4 * x41 * y42 + 2 * F22 * w4 * y41 * y42 + 2 * F13 * w4 * x42 + 2 * F23 * w4 * y42 + 2 * F31 * w4 * x41 + 2 * F32 * w4 * y41 + 2 * F33 * w4 ) / (F11 * F22 - F12 * F21) + 4 * w4 * ( (F11 * x42 + F21 * y42 + F31) * x41 + (F12 * x42 + F22 * y42 + F32) * y41 + x42 * F13 + y42 * F23 + F33 ) * x42 * x41 ) J_w[:, 1, 3] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w4 * x41 * x42 + 2 * F12 * w4 * x42 * y41 + 2 * F21 * w4 * x41 * y42 + 2 * F22 * w4 * y41 * y42 + 2 * F13 * w4 * x42 + 2 * F23 * w4 * y42 + 2 * F31 * w4 * x41 + 2 * F32 * w4 * y41 + 2 * F33 * w4 ) / (F11 * F22 - F12 * F21) + 4 * w4 * ( (F11 * x42 + F21 * y42 + F31) * x41 + (F12 * x42 + F22 * y42 + F32) * y41 + x42 * F13 + y42 * F23 + F33 ) * x42 * y41 ) J_w[:, 2, 3] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w4 * x41 * x42 + 2 * F12 * w4 * x42 * y41 + 2 * F21 * w4 * x41 * y42 + 2 * F22 * w4 * y41 * y42 + 2 * F13 * w4 * x42 + 2 * F23 * w4 * y42 + 2 * F31 * w4 * x41 + 2 * F32 * w4 * y41 + 2 * F33 * w4 ) / (F11 * F22 - F12 * F21) + 4 * w4 * ( (F11 * x42 + F21 * y42 + F31) * x41 + (F12 * x42 + F22 * y42 + F32) * y41 + x42 * F13 + y42 * F23 + F33 ) * x42 ) J_w[:, 3, 3] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w4 * x41 * x42 + 2 * F12 * w4 * x42 * y41 + 2 * F21 * w4 * x41 * y42 + 2 * F22 * w4 * y41 * y42 + 2 * F13 * w4 * x42 + 2 * F23 * w4 * y42 + 2 * F31 * w4 * x41 + 2 * F32 * w4 * y41 + 2 * F33 * w4 ) / (F11 * F22 - F12 * F21) + 4 * w4 * ( (F11 * x42 + F21 * y42 + F31) * x41 + (F12 * x42 + F22 * y42 + F32) * y41 + x42 * F13 + y42 * F23 + F33 ) * y42 * x41 ) J_w[:, 4, 3] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w4 * x41 * x42 + 2 * F12 * w4 * x42 * y41 + 2 * F21 * w4 * x41 * y42 + 2 * F22 * w4 * y41 * y42 + 2 * F13 * w4 * x42 + 2 * F23 * w4 * y42 + 2 * F31 * w4 * x41 + 2 * F32 * w4 * y41 + 2 * F33 * w4 ) / (F11 * F22 - F12 * F21) + 4 * w4 * ( (F11 * x42 + F21 * y42 + F31) * x41 + (F12 * x42 + F22 * y42 + F32) * y41 + x42 * F13 + y42 * F23 + F33 ) * y42 * y41 ) J_w[:, 5, 3] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w4 * x41 * x42 + 2 * F12 * w4 * x42 * y41 + 2 * F21 * w4 * x41 * y42 + 2 * F22 * w4 * y41 * y42 + 2 * F13 * w4 * x42 + 2 * F23 * w4 * y42 + 2 * F31 * w4 * x41 + 2 * F32 * w4 * y41 + 2 * F33 * w4 ) / (F11 * F22 - F12 * F21) + 4 * w4 * ( (F11 * x42 + F21 * y42 + F31) * x41 + (F12 * x42 + F22 * y42 + F32) * y41 + x42 * F13 + y42 * F23 + F33 ) * y42 ) J_w[:, 6, 3] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w4 * x41 * x42 + 2 * F12 * w4 * x42 * y41 + 2 * F21 * w4 * x41 * y42 + 2 * F22 * w4 * y41 * y42 + 2 * F13 * w4 * x42 + 2 * F23 * w4 * y42 + 2 * F31 * w4 * x41 + 2 * F32 * w4 * y41 + 2 * F33 * w4 ) / (F11 * F22 - F12 * F21) + 4 * w4 * ( (F11 * x42 + F21 * y42 + F31) * x41 + (F12 * x42 + F22 * y42 + F32) * y41 + x42 * F13 + y42 * F23 + F33 ) * x41 ) J_w[:, 7, 3] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w4 * x41 * x42 + 2 * F12 * w4 * x42 * y41 + 2 * F21 * w4 * x41 * y42 + 2 * F22 * w4 * y41 * y42 + 2 * F13 * w4 * x42 + 2 * F23 * w4 * y42 + 2 * F31 * w4 * x41 + 2 * F32 * w4 * y41 + 2 * F33 * w4 ) / (F11 * F22 - F12 * F21) + 4 * w4 * ( (F11 * x42 + F21 * y42 + F31) * x41 + (F12 * x42 + F22 * y42 + F32) * y41 + x42 * F13 + y42 * F23 + F33 ) * y41 ) J_w[:, 8, 3] = ( 4 * w4 * ( (F11 * x42 + F21 * y42 + F31) * x41 + (F12 * x42 + F22 * y42 + F32) * y41 + x42 * F13 + y42 * F23 + F33 ) - 4 * F33 * w4 - 4 * F13 * w4 * x42 - 4 * F23 * w4 * y42 - 4 * F31 * w4 * x41 - 4 * F32 * w4 * y41 - 4 * F11 * w4 * x41 * x42 - 4 * F12 * w4 * x42 * y41 - 4 * F21 * w4 * x41 * y42 - 4 * F22 * w4 * y41 * y42 ) J_w[:, 0, 4] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w5 * x51 * x52 + 2 * F12 * w5 * x52 * y51 + 2 * F21 * w5 * x51 * y52 + 2 * F22 * w5 * y51 * y52 + 2 * F13 * w5 * x52 + 2 * F23 * w5 * y52 + 2 * F31 * w5 * x51 + 2 * F32 * w5 * y51 + 2 * F33 * w5 ) / (F11 * F22 - F12 * F21) + 4 * w5 * ( (F11 * x52 + F21 * y52 + F31) * x51 + (F12 * x52 + F22 * y52 + F32) * y51 + x52 * F13 + y52 * F23 + F33 ) * x52 * x51 ) J_w[:, 1, 4] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w5 * x51 * x52 + 2 * F12 * w5 * x52 * y51 + 2 * F21 * w5 * x51 * y52 + 2 * F22 * w5 * y51 * y52 + 2 * F13 * w5 * x52 + 2 * F23 * w5 * y52 + 2 * F31 * w5 * x51 + 2 * F32 * w5 * y51 + 2 * F33 * w5 ) / (F11 * F22 - F12 * F21) + 4 * w5 * ( (F11 * x52 + F21 * y52 + F31) * x51 + (F12 * x52 + F22 * y52 + F32) * y51 + x52 * F13 + y52 * F23 + F33 ) * x52 * y51 ) J_w[:, 2, 4] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w5 * x51 * x52 + 2 * F12 * w5 * x52 * y51 + 2 * F21 * w5 * x51 * y52 + 2 * F22 * w5 * y51 * y52 + 2 * F13 * w5 * x52 + 2 * F23 * w5 * y52 + 2 * F31 * w5 * x51 + 2 * F32 * w5 * y51 + 2 * F33 * w5 ) / (F11 * F22 - F12 * F21) + 4 * w5 * ( (F11 * x52 + F21 * y52 + F31) * x51 + (F12 * x52 + F22 * y52 + F32) * y51 + x52 * F13 + y52 * F23 + F33 ) * x52 ) J_w[:, 3, 4] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w5 * x51 * x52 + 2 * F12 * w5 * x52 * y51 + 2 * F21 * w5 * x51 * y52 + 2 * F22 * w5 * y51 * y52 + 2 * F13 * w5 * x52 + 2 * F23 * w5 * y52 + 2 * F31 * w5 * x51 + 2 * F32 * w5 * y51 + 2 * F33 * w5 ) / (F11 * F22 - F12 * F21) + 4 * w5 * ( (F11 * x52 + F21 * y52 + F31) * x51 + (F12 * x52 + F22 * y52 + F32) * y51 + x52 * F13 + y52 * F23 + F33 ) * y52 * x51 ) J_w[:, 4, 4] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w5 * x51 * x52 + 2 * F12 * w5 * x52 * y51 + 2 * F21 * w5 * x51 * y52 + 2 * F22 * w5 * y51 * y52 + 2 * F13 * w5 * x52 + 2 * F23 * w5 * y52 + 2 * F31 * w5 * x51 + 2 * F32 * w5 * y51 + 2 * F33 * w5 ) / (F11 * F22 - F12 * F21) + 4 * w5 * ( (F11 * x52 + F21 * y52 + F31) * x51 + (F12 * x52 + F22 * y52 + F32) * y51 + x52 * F13 + y52 * F23 + F33 ) * y52 * y51 ) J_w[:, 5, 4] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w5 * x51 * x52 + 2 * F12 * w5 * x52 * y51 + 2 * F21 * w5 * x51 * y52 + 2 * F22 * w5 * y51 * y52 + 2 * F13 * w5 * x52 + 2 * F23 * w5 * y52 + 2 * F31 * w5 * x51 + 2 * F32 * w5 * y51 + 2 * F33 * w5 ) / (F11 * F22 - F12 * F21) + 4 * w5 * ( (F11 * x52 + F21 * y52 + F31) * x51 + (F12 * x52 + F22 * y52 + F32) * y51 + x52 * F13 + y52 * F23 + F33 ) * y52 ) J_w[:, 6, 4] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w5 * x51 * x52 + 2 * F12 * w5 * x52 * y51 + 2 * F21 * w5 * x51 * y52 + 2 * F22 * w5 * y51 * y52 + 2 * F13 * w5 * x52 + 2 * F23 * w5 * y52 + 2 * F31 * w5 * x51 + 2 * F32 * w5 * y51 + 2 * F33 * w5 ) / (F11 * F22 - F12 * F21) + 4 * w5 * ( (F11 * x52 + F21 * y52 + F31) * x51 + (F12 * x52 + F22 * y52 + F32) * y51 + x52 * F13 + y52 * F23 + F33 ) * x51 ) J_w[:, 7, 4] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w5 * x51 * x52 + 2 * F12 * w5 * x52 * y51 + 2 * F21 * w5 * x51 * y52 + 2 * F22 * w5 * y51 * y52 + 2 * F13 * w5 * x52 + 2 * F23 * w5 * y52 + 2 * F31 * w5 * x51 + 2 * F32 * w5 * y51 + 2 * F33 * w5 ) / (F11 * F22 - F12 * F21) + 4 * w5 * ( (F11 * x52 + F21 * y52 + F31) * x51 + (F12 * x52 + F22 * y52 + F32) * y51 + x52 * F13 + y52 * F23 + F33 ) * y51 ) J_w[:, 8, 4] = ( 4 * w5 * ( (F11 * x52 + F21 * y52 + F31) * x51 + (F12 * x52 + F22 * y52 + F32) * y51 + x52 * F13 + y52 * F23 + F33 ) - 4 * F33 * w5 - 4 * F13 * w5 * x52 - 4 * F23 * w5 * y52 - 4 * F31 * w5 * x51 - 4 * F32 * w5 * y51 - 4 * F11 * w5 * x51 * x52 - 4 * F12 * w5 * x52 * y51 - 4 * F21 * w5 * x51 * y52 - 4 * F22 * w5 * y51 * y52 ) J_w[:, 0, 5] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w6 * x61 * x62 + 2 * F12 * w6 * x62 * y61 + 2 * F21 * w6 * x61 * y62 + 2 * F22 * w6 * y61 * y62 + 2 * F13 * w6 * x62 + 2 * F23 * w6 * y62 + 2 * F31 * w6 * x61 + 2 * F32 * w6 * y61 + 2 * F33 * w6 ) / (F11 * F22 - F12 * F21) + 4 * w6 * ( (F11 * x62 + F21 * y62 + F31) * x61 + (F12 * x62 + F22 * y62 + F32) * y61 + x62 * F13 + y62 * F23 + F33 ) * x62 * x61 ) J_w[:, 1, 5] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w6 * x61 * x62 + 2 * F12 * w6 * x62 * y61 + 2 * F21 * w6 * x61 * y62 + 2 * F22 * w6 * y61 * y62 + 2 * F13 * w6 * x62 + 2 * F23 * w6 * y62 + 2 * F31 * w6 * x61 + 2 * F32 * w6 * y61 + 2 * F33 * w6 ) / (F11 * F22 - F12 * F21) + 4 * w6 * ( (F11 * x62 + F21 * y62 + F31) * x61 + (F12 * x62 + F22 * y62 + F32) * y61 + x62 * F13 + y62 * F23 + F33 ) * x62 * y61 ) J_w[:, 2, 5] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w6 * x61 * x62 + 2 * F12 * w6 * x62 * y61 + 2 * F21 * w6 * x61 * y62 + 2 * F22 * w6 * y61 * y62 + 2 * F13 * w6 * x62 + 2 * F23 * w6 * y62 + 2 * F31 * w6 * x61 + 2 * F32 * w6 * y61 + 2 * F33 * w6 ) / (F11 * F22 - F12 * F21) + 4 * w6 * ( (F11 * x62 + F21 * y62 + F31) * x61 + (F12 * x62 + F22 * y62 + F32) * y61 + x62 * F13 + y62 * F23 + F33 ) * x62 ) J_w[:, 3, 5] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w6 * x61 * x62 + 2 * F12 * w6 * x62 * y61 + 2 * F21 * w6 * x61 * y62 + 2 * F22 * w6 * y61 * y62 + 2 * F13 * w6 * x62 + 2 * F23 * w6 * y62 + 2 * F31 * w6 * x61 + 2 * F32 * w6 * y61 + 2 * F33 * w6 ) / (F11 * F22 - F12 * F21) + 4 * w6 * ( (F11 * x62 + F21 * y62 + F31) * x61 + (F12 * x62 + F22 * y62 + F32) * y61 + x62 * F13 + y62 * F23 + F33 ) * y62 * x61 ) J_w[:, 4, 5] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w6 * x61 * x62 + 2 * F12 * w6 * x62 * y61 + 2 * F21 * w6 * x61 * y62 + 2 * F22 * w6 * y61 * y62 + 2 * F13 * w6 * x62 + 2 * F23 * w6 * y62 + 2 * F31 * w6 * x61 + 2 * F32 * w6 * y61 + 2 * F33 * w6 ) / (F11 * F22 - F12 * F21) + 4 * w6 * ( (F11 * x62 + F21 * y62 + F31) * x61 + (F12 * x62 + F22 * y62 + F32) * y61 + x62 * F13 + y62 * F23 + F33 ) * y62 * y61 ) J_w[:, 5, 5] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w6 * x61 * x62 + 2 * F12 * w6 * x62 * y61 + 2 * F21 * w6 * x61 * y62 + 2 * F22 * w6 * y61 * y62 + 2 * F13 * w6 * x62 + 2 * F23 * w6 * y62 + 2 * F31 * w6 * x61 + 2 * F32 * w6 * y61 + 2 * F33 * w6 ) / (F11 * F22 - F12 * F21) + 4 * w6 * ( (F11 * x62 + F21 * y62 + F31) * x61 + (F12 * x62 + F22 * y62 + F32) * y61 + x62 * F13 + y62 * F23 + F33 ) * y62 ) J_w[:, 6, 5] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w6 * x61 * x62 + 2 * F12 * w6 * x62 * y61 + 2 * F21 * w6 * x61 * y62 + 2 * F22 * w6 * y61 * y62 + 2 * F13 * w6 * x62 + 2 * F23 * w6 * y62 + 2 * F31 * w6 * x61 + 2 * F32 * w6 * y61 + 2 * F33 * w6 ) / (F11 * F22 - F12 * F21) + 4 * w6 * ( (F11 * x62 + F21 * y62 + F31) * x61 + (F12 * x62 + F22 * y62 + F32) * y61 + x62 * F13 + y62 * F23 + F33 ) * x61 ) J_w[:, 7, 5] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w6 * x61 * x62 + 2 * F12 * w6 * x62 * y61 + 2 * F21 * w6 * x61 * y62 + 2 * F22 * w6 * y61 * y62 + 2 * F13 * w6 * x62 + 2 * F23 * w6 * y62 + 2 * F31 * w6 * x61 + 2 * F32 * w6 * y61 + 2 * F33 * w6 ) / (F11 * F22 - F12 * F21) + 4 * w6 * ( (F11 * x62 + F21 * y62 + F31) * x61 + (F12 * x62 + F22 * y62 + F32) * y61 + x62 * F13 + y62 * F23 + F33 ) * y61 ) J_w[:, 8, 5] = ( 4 * w6 * ( (F11 * x62 + F21 * y62 + F31) * x61 + (F12 * x62 + F22 * y62 + F32) * y61 + x62 * F13 + y62 * F23 + F33 ) - 4 * F33 * w6 - 4 * F13 * w6 * x62 - 4 * F23 * w6 * y62 - 4 * F31 * w6 * x61 - 4 * F32 * w6 * y61 - 4 * F11 * w6 * x61 * x62 - 4 * F12 * w6 * x62 * y61 - 4 * F21 * w6 * x61 * y62 - 4 * F22 * w6 * y61 * y62 ) J_w[:, 0, 6] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w7 * x71 * x72 + 2 * F12 * w7 * x72 * y71 + 2 * F21 * w7 * x71 * y72 + 2 * F22 * w7 * y71 * y72 + 2 * F13 * w7 * x72 + 2 * F23 * w7 * y72 + 2 * F31 * w7 * x71 + 2 * F32 * w7 * y71 + 2 * F33 * w7 ) / (F11 * F22 - F12 * F21) + 4 * w7 * ( (F11 * x72 + F21 * y72 + F31) * x71 + (F12 * x72 + F22 * y72 + F32) * y71 + x72 * F13 + y72 * F23 + F33 ) * x72 * x71 ) J_w[:, 1, 6] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w7 * x71 * x72 + 2 * F12 * w7 * x72 * y71 + 2 * F21 * w7 * x71 * y72 + 2 * F22 * w7 * y71 * y72 + 2 * F13 * w7 * x72 + 2 * F23 * w7 * y72 + 2 * F31 * w7 * x71 + 2 * F32 * w7 * y71 + 2 * F33 * w7 ) / (F11 * F22 - F12 * F21) + 4 * w7 * ( (F11 * x72 + F21 * y72 + F31) * x71 + (F12 * x72 + F22 * y72 + F32) * y71 + x72 * F13 + y72 * F23 + F33 ) * x72 * y71 ) J_w[:, 2, 6] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w7 * x71 * x72 + 2 * F12 * w7 * x72 * y71 + 2 * F21 * w7 * x71 * y72 + 2 * F22 * w7 * y71 * y72 + 2 * F13 * w7 * x72 + 2 * F23 * w7 * y72 + 2 * F31 * w7 * x71 + 2 * F32 * w7 * y71 + 2 * F33 * w7 ) / (F11 * F22 - F12 * F21) + 4 * w7 * ( (F11 * x72 + F21 * y72 + F31) * x71 + (F12 * x72 + F22 * y72 + F32) * y71 + x72 * F13 + y72 * F23 + F33 ) * x72 ) J_w[:, 3, 6] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w7 * x71 * x72 + 2 * F12 * w7 * x72 * y71 + 2 * F21 * w7 * x71 * y72 + 2 * F22 * w7 * y71 * y72 + 2 * F13 * w7 * x72 + 2 * F23 * w7 * y72 + 2 * F31 * w7 * x71 + 2 * F32 * w7 * y71 + 2 * F33 * w7 ) / (F11 * F22 - F12 * F21) + 4 * w7 * ( (F11 * x72 + F21 * y72 + F31) * x71 + (F12 * x72 + F22 * y72 + F32) * y71 + x72 * F13 + y72 * F23 + F33 ) * y72 * x71 ) J_w[:, 4, 6] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w7 * x71 * x72 + 2 * F12 * w7 * x72 * y71 + 2 * F21 * w7 * x71 * y72 + 2 * F22 * w7 * y71 * y72 + 2 * F13 * w7 * x72 + 2 * F23 * w7 * y72 + 2 * F31 * w7 * x71 + 2 * F32 * w7 * y71 + 2 * F33 * w7 ) / (F11 * F22 - F12 * F21) + 4 * w7 * ( (F11 * x72 + F21 * y72 + F31) * x71 + (F12 * x72 + F22 * y72 + F32) * y71 + x72 * F13 + y72 * F23 + F33 ) * y72 * y71 ) J_w[:, 5, 6] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w7 * x71 * x72 + 2 * F12 * w7 * x72 * y71 + 2 * F21 * w7 * x71 * y72 + 2 * F22 * w7 * y71 * y72 + 2 * F13 * w7 * x72 + 2 * F23 * w7 * y72 + 2 * F31 * w7 * x71 + 2 * F32 * w7 * y71 + 2 * F33 * w7 ) / (F11 * F22 - F12 * F21) + 4 * w7 * ( (F11 * x72 + F21 * y72 + F31) * x71 + (F12 * x72 + F22 * y72 + F32) * y71 + x72 * F13 + y72 * F23 + F33 ) * y72 ) J_w[:, 6, 6] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w7 * x71 * x72 + 2 * F12 * w7 * x72 * y71 + 2 * F21 * w7 * x71 * y72 + 2 * F22 * w7 * y71 * y72 + 2 * F13 * w7 * x72 + 2 * F23 * w7 * y72 + 2 * F31 * w7 * x71 + 2 * F32 * w7 * y71 + 2 * F33 * w7 ) / (F11 * F22 - F12 * F21) + 4 * w7 * ( (F11 * x72 + F21 * y72 + F31) * x71 + (F12 * x72 + F22 * y72 + F32) * y71 + x72 * F13 + y72 * F23 + F33 ) * x71 ) J_w[:, 7, 6] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w7 * x71 * x72 + 2 * F12 * w7 * x72 * y71 + 2 * F21 * w7 * x71 * y72 + 2 * F22 * w7 * y71 * y72 + 2 * F13 * w7 * x72 + 2 * F23 * w7 * y72 + 2 * F31 * w7 * x71 + 2 * F32 * w7 * y71 + 2 * F33 * w7 ) / (F11 * F22 - F12 * F21) + 4 * w7 * ( (F11 * x72 + F21 * y72 + F31) * x71 + (F12 * x72 + F22 * y72 + F32) * y71 + x72 * F13 + y72 * F23 + F33 ) * y71 ) J_w[:, 8, 6] = ( 4 * w7 * ( (F11 * x72 + F21 * y72 + F31) * x71 + (F12 * x72 + F22 * y72 + F32) * y71 + x72 * F13 + y72 * F23 + F33 ) - 4 * F33 * w7 - 4 * F13 * w7 * x72 - 4 * F23 * w7 * y72 - 4 * F31 * w7 * x71 - 4 * F32 * w7 * y71 - 4 * F11 * w7 * x71 * x72 - 4 * F12 * w7 * x72 * y71 - 4 * F21 * w7 * x71 * y72 - 4 * F22 * w7 * y71 * y72 ) J_w[:, 0, 7] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w8 * x81 * x82 + 2 * F12 * w8 * x82 * y81 + 2 * F21 * w8 * x81 * y82 + 2 * F22 * w8 * y81 * y82 + 2 * F13 * w8 * x82 + 2 * F23 * w8 * y82 + 2 * F31 * w8 * x81 + 2 * F32 * w8 * y81 + 2 * F33 * w8 ) / (F11 * F22 - F12 * F21) + 4 * w8 * ( (F11 * x82 + F21 * y82 + F31) * x81 + (F12 * x82 + F22 * y82 + F32) * y81 + x82 * F13 + y82 * F23 + F33 ) * x82 * x81 ) J_w[:, 1, 7] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w8 * x81 * x82 + 2 * F12 * w8 * x82 * y81 + 2 * F21 * w8 * x81 * y82 + 2 * F22 * w8 * y81 * y82 + 2 * F13 * w8 * x82 + 2 * F23 * w8 * y82 + 2 * F31 * w8 * x81 + 2 * F32 * w8 * y81 + 2 * F33 * w8 ) / (F11 * F22 - F12 * F21) + 4 * w8 * ( (F11 * x82 + F21 * y82 + F31) * x81 + (F12 * x82 + F22 * y82 + F32) * y81 + x82 * F13 + y82 * F23 + F33 ) * x82 * y81 ) J_w[:, 2, 7] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w8 * x81 * x82 + 2 * F12 * w8 * x82 * y81 + 2 * F21 * w8 * x81 * y82 + 2 * F22 * w8 * y81 * y82 + 2 * F13 * w8 * x82 + 2 * F23 * w8 * y82 + 2 * F31 * w8 * x81 + 2 * F32 * w8 * y81 + 2 * F33 * w8 ) / (F11 * F22 - F12 * F21) + 4 * w8 * ( (F11 * x82 + F21 * y82 + F31) * x81 + (F12 * x82 + F22 * y82 + F32) * y81 + x82 * F13 + y82 * F23 + F33 ) * x82 ) J_w[:, 3, 7] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w8 * x81 * x82 + 2 * F12 * w8 * x82 * y81 + 2 * F21 * w8 * x81 * y82 + 2 * F22 * w8 * y81 * y82 + 2 * F13 * w8 * x82 + 2 * F23 * w8 * y82 + 2 * F31 * w8 * x81 + 2 * F32 * w8 * y81 + 2 * F33 * w8 ) / (F11 * F22 - F12 * F21) + 4 * w8 * ( (F11 * x82 + F21 * y82 + F31) * x81 + (F12 * x82 + F22 * y82 + F32) * y81 + x82 * F13 + y82 * F23 + F33 ) * y82 * x81 ) J_w[:, 4, 7] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w8 * x81 * x82 + 2 * F12 * w8 * x82 * y81 + 2 * F21 * w8 * x81 * y82 + 2 * F22 * w8 * y81 * y82 + 2 * F13 * w8 * x82 + 2 * F23 * w8 * y82 + 2 * F31 * w8 * x81 + 2 * F32 * w8 * y81 + 2 * F33 * w8 ) / (F11 * F22 - F12 * F21) + 4 * w8 * ( (F11 * x82 + F21 * y82 + F31) * x81 + (F12 * x82 + F22 * y82 + F32) * y81 + x82 * F13 + y82 * F23 + F33 ) * y82 * y81 ) J_w[:, 5, 7] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w8 * x81 * x82 + 2 * F12 * w8 * x82 * y81 + 2 * F21 * w8 * x81 * y82 + 2 * F22 * w8 * y81 * y82 + 2 * F13 * w8 * x82 + 2 * F23 * w8 * y82 + 2 * F31 * w8 * x81 + 2 * F32 * w8 * y81 + 2 * F33 * w8 ) / (F11 * F22 - F12 * F21) + 4 * w8 * ( (F11 * x82 + F21 * y82 + F31) * x81 + (F12 * x82 + F22 * y82 + F32) * y81 + x82 * F13 + y82 * F23 + F33 ) * y82 ) J_w[:, 6, 7] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w8 * x81 * x82 + 2 * F12 * w8 * x82 * y81 + 2 * F21 * w8 * x81 * y82 + 2 * F22 * w8 * y81 * y82 + 2 * F13 * w8 * x82 + 2 * F23 * w8 * y82 + 2 * F31 * w8 * x81 + 2 * F32 * w8 * y81 + 2 * F33 * w8 ) / (F11 * F22 - F12 * F21) + 4 * w8 * ( (F11 * x82 + F21 * y82 + F31) * x81 + (F12 * x82 + F22 * y82 + F32) * y81 + x82 * F13 + y82 * F23 + F33 ) * x81 ) J_w[:, 7, 7] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w8 * x81 * x82 + 2 * F12 * w8 * x82 * y81 + 2 * F21 * w8 * x81 * y82 + 2 * F22 * w8 * y81 * y82 + 2 * F13 * w8 * x82 + 2 * F23 * w8 * y82 + 2 * F31 * w8 * x81 + 2 * F32 * w8 * y81 + 2 * F33 * w8 ) / (F11 * F22 - F12 * F21) + 4 * w8 * ( (F11 * x82 + F21 * y82 + F31) * x81 + (F12 * x82 + F22 * y82 + F32) * y81 + x82 * F13 + y82 * F23 + F33 ) * y81 ) J_w[:, 8, 7] = ( 4 * w8 * ( (F11 * x82 + F21 * y82 + F31) * x81 + (F12 * x82 + F22 * y82 + F32) * y81 + x82 * F13 + y82 * F23 + F33 ) - 4 * F33 * w8 - 4 * F13 * w8 * x82 - 4 * F23 * w8 * y82 - 4 * F31 * w8 * x81 - 4 * F32 * w8 * y81 - 4 * F11 * w8 * x81 * x82 - 4 * F12 * w8 * x82 * y81 - 4 * F21 * w8 * x81 * y82 - 4 * F22 * w8 * y81 * y82 ) J_w[:, 0, 8] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w9 * x91 * x92 + 2 * F12 * w9 * x92 * y91 + 2 * F21 * w9 * x91 * y92 + 2 * F22 * w9 * y91 * y92 + 2 * F13 * w9 * x92 + 2 * F23 * w9 * y92 + 2 * F31 * w9 * x91 + 2 * F32 * w9 * y91 + 2 * F33 * w9 ) / (F11 * F22 - F12 * F21) + 4 * w9 * ( (F11 * x92 + F21 * y92 + F31) * x91 + (F12 * x92 + F22 * y92 + F32) * y91 + x92 * F13 + y92 * F23 + F33 ) * x92 * x91 ) J_w[:, 1, 8] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w9 * x91 * x92 + 2 * F12 * w9 * x92 * y91 + 2 * F21 * w9 * x91 * y92 + 2 * F22 * w9 * y91 * y92 + 2 * F13 * w9 * x92 + 2 * F23 * w9 * y92 + 2 * F31 * w9 * x91 + 2 * F32 * w9 * y91 + 2 * F33 * w9 ) / (F11 * F22 - F12 * F21) + 4 * w9 * ( (F11 * x92 + F21 * y92 + F31) * x91 + (F12 * x92 + F22 * y92 + F32) * y91 + x92 * F13 + y92 * F23 + F33 ) * x92 * y91 ) J_w[:, 2, 8] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w9 * x91 * x92 + 2 * F12 * w9 * x92 * y91 + 2 * F21 * w9 * x91 * y92 + 2 * F22 * w9 * y91 * y92 + 2 * F13 * w9 * x92 + 2 * F23 * w9 * y92 + 2 * F31 * w9 * x91 + 2 * F32 * w9 * y91 + 2 * F33 * w9 ) / (F11 * F22 - F12 * F21) + 4 * w9 * ( (F11 * x92 + F21 * y92 + F31) * x91 + (F12 * x92 + F22 * y92 + F32) * y91 + x92 * F13 + y92 * F23 + F33 ) * x92 ) J_w[:, 3, 8] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w9 * x91 * x92 + 2 * F12 * w9 * x92 * y91 + 2 * F21 * w9 * x91 * y92 + 2 * F22 * w9 * y91 * y92 + 2 * F13 * w9 * x92 + 2 * F23 * w9 * y92 + 2 * F31 * w9 * x91 + 2 * F32 * w9 * y91 + 2 * F33 * w9 ) / (F11 * F22 - F12 * F21) + 4 * w9 * ( (F11 * x92 + F21 * y92 + F31) * x91 + (F12 * x92 + F22 * y92 + F32) * y91 + x92 * F13 + y92 * F23 + F33 ) * y92 * x91 ) J_w[:, 4, 8] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w9 * x91 * x92 + 2 * F12 * w9 * x92 * y91 + 2 * F21 * w9 * x91 * y92 + 2 * F22 * w9 * y91 * y92 + 2 * F13 * w9 * x92 + 2 * F23 * w9 * y92 + 2 * F31 * w9 * x91 + 2 * F32 * w9 * y91 + 2 * F33 * w9 ) / (F11 * F22 - F12 * F21) + 4 * w9 * ( (F11 * x92 + F21 * y92 + F31) * x91 + (F12 * x92 + F22 * y92 + F32) * y91 + x92 * F13 + y92 * F23 + F33 ) * y92 * y91 ) J_w[:, 5, 8] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w9 * x91 * x92 + 2 * F12 * w9 * x92 * y91 + 2 * F21 * w9 * x91 * y92 + 2 * F22 * w9 * y91 * y92 + 2 * F13 * w9 * x92 + 2 * F23 * w9 * y92 + 2 * F31 * w9 * x91 + 2 * F32 * w9 * y91 + 2 * F33 * w9 ) / (F11 * F22 - F12 * F21) + 4 * w9 * ( (F11 * x92 + F21 * y92 + F31) * x91 + (F12 * x92 + F22 * y92 + F32) * y91 + x92 * F13 + y92 * F23 + F33 ) * y92 ) J_w[:, 6, 8] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w9 * x91 * x92 + 2 * F12 * w9 * x92 * y91 + 2 * F21 * w9 * x91 * y92 + 2 * F22 * w9 * y91 * y92 + 2 * F13 * w9 * x92 + 2 * F23 * w9 * y92 + 2 * F31 * w9 * x91 + 2 * F32 * w9 * y91 + 2 * F33 * w9 ) / (F11 * F22 - F12 * F21) + 4 * w9 * ( (F11 * x92 + F21 * y92 + F31) * x91 + (F12 * x92 + F22 * y92 + F32) * y91 + x92 * F13 + y92 * F23 + F33 ) * x91 ) J_w[:, 7, 8] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w9 * x91 * x92 + 2 * F12 * w9 * x92 * y91 + 2 * F21 * w9 * x91 * y92 + 2 * F22 * w9 * y91 * y92 + 2 * F13 * w9 * x92 + 2 * F23 * w9 * y92 + 2 * F31 * w9 * x91 + 2 * F32 * w9 * y91 + 2 * F33 * w9 ) / (F11 * F22 - F12 * F21) + 4 * w9 * ( (F11 * x92 + F21 * y92 + F31) * x91 + (F12 * x92 + F22 * y92 + F32) * y91 + x92 * F13 + y92 * F23 + F33 ) * y91 ) J_w[:, 8, 8] = ( 4 * w9 * ( (F11 * x92 + F21 * y92 + F31) * x91 + (F12 * x92 + F22 * y92 + F32) * y91 + x92 * F13 + y92 * F23 + F33 ) - 4 * F33 * w9 - 4 * F31 * w9 * x91 - 4 * F32 * w9 * y91 - 4 * F13 * w9 * x92 - 4 * F23 * w9 * y92 - 4 * F11 * w9 * x91 * x92 - 4 * F12 * w9 * x92 * y91 - 4 * F21 * w9 * x91 * y92 - 4 * F22 * w9 * y91 * y92 ) J_w[:, 0, 9] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w10 * x10_1 * x10_2 + 2 * F12 * w10 * x10_2 * y10_1 + 2 * F21 * w10 * x10_1 * y10_2 + 2 * F22 * w10 * y10_1 * y10_2 + 2 * F13 * w10 * x10_2 + 2 * F23 * w10 * y10_2 + 2 * F31 * w10 * x10_1 + 2 * F32 * w10 * y10_1 + 2 * F33 * w10 ) / (F11 * F22 - F12 * F21) + 4 * w10 * ( (F11 * x10_2 + F21 * y10_2 + F31) * x10_1 + (F12 * x10_2 + F22 * y10_2 + F32) * y10_1 + x10_2 * F13 + y10_2 * F23 + F33 ) * x10_2 * x10_1 ) J_w[:, 1, 9] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w10 * x10_1 * x10_2 + 2 * F12 * w10 * x10_2 * y10_1 + 2 * F21 * w10 * x10_1 * y10_2 + 2 * F22 * w10 * y10_1 * y10_2 + 2 * F13 * w10 * x10_2 + 2 * F23 * w10 * y10_2 + 2 * F31 * w10 * x10_1 + 2 * F32 * w10 * y10_1 + 2 * F33 * w10 ) / (F11 * F22 - F12 * F21) + 4 * w10 * ( (F11 * x10_2 + F21 * y10_2 + F31) * x10_1 + (F12 * x10_2 + F22 * y10_2 + F32) * y10_1 + x10_2 * F13 + y10_2 * F23 + F33 ) * x10_2 * y10_1 ) J_w[:, 2, 9] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w10 * x10_1 * x10_2 + 2 * F12 * w10 * x10_2 * y10_1 + 2 * F21 * w10 * x10_1 * y10_2 + 2 * F22 * w10 * y10_1 * y10_2 + 2 * F13 * w10 * x10_2 + 2 * F23 * w10 * y10_2 + 2 * F31 * w10 * x10_1 + 2 * F32 * w10 * y10_1 + 2 * F33 * w10 ) / (F11 * F22 - F12 * F21) + 4 * w10 * ( (F11 * x10_2 + F21 * y10_2 + F31) * x10_1 + (F12 * x10_2 + F22 * y10_2 + F32) * y10_1 + x10_2 * F13 + y10_2 * F23 + F33 ) * x10_2 ) J_w[:, 3, 9] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w10 * x10_1 * x10_2 + 2 * F12 * w10 * x10_2 * y10_1 + 2 * F21 * w10 * x10_1 * y10_2 + 2 * F22 * w10 * y10_1 * y10_2 + 2 * F13 * w10 * x10_2 + 2 * F23 * w10 * y10_2 + 2 * F31 * w10 * x10_1 + 2 * F32 * w10 * y10_1 + 2 * F33 * w10 ) / (F11 * F22 - F12 * F21) + 4 * w10 * ( (F11 * x10_2 + F21 * y10_2 + F31) * x10_1 + (F12 * x10_2 + F22 * y10_2 + F32) * y10_1 + x10_2 * F13 + y10_2 * F23 + F33 ) * y10_2 * x10_1 ) J_w[:, 4, 9] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w10 * x10_1 * x10_2 + 2 * F12 * w10 * x10_2 * y10_1 + 2 * F21 * w10 * x10_1 * y10_2 + 2 * F22 * w10 * y10_1 * y10_2 + 2 * F13 * w10 * x10_2 + 2 * F23 * w10 * y10_2 + 2 * F31 * w10 * x10_1 + 2 * F32 * w10 * y10_1 + 2 * F33 * w10 ) / (F11 * F22 - F12 * F21) + 4 * w10 * ( (F11 * x10_2 + F21 * y10_2 + F31) * x10_1 + (F12 * x10_2 + F22 * y10_2 + F32) * y10_1 + x10_2 * F13 + y10_2 * F23 + F33 ) * y10_2 * y10_1 ) J_w[:, 5, 9] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w10 * x10_1 * x10_2 + 2 * F12 * w10 * x10_2 * y10_1 + 2 * F21 * w10 * x10_1 * y10_2 + 2 * F22 * w10 * y10_1 * y10_2 + 2 * F13 * w10 * x10_2 + 2 * F23 * w10 * y10_2 + 2 * F31 * w10 * x10_1 + 2 * F32 * w10 * y10_1 + 2 * F33 * w10 ) / (F11 * F22 - F12 * F21) + 4 * w10 * ( (F11 * x10_2 + F21 * y10_2 + F31) * x10_1 + (F12 * x10_2 + F22 * y10_2 + F32) * y10_1 + x10_2 * F13 + y10_2 * F23 + F33 ) * y10_2 ) J_w[:, 6, 9] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w10 * x10_1 * x10_2 + 2 * F12 * w10 * x10_2 * y10_1 + 2 * F21 * w10 * x10_1 * y10_2 + 2 * F22 * w10 * y10_1 * y10_2 + 2 * F13 * w10 * x10_2 + 2 * F23 * w10 * y10_2 + 2 * F31 * w10 * x10_1 + 2 * F32 * w10 * y10_1 + 2 * F33 * w10 ) / (F11 * F22 - F12 * F21) + 4 * w10 * ( (F11 * x10_2 + F21 * y10_2 + F31) * x10_1 + (F12 * x10_2 + F22 * y10_2 + F32) * y10_1 + x10_2 * F13 + y10_2 * F23 + F33 ) * x10_1 ) J_w[:, 7, 9] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w10 * x10_1 * x10_2 + 2 * F12 * w10 * x10_2 * y10_1 + 2 * F21 * w10 * x10_1 * y10_2 + 2 * F22 * w10 * y10_1 * y10_2 + 2 * F13 * w10 * x10_2 + 2 * F23 * w10 * y10_2 + 2 * F31 * w10 * x10_1 + 2 * F32 * w10 * y10_1 + 2 * F33 * w10 ) / (F11 * F22 - F12 * F21) + 4 * w10 * ( (F11 * x10_2 + F21 * y10_2 + F31) * x10_1 + (F12 * x10_2 + F22 * y10_2 + F32) * y10_1 + x10_2 * F13 + y10_2 * F23 + F33 ) * y10_1 ) J_w[:, 8, 9] = ( 4 * w10 * ( (F11 * x10_2 + F21 * y10_2 + F31) * x10_1 + (F12 * x10_2 + F22 * y10_2 + F32) * y10_1 + x10_2 * F13 + y10_2 * F23 + F33 ) - 4 * F33 * w10 - 4 * F13 * w10 * x10_2 - 4 * F23 * w10 * y10_2 - 4 * F31 * w10 * x10_1 - 4 * F32 * w10 * y10_1 - 4 * F11 * w10 * x10_1 * x10_2 - 4 * F12 * w10 * x10_2 * y10_1 - 4 * F21 * w10 * x10_1 * y10_2 - 4 * F22 * w10 * y10_1 * y10_2 ) J_w[:, 0, 10] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w11 * x11_1 * x11_2 + 2 * F12 * w11 * x11_2 * y11_1 + 2 * F21 * w11 * x11_1 * y11_2 + 2 * F22 * w11 * y11_1 * y11_2 + 2 * F13 * w11 * x11_2 + 2 * F23 * w11 * y11_2 + 2 * F31 * w11 * x11_1 + 2 * F32 * w11 * y11_1 + 2 * F33 * w11 ) / (F11 * F22 - F12 * F21) + 4 * w11 * ( (F11 * x11_2 + F21 * y11_2 + F31) * x11_1 + (F12 * x11_2 + F22 * y11_2 + F32) * y11_1 + x11_2 * F13 + y11_2 * F23 + F33 ) * x11_2 * x11_1 ) J_w[:, 1, 10] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w11 * x11_1 * x11_2 + 2 * F12 * w11 * x11_2 * y11_1 + 2 * F21 * w11 * x11_1 * y11_2 + 2 * F22 * w11 * y11_1 * y11_2 + 2 * F13 * w11 * x11_2 + 2 * F23 * w11 * y11_2 + 2 * F31 * w11 * x11_1 + 2 * F32 * w11 * y11_1 + 2 * F33 * w11 ) / (F11 * F22 - F12 * F21) + 4 * w11 * ( (F11 * x11_2 + F21 * y11_2 + F31) * x11_1 + (F12 * x11_2 + F22 * y11_2 + F32) * y11_1 + x11_2 * F13 + y11_2 * F23 + F33 ) * x11_2 * y11_1 ) J_w[:, 2, 10] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w11 * x11_1 * x11_2 + 2 * F12 * w11 * x11_2 * y11_1 + 2 * F21 * w11 * x11_1 * y11_2 + 2 * F22 * w11 * y11_1 * y11_2 + 2 * F13 * w11 * x11_2 + 2 * F23 * w11 * y11_2 + 2 * F31 * w11 * x11_1 + 2 * F32 * w11 * y11_1 + 2 * F33 * w11 ) / (F11 * F22 - F12 * F21) + 4 * w11 * ( (F11 * x11_2 + F21 * y11_2 + F31) * x11_1 + (F12 * x11_2 + F22 * y11_2 + F32) * y11_1 + x11_2 * F13 + y11_2 * F23 + F33 ) * x11_2 ) J_w[:, 3, 10] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w11 * x11_1 * x11_2 + 2 * F12 * w11 * x11_2 * y11_1 + 2 * F21 * w11 * x11_1 * y11_2 + 2 * F22 * w11 * y11_1 * y11_2 + 2 * F13 * w11 * x11_2 + 2 * F23 * w11 * y11_2 + 2 * F31 * w11 * x11_1 + 2 * F32 * w11 * y11_1 + 2 * F33 * w11 ) / (F11 * F22 - F12 * F21) + 4 * w11 * ( (F11 * x11_2 + F21 * y11_2 + F31) * x11_1 + (F12 * x11_2 + F22 * y11_2 + F32) * y11_1 + x11_2 * F13 + y11_2 * F23 + F33 ) * y11_2 * x11_1 ) J_w[:, 4, 10] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w11 * x11_1 * x11_2 + 2 * F12 * w11 * x11_2 * y11_1 + 2 * F21 * w11 * x11_1 * y11_2 + 2 * F22 * w11 * y11_1 * y11_2 + 2 * F13 * w11 * x11_2 + 2 * F23 * w11 * y11_2 + 2 * F31 * w11 * x11_1 + 2 * F32 * w11 * y11_1 + 2 * F33 * w11 ) / (F11 * F22 - F12 * F21) + 4 * w11 * ( (F11 * x11_2 + F21 * y11_2 + F31) * x11_1 + (F12 * x11_2 + F22 * y11_2 + F32) * y11_1 + x11_2 * F13 + y11_2 * F23 + F33 ) * y11_2 * y11_1 ) J_w[:, 5, 10] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w11 * x11_1 * x11_2 + 2 * F12 * w11 * x11_2 * y11_1 + 2 * F21 * w11 * x11_1 * y11_2 + 2 * F22 * w11 * y11_1 * y11_2 + 2 * F13 * w11 * x11_2 + 2 * F23 * w11 * y11_2 + 2 * F31 * w11 * x11_1 + 2 * F32 * w11 * y11_1 + 2 * F33 * w11 ) / (F11 * F22 - F12 * F21) + 4 * w11 * ( (F11 * x11_2 + F21 * y11_2 + F31) * x11_1 + (F12 * x11_2 + F22 * y11_2 + F32) * y11_1 + x11_2 * F13 + y11_2 * F23 + F33 ) * y11_2 ) J_w[:, 6, 10] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w11 * x11_1 * x11_2 + 2 * F12 * w11 * x11_2 * y11_1 + 2 * F21 * w11 * x11_1 * y11_2 + 2 * F22 * w11 * y11_1 * y11_2 + 2 * F13 * w11 * x11_2 + 2 * F23 * w11 * y11_2 + 2 * F31 * w11 * x11_1 + 2 * F32 * w11 * y11_1 + 2 * F33 * w11 ) / (F11 * F22 - F12 * F21) + 4 * w11 * ( (F11 * x11_2 + F21 * y11_2 + F31) * x11_1 + (F12 * x11_2 + F22 * y11_2 + F32) * y11_1 + x11_2 * F13 + y11_2 * F23 + F33 ) * x11_1 ) J_w[:, 7, 10] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w11 * x11_1 * x11_2 + 2 * F12 * w11 * x11_2 * y11_1 + 2 * F21 * w11 * x11_1 * y11_2 + 2 * F22 * w11 * y11_1 * y11_2 + 2 * F13 * w11 * x11_2 + 2 * F23 * w11 * y11_2 + 2 * F31 * w11 * x11_1 + 2 * F32 * w11 * y11_1 + 2 * F33 * w11 ) / (F11 * F22 - F12 * F21) + 4 * w11 * ( (F11 * x11_2 + F21 * y11_2 + F31) * x11_1 + (F12 * x11_2 + F22 * y11_2 + F32) * y11_1 + x11_2 * F13 + y11_2 * F23 + F33 ) * y11_1 ) J_w[:, 8, 10] = ( 4 * w11 * ( (F11 * x11_2 + F21 * y11_2 + F31) * x11_1 + (F12 * x11_2 + F22 * y11_2 + F32) * y11_1 + x11_2 * F13 + y11_2 * F23 + F33 ) - 4 * F33 * w11 - 4 * F13 * w11 * x11_2 - 4 * F23 * w11 * y11_2 - 4 * F31 * w11 * x11_1 - 4 * F32 * w11 * y11_1 - 4 * F11 * w11 * x11_1 * x11_2 - 4 * F12 * w11 * x11_2 * y11_1 - 4 * F21 * w11 * x11_1 * y11_2 - 4 * F22 * w11 * y11_1 * y11_2 ) J_w[:, 0, 11] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w12 * x12_1 * x12_2 + 2 * F12 * w12 * x12_2 * y12_1 + 2 * F21 * w12 * x12_1 * y12_2 + 2 * F22 * w12 * y12_1 * y12_2 + 2 * F13 * w12 * x12_2 + 2 * F23 * w12 * y12_2 + 2 * F31 * w12 * x12_1 + 2 * F32 * w12 * y12_1 + 2 * F33 * w12 ) / (F11 * F22 - F12 * F21) + 4 * w12 * ( (F11 * x12_2 + F21 * y12_2 + F31) * x12_1 + (F12 * x12_2 + F22 * y12_2 + F32) * y12_1 + x12_2 * F13 + y12_2 * F23 + F33 ) * x12_2 * x12_1 ) J_w[:, 1, 11] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w12 * x12_1 * x12_2 + 2 * F12 * w12 * x12_2 * y12_1 + 2 * F21 * w12 * x12_1 * y12_2 + 2 * F22 * w12 * y12_1 * y12_2 + 2 * F13 * w12 * x12_2 + 2 * F23 * w12 * y12_2 + 2 * F31 * w12 * x12_1 + 2 * F32 * w12 * y12_1 + 2 * F33 * w12 ) / (F11 * F22 - F12 * F21) + 4 * w12 * ( (F11 * x12_2 + F21 * y12_2 + F31) * x12_1 + (F12 * x12_2 + F22 * y12_2 + F32) * y12_1 + x12_2 * F13 + y12_2 * F23 + F33 ) * x12_2 * y12_1 ) J_w[:, 2, 11] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w12 * x12_1 * x12_2 + 2 * F12 * w12 * x12_2 * y12_1 + 2 * F21 * w12 * x12_1 * y12_2 + 2 * F22 * w12 * y12_1 * y12_2 + 2 * F13 * w12 * x12_2 + 2 * F23 * w12 * y12_2 + 2 * F31 * w12 * x12_1 + 2 * F32 * w12 * y12_1 + 2 * F33 * w12 ) / (F11 * F22 - F12 * F21) + 4 * w12 * ( (F11 * x12_2 + F21 * y12_2 + F31) * x12_1 + (F12 * x12_2 + F22 * y12_2 + F32) * y12_1 + x12_2 * F13 + y12_2 * F23 + F33 ) * x12_2 ) J_w[:, 3, 11] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w12 * x12_1 * x12_2 + 2 * F12 * w12 * x12_2 * y12_1 + 2 * F21 * w12 * x12_1 * y12_2 + 2 * F22 * w12 * y12_1 * y12_2 + 2 * F13 * w12 * x12_2 + 2 * F23 * w12 * y12_2 + 2 * F31 * w12 * x12_1 + 2 * F32 * w12 * y12_1 + 2 * F33 * w12 ) / (F11 * F22 - F12 * F21) + 4 * w12 * ( (F11 * x12_2 + F21 * y12_2 + F31) * x12_1 + (F12 * x12_2 + F22 * y12_2 + F32) * y12_1 + x12_2 * F13 + y12_2 * F23 + F33 ) * y12_2 * x12_1 ) J_w[:, 4, 11] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w12 * x12_1 * x12_2 + 2 * F12 * w12 * x12_2 * y12_1 + 2 * F21 * w12 * x12_1 * y12_2 + 2 * F22 * w12 * y12_1 * y12_2 + 2 * F13 * w12 * x12_2 + 2 * F23 * w12 * y12_2 + 2 * F31 * w12 * x12_1 + 2 * F32 * w12 * y12_1 + 2 * F33 * w12 ) / (F11 * F22 - F12 * F21) + 4 * w12 * ( (F11 * x12_2 + F21 * y12_2 + F31) * x12_1 + (F12 * x12_2 + F22 * y12_2 + F32) * y12_1 + x12_2 * F13 + y12_2 * F23 + F33 ) * y12_2 * y12_1 ) J_w[:, 5, 11] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w12 * x12_1 * x12_2 + 2 * F12 * w12 * x12_2 * y12_1 + 2 * F21 * w12 * x12_1 * y12_2 + 2 * F22 * w12 * y12_1 * y12_2 + 2 * F13 * w12 * x12_2 + 2 * F23 * w12 * y12_2 + 2 * F31 * w12 * x12_1 + 2 * F32 * w12 * y12_1 + 2 * F33 * w12 ) / (F11 * F22 - F12 * F21) + 4 * w12 * ( (F11 * x12_2 + F21 * y12_2 + F31) * x12_1 + (F12 * x12_2 + F22 * y12_2 + F32) * y12_1 + x12_2 * F13 + y12_2 * F23 + F33 ) * y12_2 ) J_w[:, 6, 11] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w12 * x12_1 * x12_2 + 2 * F12 * w12 * x12_2 * y12_1 + 2 * F21 * w12 * x12_1 * y12_2 + 2 * F22 * w12 * y12_1 * y12_2 + 2 * F13 * w12 * x12_2 + 2 * F23 * w12 * y12_2 + 2 * F31 * w12 * x12_1 + 2 * F32 * w12 * y12_1 + 2 * F33 * w12 ) / (F11 * F22 - F12 * F21) + 4 * w12 * ( (F11 * x12_2 + F21 * y12_2 + F31) * x12_1 + (F12 * x12_2 + F22 * y12_2 + F32) * y12_1 + x12_2 * F13 + y12_2 * F23 + F33 ) * x12_1 ) J_w[:, 7, 11] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w12 * x12_1 * x12_2 + 2 * F12 * w12 * x12_2 * y12_1 + 2 * F21 * w12 * x12_1 * y12_2 + 2 * F22 * w12 * y12_1 * y12_2 + 2 * F13 * w12 * x12_2 + 2 * F23 * w12 * y12_2 + 2 * F31 * w12 * x12_1 + 2 * F32 * w12 * y12_1 + 2 * F33 * w12 ) / (F11 * F22 - F12 * F21) + 4 * w12 * ( (F11 * x12_2 + F21 * y12_2 + F31) * x12_1 + (F12 * x12_2 + F22 * y12_2 + F32) * y12_1 + x12_2 * F13 + y12_2 * F23 + F33 ) * y12_1 ) J_w[:, 8, 11] = ( 4 * w12 * ( (F11 * x12_2 + F21 * y12_2 + F31) * x12_1 + (F12 * x12_2 + F22 * y12_2 + F32) * y12_1 + x12_2 * F13 + y12_2 * F23 + F33 ) - 4 * F33 * w12 - 4 * F13 * w12 * x12_2 - 4 * F23 * w12 * y12_2 - 4 * F31 * w12 * x12_1 - 4 * F32 * w12 * y12_1 - 4 * F11 * w12 * x12_1 * x12_2 - 4 * F12 * w12 * x12_2 * y12_1 - 4 * F21 * w12 * x12_1 * y12_2 - 4 * F22 * w12 * y12_1 * y12_2 ) J_w[:, 0, 12] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w13 * x13_1 * x13_2 + 2 * F12 * w13 * x13_2 * y13_1 + 2 * F21 * w13 * x13_1 * y13_2 + 2 * F22 * w13 * y13_1 * y13_2 + 2 * F13 * w13 * x13_2 + 2 * F23 * w13 * y13_2 + 2 * F31 * w13 * x13_1 + 2 * F32 * w13 * y13_1 + 2 * F33 * w13 ) / (F11 * F22 - F12 * F21) + 4 * w13 * ( (F11 * x13_2 + F21 * y13_2 + F31) * x13_1 + (F12 * x13_2 + F22 * y13_2 + F32) * y13_1 + x13_2 * F13 + y13_2 * F23 + F33 ) * x13_2 * x13_1 ) J_w[:, 1, 12] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w13 * x13_1 * x13_2 + 2 * F12 * w13 * x13_2 * y13_1 + 2 * F21 * w13 * x13_1 * y13_2 + 2 * F22 * w13 * y13_1 * y13_2 + 2 * F13 * w13 * x13_2 + 2 * F23 * w13 * y13_2 + 2 * F31 * w13 * x13_1 + 2 * F32 * w13 * y13_1 + 2 * F33 * w13 ) / (F11 * F22 - F12 * F21) + 4 * w13 * ( (F11 * x13_2 + F21 * y13_2 + F31) * x13_1 + (F12 * x13_2 + F22 * y13_2 + F32) * y13_1 + x13_2 * F13 + y13_2 * F23 + F33 ) * x13_2 * y13_1 ) J_w[:, 2, 12] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w13 * x13_1 * x13_2 + 2 * F12 * w13 * x13_2 * y13_1 + 2 * F21 * w13 * x13_1 * y13_2 + 2 * F22 * w13 * y13_1 * y13_2 + 2 * F13 * w13 * x13_2 + 2 * F23 * w13 * y13_2 + 2 * F31 * w13 * x13_1 + 2 * F32 * w13 * y13_1 + 2 * F33 * w13 ) / (F11 * F22 - F12 * F21) + 4 * w13 * ( (F11 * x13_2 + F21 * y13_2 + F31) * x13_1 + (F12 * x13_2 + F22 * y13_2 + F32) * y13_1 + x13_2 * F13 + y13_2 * F23 + F33 ) * x13_2 ) J_w[:, 3, 12] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w13 * x13_1 * x13_2 + 2 * F12 * w13 * x13_2 * y13_1 + 2 * F21 * w13 * x13_1 * y13_2 + 2 * F22 * w13 * y13_1 * y13_2 + 2 * F13 * w13 * x13_2 + 2 * F23 * w13 * y13_2 + 2 * F31 * w13 * x13_1 + 2 * F32 * w13 * y13_1 + 2 * F33 * w13 ) / (F11 * F22 - F12 * F21) + 4 * w13 * ( (F11 * x13_2 + F21 * y13_2 + F31) * x13_1 + (F12 * x13_2 + F22 * y13_2 + F32) * y13_1 + x13_2 * F13 + y13_2 * F23 + F33 ) * y13_2 * x13_1 ) J_w[:, 4, 12] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w13 * x13_1 * x13_2 + 2 * F12 * w13 * x13_2 * y13_1 + 2 * F21 * w13 * x13_1 * y13_2 + 2 * F22 * w13 * y13_1 * y13_2 + 2 * F13 * w13 * x13_2 + 2 * F23 * w13 * y13_2 + 2 * F31 * w13 * x13_1 + 2 * F32 * w13 * y13_1 + 2 * F33 * w13 ) / (F11 * F22 - F12 * F21) + 4 * w13 * ( (F11 * x13_2 + F21 * y13_2 + F31) * x13_1 + (F12 * x13_2 + F22 * y13_2 + F32) * y13_1 + x13_2 * F13 + y13_2 * F23 + F33 ) * y13_2 * y13_1 ) J_w[:, 5, 12] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w13 * x13_1 * x13_2 + 2 * F12 * w13 * x13_2 * y13_1 + 2 * F21 * w13 * x13_1 * y13_2 + 2 * F22 * w13 * y13_1 * y13_2 + 2 * F13 * w13 * x13_2 + 2 * F23 * w13 * y13_2 + 2 * F31 * w13 * x13_1 + 2 * F32 * w13 * y13_1 + 2 * F33 * w13 ) / (F11 * F22 - F12 * F21) + 4 * w13 * ( (F11 * x13_2 + F21 * y13_2 + F31) * x13_1 + (F12 * x13_2 + F22 * y13_2 + F32) * y13_1 + x13_2 * F13 + y13_2 * F23 + F33 ) * y13_2 ) J_w[:, 6, 12] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w13 * x13_1 * x13_2 + 2 * F12 * w13 * x13_2 * y13_1 + 2 * F21 * w13 * x13_1 * y13_2 + 2 * F22 * w13 * y13_1 * y13_2 + 2 * F13 * w13 * x13_2 + 2 * F23 * w13 * y13_2 + 2 * F31 * w13 * x13_1 + 2 * F32 * w13 * y13_1 + 2 * F33 * w13 ) / (F11 * F22 - F12 * F21) + 4 * w13 * ( (F11 * x13_2 + F21 * y13_2 + F31) * x13_1 + (F12 * x13_2 + F22 * y13_2 + F32) * y13_1 + x13_2 * F13 + y13_2 * F23 + F33 ) * x13_1 ) J_w[:, 7, 12] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w13 * x13_1 * x13_2 + 2 * F12 * w13 * x13_2 * y13_1 + 2 * F21 * w13 * x13_1 * y13_2 + 2 * F22 * w13 * y13_1 * y13_2 + 2 * F13 * w13 * x13_2 + 2 * F23 * w13 * y13_2 + 2 * F31 * w13 * x13_1 + 2 * F32 * w13 * y13_1 + 2 * F33 * w13 ) / (F11 * F22 - F12 * F21) + 4 * w13 * ( (F11 * x13_2 + F21 * y13_2 + F31) * x13_1 + (F12 * x13_2 + F22 * y13_2 + F32) * y13_1 + x13_2 * F13 + y13_2 * F23 + F33 ) * y13_1 ) J_w[:, 8, 12] = ( 4 * w13 * ( (F11 * x13_2 + F21 * y13_2 + F31) * x13_1 + (F12 * x13_2 + F22 * y13_2 + F32) * y13_1 + x13_2 * F13 + y13_2 * F23 + F33 ) - 4 * F33 * w13 - 4 * F13 * w13 * x13_2 - 4 * F23 * w13 * y13_2 - 4 * F31 * w13 * x13_1 - 4 * F32 * w13 * y13_1 - 4 * F11 * w13 * x13_1 * x13_2 - 4 * F12 * w13 * x13_2 * y13_1 - 4 * F21 * w13 * x13_1 * y13_2 - 4 * F22 * w13 * y13_1 * y13_2 ) J_w[:, 0, 13] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w14 * x14_1 * x14_2 + 2 * F12 * w14 * x14_2 * y14_1 + 2 * F21 * w14 * x14_1 * y14_2 + 2 * F22 * w14 * y14_1 * y14_2 + 2 * F13 * w14 * x14_2 + 2 * F23 * w14 * y14_2 + 2 * F31 * w14 * x14_1 + 2 * F32 * w14 * y14_1 + 2 * F33 * w14 ) / (F11 * F22 - F12 * F21) + 4 * w14 * ( (F11 * x14_2 + F21 * y14_2 + F31) * x14_1 + (F12 * x14_2 + F22 * y14_2 + F32) * y14_1 + x14_2 * F13 + y14_2 * F23 + F33 ) * x14_2 * x14_1 ) J_w[:, 1, 13] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w14 * x14_1 * x14_2 + 2 * F12 * w14 * x14_2 * y14_1 + 2 * F21 * w14 * x14_1 * y14_2 + 2 * F22 * w14 * y14_1 * y14_2 + 2 * F13 * w14 * x14_2 + 2 * F23 * w14 * y14_2 + 2 * F31 * w14 * x14_1 + 2 * F32 * w14 * y14_1 + 2 * F33 * w14 ) / (F11 * F22 - F12 * F21) + 4 * w14 * ( (F11 * x14_2 + F21 * y14_2 + F31) * x14_1 + (F12 * x14_2 + F22 * y14_2 + F32) * y14_1 + x14_2 * F13 + y14_2 * F23 + F33 ) * x14_2 * y14_1 ) J_w[:, 2, 13] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w14 * x14_1 * x14_2 + 2 * F12 * w14 * x14_2 * y14_1 + 2 * F21 * w14 * x14_1 * y14_2 + 2 * F22 * w14 * y14_1 * y14_2 + 2 * F13 * w14 * x14_2 + 2 * F23 * w14 * y14_2 + 2 * F31 * w14 * x14_1 + 2 * F32 * w14 * y14_1 + 2 * F33 * w14 ) / (F11 * F22 - F12 * F21) + 4 * w14 * ( (F11 * x14_2 + F21 * y14_2 + F31) * x14_1 + (F12 * x14_2 + F22 * y14_2 + F32) * y14_1 + x14_2 * F13 + y14_2 * F23 + F33 ) * x14_2 ) J_w[:, 3, 13] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w14 * x14_1 * x14_2 + 2 * F12 * w14 * x14_2 * y14_1 + 2 * F21 * w14 * x14_1 * y14_2 + 2 * F22 * w14 * y14_1 * y14_2 + 2 * F13 * w14 * x14_2 + 2 * F23 * w14 * y14_2 + 2 * F31 * w14 * x14_1 + 2 * F32 * w14 * y14_1 + 2 * F33 * w14 ) / (F11 * F22 - F12 * F21) + 4 * w14 * ( (F11 * x14_2 + F21 * y14_2 + F31) * x14_1 + (F12 * x14_2 + F22 * y14_2 + F32) * y14_1 + x14_2 * F13 + y14_2 * F23 + F33 ) * y14_2 * x14_1 ) J_w[:, 4, 13] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w14 * x14_1 * x14_2 + 2 * F12 * w14 * x14_2 * y14_1 + 2 * F21 * w14 * x14_1 * y14_2 + 2 * F22 * w14 * y14_1 * y14_2 + 2 * F13 * w14 * x14_2 + 2 * F23 * w14 * y14_2 + 2 * F31 * w14 * x14_1 + 2 * F32 * w14 * y14_1 + 2 * F33 * w14 ) / (F11 * F22 - F12 * F21) + 4 * w14 * ( (F11 * x14_2 + F21 * y14_2 + F31) * x14_1 + (F12 * x14_2 + F22 * y14_2 + F32) * y14_1 + x14_2 * F13 + y14_2 * F23 + F33 ) * y14_2 * y14_1 ) J_w[:, 5, 13] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w14 * x14_1 * x14_2 + 2 * F12 * w14 * x14_2 * y14_1 + 2 * F21 * w14 * x14_1 * y14_2 + 2 * F22 * w14 * y14_1 * y14_2 + 2 * F13 * w14 * x14_2 + 2 * F23 * w14 * y14_2 + 2 * F31 * w14 * x14_1 + 2 * F32 * w14 * y14_1 + 2 * F33 * w14 ) / (F11 * F22 - F12 * F21) + 4 * w14 * ( (F11 * x14_2 + F21 * y14_2 + F31) * x14_1 + (F12 * x14_2 + F22 * y14_2 + F32) * y14_1 + x14_2 * F13 + y14_2 * F23 + F33 ) * y14_2 ) J_w[:, 6, 13] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w14 * x14_1 * x14_2 + 2 * F12 * w14 * x14_2 * y14_1 + 2 * F21 * w14 * x14_1 * y14_2 + 2 * F22 * w14 * y14_1 * y14_2 + 2 * F13 * w14 * x14_2 + 2 * F23 * w14 * y14_2 + 2 * F31 * w14 * x14_1 + 2 * F32 * w14 * y14_1 + 2 * F33 * w14 ) / (F11 * F22 - F12 * F21) + 4 * w14 * ( (F11 * x14_2 + F21 * y14_2 + F31) * x14_1 + (F12 * x14_2 + F22 * y14_2 + F32) * y14_1 + x14_2 * F13 + y14_2 * F23 + F33 ) * x14_1 ) J_w[:, 7, 13] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w14 * x14_1 * x14_2 + 2 * F12 * w14 * x14_2 * y14_1 + 2 * F21 * w14 * x14_1 * y14_2 + 2 * F22 * w14 * y14_1 * y14_2 + 2 * F13 * w14 * x14_2 + 2 * F23 * w14 * y14_2 + 2 * F31 * w14 * x14_1 + 2 * F32 * w14 * y14_1 + 2 * F33 * w14 ) / (F11 * F22 - F12 * F21) + 4 * w14 * ( (F11 * x14_2 + F21 * y14_2 + F31) * x14_1 + (F12 * x14_2 + F22 * y14_2 + F32) * y14_1 + x14_2 * F13 + y14_2 * F23 + F33 ) * y14_1 ) J_w[:, 8, 13] = ( 4 * w14 * ( (F11 * x14_2 + F21 * y14_2 + F31) * x14_1 + (F12 * x14_2 + F22 * y14_2 + F32) * y14_1 + x14_2 * F13 + y14_2 * F23 + F33 ) - 4 * F33 * w14 - 4 * F13 * w14 * x14_2 - 4 * F23 * w14 * y14_2 - 4 * F31 * w14 * x14_1 - 4 * F32 * w14 * y14_1 - 4 * F11 * w14 * x14_1 * x14_2 - 4 * F12 * w14 * x14_2 * y14_1 - 4 * F21 * w14 * x14_1 * y14_2 - 4 * F22 * w14 * y14_1 * y14_2 ) J_w[:, 0, 14] = ( -2 * (F22 * F33 - F23 * F32) * ( 2 * F11 * w15 * x15_1 * x15_2 + 2 * F12 * w15 * x15_2 * y15_1 + 2 * F21 * w15 * x15_1 * y15_2 + 2 * F22 * w15 * y15_1 * y15_2 + 2 * F13 * w15 * x15_2 + 2 * F23 * w15 * y15_2 + 2 * F31 * w15 * x15_1 + 2 * F32 * w15 * y15_1 + 2 * F33 * w15 ) / (F11 * F22 - F12 * F21) + 4 * w15 * ( (F11 * x15_2 + F21 * y15_2 + F31) * x15_1 + (F12 * x15_2 + F22 * y15_2 + F32) * y15_1 + x15_2 * F13 + y15_2 * F23 + F33 ) * x15_2 * x15_1 ) J_w[:, 1, 14] = ( -2 * (-F21 * F33 + F23 * F31) * ( 2 * F11 * w15 * x15_1 * x15_2 + 2 * F12 * w15 * x15_2 * y15_1 + 2 * F21 * w15 * x15_1 * y15_2 + 2 * F22 * w15 * y15_1 * y15_2 + 2 * F13 * w15 * x15_2 + 2 * F23 * w15 * y15_2 + 2 * F31 * w15 * x15_1 + 2 * F32 * w15 * y15_1 + 2 * F33 * w15 ) / (F11 * F22 - F12 * F21) + 4 * w15 * ( (F11 * x15_2 + F21 * y15_2 + F31) * x15_1 + (F12 * x15_2 + F22 * y15_2 + F32) * y15_1 + x15_2 * F13 + y15_2 * F23 + F33 ) * x15_2 * y15_1 ) J_w[:, 2, 14] = ( -2 * (F21 * F32 - F22 * F31) * ( 2 * F11 * w15 * x15_1 * x15_2 + 2 * F12 * w15 * x15_2 * y15_1 + 2 * F21 * w15 * x15_1 * y15_2 + 2 * F22 * w15 * y15_1 * y15_2 + 2 * F13 * w15 * x15_2 + 2 * F23 * w15 * y15_2 + 2 * F31 * w15 * x15_1 + 2 * F32 * w15 * y15_1 + 2 * F33 * w15 ) / (F11 * F22 - F12 * F21) + 4 * w15 * ( (F11 * x15_2 + F21 * y15_2 + F31) * x15_1 + (F12 * x15_2 + F22 * y15_2 + F32) * y15_1 + x15_2 * F13 + y15_2 * F23 + F33 ) * x15_2 ) J_w[:, 3, 14] = ( -2 * (-F12 * F33 + F13 * F32) * ( 2 * F11 * w15 * x15_1 * x15_2 + 2 * F12 * w15 * x15_2 * y15_1 + 2 * F21 * w15 * x15_1 * y15_2 + 2 * F22 * w15 * y15_1 * y15_2 + 2 * F13 * w15 * x15_2 + 2 * F23 * w15 * y15_2 + 2 * F31 * w15 * x15_1 + 2 * F32 * w15 * y15_1 + 2 * F33 * w15 ) / (F11 * F22 - F12 * F21) + 4 * w15 * ( (F11 * x15_2 + F21 * y15_2 + F31) * x15_1 + (F12 * x15_2 + F22 * y15_2 + F32) * y15_1 + x15_2 * F13 + y15_2 * F23 + F33 ) * y15_2 * x15_1 ) J_w[:, 4, 14] = ( -2 * (F11 * F33 - F13 * F31) * ( 2 * F11 * w15 * x15_1 * x15_2 + 2 * F12 * w15 * x15_2 * y15_1 + 2 * F21 * w15 * x15_1 * y15_2 + 2 * F22 * w15 * y15_1 * y15_2 + 2 * F13 * w15 * x15_2 + 2 * F23 * w15 * y15_2 + 2 * F31 * w15 * x15_1 + 2 * F32 * w15 * y15_1 + 2 * F33 * w15 ) / (F11 * F22 - F12 * F21) + 4 * w15 * ( (F11 * x15_2 + F21 * y15_2 + F31) * x15_1 + (F12 * x15_2 + F22 * y15_2 + F32) * y15_1 + x15_2 * F13 + y15_2 * F23 + F33 ) * y15_2 * y15_1 ) J_w[:, 5, 14] = ( -2 * (-F11 * F32 + F12 * F31) * ( 2 * F11 * w15 * x15_1 * x15_2 + 2 * F12 * w15 * x15_2 * y15_1 + 2 * F21 * w15 * x15_1 * y15_2 + 2 * F22 * w15 * y15_1 * y15_2 + 2 * F13 * w15 * x15_2 + 2 * F23 * w15 * y15_2 + 2 * F31 * w15 * x15_1 + 2 * F32 * w15 * y15_1 + 2 * F33 * w15 ) / (F11 * F22 - F12 * F21) + 4 * w15 * ( (F11 * x15_2 + F21 * y15_2 + F31) * x15_1 + (F12 * x15_2 + F22 * y15_2 + F32) * y15_1 + x15_2 * F13 + y15_2 * F23 + F33 ) * y15_2 ) J_w[:, 6, 14] = ( -2 * (F12 * F23 - F13 * F22) * ( 2 * F11 * w15 * x15_1 * x15_2 + 2 * F12 * w15 * x15_2 * y15_1 + 2 * F21 * w15 * x15_1 * y15_2 + 2 * F22 * w15 * y15_1 * y15_2 + 2 * F13 * w15 * x15_2 + 2 * F23 * w15 * y15_2 + 2 * F31 * w15 * x15_1 + 2 * F32 * w15 * y15_1 + 2 * F33 * w15 ) / (F11 * F22 - F12 * F21) + 4 * w15 * ( (F11 * x15_2 + F21 * y15_2 + F31) * x15_1 + (F12 * x15_2 + F22 * y15_2 + F32) * y15_1 + x15_2 * F13 + y15_2 * F23 + F33 ) * x15_1 ) J_w[:, 7, 14] = ( -2 * (-F11 * F23 + F13 * F21) * ( 2 * F11 * w15 * x15_1 * x15_2 + 2 * F12 * w15 * x15_2 * y15_1 + 2 * F21 * w15 * x15_1 * y15_2 + 2 * F22 * w15 * y15_1 * y15_2 + 2 * F13 * w15 * x15_2 + 2 * F23 * w15 * y15_2 + 2 * F31 * w15 * x15_1 + 2 * F32 * w15 * y15_1 + 2 * F33 * w15 ) / (F11 * F22 - F12 * F21) + 4 * w15 * ( (F11 * x15_2 + F21 * y15_2 + F31) * x15_1 + (F12 * x15_2 + F22 * y15_2 + F32) * y15_1 + x15_2 * F13 + y15_2 * F23 + F33 ) * y15_1 ) J_w[:, 8, 14] = ( 4 * w15 * ( (F11 * x15_2 + F21 * y15_2 + F31) * x15_1 + (F12 * x15_2 + F22 * y15_2 + F32) * y15_1 + x15_2 * F13 + y15_2 * F23 + F33 ) - 4 * F33 * w15 - 4 * F13 * w15 * x15_2 - 4 * F23 * w15 * y15_2 - 4 * F31 * w15 * x15_1 - 4 * F32 * w15 * y15_1 - 4 * F11 * w15 * x15_1 * x15_2 - 4 * F12 * w15 * x15_2 * y15_1 - 4 * F21 * w15 * x15_1 * y15_2 - 4 * F22 * w15 * y15_1 * y15_2 ) J_Fw = torch.zeros((b, 9, 15), device=F.device) tmp = torch.eye(9, 9, dtype=torch.float, device=F.device) for i in range(b): try: J_Fw[i, :, :] = -torch.inverse(J_F[i, :, :].double()).mm( J_w[i, :, :].double() ) tmp = J_R[i, :, :] except Exception as e: J_Fw[i, :, :] = -torch.inverse(tmp).mm(J_w[i, :, :]) return J_Fw
488,776
Python
.py
15,261
20.190486
84
0.310999
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,694
losses.py
disungatullina_MinBackProp/toy_examples/fundamental/losses.py
import torch def frobenius_norm(F_true, F): """Squared Frobenius norm of matrices' difference""" return ((F - F_true) ** 2).sum(dim=(-2, -1))
152
Python
.py
4
34.5
56
0.643836
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,695
datasets.py
disungatullina_MinBackProp/toy_examples/rotation/datasets.py
import torch def create_toy_dataset(): p1 = torch.Tensor([1, 0, 0]).unsqueeze(0) p2 = torch.Tensor([0.0472, 0.9299, 0.7934]).unsqueeze(0) p3 = torch.Tensor([0.7017, 0.1494, 0.7984]).unsqueeze(0) p4 = torch.Tensor([0.6007, 0.8878, 0.9169]).unsqueeze(0) P = torch.cat([p1, p2, p3, p4], dim=0).permute(1, 0).unsqueeze(0) # 1 x 3 x 4 q1 = torch.Tensor([0.9, 0.1, 0.0]).unsqueeze(0) q2 = torch.Tensor([0.0472, 0.9299, 0.7934]).unsqueeze(0) q3 = torch.Tensor([0.7017, 0.1494, 0.7984]).unsqueeze(0) q4 = torch.Tensor([0.6007, 0.8878, 0.9169]).unsqueeze(0) Q = torch.cat([q1, q2, q3, q4], dim=0).permute(1, 0).unsqueeze(0) # 1 x 3 x 4 R_true = torch.eye(3, dtype=torch.float).unsqueeze(0) # 1 x 3 x 3 return P, Q, R_true def get_dataset(): return create_toy_dataset()
822
Python
.py
16
46.6875
82
0.619524
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,696
nodes.py
disungatullina_MinBackProp/toy_examples/rotation/nodes.py
import torch import torch.nn as nn from ddn.ddn.pytorch.node import * ############ DDN with constraint ############ class RigitNodeConstraint(EqConstDeclarativeNode): """Declarative Rigit node with R^T R = I constraint""" def __init__(self): super().__init__() def objective(self, A, B, w, y): """ A : b x 3 x N B : b x 3 x N y : b x 3 x 3 w : b x N """ w = torch.nn.functional.relu(w) error = torch.sum((y.bmm(A) - B) ** 2, dim=1) return torch.einsum("bn,bn->b", (w**2, error)) def equality_constraints(self, A, B, w, y): eye = torch.eye(y.shape[1]) eye = eye.reshape((1, y.shape[1], y.shape[2])) eyes = eye.repeat(y.shape[0], 1, 1) constraint = (y.bmm(y.permute(0, 2, 1)) - eyes) ** 2 return constraint.sum(-1).sum(-1) def solve(self, A, B, w): w = torch.nn.functional.relu(w) A = A.detach() B = B.detach() w = w.detach() y = self.__solve(A, B, w).requires_grad_() return y.detach(), None def __solve(self, A, B, w): out_batch = [] for batch in range(w.size(0)): W = torch.diag(w[batch]) B_W = B[batch].mm(W) A_W = A[batch].mm(W) M = B_W.mm(A_W.permute(1, 0)) U, _, Vh = torch.linalg.svd(M) R = U.mm(Vh) det = torch.linalg.det(R) if det < 0: Vh[:, 2] *= -1 R = U.mm(Vh) out_batch.append(R.unsqueeze(0)) R = torch.cat(out_batch, 0) return R ############ SVD Layer ############ def SVDLayer(A, B, w): w = torch.nn.functional.relu(w) out_batch = [] for batch in range(w.size(0)): W = torch.diag(w[batch]) B_W = B[batch].mm(W) A_W = A[batch].mm(W) M = B_W.mm(A_W.permute(1, 0)) U, _, Vh = torch.linalg.svd(M) R = U.mm(Vh) det = torch.linalg.det(R) if det < 0: Vh_ = Vh.clone() Vh_[:, 2] *= -1 R = U.mm(Vh_) out_batch.append(R.unsqueeze(0)) R = torch.cat(out_batch, 0) return R ############ IFT function ############ class IFTFunction(torch.autograd.Function): @staticmethod def forward(A, B, w): """ A : b x 3 x N B : b x 3 x N w : b x N """ w = torch.nn.functional.relu(w) out_batch = [] for batch in range(w.size(0)): W = torch.diag(w[batch]) B_W = B[batch].mm(W) A_W = A[batch].mm(W) M = B_W.mm(A_W.permute(1, 0)) U, _, Vh = torch.linalg.svd(M) R = U.mm(Vh) det = torch.linalg.det(R) if det < 0: Vh_ = Vh.clone() Vh_[:, 2] *= -1 R = U.mm(Vh_) out_batch.append(R.unsqueeze(0)) R = torch.cat(out_batch, 0) return R @staticmethod def setup_context(ctx, inputs, output): A, B, w = inputs ctx.save_for_backward(A, B, w, output) @staticmethod def backward(ctx, grad_output): """ A : b x 3 x N B : b x 3 x N w : b x N """ A, B, w, output = ctx.saved_tensors # output: b x 3 x 3 grad_A = grad_B = None b = grad_output.shape[0] w = torch.nn.functional.relu(w) # R: b x 3 x 3; w: b x 4; J_Rw: b x 9 x 4; grad_output: b x 3 x 3 J_Rw = compute_jacobians(output, w, A, B) # b x 9 x 4 J_Rw = torch.einsum("bi,bij->bj", grad_output.view(b, 9), J_Rw) grad_w = J_Rw.view(b, 4) return None, None, grad_w class IFTLayer(nn.Module): def __init__(self): super().__init__() def forward(self, A, B, w): return IFTFunction.apply(A, B, w) def compute_jacobians(R, w, A, B): """ E : b x 3 x 3 w : b x 4 A : b x 3 x 4 B : b x 3 x 4 """ b = R.shape[0] R11 = R[:, 0, 0] R12 = R[:, 0, 1] R13 = R[:, 0, 2] R21 = R[:, 1, 0] R22 = R[:, 1, 1] R23 = R[:, 1, 2] R31 = R[:, 2, 0] R32 = R[:, 2, 1] R33 = R[:, 2, 2] x11 = A[:, 0, 0] x12 = A[:, 1, 0] x13 = A[:, 2, 0] x21 = A[:, 0, 1] x22 = A[:, 1, 1] x23 = A[:, 2, 1] x31 = A[:, 0, 2] x32 = A[:, 1, 2] x33 = A[:, 2, 2] x41 = A[:, 0, 3] x42 = A[:, 1, 3] x43 = A[:, 2, 3] y11 = B[:, 0, 0] y12 = B[:, 1, 0] y13 = B[:, 2, 0] y21 = B[:, 0, 1] y22 = B[:, 1, 1] y23 = B[:, 2, 1] y31 = B[:, 0, 2] y32 = B[:, 1, 2] y33 = B[:, 2, 2] y41 = B[:, 0, 3] y42 = B[:, 1, 3] y43 = B[:, 2, 3] w1 = w[:, 0] w2 = w[:, 1] w3 = w[:, 2] w4 = w[:, 3] J_R = torch.zeros((b, 9, 9), device=R.device) # R11 denom_r = 2 * ( R11**2 * R31 + R11 * R12 * R32 + R11 * R13 * R33 + R21**2 * R31 + R21 * R22 * R32 + R21 * R23 * R33 + R31**3 + R31 * R32**2 + R31 * R33**2 - R31 ) const_r = ( R31 * w1**2 * x11**2 + R31 * w2**2 * x21**2 + R31 * w3**2 * x31**2 + R31 * w4**2 * x41**2 + R32 * w1**2 * x11 * x12 + R32 * w2**2 * x21 * x22 + R32 * w3**2 * x31 * x32 + R32 * w4**2 * x41 * x42 + R33 * w1**2 * x11 * x13 + R33 * w2**2 * x21 * x23 + R33 * w3**2 * x31 * x33 + R33 * w4**2 * x41 * x43 - w1**2 * x11 * y13 - w2**2 * x21 * y23 - w3**2 * x31 * y33 - w4**2 * x41 * y43 ) J_R[:, 0, 0] = ( -1 / denom_r * ( 12 * R11**2 + 4 * R12**2 + 4 * R13**2 + 4 * R21**2 + 4 * R31**2 - 4 ) * const_r + 1 / denom_r**2 * ( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * const_r * (4 * R11 * R31 + 2 * R12 * R32 + 2 * R13 * R33) ) + 2 * w1**2 * x11**2 + 2 * w2**2 * x21**2 + 2 * w3**2 * x31**2 + 2 * w4**2 * x41**2 ) J_R[:, 1, 0] = ( -1 / denom_r * ((8 * R11 * R12 + 4 * R21 * R22 + 4 * R31 * R32) * const_r) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * const_r * (4 * R11 * R31 + 2 * R12 * R32 + 2 * R13 * R33) ) + 2 * w1**2 * x11 * x12 + 2 * w2**2 * x21 * x22 + 2 * w3**2 * x31 * x32 + 2 * w4**2 * x41 * x42 ) J_R[:, 2, 0] = ( -1 / denom_r * ((8 * R11 * R13 + 4 * R21 * R23 + 4 * R31 * R33) * const_r) + 1 / denom_r**2 * ( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * const_r * (4 * R11 * R31 + 2 * R12 * R32 + 2 * R13 * R33) ) + 2 * w1**2 * x11 * x13 + 2 * w2**2 * x21 * x23 + 2 * w3**2 * x31 * x33 + 2 * w4**2 * x41 * x43 ) J_R[:, 3, 0] = -1 / denom_r * ( (8 * R11 * R21 + 4 * R12 * R22 + 4 * R13 * R23) * const_r ) + 1 / denom_r**2 * ( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * const_r * (4 * R11 * R31 + 2 * R12 * R32 + 2 * R13 * R33) ) J_R[:, 4, 0] = -1 / denom_r * (4 * R12 * R21 * const_r) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * const_r * (4 * R11 * R31 + 2 * R12 * R32 + 2 * R13 * R33) ) J_R[:, 5, 0] = -1 / denom_r * (4 * R13 * R21 * const_r) + 1 / denom_r**2 * ( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * const_r * (4 * R11 * R31 + 2 * R12 * R32 + 2 * R13 * R33) ) J_R[:, 6, 0] = -1 / denom_r * ( (8 * R11 * R31 + 4 * R12 * R32 + 4 * R13 * R33) * const_r ) + 1 / denom_r**2 * ( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * const_r * (4 * R11 * R31 + 2 * R12 * R32 + 2 * R13 * R33) ) J_R[:, 7, 0] = -1 / denom_r * ((4 * R12 * R31) * const_r) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * const_r * (4 * R11 * R31 + 2 * R12 * R32 + 2 * R13 * R33) ) J_R[:, 8, 0] = ( -4 * R13 * R31 * const_r / denom_r + ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * const_r * (4 * R11 * R31 + 2 * R12 * R32 + 2 * R13 * R33) / denom_r**2 ) # R12 J_R[:, 0, 1] = ( -1 / denom_r * ((8 * R11 * R12 + 4 * R21 * R22 + 4 * R31 * R32) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * const_r * (R11 * R32) ) + 2 * w1**2 * x11 * x12 + 2 * w2**2 * x21 * x22 + 2 * w3**2 * x31 * x32 + 2 * w4**2 * x41 * x42 ) J_R[:, 1, 1] = ( -1 / denom_r * ( ( 4 * R11**2 + 12 * R12**2 + 4 * R13**2 + 4 * R22**2 + 4 * R32**2 - 4 ) * const_r ) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * const_r * (R11 * R32) ) + 2 * w1**2 * x12**2 + 2 * w2**2 * x22**2 + 2 * w3**2 * x32**2 + 2 * w4**2 * x42**2 ) J_R[:, 2, 1] = ( -1 / denom_r * ((8 * R12 * R13 + 4 * R22 * R23 + 4 * R32 * R33) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * const_r * (R11 * R32) ) + 2 * w1**2 * x12 * x13 + 2 * w2**2 * x22 * x23 + 2 * w3**2 * x32 * x33 + 2 * w4**2 * x42 * x43 ) J_R[:, 3, 1] = -1 / denom_r * ((4 * R11 * R22) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * const_r * (R11 * R32) ) J_R[:, 4, 1] = -1 / denom_r * ( (4 * R11 * R21 + 8 * R12 * R22 + 4 * R13 * R23) * const_r ) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * const_r * (R11 * R32) ) J_R[:, 5, 1] = -1 / denom_r * ((4 * R13 * R22) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * const_r * (R11 * R32) ) J_R[:, 6, 1] = -1 / denom_r * ((4 * R11 * R32) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * const_r * (R11 * R32) ) J_R[:, 7, 1] = -1 / denom_r * ( (4 * R11 * R31 + 8 * R12 * R32 + 4 * R13 * R33) * const_r ) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * const_r * (R11 * R32) ) J_R[:, 8, 1] = -1 / denom_r * ((4 * R13 * R32) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * const_r * (R11 * R32) ) # R13 J_R[:, 0, 2] = ( -1 / denom_r * ((8 * R11 * R13 + 4 * R21 * R23 + 4 * R31 * R33) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * const_r * (R11 * R33) ) + 2 * w1**2 * x11 * x13 + 2 * w2**2 * x21 * x23 + 2 * w3**2 * x31 * x33 + 2 * w4**2 * x41 * x43 ) J_R[:, 1, 2] = ( -1 / denom_r * ((8 * R12 * R13 + 4 * R22 * R23 + 4 * R32 * R33) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * const_r * (R11 * R33) ) + 2 * w1**2 * x12 * x13 + 2 * w2**2 * x22 * x23 + 2 * w3**2 * x32 * x33 + 2 * w4**2 * x42 * x43 ) J_R[:, 2, 2] = ( -1 / denom_r * ( ( 4 * R11**2 + 4 * R12**2 + 12 * R13**2 + 4 * R23**2 + 4 * R33**2 - 4 ) * const_r ) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * const_r * (R11 * R33) ) + 2 * w1**2 * x13**2 + 2 * w2**2 * x23**2 + 2 * w3**2 * x33**2 + 2 * w4**2 * x43**2 ) J_R[:, 3, 2] = -1 / denom_r * ((4 * R11 * R23) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * const_r * (R11 * R33) ) J_R[:, 4, 2] = -1 / denom_r * ((4 * R12 * R23) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * const_r * (R11 * R33) ) J_R[:, 5, 2] = -1 / denom_r * ( (4 * R11 * R21 + 4 * R12 * R22 + 8 * R13 * R23) * const_r ) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * const_r * (R11 * R33) ) J_R[:, 6, 2] = -1 / denom_r * ((4 * R11 * R33) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * const_r * (R11 * R33) ) J_R[:, 7, 2] = -1 / denom_r * ((4 * R12 * R33) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * const_r * (R11 * R33) ) J_R[:, 8, 2] = -1 / denom_r * ( (4 * R11 * R31 + 4 * R12 * R32 + 8 * R13 * R33) * const_r ) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * const_r * (R11 * R33) ) # # R21 J_R[:, 0, 3] = -1 / denom_r * ( (8 * R11 * R21 + 4 * R12 * R22 + 4 * R13 * R23) * const_r ) + 1 / denom_r**2 * ( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * const_r * (4 * R21 * R31 + 2 * R22 * R32 + 2 * R23 * R33) ) J_R[:, 1, 3] = -1 / denom_r * ((4 * R11 * R22) * const_r) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * const_r * (4 * R21 * R31 + 2 * R22 * R32 + 2 * R23 * R33) ) J_R[:, 2, 3] = -1 / denom_r * ((4 * R23 * R11) * const_r) + 1 / denom_r**2 * ( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * const_r * (4 * R21 * R31 + 2 * R22 * R32 + 2 * R23 * R33) ) J_R[:, 3, 3] = ( -1 / denom_r * ( ( 4 * R11**2 + 12 * R21**2 + 4 * R22**2 + 4 * R23**2 + 4 * R31**2 - 4 ) * const_r ) + 1 / denom_r**2 * ( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * const_r * (4 * R21 * R31 + 2 * R22 * R32 + 2 * R23 * R33) ) + 2 * w1**2 * x11**2 + 2 * w2**2 * x21**2 + 2 * w3**2 * x31**2 + 2 * w4**2 * x41**2 ) J_R[:, 4, 3] = ( -1 / denom_r * ((4 * R11 * R12 + 8 * R21 * R22 + 4 * R31 * R32) * const_r) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * const_r * (4 * R21 * R31 + 2 * R22 * R32 + 2 * R23 * R33) ) + 2 * w1**2 * x11 * x12 + 2 * w2**2 * x21 * x22 + 2 * w3**2 * x31 * x32 + 2 * w4**2 * x41 * x42 ) J_R[:, 5, 3] = ( -1 / denom_r * ((4 * R11 * R13 + 8 * R21 * R23 + 4 * R31 * R33) * const_r) + 1 / denom_r**2 * ( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * const_r * (4 * R21 * R31 + 2 * R22 * R32 + 2 * R23 * R33) ) + 2 * w1**2 * x11 * x13 + 2 * w2**2 * x21 * x23 + 2 * w3**2 * x31 * x33 + 2 * w4**2 * x41 * x43 ) J_R[:, 6, 3] = -1 / denom_r * ( (8 * R21 * R31 + 4 * R22 * R32 + 4 * R23 * R33) * const_r ) + 1 / denom_r**2 * ( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * const_r * (4 * R21 * R31 + 2 * R22 * R32 + 2 * R23 * R33) ) J_R[:, 7, 3] = -1 / denom_r * ((4 * R22 * R31) * const_r) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * const_r * (4 * R21 * R31 + 2 * R22 * R32 + 2 * R23 * R33) ) J_R[:, 8, 3] = -1 / denom_r * ((4 * R23 * R31) * const_r) + 1 / denom_r**2 * ( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * const_r * (4 * R21 * R31 + 2 * R22 * R32 + 2 * R23 * R33) ) # R22 J_R[:, 0, 4] = -1 / denom_r * ((4 * R12 * R21) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * const_r * (R21 * R32) ) J_R[:, 1, 4] = -1 / denom_r * ( (4 * R11 * R21 + 8 * R12 * R22 + 4 * R13 * R23) * const_r ) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * const_r * (R21 * R32) ) J_R[:, 2, 4] = -1 / denom_r * ((4 * R12 * R23) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * const_r * (R21 * R32) ) J_R[:, 3, 4] = ( -1 / denom_r * ((4 * R11 * R12 + 8 * R21 * R22 + 4 * R31 * R32) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * const_r * (R21 * R32) ) + 2 * w1**2 * x11 * x12 + 2 * w2**2 * x21 * x22 + 2 * w3**2 * x31 * x32 + 2 * w4**2 * x41 * x42 ) J_R[:, 4, 4] = ( -1 / denom_r * ( ( 4 * R12**2 + 4 * R21**2 + 12 * R22**2 + 4 * R23**2 + 4 * R32**2 - 4 ) * const_r ) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * const_r * (R21 * R32) ) + 2 * w1**2 * x12**2 + 2 * w2**2 * x22**2 + 2 * w3**2 * x32**2 + 2 * w4**2 * x42**2 ) J_R[:, 5, 4] = ( -1 / denom_r * ((4 * R12 * R13 + 8 * R22 * R23 + 4 * R32 * R33) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * const_r * (R21 * R32) ) + 2 * w1**2 * x12 * x13 + 2 * w2**2 * x22 * x23 + 2 * w3**2 * x32 * x33 + 2 * w4**2 * x42 * x43 ) J_R[:, 6, 4] = -1 / denom_r * ((4 * R21 * R32) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * const_r * (R21 * R32) ) J_R[:, 7, 4] = -1 / denom_r * ( (4 * R21 * R31 + 8 * R22 * R32 + 4 * R23 * R33) * const_r ) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * const_r * (R21 * R32) ) J_R[:, 8, 4] = -1 / denom_r * ((4 * R23 * R32) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * const_r * (R21 * R32) ) # R23 J_R[:, 0, 5] = -1 / denom_r * ((4 * R13 * R21) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * const_r * (R21 * R33) ) J_R[:, 1, 5] = -1 / denom_r * ((4 * R13 * R22) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * const_r * (R21 * R33) ) J_R[:, 2, 5] = -1 / denom_r * ( (4 * R11 * R21 + 4 * R12 * R22 + 8 * R13 * R23) * const_r ) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * const_r * (R21 * R33) ) J_R[:, 3, 5] = ( -1 / denom_r * ((4 * R11 * R13 + 8 * R21 * R23 + 4 * R31 * R33) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * const_r * (R21 * R33) ) + 2 * w1**2 * x11 * x13 + 2 * w2**2 * x21 * x23 + 2 * w3**2 * x31 * x33 + 2 * w4**2 * x41 * x43 ) J_R[:, 4, 5] = ( -1 / denom_r * ((4 * R12 * R13 + 8 * R22 * R23 + 4 * R32 * R33) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * const_r * (R21 * R33) ) + 2 * w1**2 * x12 * x13 + 2 * w2**2 * x22 * x23 + 2 * w3**2 * x32 * x33 + 2 * w4**2 * x42 * x43 ) J_R[:, 5, 5] = ( -1 / denom_r * ( ( 4 * R13**2 + 4 * R21**2 + 4 * R22**2 + 12 * R23**2 + 4 * R33**2 - 4 ) * const_r ) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * const_r * (R21 * R33) ) + 2 * w1**2 * x13**2 + 2 * w2**2 * x23**2 + 2 * w3**2 * x33**2 + 2 * w4**2 * x43**2 ) J_R[:, 6, 5] = -1 / denom_r * ((4 * R21 * R33) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * const_r * (R21 * R33) ) J_R[:, 7, 5] = -1 / denom_r * ((4 * R22 * R33) * const_r) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * const_r * (R21 * R33) ) J_R[:, 8, 5] = -1 / denom_r * ( (4 * R21 * R31 + 4 * R22 * R32 + 8 * R23 * R33) * const_r ) + 1 / denom_r**2 * ( 2 * ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * const_r * (R21 * R33) ) # R31 J_R[:, 0, 6] = -1 / denom_r * ( (8 * R11 * R31 + 4 * R12 * R32 + 4 * R13 * R33) * const_r - ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * ( w1**2 * x11**2 + w2**2 * x21**2 + w3**2 * x31**2 + w4**2 * x41**2 ) ) + 1 / denom_r**2 * ( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * const_r * (2 * R11**2 + 2 * R21**2 + 6 * R31**2 + 2 * R32**2 + 2 * R33**2 - 2) ) J_R[:, 1, 6] = -1 / denom_r * ( (4 * R11 * R32) * const_r - ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * ( w1**2 * x11**2 + w2**2 * x21**2 + w3**2 * x31**2 + w4**2 * x41**2 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * const_r * (2 * R11**2 + 2 * R21**2 + 6 * R31**2 + 2 * R32**2 + 2 * R33**2 - 2) ) J_R[:, 2, 6] = -1 / denom_r * ( (4 * R11 * R33) * const_r - ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * ( w1**2 * x11**2 + w2**2 * x21**2 + w3**2 * x31**2 + w4**2 * x41**2 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * const_r * (2 * R11**2 + 2 * R21**2 + 6 * R31**2 + 2 * R32**2 + 2 * R33**2 - 2) ) J_R[:, 3, 6] = -1 / denom_r * ( (8 * R21 * R31 + 4 * R22 * R32 + 4 * R23 * R33) * const_r - ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * ( w1**2 * x11**2 + w2**2 * x21**2 + w3**2 * x31**2 + w4**2 * x41**2 ) ) + 1 / denom_r**2 * ( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * const_r * (2 * R11**2 + 2 * R21**2 + 6 * R31**2 + 2 * R32**2 + 2 * R33**2 - 2) ) J_R[:, 4, 6] = -1 / denom_r * ( (4 * R21 * R32) * const_r - ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * ( w1**2 * x11**2 + w2**2 * x21**2 + w3**2 * x31**2 + w4**2 * x41**2 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * const_r * (2 * R11**2 + 2 * R21**2 + 6 * R31**2 + 2 * R32**2 + 2 * R33**2 - 2) ) J_R[:, 5, 6] = -1 / denom_r * ( (4 * R21 * R33) * const_r - ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * ( w1**2 * x11**2 + w2**2 * x21**2 + w3**2 * x31**2 + w4**2 * x41**2 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * const_r * (2 * R11**2 + 2 * R21**2 + 6 * R31**2 + 2 * R32**2 + 2 * R33**2 - 2) ) J_R[:, 6, 6] = ( -1 / denom_r * ( ( 4 * R11**2 + 4 * R21**2 + 12 * R31**2 + 4 * R32**2 + 4 * R33**2 - 4 ) * const_r - ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * ( w1**2 * x11**2 + w2**2 * x21**2 + w3**2 * x31**2 + w4**2 * x41**2 ) ) + 1 / denom_r**2 * ( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * const_r * ( 2 * R11**2 + 2 * R21**2 + 6 * R31**2 + 2 * R32**2 + 2 * R33**2 - 2 ) ) + 2 * w1**2 * x11**2 + 2 * w2**2 * x21**2 + 2 * w3**2 * x31**2 + 2 * w4**2 * x41**2 ) J_R[:, 7, 6] = ( -1 / denom_r * ( (4 * R11 * R12 + 4 * R21 * R22 + 8 * R31 * R32) * const_r - ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * ( w1**2 * x11**2 + w2**2 * x21**2 + w3**2 * x31**2 + w4**2 * x41**2 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * const_r * ( 2 * R11**2 + 2 * R21**2 + 6 * R31**2 + 2 * R32**2 + 2 * R33**2 - 2 ) ) + 2 * w1**2 * x11 * x12 + 2 * w2**2 * x21 * x22 + 2 * w3**2 * x31 * x32 + 2 * w4**2 * x41 * x42 ) J_R[:, 8, 6] = ( -1 / denom_r * ( (4 * R11 * R13 + 4 * R21 * R23 + 8 * R31 * R33) * const_r - ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * ( w1**2 * x11**2 + w2**2 * x21**2 + w3**2 * x31**2 + w4**2 * x41**2 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * const_r * ( 2 * R11**2 + 2 * R21**2 + 6 * R31**2 + 2 * R32**2 + 2 * R33**2 - 2 ) ) + 2 * w1**2 * x11 * x13 + 2 * w2**2 * x21 * x23 + 2 * w3**2 * x31 * x33 + 2 * w4**2 * x41 * x43 ) # R32 J_R[:, 0, 7] = -1 / denom_r * ( (4 * R12 * R31) * const_r - ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 ) ) + 1 / denom_r**2 * ( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * const_r * (2 * R11 * R12 + 2 * R21 * R22 + 4 * R31 * R32) ) J_R[:, 1, 7] = -1 / denom_r * ( (4 * R11 * R31 + 8 * R12 * R32 + 4 * R13 * R33) * const_r - ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * const_r * (2 * R11 * R12 + 2 * R21 * R22 + 4 * R31 * R32) ) J_R[:, 2, 7] = -1 / denom_r * ( (4 * R12 * R33) * const_r - ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * const_r * (2 * R11 * R12 + 2 * R21 * R22 + 4 * R31 * R32) ) J_R[:, 3, 7] = -1 / denom_r * ( (4 * R22 * R31) * const_r - ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 ) ) + 1 / denom_r**2 * ( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * const_r * (2 * R11 * R12 + 2 * R21 * R22 + 4 * R31 * R32) ) J_R[:, 4, 7] = -1 / denom_r * ( (4 * R21 * R31 + 8 * R22 * R32 + 4 * R23 * R33) * const_r - ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * const_r * (2 * R11 * R12 + 2 * R21 * R22 + 4 * R31 * R32) ) J_R[:, 5, 7] = -1 / denom_r * ( (4 * R22 * R33) * const_r - ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * const_r * (2 * R11 * R12 + 2 * R21 * R22 + 4 * R31 * R32) ) J_R[:, 6, 7] = ( -1 / denom_r * ( (4 * R11 * R12 + 4 * R21 * R22 + 8 * R31 * R32) * const_r - ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 ) ) + 1 / denom_r**2 * ( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * const_r * (2 * R11 * R12 + 2 * R21 * R22 + 4 * R31 * R32) ) + 2 * w1**2 * x11 * x12 + 2 * w2**2 * x21 * x22 + 2 * w3**2 * x31 * x32 + 2 * w4**2 * x41 * x42 ) J_R[:, 7, 7] = ( -1 / denom_r * ( ( 4 * R12**2 + 4 * R22**2 + 4 * R31**2 + 12 * R32**2 + 4 * R33**2 - 4 ) * const_r - ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * const_r * (2 * R11 * R12 + 2 * R21 * R22 + 4 * R31 * R32) ) + 2 * w1**2 * x12**2 + 2 * w2**2 * x22**2 + 2 * w3**2 * x32**2 + 2 * w4**2 * x42**2 ) J_R[:, 8, 7] = ( -1 / denom_r * ( (4 * R12 * R13 + 4 * R22 * R23 + 8 * R32 * R33) * const_r - ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * ( w1**2 * x11 * x12 + w2**2 * x21 * x22 + w3**2 * x31 * x32 + w4**2 * x41 * x42 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * const_r * (2 * R11 * R12 + 2 * R21 * R22 + 4 * R31 * R32) ) + 2 * w1**2 * x12 * x13 + 2 * w2**2 * x22 * x23 + 2 * w3**2 * x32 * x33 + 2 * w4**2 * x42 * x43 ) # R33 J_R[:, 0, 8] = ( -4 * R13 * R31 * const_r / denom_r - 4 * ( (R11**2 + R21**2 + R31**2 - 1) * R11 + (R11 * R12 + R21 * R22 + R31 * R32) * R12 + (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * ( w1**2 * x11 * x13 + w2**2 * x21 * x23 + w3**2 * x31 * x33 + w4**2 * x41 * x43 ) / denom_r + ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * const_r * (2 * R11 * R13 + 2 * R21 * R23 + 4 * R31 * R33) / denom_r**2 ) J_R[:, 1, 8] = -1 / denom_r * ( (4 * R13 * R32) * const_r - ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * ( w1**2 * x11 * x13 + w2**2 * x21 * x23 + w3**2 * x31 * x33 + w4**2 * x41 * x43 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * const_r * (2 * R11 * R13 + 2 * R21 * R23 + 4 * R31 * R33) ) J_R[:, 2, 8] = -1 / denom_r * ( (4 * R11 * R31 + 4 * R12 * R32 + 8 * R13 * R33) * const_r - ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * ( w1**2 * x11 * x13 + w2**2 * x21 * x23 + w3**2 * x31 * x33 + w4**2 * x41 * x43 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * const_r * (2 * R11 * R13 + 2 * R21 * R23 + 4 * R31 * R33) ) J_R[:, 3, 8] = -1 / denom_r * ( (4 * R23 * R31) * const_r - ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * ( w1**2 * x11 * x13 + w2**2 * x21 * x23 + w3**2 * x31 * x33 + w4**2 * x41 * x43 ) ) + 1 / denom_r**2 * ( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * const_r * (2 * R11 * R13 + 2 * R21 * R23 + 4 * R31 * R33) ) J_R[:, 4, 8] = -1 / denom_r * ( (4 * R23 * R32) * const_r - ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * ( w1**2 * x11 * x13 + w2**2 * x21 * x23 + w3**2 * x31 * x33 + w4**2 * x41 * x43 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * const_r * (2 * R11 * R13 + 2 * R21 * R23 + 4 * R31 * R33) ) J_R[:, 5, 8] = -1 / denom_r * ( (4 * R21 * R31 + 4 * R22 * R32 + 8 * R23 * R33) * const_r - ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * ( w1**2 * x11 * x13 + w2**2 * x21 * x23 + w3**2 * x31 * x33 + w4**2 * x41 * x43 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * const_r * (2 * R11 * R13 + 2 * R21 * R23 + 4 * R31 * R33) ) J_R[:, 6, 8] = ( -1 / denom_r * ( (4 * R11 * R13 + 4 * R21 * R23 + 8 * R31 * R33) * const_r - ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * ( w1**2 * x11 * x13 + w2**2 * x21 * x23 + w3**2 * x31 * x33 + w4**2 * x41 * x43 ) ) + 1 / denom_r**2 * ( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * const_r * (2 * R11 * R13 + 2 * R21 * R23 + 4 * R31 * R33) ) + 2 * w1**2 * x11 * x13 + 2 * w2**2 * x21 * x23 + 2 * w3**2 * x31 * x33 + 2 * w4**2 * x41 * x43 ) J_R[:, 7, 8] = ( -1 / denom_r * ( (4 * R12 * R13 + 4 * R22 * R23 + 8 * R32 * R33) * const_r - ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * ( w1**2 * x11 * x13 + w2**2 * x21 * x23 + w3**2 * x31 * x33 + w4**2 * x41 * x43 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * const_r * (2 * R11 * R13 + 2 * R21 * R23 + 4 * R31 * R33) ) + 2 * w1**2 * x12 * x13 + 2 * w2**2 * x22 * x23 + 2 * w3**2 * x32 * x33 + 2 * w4**2 * x42 * x43 ) J_R[:, 8, 8] = ( -1 / denom_r * ( ( 4 * R13**2 + 4 * R23**2 + 4 * R31**2 + 4 * R32**2 + 12 * R33**2 - 4 ) * const_r - ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * ( w1**2 * x11 * x13 + w2**2 * x21 * x23 + w3**2 * x31 * x33 + w4**2 * x41 * x43 ) ) + 1 / denom_r**2 * ( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * const_r * (2 * R11 * R13 + 2 * R21 * R23 + 4 * R31 * R33) ) + 2 * w1**2 * x13**2 + 2 * w2**2 * x23**2 + 2 * w3**2 * x33**2 + 2 * w4**2 * x43**2 ) J_w = torch.zeros((b, 9, 4), device=R.device) # w1 denom_w = ( 2 * R11**2 * R31 + 2 * R11 * R12 * R32 + 2 * R11 * R13 * R33 + 2 * R21**2 * R31 + 2 * R21 * R22 * R32 + 2 * R21 * R23 * R33 + 2 * R31**3 + 2 * R31 * R32**2 + 2 * R31 * R33**2 - 2 * R31 ) J_w[:, 0, 0] = ( -( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * ( 2 * R31 * w1 * x11**2 + 2 * R32 * w1 * x11 * x12 + 2 * R33 * w1 * x11 * x13 - 2 * w1 * x11 * y13 ) ) / denom_w + 4 * w1 * (R11 * x11 + R12 * x12 + R13 * x13 - y11) * x11 ) J_w[:, 1, 0] = ( -( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * ( 2 * R31 * w1 * x11**2 + 2 * R32 * w1 * x11 * x12 + 2 * R33 * w1 * x11 * x13 - 2 * w1 * x11 * y13 ) ) / denom_w + 4 * w1 * (R11 * x11 + R12 * x12 + R13 * x13 - y11) * x12 ) J_w[:, 2, 0] = ( -( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * ( 2 * R31 * w1 * x11**2 + 2 * R32 * w1 * x11 * x12 + 2 * R33 * w1 * x11 * x13 - 2 * w1 * x11 * y13 ) ) / denom_w + 4 * w1 * (R11 * x11 + R12 * x12 + R13 * x13 - y11) * x13 ) J_w[:, 3, 0] = ( -( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * ( 2 * R31 * w1 * x11**2 + 2 * R32 * w1 * x11 * x12 + 2 * R33 * w1 * x11 * x13 - 2 * w1 * x11 * y13 ) ) / denom_w + 4 * w1 * (R21 * x11 + R22 * x12 + R23 * x13 - y12) * x11 ) J_w[:, 4, 0] = ( -( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * ( 2 * R31 * w1 * x11**2 + 2 * R32 * w1 * x11 * x12 + 2 * R33 * w1 * x11 * x13 - 2 * w1 * x11 * y13 ) ) / denom_w + 4 * w1 * (R21 * x11 + R22 * x12 + R23 * x13 - y12) * x12 ) J_w[:, 5, 0] = ( -( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * ( 2 * R31 * w1 * x11**2 + 2 * R32 * w1 * x11 * x12 + 2 * R33 * w1 * x11 * x13 - 2 * w1 * x11 * y13 ) ) / denom_w + 4 * w1 * (R21 * x11 + R22 * x12 + R23 * x13 - y12) * x13 ) J_w[:, 6, 0] = ( -( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * ( 2 * R31 * w1 * x11**2 + 2 * R32 * w1 * x11 * x12 + 2 * R33 * w1 * x11 * x13 - 2 * w1 * x11 * y13 ) ) / denom_w + 4 * w1 * (R31 * x11 + R32 * x12 + R33 * x13 - y13) * x11 ) J_w[:, 7, 0] = ( -( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * ( 2 * R31 * w1 * x11**2 + 2 * R32 * w1 * x11 * x12 + 2 * R33 * w1 * x11 * x13 - 2 * w1 * x11 * y13 ) ) / denom_w + 4 * w1 * (R31 * x11 + R32 * x12 + R33 * x13 - y13) * x12 ) J_w[:, 8, 0] = ( -( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * ( 2 * R31 * w1 * x11**2 + 2 * R32 * w1 * x11 * x12 + 2 * R33 * w1 * x11 * x13 - 2 * w1 * x11 * y13 ) ) / denom_w + 4 * w1 * (R31 * x11 + R32 * x12 + R33 * x13 - y13) * x13 ) # w2 J_w[:, 0, 1] = ( -( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * ( 2 * R31 * w2 * x21**2 + 2 * R32 * w2 * x21 * x22 + 2 * R33 * w2 * x21 * x23 - 2 * w2 * x21 * y23 ) ) / denom_w + 4 * w2 * (R11 * x21 + R12 * x22 + R13 * x23 - y21) * x21 ) J_w[:, 1, 1] = ( -( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * ( 2 * R31 * w2 * x21**2 + 2 * R32 * w2 * x21 * x22 + 2 * R33 * w2 * x21 * x23 - 2 * w2 * x21 * y23 ) ) / denom_w + 4 * w2 * (R11 * x21 + R12 * x22 + R13 * x23 - y21) * x22 ) J_w[:, 2, 1] = ( -( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * ( 2 * R31 * w2 * x21**2 + 2 * R32 * w2 * x21 * x22 + 2 * R33 * w2 * x21 * x23 - 2 * w2 * x21 * y23 ) ) / denom_w + 4 * w2 * (R11 * x21 + R12 * x22 + R13 * x23 - y21) * x23 ) J_w[:, 3, 1] = ( -( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * ( 2 * R31 * w2 * x21**2 + 2 * R32 * w2 * x21 * x22 + 2 * R33 * w2 * x21 * x23 - 2 * w2 * x21 * y23 ) ) / denom_w + 4 * w2 * (R21 * x21 + R22 * x22 + R23 * x23 - y22) * x21 ) J_w[:, 4, 1] = ( -( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * ( 2 * R31 * w2 * x21**2 + 2 * R32 * w2 * x21 * x22 + 2 * R33 * w2 * x21 * x23 - 2 * w2 * x21 * y23 ) ) / denom_w + 4 * w2 * (R21 * x21 + R22 * x22 + R23 * x23 - y22) * x22 ) J_w[:, 5, 1] = ( -( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * ( 2 * R31 * w2 * x21**2 + 2 * R32 * w2 * x21 * x22 + 2 * R33 * w2 * x21 * x23 - 2 * w2 * x21 * y23 ) ) / denom_w + 4 * w2 * (R21 * x21 + R22 * x22 + R23 * x23 - y22) * x23 ) J_w[:, 6, 1] = ( -( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * ( 2 * R31 * w2 * x21**2 + 2 * R32 * w2 * x21 * x22 + 2 * R33 * w2 * x21 * x23 - 2 * w2 * x21 * y23 ) ) / denom_w + 4 * w2 * (R31 * x21 + R32 * x22 + R33 * x23 - y23) * x21 ) J_w[:, 7, 1] = ( -( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * ( 2 * R31 * w2 * x21**2 + 2 * R32 * w2 * x21 * x22 + 2 * R33 * w2 * x21 * x23 - 2 * w2 * x21 * y23 ) ) / denom_w + 4 * w2 * (R31 * x21 + R32 * x22 + R33 * x23 - y23) * x22 ) J_w[:, 8, 1] = ( -( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * ( 2 * R31 * w2 * x21**2 + 2 * R32 * w2 * x21 * x22 + 2 * R33 * w2 * x21 * x23 - 2 * w2 * x21 * y23 ) ) / denom_w + 4 * w2 * (R31 * x21 + R32 * x22 + R33 * x23 - y23) * x23 ) # w3 J_w[:, 0, 2] = ( -( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * ( 2 * R31 * w3 * x31**2 + 2 * R32 * w3 * x31 * x32 + 2 * R33 * w3 * x31 * x33 - 2 * w3 * x31 * y33 ) ) / denom_w + 4 * w3 * (R11 * x31 + R12 * x32 + R13 * x33 - y31) * x31 ) J_w[:, 1, 2] = ( -( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * ( 2 * R31 * w3 * x31**2 + 2 * R32 * w3 * x31 * x32 + 2 * R33 * w3 * x31 * x33 - 2 * w3 * x31 * y33 ) ) / denom_w + 4 * w3 * (R11 * x31 + R12 * x32 + R13 * x33 - y31) * x32 ) J_w[:, 2, 2] = ( -( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * ( 2 * R31 * w3 * x31**2 + 2 * R32 * w3 * x31 * x32 + 2 * R33 * w3 * x31 * x33 - 2 * w3 * x31 * y33 ) ) / denom_w + 4 * w3 * (R11 * x31 + R12 * x32 + R13 * x33 - y31) * x33 ) J_w[:, 3, 2] = ( -( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * ( 2 * R31 * w3 * x31**2 + 2 * R32 * w3 * x31 * x32 + 2 * R33 * w3 * x31 * x33 - 2 * w3 * x31 * y33 ) ) / denom_w + 4 * w3 * (R21 * x31 + R22 * x32 + R23 * x33 - y32) * x31 ) J_w[:, 4, 2] = ( -( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * ( 2 * R31 * w3 * x31**2 + 2 * R32 * w3 * x31 * x32 + 2 * R33 * w3 * x31 * x33 - 2 * w3 * x31 * y33 ) ) / denom_w + 4 * w3 * (R21 * x31 + R22 * x32 + R23 * x33 - y32) * x32 ) J_w[:, 5, 2] = ( -( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * ( 2 * R31 * w3 * x31**2 + 2 * R32 * w3 * x31 * x32 + 2 * R33 * w3 * x31 * x33 - 2 * w3 * x31 * y33 ) ) / denom_w + 4 * w3 * (R21 * x31 + R22 * x32 + R23 * x33 - y32) * x33 ) J_w[:, 6, 2] = ( -( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * ( 2 * R31 * w3 * x31**2 + 2 * R32 * w3 * x31 * x32 + 2 * R33 * w3 * x31 * x33 - 2 * w3 * x31 * y33 ) ) / denom_w + 4 * w3 * (R31 * x31 + R32 * x32 + R33 * x33 - y33) * x31 ) J_w[:, 7, 2] = ( -( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * ( 2 * R31 * w3 * x31**2 + 2 * R32 * w3 * x31 * x32 + 2 * R33 * w3 * x31 * x33 - 2 * w3 * x31 * y33 ) ) / denom_w + 4 * w3 * (R31 * x31 + R32 * x32 + R33 * x33 - y33) * x32 ) J_w[:, 8, 2] = ( -( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * ( 2 * R31 * w3 * x31**2 + 2 * R32 * w3 * x31 * x32 + 2 * R33 * w3 * x31 * x33 - 2 * w3 * x31 * y33 ) ) / denom_w + 4 * w3 * (R31 * x31 + R32 * x32 + R33 * x33 - y33) * x33 ) # w4 J_w[:, 0, 3] = ( -( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R11 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R12 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R13 ) * ( 2 * R31 * w4 * x41**2 + 2 * R32 * w4 * x41 * x42 + 2 * R33 * w4 * x41 * x43 - 2 * w4 * x41 * y43 ) ) / denom_w + 4 * w4 * (R11 * x41 + R12 * x42 + R13 * x43 - y41) * x41 ) J_w[:, 1, 3] = ( -( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R11 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R12 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R13 ) * ( 2 * R31 * w4 * x41**2 + 2 * R32 * w4 * x41 * x42 + 2 * R33 * w4 * x41 * x43 - 2 * w4 * x41 * y43 ) ) / denom_w + 4 * w4 * (R11 * x41 + R12 * x42 + R13 * x43 - y41) * x42 ) J_w[:, 2, 3] = ( -( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R11 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R12 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R13 ) * ( 2 * R31 * w4 * x41**2 + 2 * R32 * w4 * x41 * x42 + 2 * R33 * w4 * x41 * x43 - 2 * w4 * x41 * y43 ) ) / denom_w + 4 * w4 * (R11 * x41 + R12 * x42 + R13 * x43 - y41) * x43 ) J_w[:, 3, 3] = ( -( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R21 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R22 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R23 ) * ( 2 * R31 * w4 * x41**2 + 2 * R32 * w4 * x41 * x42 + 2 * R33 * w4 * x41 * x43 - 2 * w4 * x41 * y43 ) ) / denom_w + 4 * w4 * (R21 * x41 + R22 * x42 + R23 * x43 - y42) * x41 ) J_w[:, 4, 3] = ( -( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R21 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R22 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R23 ) * ( 2 * R31 * w4 * x41**2 + 2 * R32 * w4 * x41 * x42 + 2 * R33 * w4 * x41 * x43 - 2 * w4 * x41 * y43 ) ) / denom_w + 4 * w4 * (R21 * x41 + R22 * x42 + R23 * x43 - y42) * x42 ) J_w[:, 5, 3] = ( -( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R21 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R22 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R23 ) * ( 2 * R31 * w4 * x41**2 + 2 * R32 * w4 * x41 * x42 + 2 * R33 * w4 * x41 * x43 - 2 * w4 * x41 * y43 ) ) / denom_w + 4 * w4 * (R21 * x41 + R22 * x42 + R23 * x43 - y42) * x43 ) J_w[:, 6, 3] = ( -( ( 4 * (R11**2 + R21**2 + R31**2 - 1) * R31 + 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R32 + 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R33 ) * ( 2 * R31 * w4 * x41**2 + 2 * R32 * w4 * x41 * x42 + 2 * R33 * w4 * x41 * x43 - 2 * w4 * x41 * y43 ) ) / denom_w + 4 * w4 * (R31 * x41 + R32 * x42 + R33 * x43 - y43) * x41 ) J_w[:, 7, 3] = ( -( ( 4 * (R11 * R12 + R21 * R22 + R31 * R32) * R31 + 4 * (R12**2 + R22**2 + R32**2 - 1) * R32 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R33 ) * ( 2 * R31 * w4 * x41**2 + 2 * R32 * w4 * x41 * x42 + 2 * R33 * w4 * x41 * x43 - 2 * w4 * x41 * y43 ) ) / denom_w + 4 * w4 * (R31 * x41 + R32 * x42 + R33 * x43 - y43) * x42 ) J_w[:, 8, 3] = ( -( ( 4 * (R11 * R13 + R21 * R23 + R31 * R33) * R31 + 4 * (R12 * R13 + R22 * R23 + R32 * R33) * R32 + 4 * (R13**2 + R23**2 + R33**2 - 1) * R33 ) * ( 2 * R31 * w4 * x41**2 + 2 * R32 * w4 * x41 * x42 + 2 * R33 * w4 * x41 * x43 - 2 * w4 * x41 * y43 ) ) / denom_w + 4 * w4 * (R31 * x41 + R32 * x42 + R33 * x43 - y43) * x43 ) J_Rw = torch.zeros((b, 9, 4), device=R.device) tmp = torch.eye(9, 9, dtype=torch.float, device=R.device) for i in range(b): try: J_Rw[i, :, :] = -torch.inverse(J_R[i, :, :]).mm(J_w[i, :, :]) tmp = J_R[i, :, :] except Exception as e: J_Rw[i, :, :] = -torch.inverse(tmp).mm(J_w[i, :, :]) return J_Rw
72,996
Python
.py
2,360
19.849153
82
0.30036
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,697
losses.py
disungatullina_MinBackProp/toy_examples/rotation/losses.py
import torch def angle_error(R_true, R): """Pytorch inplementation of (0.5 * trace(R^(-1)R) - 1)""" max_dot_product = 1.0 - 1e-8 error_rotation = ( (0.5 * ((R * R_true).sum(dim=(-2, -1)) - 1.0)) # .clamp_(-max_dot_product, max_dot_product) .clamp_(-max_dot_product, max_dot_product).acos() ) return error_rotation def frobenius_norm(R_true, R): return ((R - R_true) ** 2).sum(dim=(-2, -1))
442
Python
.py
12
31.5
62
0.565728
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,698
msac_score.py
disungatullina_MinBackProp/scorings/msac_score.py
import torch class MSACScore(object): def __init__(self, device="cuda"): # self.threshold = (3 / 2 * threshold)**2 # self.th = (3 / 2) * threshold self.device = device self.provides_inliers = True def score(self, matches, models, threshold=0.75): """Rewrite from Graph-cut Ransac github.com/danini/graph-cut-ransac calculate the Sampson distance between a point correspondence and essential/ fundamental matrix. Sampson distance is the first order approximation of geometric distance, calculated from the closest correspondence who satisfy the F matrix. :param: x1: x, y, 1; x2: x', y', 1; M: F/E matrix """ squared_threshold = (3 / 2 * threshold) ** 2 pts1 = matches[:, 0:2] pts2 = matches[:, 2:4] num_pts = pts1.shape[0] # get homogeneous coordinates hom_pts1 = torch.cat( (pts1, torch.ones((num_pts, 1), device=pts1.device)), dim=-1 ) hom_pts2 = torch.cat( (pts2, torch.ones((num_pts, 1), device=pts2.device)), dim=-1 ) # calculate the sampson distance and msac scores try: M_x1_ = models.matmul(hom_pts1.transpose(-1, -2)) except: print() M_x2_ = models.transpose(-1, -2).matmul(hom_pts2.transpose(-1, -2)) JJ_T_ = ( M_x1_[:, 0] ** 2 + M_x1_[:, 1] ** 2 + M_x2_[:, 0] ** 2 + M_x2_[:, 1] ** 2 ) x1_M_x2_ = hom_pts1.T.unsqueeze(0).mul(M_x2_).sum(-2) try: squared_distances = x1_M_x2_.square().div(JJ_T_) except Exception as e: print("wrong", e) masks = squared_distances < squared_threshold # soft inliers, sum of the squared distance, while transforming the negative ones to zero by torch.clamp() msac_scores = torch.sum( torch.clamp(1 - squared_distances / squared_threshold, min=0.0), dim=-1 ) # following c++ # squared_residuals = torch.sum(torch.where(squared_distances>=self.threshold, torch.zeros_like(squared_distances), squared_distances), dim=-1) # inlier_number = torch.sum(squared_distances.squeeze(0) < self.threshold, dim=-1) # score = (-squared_residuals + inlier_number * self.threshold)/self.threshold return msac_scores, masks
2,366
Python
.py
50
37.92
151
0.59158
disungatullina/MinBackProp
8
0
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)
2,288,699
gen_data.py
XintSong_RMSF-net/gen_data.py
import numpy as np import torch import mrcfile from scipy import ndimage import subprocess import sys from moleculekit.molecule import Molecule import os def parse_map(map_file, r=1.5): mrc = mrcfile.open(map_file, 'r') voxel_size = np.asarray( [mrc.voxel_size.x, mrc.voxel_size.y, mrc.voxel_size.z], dtype=np.float32) cella = (mrc.header.cella.x, mrc.header.cella.y, mrc.header.cella.z) origin = np.asarray([mrc.header.origin.x, mrc.header.origin.y, mrc.header.origin.z], dtype=np.float32) start_xyz = np.asarray( [mrc.header.nxstart, mrc.header.nystart, mrc.header.nzstart], dtype=np.float32) ncrs = (mrc.header.nx, mrc.header.ny, mrc.header.nz) angle = np.asarray([mrc.header.cellb.alpha, mrc.header.cellb.beta, mrc.header.cellb.gamma], dtype=np.float32) map = np.asfarray(mrc.data.copy(), dtype=np.float32) assert (angle[0] == angle[1] == angle[2] == 90.0) mapcrs = np.subtract( [mrc.header.mapc, mrc.header.mapr, mrc.header.maps], 1) sort = np.asarray([0, 1, 2], dtype=np.int32) for i in range(3): sort[mapcrs[i]] = i xyz_start = np.asarray([start_xyz[i] for i in sort]) nxyz = np.asarray([ncrs[i] for i in sort]) map = np.transpose(map, axes=2-sort[::-1]) mrc.close() zoomFactor = np.divide(voxel_size, np.asarray([r, r, r], dtype=np.float32)) map2 = ndimage.zoom(map, zoom=zoomFactor) nxyz = np.asarray([map2.shape[0], map2.shape[1], map2.shape[2]], dtype=np.int32) info = dict() info['cella'] = cella info['xyz_start'] = xyz_start info['voxel_size'] = voxel_size info['nxyz'] = nxyz info['origin'] = origin return map2, info def parse_map2(map): mrc = mrcfile.open(map, 'r') voxel_size = np.asarray( [mrc.voxel_size.x, mrc.voxel_size.y, mrc.voxel_size.z], dtype=np.float32) cella = (mrc.header.cella.x, mrc.header.cella.y, mrc.header.cella.z) origin = np.asarray([mrc.header.origin.x, mrc.header.origin.y, mrc.header.origin.z], dtype=np.float32) start_xyz = np.asarray( [mrc.header.nxstart, mrc.header.nystart, mrc.header.nzstart], dtype=np.float32) ncrs = (mrc.header.nx, mrc.header.ny, mrc.header.nz) angle = np.asarray([mrc.header.cellb.alpha, mrc.header.cellb.beta, mrc.header.cellb.gamma], dtype=np.float32) map2 = np.asfarray(mrc.data.copy(), dtype=np.float32) assert (angle[0] == angle[1] == angle[2] == 90.0) mapcrs = np.subtract( [mrc.header.mapc, mrc.header.mapr, mrc.header.maps], 1) sort = np.asarray([0, 1, 2], dtype=np.int32) if (mapcrs == sort).all(): changed = False xyz_start = np.asarray([start_xyz[i] for i in sort]) nxyz = np.asarray([ncrs[i] for i in sort]) mrc.close() else: changed = True for i in range(3): sort[mapcrs[i]] = i xyz_start = np.asarray([start_xyz[i] for i in sort]) nxyz = np.asarray([ncrs[i] for i in sort]) map2 = np.transpose(map2, axes=2-sort[::-1]) mrc.close() info = dict() info['cella'] = cella info['xyz_start'] = xyz_start info['voxel_size'] = voxel_size info['nxyz'] = nxyz info['origin'] = origin info['changed'] = changed return map2, info def get_atom_map(pdb_file, shape, map_info, r=1.5): atom_map = np.full((shape[0], shape[1], shape[2]), 0, dtype=np.int8) pdb = Molecule(pdb_file) pdb.filter('protein') xyz = pdb.get('coords')-map_info['origin'] xyz_norm = ((xyz-map_info['voxel_size']*map_info['xyz_start'])/r) for coord in xyz_norm: atom_map[int(coord[2]), int(coord[1]), int(coord[0])] = 1 return atom_map def split_map_and_select_item(map, atom_map, contour_level, box_size=40, core_size=10): map_size = np.shape(map) pad_map = np.full((map_size[0]+2*box_size, map_size[1] + 2*box_size, map_size[2]+2*box_size), 0, dtype=np.float32) pad_map[box_size:-box_size, box_size:-box_size, box_size:-box_size] = map pad_atom_map = np.full( (map_size[0]+2*box_size, map_size[1]+2*box_size, map_size[2]+2*box_size), 0, dtype=np.int8) pad_atom_map[box_size:-box_size, box_size:- box_size, box_size:-box_size] = atom_map start_point = box_size - int((box_size - core_size) / 2) cur_x, cur_y, cur_z = start_point, start_point, start_point box_list = list() length = [int(np.ceil(map_size[0]/core_size)), int(np.ceil(map_size[1]/core_size)), int(np.ceil(map_size[2]/core_size))] print( f"the total box of this map is {length[0]}*{length[1]}*{length[2]}={length[0]*length[1]*length[2]}") keep_list = [] total_list = [] i = 0 while (cur_z + (box_size - core_size) / 2 < map_size[2] + box_size): next_box = pad_map[cur_x:cur_x + box_size, cur_y:cur_y + box_size, cur_z:cur_z + box_size] next_atom_box_center = pad_atom_map[cur_x+15:cur_x + box_size - 15, cur_y+15:cur_y + box_size-15, cur_z+15:cur_z + box_size-15] cur_x += core_size if (cur_x + (box_size - core_size) / 2 >= map_size[0] + box_size): cur_y += core_size cur_x = start_point if (cur_y + (box_size - core_size) / 2 >= map_size[1] + box_size): cur_z += core_size cur_y = start_point cur_x = start_point if (np.sum(next_atom_box_center) > 0): box_list.append(next_box) keep_list.append(i) total_list.append(i) i = i+1 print(f"the selected maps: {len(keep_list)}") print(f"the total maps: {len(total_list)}") return np.asarray(box_list), np.asarray(keep_list), np.asarray(total_list) def get_smi_map(pdb_file, res, out_file, chimera_path=None, number=0.1, r=1.5): chimera_script = open('./chimera_exe.cmd', 'w') chimera_script.write('open ' + pdb_file + '\n' 'molmap #0 '+str(res)+' gridSpacing ' + str(r)+'\n' 'volume #'+str(number) + ' save ' + str(out_file) + '\n' 'close all' ) chimera_script.close() print(f'chimera_path:{chimera_path}') output = subprocess.check_output( [chimera_path, '--nogui', chimera_script.name]) return output def sim_map_ot(pdb_file, res, out_file, number=0.1, r=1.5, chimera_path=None): output = get_smi_map(pdb_file, res, out_file, chimera_path=chimera_path, r=r) s = output.decode('utf-8').splitlines() if "Wrote file" not in s[-1]: output = get_smi_map(pdb_file, res, out_file, r=r, number=1, chimera_path=chimera_path) s = output.decode('utf-8').splitlines() if "Wrote file" not in s[-1]: return False return True class exp_2_sim: def __init__(self, exp_map_file, sim_map_file, keep_list, total_list): self.sim_map, self.sim_info = parse_map2(sim_map_file) self.exp_map, self.exp_info = parse_map(exp_map_file) self.keep_list = keep_list self.total_list = total_list @staticmethod def convert_to_n_base(number, n_3): result = [] i = 0 while number > 0: remainder = number % n_3[i] result.append(remainder) number = number // n_3[i] i = i+1 if len(result) != 3: if len(result) == 2: result.append(0) elif len(result) == 1: result.extend([0, 0]) elif len(result) == 0: result.extend([0, 0, 0]) else: print(f"too big,bigger than 3 digits") assert (len(result) == 3) result.reverse() return result def index_start(self, index, box_size=40, core_size=10, step_size=40): start_point = box_size - int((box_size - core_size) / 2) cur_box_num = self.keep_list[index] exp_shape = self.exp_map.shape num_per_dim = [(exp_shape[0]+9)//10, (exp_shape[1]+9) // 10, (exp_shape[2]+9)//10] box_num_zyx = self.convert_to_n_base(int(cur_box_num), num_per_dim) x11, y11, z11 = box_num_zyx[2]*core_size+start_point-box_size, box_num_zyx[1]*core_size+start_point-box_size,\ box_num_zyx[0]*core_size+start_point-box_size add_center = int((box_size-step_size)/2) x11, y11, z11 = x11+add_center, y11+add_center, z11+add_center exp_index = [x11, y11, z11] return exp_index def trans_index_exp2sim(self, exp_index): ''' convert indices on the experimental map to indices on the simulated map.''' x, y, z = exp_index[0], exp_index[1], exp_index[2] x_coord, y_coord, z_coord = self.exp_info['origin'] + \ self.exp_info['xyz_start'] * \ self.exp_info['voxel_size']+np.array([z, y, x])*1.5 xyz_sim_index = [round(i) for i in reversed((np.array([x_coord, y_coord, z_coord]) - self.sim_info['origin']-self.sim_info['voxel_size']*self.sim_info['xyz_start'])/1.5)] return xyz_sim_index def range2range_axis(self, x_left, x_right, i=0): if x_left < 0 and x_right < 0: print("out of sim_map,no overlap") return 0, 0, 0, 0 if x_left > self.sim_info['nxyz'][i] and x_right > self.sim_info['nxyz'][i]: print("out of sim_map,no overlap") return 0, 0, 0, 0 if x_left >= 0 and x_right < self.sim_info['nxyz'][i]: x_to_left, x_to_right = 0, x_right-x_left elif x_left < 0 and x_right < self.sim_info['nxyz'][i]: x_to_left, x_to_right = -x_left, x_right-x_left x_left = 0 elif x_left >= 0 and x_right >= self.sim_info['nxyz'][i]: x_to_left, x_to_right = 0, self.sim_info['nxyz'][i]-x_left x_right = self.sim_info['nxyz'][i] elif x_left < 0 and x_right >= self.sim_info['nxyz'][i]: x_to_left, x_to_right = -x_left, self.sim_info['nxyz'][i]-x_left x_left = 0 x_right = self.sim_info['nxyz'][i] return x_left, x_right, x_to_left, x_to_right def trans_range2range(self, xyz_sim_index, box_size=40, pad=0.): x_left, x_right, x_to_left, x_to_right = self.range2range_axis( xyz_sim_index[0], xyz_sim_index[0]+box_size, i=2) y_left, y_right, y_to_left, y_to_right = self.range2range_axis( xyz_sim_index[1], xyz_sim_index[1]+box_size, i=1) z_left, z_right, z_to_left, z_to_right = self.range2range_axis( xyz_sim_index[2], xyz_sim_index[2]+box_size, i=0) return [x_left, x_right], [y_left, y_right], [z_left, z_right], [x_to_left, x_to_right], [y_to_left, y_to_right], [z_to_left, z_to_right] def gene_boxs(self, box_size=40, pad=0.): sim_box_list = [] for index in range(len(self.keep_list)): exp_index = self.index_start(index) xyz_sim_index = self.trans_index_exp2sim(exp_index) sim_x_lr, sim_y_lr, sim_z_lr, box_x_lr, box_y_lr, box_z_lr = self.trans_range2range( xyz_sim_index) sim_box = np.full([box_size, box_size, box_size], pad, dtype=np.float32) sim_box[box_x_lr[0]:box_x_lr[1], box_y_lr[0]:box_y_lr[1], box_z_lr[0]:box_z_lr[1] ] = self.sim_map[sim_x_lr[0]:sim_x_lr[1], sim_y_lr[0]:sim_y_lr[1], sim_z_lr[0]:sim_z_lr[1]] sim_box_list.append(sim_box) sim_box_list = np.array(sim_box_list) return sim_box_list class gen_data: def __init__(self, exp_map_file, pdb_file, output_dir, contour_level, chimera_path=None) -> None: self.exp_map_file = exp_map_file self.pdb_file = pdb_file self.output_dir = output_dir self.contour_level = contour_level self.chimera_path = chimera_path def get_data(self, r=1.5): sim_map_file = f"{self.output_dir}/sim_map.mrc" map, info = parse_map(self.exp_map_file, r=r) atom_map = get_atom_map(self.pdb_file, map.shape, info) intensity_list, keep_list, total_list = split_map_and_select_item( map, atom_map, self.contour_level, box_size=40, core_size=10) sim_yes = sim_map_ot(self.pdb_file, 4, sim_map_file, r=r, chimera_path=self.chimera_path) if not sim_yes: print(" sim map not succeed") sys.exit() expsim = exp_2_sim(self.exp_map_file, sim_map_file, keep_list, total_list) sim_box_list = expsim.gene_boxs() data_file = f"{self.output_dir}/data.pth" torch.save({'intensity': torch.from_numpy(intensity_list).unsqueeze_(1), 'sim_intensity': torch.from_numpy(sim_box_list).unsqueeze_(1), 'keep_list': torch.from_numpy(keep_list), 'total_list': torch.from_numpy(total_list)}, data_file) print(f"tensor datafile saved at {data_file}") return data_file
13,295
Python
.py
270
39.285185
145
0.572743
XintSong/RMSF-net
8
1
0
GPL-3.0
9/5/2024, 10:48:34 PM (Europe/Amsterdam)