Scalalab as a library

92 views
Skip to first unread message

Davi Santos

unread,
Feb 25, 2014, 2:41:06 PM2/25/14
to scalalab-...@googlegroups.com
Hello,
I would like to know if it is possible/recommended to import Scalalab from my 
Scala programs and use the math syntax/constructs.

I am choosing between Saddle and Scalalab for this task since I want to have EJML* under the hoods,
but with the "matlab/R/etc." syntax.
Scalalab seems more actively developed than Saddle, but I don't even know if it is (reasonably) usable like a library.

* -> it has to be EJML; for the big calculations I already use MTJ.

tnx in advance

Davi

Stergios Papadimitriou

unread,
Feb 26, 2014, 3:09:27 AM2/26/14
to scalalab-...@googlegroups.com
Hello,

in order to have all ScalaLab functionality you can
use the ScalaLabAll.zip from:
https://sourceforge.net/projects/scalalab/files/?source=navbar

This file has all the ScalaLab sources and libraries,
and can be built with ant.

You can change the "main" class of the MANIFEST.MF to your application class,
instead of the "scalaExec.scalaLab.scalaLab" that starts the ScalaLab's GUI.

Regards
Stergios
--
You received this message because you are subscribed to the Google Groups "ScalaLab Scientific Programming Development group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalalab-dev-gr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Davi Santos

unread,
Feb 26, 2014, 9:51:07 AM2/26/14
to scalalab-...@googlegroups.com
Hello Stergios,
when I run "ant" inside scalalabSrc, I get:
   [scalac] /home/davi/scalalaball/scalalabSrc/scalaSci/math/io/XMLMethods.scala:8: error: not found: value $scope
   [scalac]     <ScalaLabConf>
   [scalac]      ^

On the other hand, I managed how to use scalaSciFromJava-Scala210-LibsAndExamplesApr23.zip updated with ScalaLab210.jar.
For those interested:

mkdir scalasci
cd scalasci/
unzip '/tmp/scalaSciFromJava-Scala210-LibsAndExamplesApr23.zip' 
mv '/tmp/ScalaLab2102June12.zip' scalalab/
cd scalalab/
unzip ScalaLab2102June12.zip 
cd lib/
mv ScalaLab210.jar ScalaLab210.jarold
ln -s ../scalalab/ScalaLab210.jar 
sbt -mem 5000


best regards

Davi

Davi Santos

unread,
Feb 26, 2014, 9:53:39 AM2/26/14
to scalalab-...@googlegroups.com
Typo in my email: "when I run "ant" inside scalalabSrc, I get:"
should read "when I run "ant" inside scalalabPr I get:".

Stergios Papadimitriou

unread,
Feb 27, 2014, 3:07:02 AM2/27/14
to scalalab-...@googlegroups.com

Hello Davi,

to build ScalaLab from sources with ant,
you should have Scala 2.11 M8 installed.

You have it?

Stergios

Davi Santos

unread,
Feb 27, 2014, 10:25:54 AM2/27/14
to scalalab-...@googlegroups.com
Hello,
It compiled fine now (except sacaladocs due to some UTF-8 io errors, but no problem, my system might be improperly configured).
I should have double checked before asking, with:
> echo $SCALA_HOME 
/home/.../scala-2.11.0-M8
> scalac -version
Scala compiler version 2.11.0-M8 -- Copyright 2002-2013, LAMP/EPFL
> scala -version
Scala code runner version 2.11.0-M8 -- Copyright 2002-2013, LAMP/EPFL

thanks

Davi

LetterYMeansO InMyEmail

unread,
Apr 3, 2014, 5:40:15 AM4/3/14
to scalalab-...@googlegroups.com
Can you publish here an extract of your code doing matlab operations ?

Here is an extract of my own translation of matlab in scala code:

val dtheta_dtheta=eye0(theta.length)
val dsto_dtheta=data.dsto_dtheta
var c0=phi.C0(info_palier(data.NbInjectionCumulees).toInt,::)
var dc0_dtheta=diag0(phi.C0(info_palier(data.NbInjectionCumulees).toInt,::))*dtheta_dtheta(data.errC0,::)

It is based on the following compilechain:

scalac -deprecation -d . -classpath ~/ScalaLab291Jan21/Scalalab291.jar:`ls ~/ScalaLab291Jan21/lib/*.jar | tr '\012' :` *.scala
~/jdk1.7.0_45/bin/jar cf monScala.jar com

I still use http://www.scala-lang.org/download/2.9.1.final.html because this is the most recent generating .jar that are compatible with javaaddpath from Matlab.

Contact me if anyone is interested.
Reply all
Reply to author
Forward
0 new messages