当前位置:网站首页>Chengxin University envi_ IDL first week experiment test: simple operation of array + detailed analysis
Chengxin University envi_ IDL first week experiment test: simple operation of array + detailed analysis
2022-07-19 03:22:00 【Fried eggplant】
Catalog
Test content in the first week
Test content in the first week


Programming
pro week_one
print, ' subject 1:'
a = findgen(4, 6) ; Create a 4 Column 6 Index matrix of rows ( The type is float)
b = 3 ; Create a value of 3 Of int Type variable
c = [3] ; Create a single element ( The value is 3) One dimension of int Type of the array
d = [9, 3, 1] ; Create a one-dimensional with three elements int Type of the array
; Start calculating
print, a[3, 4] ; Output numerical values in three columns and four rows
print, a[15] ; Output No 15 The value of ( Subscript from 0 Starting number )
print, a + b ; + Here is the addition of the elements of the two matrices , What is returned is a matrix form
print, a[1, 1] + b ; matrix a pass the civil examinations 1 Column number 1 1 That's ok ( Subscript from 0 Start ) Values and variables of b The value of the combined
print, a + c ; Because of the matrix a Is a two-dimensional array , and c It's a one-dimensional array , So generally, when adding, it returns a one-dimensional array
print, a + d ; This addition is similar
print, ' subject 2:'
; Create a general array
a = [[3, 9, 10], [2, 7, 5], [4, 1, 6]]
b = [[7, 10, 2], [5, 8, 9], [3, 1, 6]]
; Array addition 、 Multiply ————》+、* That is, the elements of the array are added correspondingly 、 Multiply to return a new array
print, a + b
print, a * b
print, ' subject 3( difficult ):'
; Create a general array
a = [[0, 5, 3], [4, 0, 2], [0, 7, 8]]
b = [[0, 0, 1], [9, 7, 4], [1, 0, 2]]
; Retain a Greater than 3 Result , All other elements are set to 0
print, (a gt 3) * a
; Retain b Medium greater than or equal to 4 Result , The rest of the elements are set to 9
print, (b le 4) * b + (b gt 4) * 9
; Calculation a and b The average of
print, (a + b) / 2.0 ; Be careful , int and int Divide the type data to get int type , There will be a loss of precision ————》 There will be 2 Turn into 2.0 You can avoid
; Calculation a and b The average of , 0 Values are not included in the calculation ( Such as 5 and 0 The average value of is still 5)
c = (a ne 0) + (b ne 0) ; Only the corresponding two are not 0 So the divisor is 2, If only one of them is 0, So the divisor is 1, If both are 0, So the divisor is 0
; print, (c le 1) + (c eq 2) * 2.0
print, (a + b) / ((c le 1) + (c eq 2) * 2.0) ; Here to c The purpose of further processing is to avoid the divisor being 0 The situation of
end
The following is the result of the compilation run :
IDL> week_one
% Compiled module: WEEK_ONE.
subject 1:
19.0000
15.0000
3.00000 4.00000 5.00000 6.00000
7.00000 8.00000 9.00000 10.0000
11.0000 12.0000 13.0000 14.0000
15.0000 16.0000 17.0000 18.0000
19.0000 20.0000 21.0000 22.0000
23.0000 24.0000 25.0000 26.0000
8.00000
3.00000
9.00000 4.00000 3.00000
subject 2:
10 19 12
7 15 14
7 2 12
21 90 20
10 56 45
12 1 36
subject 3( difficult ):
0 5 0
4 0 0
0 7 8
0 0 1
9 9 4
1 0 2
0.000000 2.50000 2.00000
6.50000 3.50000 3.00000
0.500000 3.50000 5.00000
0.000000 5.00000 2.00000
6.50000 7.00000 3.00000
1.00000 7.00000 5.00000
IDL>
————————————————————————————————————————
————————————————————————————————————————
————————————————————————————————————————
Too few words , There are a few ugly words here , thank you .
IDL> week_one
% Compiled module: WEEK_ONE.
subject 1:
19.0000
15.0000
3.00000 4.00000 5.00000 6.00000
7.00000 8.00000 9.00000 10.0000
11.0000 12.0000 13.0000 14.0000
15.0000 16.0000 17.0000 18.0000
19.0000 20.0000 21.0000 22.0000
23.0000 24.0000 25.0000 26.0000
8.00000
3.00000
9.00000 4.00000 3.00000
subject 2:
10 19 12
7 15 14
7 2 12
21 90 20
10 56 45
12 1 36
subject 3( difficult ):
0 5 0
4 0 0
0 7 8
0 0 1
9 9 4
1 0 2
0.000000 2.50000 2.00000
6.50000 3.50000 3.00000
0.500000 3.50000 5.00000
0.000000 5.00000 2.00000
6.50000 7.00000 3.00000
1.00000 7.00000 5.00000
IDL>
边栏推荐
- ubuntu清除cuda缓存
- Examine your investment path
- Shell script receives and returns parameters
- MySQL replication table
- Display zabbix6.0 information using grafana8.5.2
- Thinking for half a year
- Can't access this website can't find DNS address DNS_ PROBE_ What about started?
- ES6学习笔记——B站小马哥
- Install Net prompt "cannot establish a certificate chain to trust the root authority" (simple method with download address)
- Ncnn mat matrix class
猜你喜欢

