def gentrait(rows, cols): myclass = classname(rows, cols) fd = startfile("traits", myclass) def line(s=""): print >> fd, s line("public interface %s extends Matrix {" % myclass) line("}") fd.flush() fd.close()
def build_menu(systray): libuv_cffi_state = gloop.check( 'libuv-cffi') and fixed_fState or MFS_ENABLED libev_cext_state = gloop.check( 'libev-cext') and fixed_fState or MFS_ENABLED libev_cffi_state = gloop.check( 'libev-cffi') and fixed_fState or MFS_ENABLED nogevent_state = gloop.check('nogevent') and fixed_fState or MFS_ENABLED default_loop_state = not (libuv_cffi_state or libev_cext_state or libev_cffi_state or nogevent_state) and fixed_fState or MFS_ENABLED sub_menu1 = ( ('打开默认配置', lambda x: startfile(config_filename)), #双击打开第一个有效命令 ('打开用户配置', lambda x: startfile(config_user_filename)), ('打开自动规则配置', lambda x: startfile(config_auto_filename)), (None, '-'), ('选择 gevent 优先使用的事件循环', 'pass', MFS_DISABLED), ('以下名称同时也是等价命令行参数', 'pass', MFS_DISABLED), (' ├─ libuv-cffi', lambda x: gloop.checked('libuv-cffi', True), libuv_cffi_state, MFT_RADIOCHECK), (' ├─ libev-cext', lambda x: gloop.checked('libev-cext', True), libev_cext_state, MFT_RADIOCHECK), (' ├─ libev-cffi', lambda x: gloop.checked('libev-cffi', True), libev_cffi_state, MFT_RADIOCHECK), (' ├─ nogevent (禁用)', lambda x: gloop.checked('nogevent', True), nogevent_state, MFT_RADIOCHECK), (' └─ 默认', lambda x: gloop.clear(True), default_loop_state, MFT_RADIOCHECK)) mo_state = buildipdb.ds_APNIC.check('mo') and MFS_CHECKED or MFS_ENABLED hk_state = buildipdb.ds_APNIC.check('hk') and MFS_CHECKED or MFS_ENABLED sub_menu2 = ( ('建议更新频率:10~30 天一次', 'pass', MFS_DISABLED), (None, '-'), ('Ⅰ 从 APNIC 下载(每日更新)', lambda x: download_cniplist(buildipdb.ds_APNIC)), (' ├─ 包含澳门', lambda x: buildipdb.ds_APNIC.switch('mo', True), mo_state, MFT_RADIOCHECK), (' └─ 包含香港', lambda x: buildipdb.ds_APNIC.switch('hk', True), hk_state, MFT_RADIOCHECK), ('Ⅱ 从 17mon 下载(每月初更新)', lambda x: download_cniplist(buildipdb.ds_17MON)), ('Ⅲ 从 gaoyifan 下载(每日更新)', lambda x: download_cniplist(buildipdb.ds_GAOYIFAN)), ('从 Ⅰ、Ⅱ 下载后合并', lambda x: download_cniplist(buildipdb.ds_APNIC | buildipdb.ds_17MON)), ('从 Ⅰ、Ⅲ 下载后合并', lambda x: download_cniplist(buildipdb.ds_APNIC | buildipdb.ds_GAOYIFAN)), ('从 Ⅱ、Ⅲ 下载后合并', lambda x: download_cniplist(buildipdb.ds_17MON | buildipdb.ds_GAOYIFAN)), ('全部下载后合并', lambda x: download_cniplist(buildipdb.data_source_manager.sign_all))) fapple_state = builddomains.ds_FELIX.check( 'apple') and MFS_CHECKED or MFS_ENABLED sub_menu3 = (('建议更新频率:1~7 天一次', 'pass', MFS_DISABLED), (None, '-'), ('Ⅰ 从 felixonmars 下载(每日更新)', lambda x: download_domains(builddomains.ds_FELIX)), (' └─ 包含 apple', lambda x: builddomains.ds_FELIX.switch('apple', True), fapple_state, MFT_RADIOCHECK), ('全部下载后合并', lambda x: download_domains( builddomains.data_source_manager.sign_all))) global proxy_state_menu, last_main_menu proxy_state_menu = proxy_state = get_proxy_state() disable_state = proxy_state.type == 0 and fixed_fState or MFS_ENABLED disable_http_state = disable_state or proxy_state.type & 2 and not proxy_state.http and fixed_fState or MFS_ENABLED disable_https_state = disable_state or proxy_state.type & 2 and not proxy_state.https and fixed_fState or MFS_ENABLED disable_ftp_state = disable_state or proxy_state.type & 2 and not proxy_state.ftp and fixed_fState or MFS_ENABLED disable_socks_state = disable_state or proxy_state.type & 2 and not proxy_state.socks and fixed_fState or MFS_ENABLED auto_state = proxy_state.type == 2 and LISTEN_AUTO in proxy_state and fixed_fState or MFS_ENABLED gae_state = proxy_state.type == 2 and LISTEN_GAE in proxy_state and fixed_fState or MFS_ENABLED sub_menu4 = (('使用自动代理', on_enable_auto_proxy, auto_state, MFT_RADIOCHECK), ('使用 GAE 代理', on_enable_gae_proxy, gae_state, MFT_RADIOCHECK), ('完全禁用代理', on_disable_proxy, disable_state, MFT_RADIOCHECK), (None, '-'), ('禁用 HTTP 代理', on_disable_http_proxy, disable_http_state, MFT_RADIOCHECK), ('禁用 HTTPS 代理', on_disable_https_proxy, disable_https_state, MFT_RADIOCHECK), ('禁用 FTP 代理', on_disable_ftp_proxy, disable_ftp_state, MFT_RADIOCHECK), ('禁用 SOCKS 代理', on_disable_socks_proxy, disable_socks_state, MFT_RADIOCHECK)) visible = ctypes.windll.user32.IsWindowVisible(hwnd) show_state = visible and fixed_fState or MFS_ENABLED hide_state = not visible and fixed_fState or MFS_ENABLED main_menu = (('GotoX 设置', sub_menu1, icon_gotox, MFS_DEFAULT), ('更新直连 IP 库', sub_menu2), ('更新直连域名列表', sub_menu3), (None, '-'), ('显示窗口', on_show, show_state, MFT_RADIOCHECK), ('隐藏窗口', on_hide, hide_state, MFT_RADIOCHECK), ('创建桌面快捷方式', on_create_shortcut), ('设置系统(IE)代理', sub_menu4), ('重置 DNS 缓存', on_reset_dns), ('重置自动规则缓存', on_reset_autorule), ('重启 GotoX', on_refresh), (None, '-'), ('关于', on_about)) if main_menu != last_main_menu: systray.update(menu=main_menu) last_main_menu = main_menu
def build_menu(systray): sub_menu1 = ( ('打开默认配置', lambda x: startfile(config_filename)), #双击打开第一个有效命令 ('打开用户配置', lambda x: startfile(config_user_filename)), ('打开自动规则配置', lambda x: startfile(config_auto_filename)), (None, '-'), ('选择 gevent 优先使用的事件循环', *pass_fState), ('以下名称同时也是等价命令行参数', *pass_fState), (' ├─ libuv-cffi', lambda x: gloop.checked('libuv-cffi', True), *make_rc_state(gloop.check('libuv-cffi'))), (' ├─ libev-cext', lambda x: gloop.checked('libev-cext', True), *make_rc_state(gloop.check('libev-cext'))), (' ├─ libev-cffi', lambda x: gloop.checked('libev-cffi', True), *make_rc_state(gloop.check('libev-cffi'))), (' ├─ nogevent (禁用)', lambda x: gloop.checked('nogevent', True), *make_rc_state(gloop.check('nogevent'))), (' └─ 默认', lambda x: gloop.clear(True), *make_rc_state(not gloop)), ) sub_menu2 = (('点击此处开始更新', on_update_cas), ('建议更新频率:60 天一次', *pass_fState), ('固定数据来源', *pass_fState), (None, '-'), ('Google Trust Services', *pass_fState), ('Mozilla NSS, 由 curl.se 提供转换格式', *pass_fState)) dsm = buildipdb.data_source_manager apnic_checked = dsm.check(buildipdb.ds_APNIC.name) l7mon_checked = dsm.check(buildipdb.ds_17MON.name) gaoyifan_checked = dsm.check(buildipdb.ds_GAOYIFAN.name) misakaio_checked = dsm.check(buildipdb.ds_MISAKAIO.name) standalone_source = sum( map(int, [apnic_checked, l7mon_checked, gaoyifan_checked, misakaio_checked ])) == 1 sub_menu3 = ( ('点击此处开始更新', lambda x: download_cniplist(dsm.data_source)), ('建议更新频率:10~30 天一次', *pass_fState), ('请选择数据来源(多选)', *pass_fState), (None, '-'), ('APNIC(每日更新)', lambda x: dsm.switch(buildipdb.ds_APNIC.name, True), *make_rc_state(apnic_checked, standalone_source)), (' ├─ 包含澳门', lambda x: buildipdb.ds_APNIC.switch('mo', True), *make_rc_state(buildipdb.ds_APNIC.check('mo'), False)), (' └─ 包含香港', lambda x: buildipdb.ds_APNIC.switch('hk', True), *make_rc_state(buildipdb.ds_APNIC.check('hk'), False)), ('17mon(每季度更新)', lambda x: dsm.switch(buildipdb.ds_17MON.name, True), *make_rc_state(l7mon_checked, standalone_source)), ('gaoyifan(每日更新)', lambda x: dsm.switch(buildipdb.ds_GAOYIFAN.name, True), *make_rc_state(gaoyifan_checked, standalone_source)), ('misakaio(每小时更新)', lambda x: dsm.switch(buildipdb.ds_MISAKAIO.name, True), *make_rc_state(misakaio_checked, standalone_source)), ) sub_menu4 = (('点击此处开始更新', lambda x: download_domains( builddomains.data_source_manager.data_source)), ('建议更新频率:1~7 天一次', *pass_fState), ('请选择数据来源', *pass_fState), (None, '-'), ('felixonmars(随时更新)', 'pass', *make_rc_state(True)), (' └─ 包含 apple', lambda x: builddomains.ds_FELIX.switch('apple', True), *make_rc_state(builddomains.ds_FELIX.check('apple'), False))) global proxy_state_menu, last_main_menu proxy_state_menu = proxy_state = get_proxy_state() auto_state = proxy_state.type == 2 and LISTEN_AUTO in proxy_state act_state = proxy_state.type == 2 and LISTEN_ACT in proxy_state disable_state = proxy_state.type == 0 disable_http_state = disable_state or proxy_state.type & 2 and not proxy_state.http disable_https_state = disable_state or proxy_state.type & 2 and not proxy_state.https disable_ftp_state = disable_state or proxy_state.type & 2 and not proxy_state.ftp disable_socks_state = disable_state or proxy_state.type & 2 and not proxy_state.socks sub_menu5 = ( ('启动时设置代理', lambda x: sysproxy.switch('start-set', True), *make_rc_state(sysproxy.check('start-set'), False)), ('退出时恢复代理', lambda x: sysproxy.switch('quit-restore', True), *make_rc_state(sysproxy.check('quit-restore'), False)), (None, '-'), ('使用自动代理', on_enable_auto_proxy, *make_rc_state(auto_state)), (f'使用 {LISTEN_ACTTYPE} 代理', on_enable_act_proxy, *make_rc_state(act_state)), ('完全禁用代理', on_disable_proxy, *make_rc_state(disable_state)), (None, '-'), ('禁用 HTTP 代理', on_disable_http_proxy, *make_rc_state(disable_http_state)), ('禁用 HTTPS 代理', on_disable_https_proxy, *make_rc_state(disable_https_state)), ('禁用 FTP 代理', on_disable_ftp_proxy, *make_rc_state(disable_ftp_state)), ('禁用 SOCKS 代理', on_disable_socks_proxy, *make_rc_state(disable_socks_state)), ) visible = IsWindowVisible(hwnd) main_menu = (('GotoX 设置', sub_menu1, icon_gotox, MFS_DEFAULT), ('更新 CA 证书集', sub_menu2), ('更新直连 IP 库', sub_menu3), ('更新直连域名列表', sub_menu4), (None, '-'), visible and ('隐藏窗口', on_hide) or ('显示窗口', on_show), ('创建桌面快捷方式', on_create_shortcut), (f'设置系统({sys_web_browser})代理', sub_menu5), ('重置 DNS 缓存', on_reset_dns), ('重置自动规则缓存', on_reset_autorule_cache), ('重置自动规则', on_reset_autorule), ('重启 GotoX', on_refresh), (None, '-'), ('关于', on_about)) if not compare_menu_eq(main_menu, last_main_menu): systray.update(menu=main_menu) last_main_menu = main_menu
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from common import startfile, SIZES, classname, cells if __name__ == '__main__': fd = startfile("functions", "Identity") def line(s=""): print >> fd, s for rows in SIZES: line("import org.dnikulin.jula.fixed.%s;" % classname(rows, rows)) line() line("public final class Identity {") for rows in SIZES: line(" public static void setIdentity(final %s a) {" % classname(rows, rows)) for (row, col, label) in cells(rows, rows): value = (1 if (row == col) else 0) line(" a.%s = %d;" % (label, value)) line(" }")
def download_cniplist(p): msg = buildipdb.download_cniplist_as_db(direct_ipdb, p) if msg: balloons_warning(msg) def download_domains(p): msg = builddomains.download_domains_as_txt(direct_domains, p) if msg: balloons_warning(msg) last_main_menu = None sub_menu1 = ( ('打开默认配置', lambda x: startfile(config_filename)), #双击打开第一个有效命令 ('打开用户配置', lambda x: startfile(config_user_filename)), ('打开自动规则配置', lambda x: startfile(config_auto_filename))) def build_menu(systray): mo_state = buildipdb.ds_APNIC.check_ext('mo') and MFS_CHECKED hk_state = buildipdb.ds_APNIC.check_ext('hk') and MFS_CHECKED sub_menu2 = ( ('建议更新频率:10~30 天一次', 'pass', MFS_DISABLED), (None, '-'), ('Ⅰ 从 APNIC 下载(每日更新)', lambda x: download_cniplist(buildipdb.ds_APNIC)), (' ├─ 包含澳门', lambda x: buildipdb.ds_APNIC.switch_ext('mo', save=True), mo_state, MFT_RADIOCHECK), (' └─ 包含香港',
def build_menu(systray): libuv_cffi_state = gloop.check( 'libuv-cffi') and fixed_fState or MFS_ENABLED libev_cext_state = gloop.check( 'libev-cext') and fixed_fState or MFS_ENABLED libev_cffi_state = gloop.check( 'libev-cffi') and fixed_fState or MFS_ENABLED nogevent_state = gloop.check('nogevent') and fixed_fState or MFS_ENABLED default_loop_state = not (libuv_cffi_state or libev_cext_state or libev_cffi_state or nogevent_state) and fixed_fState or MFS_ENABLED sub_menu1 = ( ('打开默认配置', lambda x: startfile(config_filename)), #双击打开第一个有效命令 ('打开用户配置', lambda x: startfile(config_user_filename)), ('打开自动规则配置', lambda x: startfile(config_auto_filename)), (None, '-'), ('选择 gevent 优先使用的事件循环', 'pass', MFS_DISABLED), ('以下名称同时也是等价命令行参数', 'pass', MFS_DISABLED), (' ├─ libuv-cffi', lambda x: gloop.checked('libuv-cffi', True), libuv_cffi_state, MFT_RADIOCHECK), (' ├─ libev-cext', lambda x: gloop.checked('libev-cext', True), libev_cext_state, MFT_RADIOCHECK), (' ├─ libev-cffi', lambda x: gloop.checked('libev-cffi', True), libev_cffi_state, MFT_RADIOCHECK), (' ├─ nogevent (禁用)', lambda x: gloop.checked('nogevent', True), nogevent_state, MFT_RADIOCHECK), (' └─ 默认', lambda x: gloop.clear(True), default_loop_state, MFT_RADIOCHECK)) dsm = buildipdb.data_source_manager apnic_checked = dsm.check(buildipdb.ds_APNIC.name) l7mon_checked = dsm.check(buildipdb.ds_17MON.name) gaoyifan_checked = dsm.check(buildipdb.ds_GAOYIFAN.name) misakaio_checked = dsm.check(buildipdb.ds_MISAKAIO.name) multi_data_source = len( list( filter(None, [ apnic_checked, l7mon_checked, gaoyifan_checked, misakaio_checked ]))) > 1 multi_state = multi_data_source and MFS_CHECKED or fixed_fState apnic_state = apnic_checked and multi_state or MFS_ENABLED mo_state = buildipdb.ds_APNIC.check('mo') and MFS_CHECKED or MFS_ENABLED hk_state = buildipdb.ds_APNIC.check('hk') and MFS_CHECKED or MFS_ENABLED l7mon_state = l7mon_checked and multi_state or MFS_ENABLED gaoyifan_state = gaoyifan_checked and multi_state or MFS_ENABLED misakaio_state = misakaio_checked and multi_state or MFS_ENABLED sub_menu2 = (('点击此处开始更新', lambda x: download_cniplist(dsm.data_source)), ('建议更新频率:10~30 天一次', 'pass', MFS_DISABLED), ('请选择数据来源(多选)', 'pass', MFS_DISABLED), (None, '-'), ('APNIC(每日更新)', lambda x: dsm.switch(buildipdb.ds_APNIC.name, True), apnic_state, MFT_RADIOCHECK), (' ├─ 包含澳门', lambda x: buildipdb.ds_APNIC.switch('mo', True), mo_state, MFT_RADIOCHECK), (' └─ 包含香港', lambda x: buildipdb.ds_APNIC.switch('hk', True), hk_state, MFT_RADIOCHECK), ('17mon(每月初更新)', lambda x: dsm.switch(buildipdb.ds_17MON.name, True), l7mon_state, MFT_RADIOCHECK), ('gaoyifan(每日更新)', lambda x: dsm.switch(buildipdb.ds_GAOYIFAN.name, True), gaoyifan_state, MFT_RADIOCHECK), ('misakaio(每小时更新)', lambda x: dsm.switch(buildipdb.ds_MISAKAIO.name, True), misakaio_state, MFT_RADIOCHECK)) fapple_state = builddomains.ds_FELIX.check( 'apple') and MFS_CHECKED or MFS_ENABLED sub_menu3 = (('点击此处开始更新', lambda x: download_domains( builddomains.data_source_manager.data_source)), ('建议更新频率:1~7 天一次', 'pass', MFS_DISABLED), ('请选择数据来源', 'pass', MFS_DISABLED), (None, '-'), ('felixonmars(随时更新)', 'pass', fixed_fState, MFT_RADIOCHECK), (' └─ 包含 apple', lambda x: builddomains.ds_FELIX.switch('apple', True), fapple_state, MFT_RADIOCHECK)) global proxy_state_menu, last_main_menu proxy_state_menu = proxy_state = get_proxy_state() disable_state = proxy_state.type == 0 and fixed_fState or MFS_ENABLED disable_http_state = disable_state or proxy_state.type & 2 and not proxy_state.http and fixed_fState or MFS_ENABLED disable_https_state = disable_state or proxy_state.type & 2 and not proxy_state.https and fixed_fState or MFS_ENABLED disable_ftp_state = disable_state or proxy_state.type & 2 and not proxy_state.ftp and fixed_fState or MFS_ENABLED disable_socks_state = disable_state or proxy_state.type & 2 and not proxy_state.socks and fixed_fState or MFS_ENABLED auto_state = proxy_state.type == 2 and LISTEN_AUTO in proxy_state and fixed_fState or MFS_ENABLED act_state = proxy_state.type == 2 and LISTEN_ACT in proxy_state and fixed_fState or MFS_ENABLED sub_menu4 = (('使用自动代理', on_enable_auto_proxy, auto_state, MFT_RADIOCHECK), (f'使用 {LISTEN_ACTTYPE} 代理', on_enable_act_proxy, act_state, MFT_RADIOCHECK), ('完全禁用代理', on_disable_proxy, disable_state, MFT_RADIOCHECK), (None, '-'), ('禁用 HTTP 代理', on_disable_http_proxy, disable_http_state, MFT_RADIOCHECK), ('禁用 HTTPS 代理', on_disable_https_proxy, disable_https_state, MFT_RADIOCHECK), ('禁用 FTP 代理', on_disable_ftp_proxy, disable_ftp_state, MFT_RADIOCHECK), ('禁用 SOCKS 代理', on_disable_socks_proxy, disable_socks_state, MFT_RADIOCHECK)) visible = IsWindowVisible(hwnd) main_menu = (('GotoX 设置', sub_menu1, icon_gotox, MFS_DEFAULT), ('更新直连 IP 库', sub_menu2), ('更新直连域名列表', sub_menu3), (None, '-'), visible and ('隐藏窗口', on_hide) or ('显示窗口', on_show), ('创建桌面快捷方式', on_create_shortcut), (f'设置系统({sys_web_browser})代理', sub_menu4), ('重置 DNS 缓存', on_reset_dns), ('重置自动规则缓存', on_reset_autorule_cache), ('重置自动规则', on_reset_autorule), ('重启 GotoX', on_refresh), (None, '-'), ('关于', on_about)) if main_menu != last_main_menu: systray.update(menu=main_menu) last_main_menu = main_menu
def genmatrix(rows, cols): myclass = classname(rows, cols) fd = startfile("fixed", myclass) def line(s=""): print >> fd, s traits = [("Matrix_%d_N" % rows), ("Matrix_M_%d" % cols)] if (rows == cols): traits.append("Matrix_M_M") for trait in traits: line("import org.dnikulin.jula.traits.%s;" % trait) line() line("import org.dnikulin.jula.functions.Copy;") line() line("public final class %s implements %s {" % (myclass, ", ".join(traits))) line(" public static final int rows = %d;" % rows) line(" public static final int cols = %d;" % cols) line(" public static final int size = (rows * cols);") line() for row in range(rows): labels = ", ".join([mklabel(row, col) for col in range(cols)]) line(" public double %s;" % labels) line() line(" @Override") line(" public int getRows() {") line(" return rows;") line(" }") line() line(" @Override") line(" public int getCols() {") line(" return cols;") line(" }") line() line(" @Override") line(" public double get(final int row, final int col) {") line(" assert(row >= 0);") line(" assert(col >= 0);") line(" assert(row < rows);") line(" assert(col < cols);") line() line(" switch ((row * cols) + col) {") for (row, col, label) in cells(rows, cols): off = (row * cols) + col line(" case %2d: return %s;" % (off, label)) line(" default: return 0;") line(" }") line(" }") line() line(" @Override") line(" public void set(final int row, final int col, final double val) {") line(" assert(row >= 0);") line(" assert(col >= 0);") line(" assert(row < rows);") line(" assert(col < cols);") line() line(" switch ((row * cols) + col) {") for (row, col, label) in cells(rows, cols): off = (row * cols) + col line(" case %2d: %s = val; return;" % (off, label)) line(" default: return;") line(" }") line(" }") line() line(" @Override") line(" public %s clone() {" % (myclass)) line(" final %s that = new %s();" % (myclass, myclass)) line(" Copy.copy(this, that);") line(" return that;") line(" }") line("}") fd.flush() fd.close()
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from common import startfile, SIZES, classname, cells, mklabel if __name__ == '__main__': fd = startfile("functions", "Multiply") def line(s=""): print >> fd, s for rows in SIZES: for cols in SIZES: line("import org.dnikulin.jula.fixed.%s;" % classname(rows, cols)) line() line("public final class Multiply {") for rows in SIZES: for idxs in SIZES: for cols in SIZES: cnameA = classname(rows, idxs) cnameB = classname(idxs, cols)
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from common import startfile, SIZES, classname, cells if __name__ == '__main__': fd = startfile("functions", "Copy") def line(s=""): print >> fd, s for rows in SIZES: for cols in SIZES: line("import org.dnikulin.jula.fixed.%s;" % classname(rows, cols)) line() line("public final class Copy {") for rows in SIZES: for cols in SIZES: cname = classname(rows, cols) line(" public static void copy(final %s a, final %s b) {" % (cname, cname)) for (row, col, label) in cells(rows, cols):
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from common import startfile, SIZES, classname, cells if __name__ == '__main__': fd = startfile("functions", "Add") def line(s=""): print >> fd, s for rows in SIZES: for cols in SIZES: line("import org.dnikulin.jula.fixed.%s;" % classname(rows, cols)) line() line("public final class Add {") for rows in SIZES: for cols in SIZES: cname = classname(rows, cols) line(" public static void add(final %s a, final double b) {" % cname) for (_, _, label) in cells(rows, cols):
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from common import startfile, SIZES, classname, mklabel if __name__ == '__main__': fd = startfile("functions", "Cholesky") def line(s=""): print >> fd, s for rows in SIZES: line("import org.dnikulin.jula.fixed.%s;" % classname(rows, rows)) line() line("public final class Cholesky {") for rows in SIZES: line(" public static void cholesky(final %s a) {" % classname(rows, rows)) def lab(row, col): return ("a." + mklabel(row, col))
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from common import startfile, SIZES, classname, cells if __name__ == '__main__': fd = startfile("functions", "Zero") def line(s=""): print >> fd, s for rows in SIZES: for cols in SIZES: line("import org.dnikulin.jula.fixed.%s;" % classname(rows, cols)) line() line("public final class Zero {") for rows in SIZES: for cols in SIZES: line(" public static void setZero(final %s a) {" % classname(rows, cols)) for (_, _, label) in cells(rows, cols): line(" a.%s = 0;" % label)
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from common import startfile, SIZES, classname, cells, mklabel if __name__ == '__main__': fd = startfile("functions", "Transpose") def line(s=""): print >> fd, s for rows in SIZES: for cols in SIZES: line("import org.dnikulin.jula.fixed.%s;" % classname(rows, cols)) line() line("public final class Transpose {") for rows in SIZES: for cols in SIZES: iclass = classname(rows, cols) oclass = classname(cols, rows)