|
|
|
![]() |
|
Strumenti |
![]() |
#41 |
Bannato
Iscritto dal: Jan 2001
Messaggi: 1976
|
ancora un pezzettino:
[size=1.5] Overview of Mixed-Language Issues Mixed-language programming involves a call from a routine written in one language to a function, procedure, or subroutine written in another language. For example, a Fortran main program may need to execute a specific task that you want to program separately in an assembly-language procedure, or you may need to call an existing DLL or system procedure. Mixed-language programming is possible with Microsoft languages because each language implements functions, subroutines, and procedures in approximately the same way. Table 22.1 shows how different kinds of routines from each language correspond to each other. For example, a C main program could call an external void function, which is actually implemented as a Fortran subroutine. Table 22.1 Language Equivalents for Calls to Routines Language Call with return value Call with no return value Fortran FUNCTION SUBROUTINE C and Visual C++ function (void) function Visual Basic Function Sub Assembly language Procedure Procedure There are some important differences in the way languages implement routines. Argument passing, naming conventions and other interface issues must be thoughtfully and consistently reconciled between any two languages to prevent program failure and indeterminate results. But the advantages of mixed-language programming often make the extra effort worthwhile. A summary of a few mixed-language advantages and restrictions follows: · Fortran/Assembly Language Assembly-language routines are small and execute very quickly because they don’t require initialization as do high-level languages like Fortran and C. Also, they allow access to hardware instructions unavailable to the high-level language user. In a Fortran/assembly-language program, compiling the main routine in Fortran gives the assembly code access to Fortran high-level procedures and library functions, yet allows freedom to tune the assembly-language routines for maximum speed and efficiency. The main program can also be an assembly-language program. · Fortran/Visual Basic A mix of Fortran and Visual Basic 4.0 (32-bit) allows you to use the easy-to-implement user-interface features of Visual Basic, yet do all your computation, especially floating-point math, in Fortran routines. In a Fortran/Visual Basic program, the main routine must be Visual Basic. It is not possible to call Basic routines from Fortran. · Fortran/C Generally, Fortran/C programs are mixed to allow one to use existing code written in the other language. Either Fortran or C can call the other, so the main routine can be in either language. This section presents an explanation of the keywords, attributes, and techniques you can use to reconcile differences between Fortran and other languages. Adjusting calling conventions, adjusting naming conventions and writing interface procedures are discussed in the next sections: · Adjusting Calling Conventions · Adjusting Naming Conventions · Prototyping a Procedure in Fortran After establishing a consistent interface between mixed-language procedures, you then need to reconcile any differences in the treatment of individual data types (strings, arrays, and so on). This is discussed after conventions and prototyping in the section Exchanging and Accessing Data. Note This section uses the term “routine” in a generic way, to refer to functions, subroutines, and procedures from different languages. [/size] Ultima modifica di a2000 : 11-11-2003 alle 09:12. |
![]() |
![]() |
![]() |
#42 |
Senior Member
Iscritto dal: Jan 2000
Messaggi: 551
|
Grazie!!!
![]() Mi sa tanto che vuoi dire che aspiro al suicidio! ![]() E mi sa pure che la fattorizzazione sulle sparse me la devo fare da solo. |
![]() |
![]() |
![]() |
#43 | ||
Senior Member
Iscritto dal: May 2002
Città: udine
Messaggi: 546
|
Quote:
![]() ![]() ![]() Quote:
![]() Scusa ma mi sembra un po' riduttivo come commento ad una tesi di 14 mesi!!! ![]() ![]() Inoltre lo scopo non era quello unico di ottimizzare una macchina, già buona in partenza, ma confrontare i risultati numerici con quelli sperimentali e le conclusioni.... sono da pubblicazione internazionale.... Lascia stare che non sarò un bravo programmatore, ma nel mio campo.... PS Cmq, grazie anche alle tue osservazioni, sto portando il problema da n^3 a 3*n.... ![]() |
||
![]() |
![]() |
![]() |
#44 | |
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#45 | |
Senior Member
Iscritto dal: May 2002
Città: udine
Messaggi: 546
|
Quote:
![]() ![]() ![]() PS Grazie anche a te, al solito... ![]() ![]() |
|
![]() |
![]() |
![]() |
#46 | |
Senior Member
Iscritto dal: Jan 2000
Città: Prov. di VE
Messaggi: 2713
|
Scusa, perchè dicevi:
Quote:
![]() ![]() |
|
![]() |
![]() |
![]() |
#47 | |
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Quote:
![]() |
|
![]() |
![]() |
![]() |
#48 | |||
Bannato
Iscritto dal: Jul 2000
Città: Malo (VI)
Messaggi: 1000
|
Quote:
Quote:
![]() Quote:
Per la fattorizzazione di matrici sparse: esistono alcune librerie gratuite in giro, perlopiu' in Fortran, ma trovi anche le interfacce C++, e le ho usate con successo un po' di tempo fa per lavoro (matrici sparse 200000x50000). Purtroppo ora non ricordo i nomi ![]() ![]() ![]() ![]() ![]() ![]() |
|||
![]() |
![]() |
![]() |
#49 |
Bannato
Iscritto dal: Jan 2001
Messaggi: 1976
|
ma guardatevi le librerie in C++ pronte per l'uso nel CD allegato all'ottimo:
G. Buzzi-Ferraris, Metodi Numerici e Software in C++, Addison-Wesley |
![]() |
![]() |
![]() |
#50 | |
Bannato
Iscritto dal: Jan 2001
Messaggi: 1976
|
Quote:
![]() ![]() ![]() Ultima modifica di a2000 : 11-11-2003 alle 19:27. |
|
![]() |
![]() |
![]() |
#51 |
Bannato
Iscritto dal: Jan 2001
Messaggi: 1976
|
che ho conservato insieme al "disco rigido" su cassette audio
![]() |
![]() |
![]() |
![]() |
#52 |
Bannato
Iscritto dal: Jan 2001
Messaggi: 1976
|
ma a te non servirà: tanto, per il tuo problema, dovrai digitare ogni volta non più di 7 righe di codice !
![]() ![]() |
![]() |
![]() |
![]() |
#53 | |
Senior Member
Iscritto dal: Jan 2000
Messaggi: 551
|
Quote:
sembrerà un eresia ma se te lo dico io "che non sono un c..."che ha uno stile di programmazione da mani nei capelli....Pensa che non ottimizza neanche memorizzando la matrice in solo vettore. Meglio quella di Barton-Nackmann. di Buzzi,forse posso sfruttare il materiale sulle sparse. |
|
![]() |
![]() |
![]() |
#54 | |
Bannato
Iscritto dal: Jan 2001
Messaggi: 1976
|
Quote:
comunque le sue procedure, pardon classi, sono rinomate per essere molto robuste e veloci, in particolare quelle per la soluzione di sistemi di equazioni algebrico-differenziali. P.S. può anche darsi che quando può (didattica) abbia un rifiuto psicologico a utilizzare "un solo vettore" perchè quando programmava in Fortran77 memorizzava tutte le variabili in un solo vettore e le andava a cercare non con il nome, ma con un puntatore numerico ! ![]() |
|
![]() |
![]() |
![]() |
#55 |
Senior Member
Iscritto dal: Jan 2000
Messaggi: 551
|
Quindi Marco per riepilogare:
1)scarico Atlas 2)scarico le Blas (già precompilate?) Atlas mi fornisce l'interfaccia alle librerie Blas senza che devo compilarle in Fortran? ps Miezzeca:se ci hai messo tu una settimana,io arrivo alla pensione!!! Cmq adesso sono solo ad uno stadio di intenzione.All'occcorrenza ti posso contattare?(No te preocupe,non ti assillerò ![]() Cmq era così bella la MTL (se a2000 vede i bench si incazza ![]() (non c'è stato verso di farla andare) http://www.osl.iu.edu/research/mtl/performance.php3 Ultima modifica di verloc : 11-11-2003 alle 19:51. |
![]() |
![]() |
![]() |
#56 |
Bannato
Iscritto dal: Jan 2001
Messaggi: 1976
|
ma la decomposizione LU è un piacere che non ti puoi negare !
![]() |
![]() |
![]() |
![]() |
#57 | |||
Bannato
Iscritto dal: Jul 2000
Città: Malo (VI)
Messaggi: 1000
|
Quote:
Quote:
Risolto questo pero' tutto viaggia alla perfezione, si tratta solo di fare l'abitudine ai nomi delle funzioni e all'elenco interminabile di parametri (o perdere un po' di tempo e farsi una classe wrapper). Quote:
![]() In bocca al lupo per la tesi ! |
|||
![]() |
![]() |
![]() |
#58 |
Senior Member
Iscritto dal: Jan 2000
Messaggi: 551
|
Grazie!
Come al solito sei paziente e gentile! ![]() ...crepi! |
![]() |
![]() |
![]() |
#59 |
Bannato
Iscritto dal: Jan 2001
Messaggi: 1976
|
che bo' fa' : Fortran rulez !
![]() |
![]() |
![]() |
![]() |
#60 |
Bannato
Iscritto dal: Jan 2001
Messaggi: 1976
|
a /\/\@®¢Ø ma che ci fai in sardegna d'inverno ?!
![]() ![]() |
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 20:40.