Skip to content

Instantly share code, notes, and snippets.

View daviddavo's full-sized avatar
🎓
Doctorando que es gerundio

David Davó daviddavo

🎓
Doctorando que es gerundio
View GitHub Profile
@daviddavo
daviddavo / sample_schwartz.py
Created January 24, 2025 09:22
Implementation of alternative basis example for StackOverflow question https://math.stackexchange.com/posts/5026786
# See https://math.stackexchange.com/posts/5026786
def submatrices(A):
d = len(A)
d2 = d//2
return [ [ [ [ A[d2*i + k][ d2*j+l] for l in range(d2) ] for k in range(d2) ] for j in range(2) ] for i in range(2) ]
def combine(A):
d = len(A[0][0])
d2 = d*2
@daviddavo
daviddavo / split_xblock-eth_files.c
Created August 7, 2024 14:03
Example splitting huge CSV files
/*
This program should split xblock-eth's CSV files into smaller files that fit into
memory.
The program checks the two numbers in the filename and takes N extra digits.
With N=1, it converts a file like 1000to1099_... into 10 files: 1000to1019_..., etc.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
# Copyright (c) Recommenders contributors.
# Licensed under the MIT License.
import random
import numpy as np
import pandas as pd
import scipy.sparse as sp
from recommenders.utils.constants import (
DEFAULT_ITEM_COL,
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.