Skip to content

Instantly share code, notes, and snippets.

View AndreaCrotti's full-sized avatar

Andrea Crotti AndreaCrotti

View GitHub Profile
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define LIMIT 10000000
int square_digits(int);
int is_89(int);
int main(int argc, char *argv[])
function x = trsv(L, y, b, alg)
## No sanity check of the input, assuming is always correct
len = length(L);
## this could be whatever, after I overwrite any value present
x = zeros(len, 1);
## setting initial values
Ltl = L(1:0, 1:0);
Lbl = L(1:len, 1:0);
dim_range = 2:10:200;
idx = 1;
for dim = dim_range
test_mat = [ tril(rand(dim)) tril(rand(d) + eye(d)) tril(randn(dim)) ];
m1 = tril(rand(dim));
m2 = tril(rand(dim) + eye(dim));
m3 = tril(randn(dim));
y = rand(dim, 1);
acc11(idx) = accuracy(m1, y, b, 1);
## get the accuracy of the algorithm and plot it nicely
## x = problem size
## y = accuracy (different lines for different problem)
## Plotting should contain also the precision working with the different kind of matrices
function gen_plot(range, acc1, acc2)
xlabel('dimension');
ylabel('accuracy');
## why ignoring extra labels?
legend('alg 1', 'alg 2');
grid on;

Compiling and running

Under linux/osx simply run the script test.sh in the main directory, it will compile everything and run one server and one client. For example this is the output of a possible execution:

Example

module Inference where
-- |recursive subtyping inference program
import TypeUtils
import List (union, (\\), nub)
import Flatten (isTypeFlat,isSysFlat)
import Maybe(fromJust)
-- main function for analysis
uni :: Subst -> Subst
// -*- compile-command: "make" -*-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <assert.h>
#include <sysexits.h>
#include <math.h>
#include "razz.h"
/**
* @file razz.h
* @author Andrea Crotti <andrea.crotti.0@gmail.com>
* @date Fri Feb 5 21:10:41 2010
*
* @brief Razz simulation
*
*
*
bash-3.2$ ./glue.sh 3 A A A 2 3
theoretical result:
-1 0.403918930283
5 0.000807333277269
6 0.00376755529392
7 0.0103159252095
8 0.0218877021837
9 0.0399181453761
10 0.0658425139461
11 0.101096067054
Es war Acht Uhr und der Wecker hat geklingelt zu Hosni Hause.
Danach er ist aufgewacht und bereit für einen neuen Tag.
Herr Hosni hat gefrühstückt und dann hat er damit begonnen.
Die Aufgabe war sehr einfach, der Fenster putzen mit den Leiter.