Skip to content

Instantly share code, notes, and snippets.

View kalmarek's full-sized avatar

Marek Kaluba kalmarek

View GitHub Profile
@kalmarek
kalmarek / fast_paced_gh.md
Created November 12, 2023 15:28
Documenter.jl fast paced github setting up guide

Fast paced github setting up guide

Situation

You have your own repository on github.com/username/MyPackage.jl with a julia package and would like to write and deploy documentation for it using Documenter.jl.

Step 0 - Prerequisites

Install DocumenterTools.jl:

# # Character Multiplication Example
#
using SymbolicWedderburn
SW_path = dirname(dirname(pathof(SymbolicWedderburn)))
include(joinpath(SW_path, "examples", "preamble.jl"));
include(joinpath(SW_path, "examples", "action_polynomials.jl"))
# Let us define some basis
N = 4
@polyvar x[1:4]
@kalmarek
kalmarek / ma_arb.jl
Last active November 15, 2023 14:45
MA.add_mul!! with Arbs
using Revise
using Arblib
import MutableArithmetics
const MA = MutableArithmetics
using LinearAlgebra
MA.mutability(::Type{Arb}) = MA.IsMutable()
MA.mutable_copy(x::Arb) = set!(Arb(prec=precision(x)), x)
@kalmarek
kalmarek / fast_paced_gh.md
Created November 12, 2023 15:25
Documenter.jl fast paced github setting up guide

Fast paced github setting up guide

Situation

You have your own repository on github.com/username/MyPackage.jl with a julia package and would like to write and deploy documentation for it using Documenter.jl.

Step 0 - Prerequisites

Install DocumenterTools.jl:

@kalmarek
kalmarek / backtrack.jl
Last active October 14, 2022 16:32
Simple backtracking search over iterators in julia
struct BacktrackSearch{V<:AbstractVector, VI<:AbstractVector, VS<:AbstractVector, O, A}
nodes::V
iterators::VI
states::VS
oracle_descend::O
node_accept::A
end
"""
BacktrackSearch(iterators; oracle_descend, node_accept)
@kalmarek
kalmarek / build_scs_for_julia.sh
Last active October 15, 2021 20:36
custom build of scs (SCS.jl)
#!/bin/bash
JULIA_HOME="/opt/julias/julia-1.6"
JULIA_LD_PATH="$JULIA_HOME/lib/julia"
BLASLDFLAGS="-L$JULIA_LD_PATH -lopenblas64_"
SCSFLAGS="USE_OPENMP=1 BLAS64=1 BLASSUFFIX=_64_"
make purge
make -j4 CFLAGS="-march=native" DLONG=1 ${SCSFLAGS} BLASLDFLAGS="${BLASLDFLAGS}" direct
make -j4 CFLAGS="-march=native" DLONG=1 ${SCSFLAGS} BLASLDFLAGS="${BLASLDFLAGS}" indirect
import Arblib: arb_struct, arf_struct, @libarb, ArbLike
struct arf_interval
lo::arf_struct
hi::arf_struct
# function arf_interval()
# v = new()
# init!(v)
# finalizer(clear!, v)
module Monoids
using KnuthBendix
import KnuthBendix: Alphabet, AbstractWord, LenLex, alphabet
export Alphabet, FreeMonoid, gens
# this should go to KnuthBendix.jl
Base.convert(::Type{Word{I}}, v::AbstractVector{<:Integer}) where I = Word{I}(v)
@kalmarek
kalmarek / order.jl
Last active March 21, 2021 10:20
Order implementation
struct Order{I} <: Integer
val::I
Order{I}(n::Integer) where I<:Integer = (n > 0 ? new{I}(n) : throw(DomainError(0, "invalid order")))
Order{I}(::Val{Inf}) where I<:Integer = new{I}(0)
end
Order(n::I) where I<:Integer = Order{I}(n)
Order(v::Val{Inf}) = Order{Int}(v)
@kalmarek
kalmarek / W_statistic.jl
Last active January 22, 2021 08:56
Shapiro-Wilk coefficients, computed exactly (up to `eps(Float64)`) using Arb with 512 bits of precision and itegration radius 32.0
using Statistics
using Random
using LinearAlgebra
function Wstatistic(X, sw_coeffs)
@boundscheck @assert length(X) == length(sw_coeffs)
@assert issorted(X)
@assert last(X) - first(X) > length(X) * eps(eltype(X)) "Data seems to be constant!"
µ = mean(X)