Skip to content

Instantly share code, notes, and snippets.

View DarkDimius's full-sized avatar

Dmitry Petrashko DarkDimius

View GitHub Profile
@DarkDimius
DarkDimius / hw.scala
Created November 7, 2012 22:15
First Homework
def gcd(a: Int, b: Int) {
if (a == 0) {
(0, 1, b)
}
else {
val (d, x1, y1) = gcd(b % a, a)
val x = y1 - (b / a) * x1
val y = x1
(x, y, d)
}
Exception in thread "main" java.lang.ExceptionInInitializerError
at scala.collection.workstealing.benchmark.scalameter.RangeBenchmark$$anonfun$3.apply(ParRangeBenchmark.scala:33)
at scala.collection.workstealing.benchmark.scalameter.RangeBenchmark$$anonfun$3.apply(ParRangeBenchmark.scala:33)
at org.scalameter.Gen$$anon$1$$anonfun$warmupset$1.apply(Gen.scala:13)
at scala.collection.Iterator$$anon$11.next(Iterator.scala:328)
at scala.collection.Iterator$class.foreach(Iterator.scala:727)
at scala.collection.AbstractIterator.foreach(Iterator.scala:1157)
at org.scalameter.execution.SeparateJvmsExecutor$$anonfun$sample$1$1.apply(SeparateJvmsExecutor.scala:49)
at org.scalameter.execution.SeparateJvmsExecutor$$anonfun$sample$1$1.apply(SeparateJvmsExecutor.scala:39)
at org.scalameter.execution.package$Main$.mainMethod(package.scala:73)
from nltk.tokenize import word_tokenize
from math import erf, log
import sys
import numpy
eng_filename = sys.argv[1]
ru_filename = sys.argv[2]
output_filename = sys.argv[3]
object IMB1 extends App {
type French = String
type English = String
case class SentencePair(eng: English, fr: French)
case class Translation(eng: English, prob: Double)
case class WordPair(eng: English, fr: French)
val EPS = 1e-6
var iter = 0
def finished = iter > 5
Some GC time recorded, accepted: 5, ignored: 6
measurements: 10378.641435, 11963.530569, 11378.469428, 10396.542717, 10984.350433
After outlier elimination: 10378.641435, 10396.542717, 10984.350433, 11378.469428, 11963.530569
After applying noise: 10378,641, 10396,543, 10984,350, 11378,469, 11963,531
Test threw exception: java.util.NoSuchElementException: key not found: Parameters(SamplePageRank -> [[I@1e1c2fc6)
java.util.NoSuchElementException: key not found: Parameters(SamplePageRank -> [[I@1e1c2fc6)
at scala.collection.MapLike$class.default(MapLike.scala:228)
at scala.collection.AbstractMap.default(Map.scala:58)
at scala.collection.MapLike$class.apply(MapLike.scala:141)
at scala.collection.AbstractMap.apply(Map.scala:58)
def readVolatile[T](l: T): T = macro readVolatile_impl[T]
def readVolatile_impl[T: c.WeakTypeTag](c: Context)(l: c.Expr[T]): c.Expr[T] = {
import c.universe._
l.tree match {
case Select(obj, sel) =>
val name = c.Expr[String](Literal(Constant(sel.encoded)))
val objRef = c.Expr[Any](obj)
l.actualType match {
case x if (x =:= typeOf[Int]) => reify {
scala> import scala.collection.par._
import scala.collection.par._
scala> import scala.collection.views.BlitzViews._
import scala.collection.views.BlitzViews._
scala> import scala.collection.par.Scheduler.Implicits.sequential
import scala.collection.par.Scheduler.Implicits.sequential
scala> val mymap = new Map[Int,Int](_ + 10)
class A{
class Color{}
val o1: {def color:Any} = new {def color: Any = 1 }
val o2 = o1.asInstanceOf[{def color: Color}]
o2.color
}
import A.;
import A..anon;
import A..anon.1;
import java.lang.Class;
import java.lang.Object;
import java.lang.String;
import java.lang.Throwable;
import java.lang.ref.SoftReference;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

Keybase proof

I hereby claim:

  • I am DarkDimius on github.
  • I am darkdimius (https://keybase.io/darkdimius) on keybase.
  • I have a public key whose fingerprint is D52F 52CB D17F D6EF EB47 672E 4D4B FF78 772D 136D

To claim this, I am signing this object: