Rupert Swarbrick | 1 Dec 2010 01:43
Picon
Gravatar

Fortran ffi question


Hi,

Is it possible to define subroutines with output parameters using the
Fortran FFI? I'm trying to wrap (some of!) arpack[1] and, following the
example in the manual[2], want to do something with DSAUPD.

The interface for DSAUPD is defined at [3], but basically it's a
subroutine that takes loads of parameters, some of which are
input/output.

I tried the following:
USING: alien.fortran kernel ;
FROM: alien.libraries => deploy-library ;
IN: geometry.arpack.ffi

<<
"arpack" "libarpack.so.2" gfortran-abi add-fortran-library
"arpack" deploy-library 
>>

LIBRARY: arpack

SUBROUTINE: DSAUPD
  ( !INTEGER IDO, CHARACTER*1 BMAT, INTEGER N, CHARACTER*2 WHICH,
    INTEGER NEV, DOUBLE-PRECISION TOL, !DOUBLE-PRECISION(*) RESID,
    INTEGER NCV, !DOUBLE-PRECISION(*) V, INTEGER LDV,
    !INTEGER(11) IPARAM, !INTEGER(11) IPNTR,
(Continue reading)

Joe Groff | 1 Dec 2010 02:36
Picon
Gravatar

Re: Fortran ffi question

On Wed, Dec 1, 2010 at 6:13 AM, Rupert Swarbrick <rswarbrick-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:


Hi,

Is it possible to define subroutines with output parameters using the
Fortran FFI? I'm trying to wrap (some of!) arpack[1] and, following the
example in the manual[2], want to do something with DSAUPD.

The interface for DSAUPD is defined at [3], but basically it's a
subroutine that takes loads of parameters, some of which are
input/output.

I tried the following:

USING: alien.fortran kernel ;
FROM: alien.libraries => deploy-library ;
IN: geometry.arpack.ffi

<<
"arpack" "libarpack.so.2" gfortran-abi add-fortran-library
"arpack" deploy-library
>>

LIBRARY: arpack

SUBROUTINE: DSAUPD
 ( !INTEGER IDO, CHARACTER*1 BMAT, INTEGER N, CHARACTER*2 WHICH,
   INTEGER NEV, DOUBLE-PRECISION TOL, !DOUBLE-PRECISION(*) RESID,
   INTEGER NCV, !DOUBLE-PRECISION(*) V, INTEGER LDV,
   !INTEGER(11) IPARAM, !INTEGER(11) IPNTR,
   !DOUBLE-PRECISION(*) WORKD, !DOUBLE-PRECISION(*) WORKL,
   INTEGER LWORKL, !INTEGER INFO ) ;

You've got the right idea, Rupert, but there was a bug in the SUBROUTINE: and FUNCTION: parsing words that caused them to define the words with the wrong stack effect. I've pushed a fix.

-Joe

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@...
https://lists.sourceforge.net/lists/listinfo/factor-talk
Joe Groff | 1 Dec 2010 02:40
Picon
Gravatar

Re: C++ and Fortran 95 examples

On Wed, Dec 1, 2010 at 12:33 AM, David Dreisigmeyer <dwdreisigmeyer-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:

Hi,

I was wondering if there were any C++ and Fortran 95 examples of
calling these languages from Factor?  I was thinking something along
the lines of:

http://fun-factor.blogspot.com/2007/10/getting-started-with-factor-easy-ffi.html

I remember having seen a page on Fortran stuff previously, but now I
can't find it.

The C++ stuff is all experimental and to my knowledge hasn't been used in any real case. The Fortran FFI is used to call out to BLAS; the FFI definitions are in the math.blas.ffi module, at basis/math/blas/ffi/ffi.factor in the Factor distribution.
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@...
https://lists.sourceforge.net/lists/listinfo/factor-talk
Slava Pestov | 1 Dec 2010 12:02

Re: Some documentation fixes

Thank you for the patches, I've merged them in.

On Tue, Nov 30, 2010 at 10:41 AM, Keita Haga <keitahaga@...> wrote:
> Hi, Slava.
>
> I have read Factor's documents and recognized some wrong parts.
> so, I fixed the documents and put this patches in 'doc-fixes' branch at
> https://github.com/keitahaga/factor
> would you accept and merge my patches if you like it, and I'm glad to
> do so.
>
> Thank you.
> Keita
>
> ------------------------------------------------------------------------------
> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
> Tap into the largest installed PC base & get more eyes on your game by
> optimizing for Intel(R) Graphics Technology. Get started today with the
> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
> http://p.sf.net/sfu/intelisp-dev2dev
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@...
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
Rupert Swarbrick | 3 Dec 2010 01:54
Picon
Gravatar

Re: Fortran ffi question

Joe Groff <arcata@...> writes:
> You've got the right idea, Rupert, but there was a bug in the SUBROUTINE:
> and FUNCTION: parsing words that caused them to define the words with the
> wrong stack effect. I've pushed a fix.
>

Brill! I'll keep playing, thanks.

Rupert
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Factor-talk mailing list
Factor-talk@...
https://lists.sourceforge.net/lists/listinfo/factor-talk
Jim mack | 5 Dec 2010 00:33

Git patch

Hi,


Growing circulars had a problem pushing once rotated, so here's my attempt.  I had trouble updating the read only seq slot, and expect there's a better way than my cheat, but it's beyond me for now..  It includes the test proving the need.

This is my first attempt to fix anything, so please let me know what to do better.  I tried forking a private repos and pushing to it, but got this and don't have time to monkey much more.

fatal: bad object 541390b56187b99df4da5716b6987f9c051babe1
error: pack-objects died with strange error
error: failed to push some refs to 'git-9UaJU3cA/F/QT0dZR+AlfA@public.gmane.org:jimmack1963/factor.git'

and 20 min of google browsing didn't answer, so, here it is by email, which I think others have used recently.  

--
Jim
"I'm for extending the working Medicare program for our seniors all the way back to contraception, so Americans can concentrate on living their lives without fear of changing a job, going bankrupt from deductibles or fighting HMO bureaucracy."
Attachment (commit-8f434fb): application/octet-stream, 4762 bytes
------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Factor-talk mailing list
Factor-talk@...
https://lists.sourceforge.net/lists/listinfo/factor-talk
Samuel Tardieu | 5 Dec 2010 12:37
Gravatar

Re: Git patch



2010/12/5 Jim mack <jim-5p38wz9uQSZBDgjK7y7TUQ@public.gmane.org>

Growing circulars had a problem pushing once rotated, so here's my attempt.  I had trouble updating the read only seq slot, and expect there's a better way than my cheat, but it's beyond me for now..  It includes the test proving the need.

This is my first attempt to fix anything, so please let me know what to do better.  I tried forking a private repos and pushing to it, but got this and don't have time to monkey much more.

fatal: bad object 541390b56187b99df4da5716b6987f9c051babe1
error: pack-objects died with strange error
error: failed to push some refs to 'git-9UaJU3cA/F/QT0dZR+AlfA@public.gmane.org:jimmack1963/factor.git'

and 20 min of google browsing didn't answer, so, here it is by email, which I think others have used recently.

 
Jim, I fixed whitespace issues in your commit and set your name and email address:
https://github.com/samueltardieu/factor/commit/c8b699a232e2baddefba643e84a8f790e7dc47cd

If it looks right to you, slava can pull from

  git://github.com/samueltardieu/factor.git for-slava

to get this change if he hasn't got it yet.

  Sam
------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Factor-talk mailing list
Factor-talk@...
https://lists.sourceforge.net/lists/listinfo/factor-talk
Jim mack | 5 Dec 2010 16:46

Re: Git patch

Thanks.  I'll repeat my clone/upstream/modify/push experiment until I see what I'm doing wrong.  :(

On Sun, Dec 5, 2010 at 3:37 AM, Samuel Tardieu <sam-kn3qQ3qycSvR7s880joybQ@public.gmane.org> wrote:


2010/12/5 Jim mack <jim-5p38wz9uQSZBDgjK7y7TUQ@public.gmane.org>


Growing circulars had a problem pushing once rotated, so here's my attempt.  I had trouble updating the read only seq slot, and expect there's a better way than my cheat, but it's beyond me for now..  It includes the test proving the need.

This is my first attempt to fix anything, so please let me know what to do better.  I tried forking a private repos and pushing to it, but got this and don't have time to monkey much more.

fatal: bad object 541390b56187b99df4da5716b6987f9c051babe1
error: pack-objects died with strange error
error: failed to push some refs to 'git-9UaJU3cA/F/QT0dZR+AlfA@public.gmane.org:jimmack1963/factor.git'

and 20 min of google browsing didn't answer, so, here it is by email, which I think others have used recently.

 
Jim, I fixed whitespace issues in your commit and set your name and email address:
https://github.com/samueltardieu/factor/commit/c8b699a232e2baddefba643e84a8f790e7dc47cd

If it looks right to you, slava can pull from

  git://github.com/samueltardieu/factor.git for-slava

to get this change if he hasn't got it yet.

  Sam

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Factor-talk mailing list
Factor-talk-5NWGOfrQmnd4wTydcyPnfg@public.gmane.orgceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk




--
Jim
"I'm for extending the working Medicare program for our seniors all the way back to contraception, so Americans can concentrate on living their lives without fear of changing a job, going bankrupt from deductibles or fighting HMO bureaucracy."
------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Factor-talk mailing list
Factor-talk@...
https://lists.sourceforge.net/lists/listinfo/factor-talk
Keita Haga | 6 Dec 2010 03:30
Picon

Some patches

Hi,

I fixed some Factor's documentation.
The patches is in 'cleanup' and 'doc-fixes' branch at 
https://github.com/keitahaga
If you like, please merge it.

Thanks,
Keita.

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
Shaping | 6 Dec 2010 10:51
Favicon

Cartesian plot?

Does Factor have a vocab for plotting Cartesian graphs?

 

 

Shaping

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Factor-talk mailing list
Factor-talk@...
https://lists.sourceforge.net/lists/listinfo/factor-talk

Gmane