Skip to content

Instantly share code, notes, and snippets.

View PoslavskySV's full-sized avatar
:electron:

Stanislav Poslavsky PoslavskySV

:electron:
View GitHub Profile
import cc.r2.core.poly.Integers;
import cc.r2.core.poly.IntegersModulo;
import cc.r2.core.poly.multivar.DegreeVector;
import cc.r2.core.poly.multivar.MultivariateGCD;
import cc.r2.core.poly.multivar.MultivariatePolynomial;
import cc.r2.core.poly.univar.Factorization;
import cc.r2.core.poly.univar.UnivariatePolynomial;
import com.wolfram.jlink.KernelLink;
import com.wolfram.jlink.MathLinkFactory;
import edu.jas.arith.BigInteger;
import edu.jas.arith.BigInteger;
import edu.jas.arith.ModInteger;
import edu.jas.arith.ModIntegerRing;
import edu.jas.poly.GenPolynomial;
import edu.jas.poly.GenPolynomialRing;
import edu.jas.ufd.FactorAbstract;
import edu.jas.ufd.FactorFactory;
import edu.jas.ufd.GCDFactory;
import edu.jas.ufd.GreatestCommonDivisorAbstract;
@PoslavskySV
PoslavskySV / factor.sc
Created April 11, 2018 13:20
factorize from form file
import scala.io.Source
val exprStr = Source.fromFile("expression.txt").mkString
val polyStr = exprStr.replace("L num = ", "").replace("\\","").replace("\n","").replace(";","")
implicit val ring = MultivariateRing(Z, Array("s", "t", "m", "e", "c"))
val poly = ring(polyStr)
val factors = Factor(poly)
import scala.concurrent.duration._
implicit val ring = Frac(MultivariateRing(Z, Array("n1", "n2", "n3", "n4", "n5", "d", "i", "ppp", "qq")))
val a1 = ring(
"""
| (-24*n3^2*n4*n5-32*n3^2*n4*n2+16*n3^2*n4*d-40*n1*n5*d*n3+24*n1*d^2*
| n3-48*n1*n5^2*d+44*n1*d^2*n5+72*n2*n1^2*n3+2*n4^2*d^2+4*n3^3*d-16*n1*d+32*n1*n5
| +16*n1*n4+32*n1*n2+32*n1^2+32*n1*n3+16*n3*n4+16*n5*n4+3*n3*d^3+80*n1*n2^2*n5+24
| *n1*n3*n2^2+8*n5*d^2*n4-120*n2*n1^2*d+24*n1*n5*n4^2-8*n4*d-80*n1*n5*n4*d+40*n1*
@PoslavskySV
PoslavskySV / example-docker-registry.yaml
Created January 31, 2019 14:03
In-cluster Docker registry AKS bug
apiVersion: apps/v1
kind: Deployment
metadata:
name: docker-registry
namespace: docker-registry
labels:
app: docker-registry
spec:
replicas: 1
selector:
@PoslavskySV
PoslavskySV / ShoenhageStrassenPerformance.java
Last active December 27, 2019 22:05
Shoenhage-Strassen performance compared to Karatsuba in Rings 2.x
@Test
public void testShoenhageStrassenPerformance() {
// some test polynomials
UnivariatePolynomial<BigInteger> a = UnivariatePolynomial.create(1, 2, 1);
UnivariatePolynomial<BigInteger> b = UnivariatePolynomial.create(1, 1, 1, 2, 1, 1, 1, 3, 1, 1);
a = a.shiftRight(111814).increment();
b = b.shiftRight(111001).increment();
System.out.println("a degree: " + a.degree);
System.out.println("a max cf: " + a.maxAbsCoefficient());
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>z</artifactId>
<version>1.0-SNAPSHOT</version>