高精度计算原创教案与程序完整教程

版权申诉
0 下载量 121 浏览量 更新于2024-10-17 收藏 11KB RAR 举报
资源摘要信息:"GJ.rar_高精度计算" 高精度计算是计算机科学领域中的一项基础而关键的技术,尤其在金融、工程、科学计算等多个领域中占有极其重要的地位。由于标准的编程语言提供的数据类型(如int、float等)有其内在的精度限制,当处理超出这些范围的大数运算时,就会出现精度问题。为了克服这种限制,高精度计算应运而生,它允许对非常大的数字进行精确的数学运算。 从给定的文件信息来看,"GJ.rar_高精度计算"是一个包含了高精度计算相关资源的压缩文件,其中包含了相关的教案和程序,以及相关文档资料。这些内容对于学习和掌握高精度计算技术具有一定的帮助。 在介绍具体的知识点之前,需要明确一点,高精度计算通常不是指一种单一的技术或者算法,而是一系列技术与方法的集合,其中涉及到数据结构、算法设计、软件工程等多个方面。以下将详细解释几个与高精度计算密切相关的知识点: 1. 大数表示方法: - 概念:大数(Big Number)通常是指那些超出常规数据类型能够表示范围的整数和浮点数。 - 表示方法:常见的表示方法有数组表示法、链表表示法、字符串表示法等。 - 重要性:正确选择和使用大数的表示方法是进行高精度计算的基础。 2. 大数运算算法: - 加法:通过模拟手工加法的过程,逐位相加并处理进位。 - 减法:模拟手工减法,考虑借位处理。 - 乘法:可以采用长乘法或者Karatsuba算法等优化算法进行计算。 - 除法:通常采用长除法或者牛顿迭代法等高级算法进行处理。 - 幂运算:计算大数的幂次方,可以使用快速幂算法等高效方法。 3. 高精度计算的软件实现: - 编程语言支持:在某些语言中,比如Python、Java,语言本身就支持高精度计算,而在其他如C/C++中,则需要手动实现。 - 库函数和类库:例如GMP(GNU Multiple Precision Arithmetic Library)、MPIR(Multiple Precision Intenger Reliable Library)、Boost.Multiprecision等,都是支持高精度计算的第三方库。 - 优化技巧:在实现高精度计算时,优化算法效率和减少内存占用是重要考量,例如采用分治算法、缓存优化等。 4. 高精度计算在不同领域中的应用: - 金融领域:在金融计算中,经常需要处理非常精确的货币计算和财务分析。 - 密码学:在加密算法中,大数运算用于生成密钥、数字签名、安全散列等。 - 科学计算:在物理学、化学、生物学等领域,高精度计算用于模拟和分析极其复杂的现象。 - 工程领域:在工程设计中,大数计算用于结构分析、信号处理、系统模拟等。 具体到提供的文件信息,我们可以从标题和描述中得知,这是一个包含高精度计算教案和程序的资源包。标题中的"高精度计算"直接指向了文件的主要内容,而描述中的"完全原创,自由下载"表明了该资源的性质和使用权限。标签中的"高精度计算"与标题一致,强调了文件的核心主题。至于文件名列表中的"2.cpp、1.cpp"表明了这两个文件可能是某种编程语言(最有可能是C/C++)的源代码文件,"高精度教案.doc、高精度教案.ppt"则可能是相关的教学文档和演示文稿,而"***.txt"可能是一个文本文件,包含了来自***网站的某种信息,考虑到***是一个提供源代码下载的平台,该文件可能包含了一些下载链接或说明。 通过以上的资源和知识点分析,学习者可以对高精度计算有一个全面的认识,并且能够利用这些资源进行深入的学习和实践。

