Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.
29285 Discussions

Bit field and Graphic library on Linux

brunocalado
Beginner
862 Views
I'm using the intel fortran compiler 11 on linux.

1 - ) Bit field
I want to create a long bit chain. Use the bits on Integer (Kind=8) is not enough. It must have the range 1-10000000.

The way I founded is create a array of logical
LOGICAL (KIND=1) :: gene( 10000 )

But it is very ugly because it allocated 10000 bytes instead bits. And I can't use the intrisic bit functions.

Is there a way of make true bit field?

2 - ) I tried to use the graphic library but it is just available for windows. Please make it work for linux.


tks
0 Kudos
8 Replies
eliosh
Beginner
862 Views
Quoting - brunocalado
I'm using the intel fortran compiler 11 on linux.

1 - ) Bit field
I want to create a long bit chain. Use the bits on Integer (Kind=8) is not enough. It must have the range 1-10000000.

The way I founded is create a array of logical
LOGICAL (KIND=1) :: gene( 10000 )

But it is very ugly because it allocated 10000 bytes instead bits. And I can't use the intrisic bit functions.

Is there a way of make true bit field?

2 - ) I tried to use the graphic library but it is just available for windows. Please make it work for linux.


tks
1) I am afraid you will have to allocate an array of integers and access the bits manually.
2) not clear what library is "*the* graphics library" :)
0 Kudos
brunocalado
Beginner
862 Views
Quoting - eliosh
1) I am afraid you will have to allocate an array of integers and access the bits manually.
2) not clear what library is "*the* graphics library" :)

There's functions for graphical interface. like arc pixels But they are available only for windows



INTEGER :: Array(5,10)
INTEGER :: tmp(5)

Array = 1
tmp = 2

Array(:,10) = tmp


Why the last line doesn't work?



0 Kudos
Steven_L_Intel1
Employee
862 Views
How does it "not work"?
0 Kudos
brunocalado
Beginner
862 Views
How does it "not work"?


But I did the same here. Look:


LOGICAL (KIND=1) :: gene(5, 10)
INTEGER :: Index(10)

gene(:,:) = gene(:,Index)



Output:
Index Gene before (gene(:,:) = gene(:,Index))
1 : T F F T T
2 : T T T T T
3 : T T T T T
4 : T T F T T
5 : F T F T T
6 : F F F T T
7 : T F T F F
8 : T F T T T
9 : F F T T F
10 : T T F T F

Index before -> new Index Gene after (gene(:,:) = gene(:,Index))
1 -> 5 F T F T T
2 -> 1 T F F T T
3 -> 2 T T T T T
4 -> 3 T T T T T
5 -> 6 F F F T T
6 -> 8 T F T T T
7 -> 9 F F T T F
8 -> 4 T T F T T
9 -> 10 T T F T F
10 -> 7 T F T F F

The genes must change. The second (T T T T T) should go to the first position. The third (T T T T T) to the second...

It is the same thing, no?
0 Kudos
eliosh
Beginner
862 Views
Quoting - brunocalado


But I did the same here. Look:


LOGICAL (KIND=1) :: gene(5, 10)
INTEGER :: Index(10)

gene(:,:) = gene(:,Index)



Output:
1 : T F F T T
2 : T T T T T
3 : T T T T T
4 : T T F T T
5 : F T F T T
6 : F F F T T
7 : T F T F F
8 : T F T T T
9 : F F T T F
10 : T T F T F

1 -> 5 F T F T T
2 -> 1 T F F T T
3 -> 2 T T T T T
4 -> 3 T T T T T
5 -> 6 F F F T T
6 -> 8 T F T T T
7 -> 9 F F T T F
8 -> 4 T T F T T
9 -> 10 T T F T F
10 -> 7 T F T F F

The genes must change. The second (T T T T T) should go to the first position. The third (T T T T T) to the second...

It is the same thing, no?

What can we see from this example ?????
Show the content of gene and Index before the permutation and after it.

0 Kudos
brunocalado
Beginner
862 Views
updated
0 Kudos
eliosh
Beginner
862 Views
Quoting - brunocalado
updated
Your results look perfectly reasonable.
Note that the index change 1->5 means that the 5th element moves to the first position. Similarly, 2->4 means that the fourth element becomes the second.

For some reason you expect them to move in "reverse" direction.
0 Kudos
brunocalado
Beginner
862 Views
Quoting - eliosh
Your results look perfectly reasonable.
Note that the index change 1->5 means that the 5th element moves to the first position. Similarly, 2->4 means that the fourth element becomes the second.

For some reason you expect them to move in "reverse" direction.

Thank you.

This is what I want.
gene(:,Index) = gene(:,:)

0 Kudos
Reply