Questions tagged [scala-breeze]

Breeze is a linear algebra library for Scala.

Breeze is a linear algebra library for Scala.

From the project's GitHub page:

Breeze is a library for numerical processing, machine learning, and natural language processing. Its primary focus is on being generic, clean, and powerful without sacrificing (much) efficiency. Breeze is the merger of the ScalaNLP and Scalala projects, because one of the original maintainers is unable to continue development.

197 questions
2
votes
2 answers

How to convert RowMatrix to BDM (Breeze Dense Matrix) and more questions

trying to convert a RowMatrix into BDM (Breeze Dense Matrix), not sure how to proceed need to implement def getDenseMatrix(A: RowMatrix): BDM[Double] = { //write code here } additional questions: how to convert a RowMatrix into a Matrix? How…
2
votes
1 answer

Difference on Inverse Fourier Transform beetween R and Scala Breeze

I'm trying to convert R code into scala, and i notice a difference beetween breeze and R when i perform an inverse fourier transform. ( fft in R ; inverseFourierTransform in breeze ). In Scala Breeze val vec = new…
KyBe
  • 842
  • 1
  • 14
  • 33
2
votes
2 answers

How can i take the real part of a complex matrix in breeze

I would like to take the real part of a breeze matrix. I try this as for complex number but it doesn't compile : val realMat = mat.real
KyBe
  • 842
  • 1
  • 14
  • 33
2
votes
1 answer

No ClassTag available despite ClassTag defined

I have the following code: trait MyTrait[B] { def func() } class A[B: ClassTag : Zero](val x: SparseVector[B]) extends MyTrait[B] { def this(x: Seq[(Int,B)]) = this({ val (index, vals) = x.unzip vals.toArray new…
user1094206
  • 920
  • 1
  • 12
  • 24
2
votes
2 answers

How to add rows and columns dynamically to a Breeze DenseMatrix in Scala

I am hard-coding a matrix with the values below: val m = breeze.linalg.DenseMatrix((1, 4), (2, 5)) val v = breeze.linalg.DenseMatrix((7, 8), (3, 6)) I want to insert these values on the rows and columns by reading from lists.
aakash singh
  • 43
  • 1
  • 6
2
votes
1 answer

implicit Impl method for collections in scala breeze

I have a type alias on a SortedMap[Int, Double] and I'd like to have an implicit that allows me to pass my SortedMap to some of the built-in functions in breeze, specifically the breeze.stats._ functions variance and stddev. Here's a working example…
Alexander Kahoun
  • 2,458
  • 24
  • 36
2
votes
1 answer

Linear operations with slices in breeze

Is it somehow possible to slice updates on Matrices in breeze? I could not find implicit value for parameter op. Breeze 0.11.2. val idxs = Seq(0,1) val x = DenseMatrix.rand(3,3) val y = DenseMatrix.rand(3,3) x(idxs,idxs)+= y(idxs, idxs) // cant find…
kokorins
  • 72
  • 7
2
votes
1 answer

Can Scala Breeze Library be used from Groovy code?

Given that Groovy has most of the same features as Scala, can we write Groovy program to import Breeze and do scientific computing in Groovy. It is said that Apache Spark is written in Scala and spark provides exactly same library for writing…
ace
  • 11,526
  • 39
  • 113
  • 193
2
votes
1 answer

Generic Breeze Vector method

I am trying to implement a generic Scala method that processes Breeze vectors typed as Float or as Double (at least, less specificity a plus). Here is a simple example for Vector[Double]: def vectorSum(vectors: Seq[Vector[Double]]): Vector[Double] =…
Carsten
  • 1,912
  • 1
  • 28
  • 55
2
votes
1 answer

scala breeze compilation error

I am trying to compile the scala breeze library (release 0.9) with sbt 2.13. I am getting the following error: [info] Loading project definition from C:\scala\breeze-releases-v0.9\project [info] Set current project to breeze-parent (in build…
michael meyer
  • 169
  • 2
  • 9
2
votes
2 answers

Breeze Vector to matrix conversion

Is there any way to convert breeze vector to breeze matrix of row/column size 1? I'm new in Scala and found it quite useful in past to write functions that handle vectors and matrices seamlessly (mostly in Matlab). For example, I would like func in…
Ahsan Ijaz
  • 103
  • 1
  • 6
2
votes
1 answer

Sampling without Replacement using Scala and Breeze

Is there support for sampling from a multinomial distribution without replacement? I'm imagining some sort of code like: import breeze.linalg._ import breeze.stats.distributions._ val params = DenseVector(0.1, 0.3, 0.2, 0.4) val mult = new…
sinwav
  • 724
  • 1
  • 7
  • 20
2
votes
1 answer

Using Multinomial Distribution with Scala and Breeze package

I'm using the breeze package with Scala 2.10.3, and I'd like to sample from a multinomial distribution. I.e. I'd like to sample values of a random variable Y, where Y ~ Multinomial(Y1 = 0, Y2 = 1, Y3 = 3; p1 = 0.2, p2 = 0.5, p3 = 0.3) I'm having…
sinwav
  • 724
  • 1
  • 7
  • 20
2
votes
2 answers

Cannot compile "dot" function with Breeze

I can't get the dot function to compile with Breeze in Scala. The following code : val test = DenseMatrix((1.0,2.0)) val test2 = DenseMatrix((3.0),(4.0)) val test3 = test dot test2 gives me the following error : could not find implicit value for…
user1401072
2
votes
1 answer

DenseVector convolve , how to.(Scala Breeze)

Naive user wants to do a simple convolve in Scala Breeze: import breeze.linalg._ import breeze.numerics._ import breeze.signal.support.{OverhangOpt, CanConvolve} // ?? val kernel = DenseVector(1.0, 2.0) val data = DenseVector(2.0, 3.0, 4.0,…
kos
  • 51
  • 3