MySQL面试题(2022)

Yolov6 learning first chapter
![mysqldump: [Warning] Using a password on the command line interface can be insecure.](/img/91/8b0d35f85bc0f46daac4e1e9bc9e34.png)
mysqldump: [Warning] Using a password on the command line interface can be insecure.
![[face recognition] face recognition based on histogram histogram with matlab code](/img/a6/ae776d084a207647501ca951e32000.png)
[face recognition] face recognition based on histogram histogram with matlab code

Visual analysis of ncnn param file and bin model

Flutter development: running the flutter upgrade command reports an error exception:flutter failed to create a directory at... Solution

Can't access this website can't find DNS address DNS_ PROBE_ What about started?
![Theoretical basis of doubledqn and its code implementation [pytoch + pendulum-v0]](/img/f2/4a3cc8e5173789111080915aceb9fd.png)
Theoretical basis of doubledqn and its code implementation [pytoch + pendulum-v0]
![[regression prediction] lithium ion battery life prediction based on particle filter with matlab code](/img/1d/5562934499edfb4781b1118d0c4f9c.png)
[regression prediction] lithium ion battery life prediction based on particle filter with matlab code
![[NoSQL] redis high availability and persistence](/img/73/53580db08b33c06c595fb3dfd6abce.png)
[NoSQL] redis high availability and persistence
随机推荐
[NoSQL] redis configuration and optimization of NoSQL (simple operation)
zsh: command not found: mysql
Code demonstration of fcos face detection model in openvino
Specifications, multi table query basis
ubuntu清除cuda缓存
Zabbix6.0 monitoring vcenter7.0
We should increase revenue and reduce expenditure
This is a mathematical problem
module_ Basic principle of init function
樂視還有400多比特員工?過著沒有老板的神仙日子 官方出來回應了...
05 central processing unit
2022-07-16:以下go语言代码输出什么?A:[];B:[5];C:[5 0 0 0 0];D:[0 0 0 0 0]。 package main import ( “fmt“ )
RuntimeError_ Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor)
[PHP] tp6 multi table connection query
It's good to take more exercise
JPA初识(ORM思想、JPA的基本操作)
Zabbix6.0 monitors Dell and IBM server hardware through Idrac and imm2
深入理解机器学习——类别不平衡学习(Imbalanced Learning):样本采样技术-[人工采样技术之ADASYN采样法]
[NoSQL] redis high availability and persistence
Yolov5 opencv DNN reasoning