Anonymous
This is matrix multiplication code in parallel:
#pragma omp parallel for
for(int i=0; i<dimension; i++){
for(int j=0; j<dimension; j++){
for(int k=0; k<dimension; k++){
matrixC[i][j] += matrixA[i][k] * matrixB[k][j];
}
}
}
Anonymous
Anonymous
Anonymous
And this is another one:
#pragma omp parallel for private(m,j)
for(i=0;i<N;i++)
{
for(j=0;j<N;j++){
C[i][j]=0.; // set initial value of resulting matrix C = 0
for(m=0;m<N;m++){
C[i][j]=A[i][m]*B[m][j]+C[i][j];
} // printf("C: %f \t",C[i][j]);
}
}
Anonymous
In the first one, the OUTER for loop is parallelized and iterations are distributed to different threads.
Anonymous
In the 2nd case, why are m and j declared private
Anonymous
Can anyone decode it for me how is the above code running among different threads?
Anonymous
Ok, so is it like each i is distributed among different thread for computation?
Kirk
Thank you admin :)
Kirk
code for controlling 4 blinking LED's. first LED to blink after 8 seconds, second LED to blink after 4 seconds, third after 2 seconds and the last one to blink after every one second. please, code in C
Où va le monde
https://pastebin.com/mUMyjREX dont working in reading files,where loop while
Anonymous
Anonymous
Kirk
Où va le monde
in reading files produces such an error
while (! find_name.eof ())
{
find_name « read_name [i] « '\ n';
find_lastname « read_lastname [i] « '\ n';
find_city « read_city [i] « '\ n';
find_address « read_address [i] « '\ n';
find_mobile_namber « read_mobile_namber [i] « '\ n';
i ++;
}
in this cycle writes * invalid operands to binary expression (std :: ifstream) *
I’m doing this algorithm following the example of how I was taught at the Academy,
I searched for such an error for this loop but could not find it.
https://pastebin.com/mUMyjREX
Kirk
Write it yourself
since I am new here... I can't paste a link from pastebin....... I've tried and the bot deleted it. looks like am gonna wait for 24 hours before i get help😢
Anonymous
The message from @DrWambua:
Well, I wanna create a binary counting circuit in Arduino and the code I have is somewhat long...I wanna figure out how to use loops to make it shorter...... I'd like to have a counter that counts sequentially from 0 to 7 without necessarily having to hardcode the state of every count. here's the code I've written so far; https://pastebin.com/KtFtHA7d
Talula
Talula
rock
Hi
klimi
Hi
Talula
Hi
01000001011011010100000101101110
/rules
rock
I'm new to the group
rock
Can I know from which country
klimi
This group is international
rock
Beginner in programming language C
Talula
rock
on God `s will
X3eRo0
hey
X3eRo0
i want a stack in which i can push both char *'s and ints
X3eRo0
something like push("Hello, World\n"); and push(5);
András
András
Std::variant?
X3eRo0
===========stack=============
[00] Hello, World
[01] 5
=============================
András
Void* ?
X3eRo0
i did found this https://stackoverflow.com/questions/13059988/can-i-push-string-and-int-values-onto-a-stack
X3eRo0
Void* ?
yeah but how do i implement the stack itself
I_Interface
X3eRo0
I_Interface
X3eRo0
I HAVE THIS https://pastebin.com/EzwxNx8r
X3eRo0
thanks @I_Interface and sorry
Anonymous
Hi how are you ?
rock
X3eRo0
@I_Interface template will give me 2 different function for char * strings and ints
X3eRo0
am i right?
X3eRo0
but my stack implementation should be able to hold both data types
Ahmed
Everything is fine while c++ is strong!🏆
András
András
X3eRo0
i want something which can hold both data types like 1 function and 1 stack
X3eRo0
@Deumaudit see this https://pastebin.com/1qhEeFYZ
X3eRo0
in this code i tried the void * thingy
I_Interface
Anonymous
Anonymous
Actually I am not getting how to do it
Anonymous
What r u trying to do say me the problem
Anonymous
You have to enter a string. Output will be longest palindrome substring.
For example:-
Input- ababdbax
Output- abdba
There are other substring which are also palindrome such as aba,bab,bdb. But abdba is longest so it is the output
Anonymous
Tomas
Dude please indent your code properly.
Tomas
https://01.org/linuxgraphics/gfx-docs/drm/process/coding-style.html
Anonymous
Hey
Kirk
https://pastebin.com/CDjaprQ7
void loop() {
for (int i = 0;i<=7;i++)
{
CountBinary(i);
delay(1000);
}
}
void CountBinary(int pin1, int pin2, int pin3){
switch (value){
case 0:
digitalWrite(pin1, LOW); digitalWrite(pin2, LOW); digitalWrite(pin3, LOW);
break;
case 1:
Kirk
klimi
https://t.me/programminginc/231507
01000001011011010100000101101110
Kirk
Anonymous
Talula
Talula
Tomas
I think this is okay.
No one codes like what. It is important to write your code in a way what it is easy to read and comprehend. It's bad that anyone reading it must take additional time to understand what is written.
Anonymous
Nomid Íkorni-Sciurus
I have a question
klimi
ask
Kirk
https://pastebin.com/uUpz6GLg
Thanks mate..... now there's one little problem....... it only counts the even bits (000,010,100,110) only the even numbers......... the states 001,011,101 and 111 are not displayed....... would you happen to know how to incorporate the missing states? thank you :)