NORMA (1158464), страница 5

Файл №1158464 NORMA (Раздаточные материалы) 5 страницаNORMA (1158464) страница 52019-09-18СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 5)

INPUT One (FILE=‘file1’,F10.2), Two(FILE=‘file2.dat’ ) ON Grid2.

Here are examples of output variables declarations:

OUTPUT Velocity(' Velocity = ' ,F9.1) .

OUTPUT X(FILE='FILE17' , ORDER(J,K,I), ALL, F5.1) ON Grid.

OUTPUT Y('Matrix of values Y parameter', FILE=‘OT5’ ,ALL,F15.2) ON ABC.

For output in more complicated form (diagrams, tables, etc.) you should use standard libraries and packets tools or your own programs written in other languages (5.2.5).

Syntax of input data files:

file :

input-element { input-element }*

input-element :

name-scalar = arithm-constant;

name-variable-on-domain ( list-index-range ) = data ;

index-range :

name-index = int-constant .. int-constant

data :

list-data-element

data-element :

int-constant

body

int-constant ( data )

Programmer can:

place input elements in any order,

control the order of numerical values in file by changing index order,

write repeated data in a short form.

Here is an example of input data file’s contents:

C(K=1..10)=5(-10.1) ,5(1.01);

ALPHA=3.17; BETA=-0.12; GAMMA=0.000000001;

C(K=11..20)=5(10.1),5(-1.01);

Here is an example of input data file data.dat contents for Gauss program:

MAIN PART Gauss.

! Solution of linear equations by Gauss-Jourdan method.

BEGIN

Ot:(t=0..n). Oi:(i=1..n). Oj:(j=1..n).

Oij:(Oi;Oj). Otij:(Ot;Oij).

Oti:(Ot;Oi). Otij1:Otij / t=1..n. Oti1:Oti / t=1..n.

DOMAIN PARAMETERS n=5.

VARIABLE a ON Oij. VARIABLE m ON Otij.

VARIABLE b, ON Oi. VARIABLE r ON Oti.

INPUT a(FILE='data') ON Oij, b(FILE='data') ON Oi.

OUTPUT x(FILE='results',ALL) ON Oi.

FOR Otij/ t=0 ASSUME m=a.

FOR Oti / t=0 ASSUME r=b.

OtiEQtij1,OtiNEtj1:Otij1 / i=t. OiEQti1,OiNEti1:Oti1 / i=t.

FOR OtiEQtj1 ASSUME m = m[t-1,i=t]/m[t-1,i=t,j=t].

FOR OiEQj1 ASSUME r = r[t-1,i=t]/m[t-1,i=t,j=t].

FOR OiNEtj1 ASSUME m = m[t-1]-m[t-1,j=t]*m[i=t].

FOR OiNEti1 ASSUME r = r[t-1]-m[t-1,j=t]*m[i=t].

FOR Oi ASSUME x = r [t=n].

END PART.

Input file data.dat:

B(I=1..3)=5.0, 13.0, 3.0;

A(I=1..5,J=1..5)=2.0, 3.0, -4.0, 5.0, -1.0,

3.0, 4.0, -1.0, 6.0, 1.0,

2.0, 0.0, -3.0, 0.0, 4.0,

0.0, 2.0, 0.0, 0.3, 0.0,

3.0, -1.0, 2(0.0), 1.0;

B(I=4..5)= 5.0, 3.0;

The values of data multidimensional arrays are placed in the file corresponding to the given indexes. The values of the first index from the right are changed the first : in the given example matrix A(I,J) is set on rows, in other words I =1, J = 1,2,3,4,5, then I = 2, J = 1,2,3,4,5 etc. till I =5, J = 1,2,3,4,5.

The way of input file data.dat setting isn’t the only one.

5.1.6. Declaration of external names

declaration-of-external-names :

declaration-of-external-functions

declaration-of-external-parts

declaration-of-external-functions :

EXTERNAL FUNCTION list-name-external-function [ type ]

declaration-of-external-parts :

EXTERNAL PART list-name-external-simple-part

If the names of the functions or parts are their actual or formal parameters they are indicated In the declaration of external names by all means . Default type of external function is REAL.

EXTERNAL FUNCTION Last,First DOUBLE.

EXTERNAL PART Middle.

5.1.7. Declaration of distribution indexes

declaration-of-distribution-indexes :

DISTRIBUTION INDEX name-index = simple-range , name-index = simple-range

simple-range :

int-constant .. int-constant

Declaration of distribution indexes is used for representation of two index directions from task domain index space on processor element (PE) matrix of distributed system. If functions and parts have this declaration they are called distributed, if there is no such declaration in their content they are called nondistributed systems. You can meet this declaration in the distributed part or function only once; it is prohibited in the main part in other words the main part is always nondistributed.

Given declaration results in data and control distribution between PE elements of the system or automatic generation of data exchange between PE if you need it. The subject of distribution is variables which indexes coincided with ones in declaration DISTRIBUTION INDEX. E.g. if there is a declaration

DISTRIBUTION INDEX i=2..8, j=11..11.

all the variables defined on the domains with i and j indexes will be distributed on PEi,j with virtual row numbers i=2..8 in the column number j=11 of PE matrix.

Computations defined in nondistributed part or function are carried out as a whole in one PE ( though there may be several such PEs).

Declaration

DISTRIBUTION INDEX i=2...8,j=0..0.

is false: the elements of PE matrix are considered to be numbered from 1.

5.2. Operators in NORMA

operator :

scalar-operator

operator-ASSUME

call-part

There are three defined types of operators in NORMA. They are scalar operator, operator ASSUME and call part. The operators are used for description of computations for task solution.

5.2.1. Scalar operator

scalar-operator :

name-scalar = scalar-arithm-expression

scalar-arithm-expression :

arithm-expression

Scalar operator is used for computation of scalar arithmetical values. In fact it is an analogue of assignment statement in traditional programming languages. Name of scalar is indicated in the left part of the operator and scalar arithmetical expression built in usual way from scalars, arithmetical constants, domain’s parameters, function calls, variables on domain with index-constants.

Variables defined on domain which index expressions are not constants can’t be included into scalar arithmetical expression (exception from this rule is arguments of reduction functions (5.2.3) ).

IJ: ( ( i=1..MaxI) ; (j=1..MaxJ ) ).

DOMAIN PARAMETERS MaxI = 3, MaxJ = 90.

VARIABLE ScalarV INTEGER. VARIABLE Pi DOUBLE.

VARIABLE ArrayV DEFINED ON IJ DOUBLE.

ScalarV = MaxI*(MaxJ-1)/2+SQRT(PI)/SIN(ArrayV[i=1,j=55]).

Reassignment in scalar operator is prohibited, that’s the next operator is false:

ALPHA = ALPHA-1.

5.2.2. ASSUME operator

operator-ASSUME

FOR domain ASSUME relation { ; relation }*

relation :

name-variable-on-domain = arithm-expression

call-part

ASSUME operator is used for computation of arithmetical variables defined on domains.

The case of part call in the body of ASSUME operator is described in 5.2.4.

The terms of arithmetical expression in the right part of relation may be variables defined on domain, scalars, arithmetical constants, domain’s parameters, function calls, indexes.

Informally ASSUME operator’s semantics is defined in the way described below. Let’s consider given relation

FOR D(i1,...,in) ASSUME

where

- D(i1,...,in) - ASSUME operator’s domain,

- (i1,...,in) - D domain indexes,

- - variables names defined on domain,

- -index expressions of the left part

- - index expressions of the right part,

- F - function computed in the right part,

- Other - other terms of the right part.

Every relation set the rule F of variable from the left part values computation based on the values of variables and the terms Other from the right part:

(1) all the points are defined;

(2) value of from the left part is computed in point for every point ;

(3) index expressions of all the variables from the right part of relation are computed for every point and the set of right part arguments is defined

(4) if for some period of time for point all the arguments from X have been computed the computation of value from the left part is possible, but if all the arguments haven’t been defined the computation in that point in that period of time is impossible (it doesn’t mean that it is impossible in all cases).

The name of ASSUME operator underlines the fact that it defines the rule of value computation in the only way but doesn’t require immediate computation in particular place of program and doesn’t arrange the order and the method (parallel or sequential) of computation.

E.g. if the variable is defined as

Matrix: ( (I=1..5) ; (j=1..5) ).

VARIABLE DEFINED ON Matrix.

then operator

FOR Matrix ASSUME X =0.

is a request for 25 elements of variable X zeroisement. The method of this request realization isn’t fixed in this language.

NORMA is a single-assignment language, reassignment is prohibited. That’s further operators are incorrect:

FOR Matrix ASSUME X = Y; X = Z.

FOR Matrix ASSUME X = X+1.

Constraints on the index form the left part of relation (these are indexes without displacement) are not essential because domain D from the operator’s header allows to define rather complicated relations. If you need to define the computation

Xi,+1i =F(Yi), i=1,...,n, X defined on domain Ox : ( ( I=1..N ) ; ( J=1..N ) )

you may do it in this way :

Ox : ( ( I=1..N ) ; ( J=1..N ) ). OxII : Ox/ J=I+1.

Характеристики

Список файлов учебной работы

Свежие статьи
Популярно сейчас
Почему делать на заказ в разы дороже, чем купить готовую учебную работу на СтудИзбе? Наши учебные работы продаются каждый год, тогда как большинство заказов выполняются с нуля. Найдите подходящий учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6508
Авторов
на СтудИзбе
302
Средний доход
с одного платного файла
Обучение Подробнее