Merged
Show file tree
Hide file tree
Changes from all commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Failed to load files.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
FC = gfortran
STDLIB_CFLAGS = $(shell pkg-config --cflags fortran_stdlib)
STDLIB_LIBS = $(shell pkg-config --libs fortran_stdlib)

all: ex_bitsets ex_logger ex_sorting

ex_bitsets: ex_bitsets.f90
$(FC) $(STDLIB_CFLAGS) $^ -o $@ $(STDLIB_LIBS)

ex_logger: ex_logger.f90
$(FC) $(STDLIB_CFLAGS) $^ -o $@ $(STDLIB_LIBS)

ex_sorting: ex_sorting.f90
$(FC) $(STDLIB_CFLAGS) $^ -o $@ $(STDLIB_LIBS)

clean:
$(RM) ex_bitsets
$(RM) ex_logger
$(RM) ex_sorting

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
use, intrinsic :: iso_fortran_env, only: output_unit
use stdlib_bitsets
implicit none

integer :: i
type(bitset_64) :: b1, b2

! initialization from string
call b1%from_string('001100')
call b1%write_bitset(output_unit) ! S6B001110

! initialization from logical array
b2 = [(.true., i=1,6)]
call b2%write_bitset(output_unit) ! S6B111111

! binary operations overwrite first arg
call xor(b1, b2)
call b1%write_bitset(output_unit) ! S6B110001
call b2%write_bitset(output_unit) ! S6B111111

! set specific position/contiguous subset (zero-based!)
call b1%set(2, 4)
print *, b1 == b2 ! T
end

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
use stdlib_sorting, only: sort_index
use stdlib_kinds, only: int64
implicit none

integer :: digits(6) = [3,1,4,1,5,9]
character :: chars(6) = ['a','b','c','d','e','f']
integer(int64) :: index(6)
call sort_index(digits, index)
print '(6i1)', digits ! 113459
print '(6i1)', index ! 241356
print '(6a1)', chars(index) ! bdacef
end
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading