Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Network & Security Expert

The FORALL Statement

The FORALL statement allows for more common assignments to sections of an array. A FORALL statement has the general form.

              FORALL ( triplet, ..., triplet,  mask )

                     statement

  where triplet has the general form

                 subscript = lower: upper : step-size

and states a set of indices. step-size is optional. Statement is an pointer or arithmetic assignment and the assignment statement is evaluated for those index values shown by the list of triplets that are not rejected by the optional mask.

Example 7 The following statements set each element of matrix X to the sum of its indices.

 Parallel Programming

 FORALL (i=1:m, j=1:n)     X(i,j) = i+j

and the following statement sets the upper right triangle of  matrix Y to zero .

FORALL (i=1:n, j=1:n, i

Multi-statement FORALL construct:

Multi-statement FORALL is shorthand for the series of single statement FORALLs. The

syntax for FORALL is

FORALL (index-spec-list [,mask]) Body

END FORALL

Nesting of FORALL is allowed.

Example 8

Let a= [2,4,6,8,10], b=[1,3,5,7,9], c=[0,0,0,0,0]

Consider the following program segment

FORALL (i = 2:4) a(i) = a(i-1)+a(i+1) c(i) = b(i) *a(i+1). END FORALL

The computation will be a[2] =a[1]+a[3] =2+6=8 a[3] =a[2]+a[4] =4+8=12 a[4] =a[3]+a[5] = 6+10=16

c[2] = b[2] *a[3] = 3*12=36 c[3] = b[3] *a[4] = 5*16=80

c[4] = b[4] *a[5] =7*10=70

Thus output is

a= [2,8,12,16,10], b=[1,3,5,7,9], c=[0,36,80,70,0]

Computer Network & Security, Computer Science

  • Category:- Computer Network & Security
  • Reference No.:- M9525805

Have any Question?


Related Questions in Computer Network & Security

Data communications and networks assignment -aim a library

Data Communications and Networks Assignment - Aim: A library research and industry related project is to be carried out on a topic of your choice. The project topic must be related to Data Communications and Networking. ...

Lab activity investigate system backup and restore

Lab Activity: Investigate System Backup and Restore Tools Purpose: Assess and Document Tools to Backup and Restore the System Hard Drive for a Windows 8.1 Workstation. - Assess and document the use of a system backup too ...

Question do some research and find a case of cyber

Question : Do some research and find a case of cyber harassment or cyberbullying. Explain the case, and discuss the relevant theories of criminal justice associated with the perpetrator(s). Your response should be a mini ...

Assignment - 8021q tunneling q-in-q configuration8021q

Assignment - 802.1Q Tunneling (Q-in-Q) Configuration 802.1Q tunneling (aka Q-in-Q) is a technique often used by Metro Ethernet providers as a layer 2 VPN for customers. 802.1Q (or dot1q) tunneling is pretty simple...the ...

Cybersecurity policy design issues describe cybersecurity

Cybersecurity Policy Design Issues Describe cybersecurity policy features that are needed to protect against the Insider Threat, Operations Security, Access Control and Biometric Authentication What features can be added ...

This is from a practical exercise the answers are below but

This is from a practical exercise. The answers are below BUT, I do not know how they came up with them. I'd like a step-by-step explanation of how they got the answers. Practical Exercise 1: Assume the demand for teacher ...

If a router is attached to a network with a base ip address

If a router is attached to a network with a base IP address of 198.10.0.0/20 and receives a packet addressed to 198.10.10.144, answer the following questions: a. What is the network mask used by the router? (in dotted de ...

Per capita income of winterfell is 15000 with a growth rate

Per capita income of Winterfell is $15,000 with a growth rate of 4%. Per capita income of King's Landing is $25,000 with a growth rate of 0%. How long until per capita income is the same in both locations?

Overview of network security assessment - security

Overview of Network Security Assessment - Security Challenges in Emerging Networks Purpose of the assessment - The purpose of this assignment is to develop skills to independently think of innovation. Students will be ab ...

From the product designed expanded as follows1 from your

From the product designed expanded as follows. 1. From your list of possible responses to the threat, choose one that you will focus on in this product. Create the requirements for your product by completely identifying ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As