Skip to content

Instantly share code, notes, and snippets.

View certik's full-sized avatar

Ondřej Čertík certik

View GitHub Profile
This file has been truncated, but you can view the full file.
program bench3
implicit none
integer :: c
c = 0
call g1(c)
call g2(c)
call g3(c)
call g4(c)
call g5(c)
call g6(c)
@certik
certik / mydelta.cpp
Created November 12, 2024 17:43
mydelta prototype implementation of `delta`
// Compile with:
// g++ -O3 -march=native -o mydelta mydelta.cpp
// Use it like:
// git diff | ./mydelta
#include <iostream>
#include <string>
#include <regex>
// ANSI escape codes for colors
@certik
certik / mnist-cnn.dot.png
Last active February 27, 2024 15:06
Computational Graph
Image
/* The Computer Language Benchmarks Game
https://salsa.debian.org/benchmarksgame-team/benchmarksgame/
contributed by Martin Jambrek
based off the Java #2 program contributed by Mark C. Lewis and modified slightly by Chad Whipkey
*/
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <stdio.h>
int main()
{
#define REPEAT(count, action) REPEAT_HELPER(count, action)
#define REPEAT_HELPER(count, action) \
REPEAT_##count(action)
#define REPEAT_1(action) action(1)
#define REPEAT_2(action) action(2) REPEAT_1(action)
#define REPEAT_3(action) action(3) REPEAT_2(action)
module semigroup_m
!! A semigroup is a type with a sensible operation for combining two objects
!! of that type to produce another object of the same type.
!! A sensible operation has the associative property (i.e. (a + b) + c == a + (b + c))
!! Given this property, it also makes sense to combine a list of objects of
!! that type into a single object, or to repeatedly combine an object with
!! itself. These operations can be derived in terms of combine.
!! Examples include integer (i.e. +), and character (i.e. //)
implicit none
private

NAME

LFortran - modern interactive LLVM-based Fortran compiler

SYNOPSIS

lfortran [OPTIONS] [files...] [SUBCOMMAND]

DESCRIPTION

@certik
certik / a.f90
Created December 1, 2023 15:12
PROGRAM Calibration
IMPLICIT NONE
INTEGER :: total_sum, first_digit, last_digit, calibration_value
CHARACTER(100), DIMENSION(:), ALLOCATABLE :: calibration_document
INTEGER :: i, len_line, char_value, status
! Initialize total sum
total_sum = 0
@certik
certik / a.f90
Created November 11, 2023 00:31
program XX
requirement is_binary_op(T, op)
type, deferred :: T
function op(lhs, rhs) result(res)
type(T), intent(in) :: lhs, rhs
type(T) :: res
end function
end requirement
program expr2
implicit none
integer :: y, z
z = f(y)
print *, z, y
contains