select a.IMSI, a.GJ, a.YYS, count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 then a.IMSI else null end) as MRWZGXQQCS, count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 and b.result<>1 then a.IMSI else null end) as MRWZGXQQCS, case when count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 then a.IMSI else null end)=0 then 0 else count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 and b.result<>1 then a.IMSI else null)/ count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 then a.IMSI else null end) as MRWZGXCGL, sum(c.MRZJCS) as MRZJCS, sum(c.MRZJHJCGCS) as MRZJHJCGCS, sum(d.MRBJCS) as MRBJCS, sum(d.MRBJHJCGCS) as MRBJHJCGCS, case when sum(c.MRZJCS)=0 then 0 else sum(c.MRZJHJCGCS)/sum(c.MRZJCS) end as MRZJWLJTL, case when sum(c.MRZJCS)=0 then 0 else sum(d.MRBJHJCGCS)/sum(d.MRBJCS) end as MRBJWLJTL, count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 then a.IMSI else null end) as MCWZGXQQCS, count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 and b.result<>1 then a.IMSI else null end) as MCWZGXCGCS, case when count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 then a.IMSI else null end)=0 then 0 else count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 and b.result<>1 then a.IMSI else null end)/ count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 then a.IMSI else null end) as MCWZGXCGL from (select * from TAB_A union select * from TAB_B union select * from TAB_C)a left join (select * from spark_odc_dwd.D_ENS_GMAP_MM where p_hour='#{time yyyyMMddHH}') b on a.IMSI=b.IMSI left join TAB_D c on a.IMSI=c.calling_imsi left join TAB_E c on a.IMSI=c.called_imsi group by a.IMSI, a.GJ, a.YYS

2023-06-06 上传
2023-06-07 上传

mismatched input 'count' expecting <EOF>(line 1, pos 379) == SQL == insert overwrite table spark_odc_data.D_RE_BA_RAD_MAP_H partition(p_hour = '2023060600') select '202306060000' TIME_ID, a.IMSI, a.GJ, a.YYS, count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 then a.IMSI else null end) as MRWZGXQQCS, count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 and b.result<>1 then a.IMSI else null end) as MRWZGXCGCS, case when count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 then a.IMSI else null end)=0 then 0 else count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 and b.result<>1 then a.IMSI else null)/count(case when substr(b.IMSI,1,5)<>46000 and b.operate_code=2 then a.IMSI else null end) as MRWZGXCGL, sum(c.MRZJCS) as MRZJCS, sum(c.MRZJHJCGCS) as MRZJHJCGCS, sum(d.MRBJCS) as MRBJCS, sum(d.MRBJHJCGCS) as MRBJHJCGCS, case when sum(c.MRZJCS)=0 then 0 else sum(c.MRZJHJCGCS)/sum(c.MRZJCS) end as MRZJWLJTL, case when sum(c.MRZJCS)=0 then 0 else sum(d.MRBJHJCGCS)/sum(d.MRBJCS) end as MRBJWLJTL, count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 then a.IMSI else null end) as MCWZGXQQCS, count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 and b.result<>1 then a.IMSI else null end) as MCWZGXCGCS, case when count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 then a.IMSI else null end)=0 then 0 else count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 and b.result<>1 then a.IMSI else null end)/ count(case when substr(b.msc,1,2)<>86 and a.GJ is not null and b.operate_code=2 then a.IMSI else null end) as MCWZGXCGL, now() LOAD_TIME

2023-06-07 上传

