This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit def opMulMatrix_DM_DV_Semiring[T:Semiring:ClassTag:DefaultArrayValue]:OpMulMatrix.Impl2[DenseMatrix[T], DenseVector[T], DenseVector[T]] = new OpMulMatrix.Impl2[DenseMatrix[T], DenseVector[T], DenseVector[T]] { | |
implicit val ring = implicitly[Semiring[T]] | |
override def apply(a: DenseMatrix[T], b: DenseVector[T]) = { | |
require(a.cols == b.length) | |
val res = DenseVector.zeros[T](a.rows) | |
var c = 0 | |
while(c < a.cols) { | |
var r = 0 | |
while (r < a.rows) { | |
val v = a(r, c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package foo { | |
class Bar | |
object Bar { | |
implicit val b = new Bar | |
} | |
} | |
import foo.Bar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object NMF { | |
def supervised(W: CuMatrix[Float], X: CuMatrix[Float], iters: Int = 200, eps: Float = 1E-6f) = { | |
require(W.rows == X.rows) | |
import W.blas | |
val n = X.rows | |
val m = X.cols | |
val r = W.cols | |
var H = CuMatrix.ones[Float](r, m) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import breeze.linalg._ | |
import gust.linalg.cuda._ | |
import jcuda.jcublas._ | |
implicit val handle = new cublasHandle() | |
JCublas2.cublasCreate(handle) | |
// an extract from a REPL session | |
val A = CuMatrix.fromDense(DenseMatrix((1.0f, 1.0f, 2.0f, 1.0f), (1.0f, 2.0f, 1.0f, -2.0f), (3.0f, -1.0f, 3.0f, -2.0f), (-2.0f, 3.0f, -1.0f, 1.0f))) | |
val N = 4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[info] org.scalanlp:epic_2.10:0.2-SNAPSHOT [S] | |
[info] +-de.jflex:jflex:1.4.3 | |
[info] +-org.mapdb:mapdb:0.9.2 | |
[info] +-org.scala-lang:scala-library:2.10.2 (evicted by: 2.10.4) | |
[info] +-org.scala-lang:scala-library:2.10.3 (evicted by: 2.10.4) | |
[info] +-org.scalanlp:breeze-config_2.10:0.8 (evicted by: 0.8.1-SNAPSHOT) | |
[info] +-org.scalanlp:breeze-config_2.10:0.8.1-SNAPSHOT [S] | |
[info] | +-com.thoughtworks.paranamer:paranamer:2.2 | |
[info] | +-org.scala-lang:scala-reflect:2.10.4 [S] | |
[info] | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io._ | |
import java.util.zip.GZIPInputStream | |
import breeze.util.SerializableLogging | |
/** | |
* Class that reads in objects serialized with [[breeze.util.writeObject]], ignoring their serialversionuids, | |
* and then writes them to the same file. | |
* | |
* @author dlwh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit class scEnrichColl[Coll <: Traversable[(_,_)]](val __this: Coll) extends AnyVal { | |
def toMultiMap[Result, A, B](implicit view: Coll <:< Traversable[(A, B)], cbf: CanBuildFrom[Coll, B, Result]): Map[A, Result] = { | |
var result = collection.mutable.Map[A, mutable.Builder[B, Result]]() | |
result = result.withDefault { a => val r = cbf(__this); result.update(a, r); r} | |
for((a,b) <- view(__this)) { | |
result(a) += b | |
} | |
result.mapValues(_.result()).toMap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
organization := "org.scalanlp" | |
name := "qqq" | |
version := "0.1-SNAPSHOT" | |
scalaVersion := "2.11.4" | |
libraryDependencies ++= Seq( | |
"com.nativelibs4java" % "javacl" % "1.0-SNAPSHOT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package smr.plugin; | |
import scala.tools.nsc | |
import nsc.Global | |
import nsc.Phase | |
import nsc.plugins.Plugin | |
import nsc.plugins.PluginComponent | |
import nsc.transform._ | |
import nsc.symtab.Flags._ | |
class SerOverride(val global: Global) extends Plugin { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private[hadoop] def runMapReduce[K1,V1,K2,V2,K3,V3](paths : Array[Path], | |
m: Mapper[K1,V1,K2,V2], | |
r: Reduce[K2,V2,K3,V3]) | |
(implicit mk2:Manifest[K2], mv2:Manifest[V2], | |
mk3:Manifest[K3], mv3:Manifest[V3]) = { | |
implicit val jobConf = new JobConf(conf, m.getFunClass); | |
val outputPath = genDir; | |
jobConf.setJobName("SMR-"+outputPath.getName); |
OlderNewer