So, this looks basically good!
My main comment is that I think we can just put breeze.signal as a new
package in the math subproject, rather than its own new project.
JTransforms is a pretty small library (500KB), so it shouldn't matter
much in terms of dependency bloat. (Unless there are objections?)
The style/implementation is mostly fine. Don't use v.data directly on
input vectors, because they might have a non-zero offset or non-unit
stride. (i.e. they might be a slice of a matrix or something.) Vectors
you create you have control over and so you can access their data
directly.
Also, you can use slices to avoid this loop:
val tempArr = new Array[Double](v.length*2)
for (n <- 0 to v.length) {
tempArr(n*2) = v.data(n)
//tempIn(n*2 + 1) = 0 ...not necessary, arrays initialized to zero
}
val tempArr = DenseVector.zeros[Double](v.length * 2)
tempArr(0 until tempArr.length by 2) := v
// then do the fft on tempArr.data
As for going forward, I'd happily take this code as a PR that goes
into breeze-math. We can't accept code that is directly based on
implementation details of GNU Octave or other GPL/LGPL code, since
Breeze is Apache-licensed. We can depend on LGPL code (hence
JTransforms is ok). Copying APIs is apparently fine, given the Oracle
v. Google ruling (IANAL, and it could still be overturned), however.
Thanks!
-- David
On Sun, May 5, 2013 at 4:03 AM, ktakagaki <
kentaroh...@gmail.com> wrote:
> Hi everyone,
>
> I'm a scientific end-user, and I'm migrating from Java to Scala for my
> backend. I especially need some equivalents to the Matlab DSP toolbox, like
> fft, ifft, filt, etc. ScalaLab looks promising, but just personally, it
> seems a bit confusing and perhaps too complex (just one matrix library is
> enough for me, and having 0-indexed and 1-indexed matrix classes in the same
> package is a bit scary). The small contributing community also worries me.
>
> I would really like to contribute to breeze, but I am very new to Scala (-3
> months, I am doing the Odersky Coursera course now). This weekend, as a
> Scala exercise, I rigged up a simple "breeze.signal":
>
https://github.com/ktakagaki/breezeTemp.git
>
> Could somebody with experience be so kind as to take a peek, and see if the
> structure of what I put in place might be of any use? I am very new to
> Scala, and the overall project design (the handling of Types, for instance),
> goes a bit over my head at this point. If what I set up has potential for
> breeze, I would expand, document, unit test, etc., and my goal would be to
> slowly incorporate functionality equivalent to the Matlab DSP toolbox, using
> JTransform as well as translations of some scripts from the GNU Octave DSP
> toolbox. Alternatively, I would love to contribute to a better-structured
> branch set up by somebody who knows what they're doing. (I can also just
> patch the libraries ad hoc, directly into my own new Scala backend, but it
> would be super if my work were shareable.)
>
> Thanks to all for what seems like a great project!
> Kenta
>
https://groups.google.com/d/msg/scala-breeze/-/mj4Vhu4IxS0J.