SELECT '155427848241370' || SEQ_KD_INDEX.nextval || 'GJ', a.PROBABLECAUSE, ( SELECT zhFUNc_GETNEWIDFORCIR ( id ) FROM gistar.tdn_switch ch WHERE ch.ipaddress = a.IP AND ROWNUM = 1 ), '1028200001', ( SELECT name FROM gistar.tdn_switch ch WHERE ch.ipaddress = a.IP AND ROWNUM = 1 ), ( SELECT code FROM gistar.tdn_switch ch WHERE ch.ipaddress = a.IP AND ROWNUM = 1 ), a.IP, a.ALARMTIME, a.alarmtext, SYSDATE, NULL, a.alarmid, a.createtime, a.perceivedseverity, a.moname FROM ( SELECT x.*, ( SELECT COUNT( DISTINCT re.coveraddressid ) FROM gistar.jr_customer_record @yjyx_zy re WHERE re.project_type IN ( 'FTTH宽带' ) AND re.oltip = x.IP ) AS oltcount FROM gistar.t_trouble_alarminfo x ) a WHERE a.specialty = 'PON' AND a.motype = 'OLT' AND IP IS NOT NULL AND a.PROBABLECAUSE = 'OLT网管脱网' AND ( SELECT substr( b.tt_number, 0, 2 ) FROM fwbz.t_trouble_ticket_new @GDOSSDB_SGDD b WHERE a.tt_id = b.tt_id ) = 'NM' AND ( SELECT title FROM fwbz.t_trouble_ticket_new @GDOSSDB_SGDD b WHERE a.tt_id = b.tt_id ) = 'OLT网管脱网' AND ( ( SYSDATE < '2021-05-01' AND a.oltcount >= 600 ) OR a.oltcount >= 400 ) UNION ALL SELECT '155427848241370' || SEQ_KD_INDEX.nextval || 'GJ', a.PROBABLECAUSE, ( SELECT zhFUNc_GETNEWIDFORCIR ( id ) FROM gistar.tdn_switch ch WHERE ch.ipaddress = a.IP AND ROWNUM = 1 ), '1028200001', ( SELECT name FROM gistar.tdn_switch ch WHERE ch.ipaddress = a.IP AND ROWNUM = 1 ), ( SELECT code FROM gistar.tdn_switch ch WHERE ch.ipaddress = a.IP AND ROWNUM = 1 ), a.IP, a.ALARMTIME, a.alarmtext, SYSDATE, a.cleartime, a.alarmid, a.createtime, a.perceivedseverity, a.moname FROM ( SELECT x.*, ( SELECT COUNT( DISTINCT re.coveraddressid ) FROM gistar.jr_customer_record @yjyx_zy re WHERE re.project_type IN ( 'FTTH宽带' ) AND re.oltip = x.IP ) AS oltcount FROM gistar.t_trouble_alarminfo x ) a WHERE a.specialty = 'PON' AND a.motype = 'OLT' AND IP IS NOT NULL AND a.PROBABLECAUSE = 'OLT网管脱网' AND ( SELECT substr( b.tt_number, 0, 2 ) FROM fwbz.t_trouble_ticket_new @GDOSSDB_SGDD b WHERE a.tt_id = b.tt_id ) = 'NM' AND ( SELECT title FROM fwbz.t_trouble_ticket_new @GDOSSDB_SGDD b WHERE a.tt_id = b.tt_id ) = 'OLT网管脱网' AND ( ( SYSDATE < '2021-05-01' AND a.oltcount >= 600 ) OR a.oltcount >= 400 ) AND a.cleartime IS NOT NULL AND a.alarmid IN ( SELECT alarm_id FROM olt_ALARM_BILL GROUP BY alarm_id, device_ip, alarm_time, create_time HAVING count( * ) = 1 );报错ORA-02287: sequence number not allowed here

2023-06-13 上传

上述211行附近的代码如下,请具体指出问题 def build_targets(self, p, targets): # Build targets for compute_loss(), input targets(image,class,x,y,w,h) na, nt = self.na, targets.shape[0] # number of anchors, targets tcls, tbox, indices, anch = [], [], [], [] gain = torch.ones(7, device=targets.device) # normalized to gridspace gain ai = torch.arange(na, device=targets.device).float().view(na, 1).repeat(1, nt) # same as .repeat_interleave(nt) targets = torch.cat((targets.repeat(na, 1, 1), ai[:, :, None]), 2) # append anchor indices g = 0.5 # bias off = torch.tensor([[0, 0], [1, 0], [0, 1], [-1, 0], [0, -1], # j,k,l,m # [1, 1], [1, -1], [-1, 1], [-1, -1], # jk,jm,lk,lm ], device=targets.device).float() * g # offsets for i in range(self.nl): anchors = self.anchors[i] gain[2:6] = torch.tensor(p[i].shape)[[3, 2, 3, 2]] # xyxy gain # Match targets to anchors t = targets * gain if nt: # Matches r = t[:, :, 4:6] / anchors[:, None] # wh ratio j = torch.max(r, 1. / r).max(2)[0] < self.hyp['anchor_t'] # compare # j = wh_iou(anchors, t[:, 4:6]) > model.hyp['iou_t'] # iou(3,n)=wh_iou(anchors(3,2), gwh(n,2)) t = t[j] # filter # Offsets gxy = t[:, 2:4] # grid xy gxi = gain[[2, 3]] - gxy # inverse j, k = ((gxy % 1. < g) & (gxy > 1.)).T l, m = ((gxi % 1. < g) & (gxi > 1.)).T j = torch.stack((torch.ones_like(j), j, k, l, m)) t = t.repeat((5, 1, 1))[j] offsets = (torch.zeros_like(gxy)[None] + off[:, None])[j] else: t = targets[0] offsets = 0 # Define b, c = t[:, :2].long().T # image, class gxy = t[:, 2:4] # grid xy gwh = t[:, 4:6] # grid wh gij = (gxy - offsets).long() gi, gj = gij.T # grid xy indices # Append a = t[:, 6].long() # anchor indices indices.append((b, a, gj.clamp_(0, gain[3] - 1), gi.clamp_(0, gain[2] - 1))) # image, anchor, grid indices tbox.append(torch.cat((gxy - gij, gwh), 1)) # box anch.append(anchors[a]) # anchors tcls.append(c) # class return tcls, tbox, indices, anch

2023-07-17 上传