This is the first alpha release, but it has a fairly complete test
suite (except that the tensor::expr command should be tested more
thoroughly), which it passes. It has been built on both Fedora Linux
and Windows XP. The code is available at http://www.eecs.umich.edu:~mckay/computer/tensor4.0a1.tar.gz
Neil McKay
Just out of curiosity: would it be possible to support complex
numbers too?
Regards,
Arjen
When I tried to make it under Windows, it somehow failed:
cd win
nmake -f makefile.vc INSTALLDIR=c:\tcl85
gave a problem on tensorTransUtils.obj - no rule to build it.
Regards,
Arjen
Complex numbers would require some fairly extensive changes. I allow a
bunch of different data types (bytes, shorts, ints, floats, and
doubles) but I assumed that all of them could be converted to/from
doubles without loss of precision. I'd have to change the code so that
my "generic" numeric type was double-complex instead. Maybe for
version 5.0...
Neil McKay
I'm glad I called this an alpha release. :-) The makefile in the "win"
directory is left over from version 3.0. I did some light editing on
it, but never tested it with the MS tools. The package does build on
WinXP if you use the GNU tools. (I successfully did a configure/make/
make test/make install under MSys.) If I can get access to Visual
Studio I might give it a try, and clean up makefile.vc. I should at
least note in the README file that the stuff in the win directory is
out of date.
Neil McKay
Well, that should do the trick for me too.
Right now, I am just exploring what uses I could make of your
package. Or abuses, as the case may be :). The thing I am
interested in is both processing of large amounts of numerical
data - in the form of one-, two- or three-dimensional arrays
- and solving PDEs.
An alternative package is NAP, but I'd like to explore
yours as well :). (Tensor calculus as such is a bit out of
my league, never had any serious dealings with it ...)
Regards,
Arjen
Saw that tensor used TEA as main build system and is without big
dependencies. Plugged it into AS's buildsystem ... Last night was the
first test run and it apparently built fine on all the public
platforms, given that TEApot now contains
bluepeak:(506) ~ > teacup list Tensor
entity name version platform
------- ------ ------- ---------------------
package Tensor 4.0 hpux-parisc
package Tensor 4.0 linux-glibc2.3-ix86
package Tensor 4.0 linux-glibc2.3-x86_64
package Tensor 4.0 macosx-universal
package Tensor 4.0 solaris2.8-sparc
package Tensor 4.0 solaris2.10-ix86
package Tensor 4.0 win32-ix86
------- ------ ------- ---------------------
7 entities found
--
So long,
Andreas Kupries <akup...@shaw.ca>
<http://www.purl.org/NET/akupries/>
Developer @ <http://www.activestate.com/>
-------------------------------------------------------------------------------
Hi Neil,
care for some comments?
I have put a small experiment with your package on the Wiki,
during the development of that code I came across a few
small issues:
1. tensor::expr does not like expressions on the indices, it seems.
Probably inherent to the need for generalised multiplication
and the like, but it was a little awkward.
2. some typos in the manual pages (and I could do with an HTML
version of them - have you considered using Tcllib's doctools?
Then you can generate the man pages in different formats)
3. I miss a subcommand "merge":
tensorName merge tvalue fvalue mask
where the value from tvalue is used when the mask is true
and the value from fvalue otherwise.
4. I miss a more convenient way to extract the data from a
tensor:
- writechannel gave rubbish on the screen
- storing the data in an array is somewhat unsatisfying, I'd like
a (nested) list as well
Oh well, minor issues - for my simple program it was working
very nicely indeed (thanks to Andreas for putting it in Teapot,
btw).
Regards,
Arjen
>
> Hi Neil,
>
> care for some comments?
>
> I have put a small experiment with your package on the Wiki,
> during the development of that code I came across a few
> small issues:
>
> 1. tensor::expr does not like expressions on the indices, it seems.
> Probably inherent to the need for generalised multiplication
> and the like, but it was a little awkward.
You can, of course, use the standard [expr] combined with variable or
command substitution in your tensor expression. Could get a little
tricky though...
>
> 2. some typos in the manual pages (and I could do with an HTML
> version of them - have you considered using Tcllib's doctools?
> Then you can generate the man pages in different formats)
>
I'll look at this for the next release.
> 3. I miss a subcommand "merge":
>
> tensorName merge tvalue fvalue mask
>
> where the value from tvalue is used when the mask is true
> and the value from fvalue otherwise.
>
There are ways to do this, but they take multiple statements. You
could,
for example, say
tensorName = tensor tvalue
tensorName *= tensor mask
tmp = scalar 1
tmp -= tensor mask
tmp *= fvalue
tensorName += tensor tmp
Ugly, I admit. A "merge" command might be a nice addition.
> 4. I miss a more convenient way to extract the data from a
> tensor:
> - writechannel gave rubbish on the screen
> - storing the data in an array is somewhat unsatisfying, I'd like
> a (nested) list as well
>
You should be able to just use the tensor name as an object command
to extract data:
set tList [tensorName]
should set tList to the tensor's contents, expressed as a nested Tcl
list.
You can also say, for example,
set tList [tensorName section {{1 2} {3 4}}]
if tensorName is a 2-dimensional array, and it will extract a 2-by-2
square sub-array.
> Oh well, minor issues - for my simple program it was working
> very nicely indeed (thanks to Andreas for putting it in Teapot,
> btw).
>
I also want to thank Andreas for putting it into Teapot.
Neil McKay
Just something I ran into - in my little experiment on the Wiki, I
simply
use "" instead of {} :).
>
>
>
> > 2. some typos in the manual pages (and I could do with an HTML
> > version of them - have you considered using Tcllib's doctools?
> > Then you can generate the man pages in different formats)
>
> I'll look at this for the next release.
Good, it would help Windows users a lot.
>
> > 3. I miss a subcommand "merge":
>
> > tensorName merge tvalue fvalue mask
>
> > where the value from tvalue is used when the mask is true
> > and the value from fvalue otherwise.
>
> There are ways to do this, but they take multiple statements. You
> could,
> for example, say
>
> tensorName = tensor tvalue
> tensorName *= tensor mask
> tmp = scalar 1
> tmp -= tensor mask
> tmp *= fvalue
> tensorName += tensor tmp
>
> Ugly, I admit. A "merge" command might be a nice addition.
>
No hurry, just something I find very useful at times (in Fortran).
> > 4. I miss a more convenient way to extract the data from a
> > tensor:
> > - writechannel gave rubbish on the screen
> > - storing the data in an array is somewhat unsatisfying, I'd like
> > a (nested) list as well
>
> You should be able to just use the tensor name as an object command
> to extract data:
>
> set tList [tensorName]
>
> should set tList to the tensor's contents, expressed as a nested Tcl
> list.
> You can also say, for example,
>
> set tList [tensorName section {{1 2} {3 4}}]
>
> if tensorName is a 2-dimensional array, and it will extract a 2-by-2
> square sub-array.
Ah! Missed that bit in the documentation.
Regards,
Arjen