scientific library for swift?


(Jonas Fredriksson) #1

hi

is there any scientific library available to swift under ubuntu? like gsl
for C. I am especially looking for matrix manipulation and fourier
functions.


(Donald Pinckney) #2

I'm not sure if this fully addresses your needs, but it seems pretty close:

https://github.com/mattt/Surge/

It has some (basic) matrix functionality, and an FFT function. I haven't used it much, so I can't comment on its performance relative to other libraries.

Donald Pinckney

···

Sent from my iPhone

On Dec 22, 2015, at 12:38 PM, Michael Gottesman via swift-users <swift-users@swift.org> wrote:

Have you tried using a module map with the many c libraries available?

+Steve in case he has any thoughts here.

Michael

On Dec 22, 2015, at 4:13 PM, Jonas Fredriksson via swift-users <swift-users@swift.org> wrote:

hi

is there any scientific library available to swift under ubuntu? like gsl for C. I am especially looking for matrix manipulation and fourier functions.
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Donald Pinckney) #3

Of course, duh. I'm interested in what you end up using, as scientific computing seems to me like a great use case for Swift.

Donald Pinckney

···

Sent from my iPhone

On Dec 22, 2015, at 3:53 PM, Stephen Canon <scanon@apple.com> wrote:

Surge sits on Accelerate.framework, which is Apple-specific (i.e. OS X / iOS only).

– Steve

On Dec 22, 2015, at 8:50 PM, Donald Pinckney <djpinckney@ucdavis.edu> wrote:

I'm not sure if this fully addresses your needs, but it seems pretty close:

https://github.com/mattt/Surge/

It has some (basic) matrix functionality, and an FFT function. I haven't used it much, so I can't comment on its performance relative to other libraries.

Donald Pinckney

Sent from my iPhone

On Dec 22, 2015, at 12:38 PM, Michael Gottesman via swift-users <swift-users@swift.org> wrote:

Have you tried using a module map with the many c libraries available?

+Steve in case he has any thoughts here.

Michael

On Dec 22, 2015, at 4:13 PM, Jonas Fredriksson via swift-users <swift-users@swift.org> wrote:

hi

is there any scientific library available to swift under ubuntu? like gsl for C. I am especially looking for matrix manipulation and fourier functions.
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Michael Gottesman) #4

Have you tried using a module map with the many c libraries available?

+Steve in case he has any thoughts here.

Michael

···

On Dec 22, 2015, at 4:13 PM, Jonas Fredriksson via swift-users <swift-users@swift.org> wrote:

hi

is there any scientific library available to swift under ubuntu? like gsl for C. I am especially looking for matrix manipulation and fourier functions.
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Stephen Canon) #5

Surge sits on Accelerate.framework, which is Apple-specific (i.e. OS X / iOS only).

– Steve

···

On Dec 22, 2015, at 8:50 PM, Donald Pinckney <djpinckney@ucdavis.edu> wrote:

I'm not sure if this fully addresses your needs, but it seems pretty close:

https://github.com/mattt/Surge/

It has some (basic) matrix functionality, and an FFT function. I haven't used it much, so I can't comment on its performance relative to other libraries.

Donald Pinckney

Sent from my iPhone

On Dec 22, 2015, at 12:38 PM, Michael Gottesman via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

Have you tried using a module map with the many c libraries available?

+Steve in case he has any thoughts here.

Michael

On Dec 22, 2015, at 4:13 PM, Jonas Fredriksson via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

hi

is there any scientific library available to swift under ubuntu? like gsl for C. I am especially looking for matrix manipulation and fourier functions.
_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users


(William Ray Wing) #6

Well, this prompts me to ask if there is anything yet that starts to duplicate the functionality of Python’s mathplotlib? I assume something like that will come along eventually, but I’d love to discover that it exists already.

Thanks,
Bill

···

On Dec 22, 2015, at 8:55 PM, Donald Pinckney via swift-users <swift-users@swift.org> wrote:

Of course, duh. I'm interested in what you end up using, as scientific computing seems to me like a great use case for Swift.

Donald Pinckney

Sent from my iPhone

On Dec 22, 2015, at 3:53 PM, Stephen Canon <scanon@apple.com <mailto:scanon@apple.com>> wrote:

Surge sits on Accelerate.framework, which is Apple-specific (i.e. OS X / iOS only).

– Steve

On Dec 22, 2015, at 8:50 PM, Donald Pinckney <djpinckney@ucdavis.edu <mailto:djpinckney@ucdavis.edu>> wrote:

I'm not sure if this fully addresses your needs, but it seems pretty close:

https://github.com/mattt/Surge/

It has some (basic) matrix functionality, and an FFT function. I haven't used it much, so I can't comment on its performance relative to other libraries.

Donald Pinckney

Sent from my iPhone

On Dec 22, 2015, at 12:38 PM, Michael Gottesman via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

Have you tried using a module map with the many c libraries available?

+Steve in case he has any thoughts here.

Michael

On Dec 22, 2015, at 4:13 PM, Jonas Fredriksson via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

hi

is there any scientific library available to swift under ubuntu? like gsl for C. I am especially looking for matrix manipulation and fourier functions.
_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org <mailto:swift-users@swift.org>
https://lists.swift.org/mailman/listinfo/swift-users


(Tino) #7

Of course, duh. I'm interested in what you end up using, as scientific computing seems to me like a great use case for Swift.

imho there is one thing missing to make this a true statement:
Fixed size vectors and matrices to do typesafe calculations (the compiler can't warn you when you try to multiply 3x3 with 4x4…)
Hope we'll see some sort of limited template support in the future.

Tino


#8

Please NO. Templates are the worst idea ever to evolve from C++. Never let this madness enter into Swift, it has done enough damage in the C++ world already.

Jan

···

On 23.12.2015, at 12:34, Tino Heth via swift-users <swift-users@swift.org <mailto:swift-users@swift.org>> wrote:

Of course, duh. I'm interested in what you end up using, as scientific computing seems to me like a great use case for Swift.

imho there is one thing missing to make this a true statement:
Fixed size vectors and matrices to do typesafe calculations (the compiler can't warn you when you try to multiply 3x3 with 4x4…)
Hope we'll see some sort of limited template support in the future.


(Tino) #9

Please NO. Templates are the worst idea ever to evolve from C++. Never let this madness enter into Swift, it has done enough damage in the C++ world already.

Hey, templates are cool — they are even Turing complete! :wink:
No, I really don't think it's that useful to calculate Fibunacci-numbers at compile time (at least I don't think C++ template syntax is a good tool to do so).

But it wouldn't be that hard to implement something in between generics and full template support, without the dangers (that's what I meant with "limited").
I might write a proposal some day, but the concept isn't that hard:
Right now, we can have something like
let m = Matrix(rows: 3, columns: 4)
easily.
There's just the problem that the compiler cannot deduce which matrices are "compatible", as there is only one Matrix-type.
If we had a way to tell the compiler that "rows" and "columns" have an effect on the type, everything would be fine, and this model of compile-time parameters imho is quite simple:

struct FloatVector<dimensions: UInt> {
  private var elements = Array<Float>(capacity: dimensions)

}

let vector = FloatVector<3>(0, 0, 1)
let otherVector = FloatVector<2>(0, 1)

let sum = vector + otherVector // compiler error, type mismatch

I think many problems with template happen because they are not compiled unless you use them, and compile-time parameters wouldn't suffer from this.

Best regards,
Tino