Re: Feedback requested: Should Chapel use 0-based indexing for tuples, strings, etc.? [resent to correct typos]

2019-12-06 Thread Damian McGuckin
On Fri, 6 Dec 2019, Damian McGuckin wrote: Indexing cases that may or will need to change -- So then what cases do default to 1-based indexing today? I think Perl (currently) and APL (long ago) allowed this to be set at compile time I believe

Re: Feedback requested: Should Chapel use 0-based indexing for tuples, strings, etc.? [resent to correct typos]

2019-12-06 Thread Damian McGuckin
I program scientific and technical applications. Mainly engineering but also geophysics, physics, mathematics, statistics, epidemiology. I deal with masses of data, much of which needs to be visualized. So my answer are biased. On Mon, 4 Nov 2019, Brad Chamberlain wrote: Indexing cases t

Using Chapel for programming Finite Element Method applications

2019-06-30 Thread Damian McGuckin
Hi all, Is anybody doing anything like this? I want to bounce some ideas around on the list. If nobody is, I will phrase my emails in a finite-element-agnostic way but I would prefer to avoid that as it makes emails longer and wordier. And I am bad enough at doing that as it is. Regards - Da

Re: Concerns about deprecating external classes?

2018-06-24 Thread Damian McGuckin
On Sun, 24 Jun 2018, Michael Ferguson wrote: If you mean being able to refer to an external C variable which is a struct then yes. To be clear, the usual way to allow a C struct to work in Chapel code is `extern record`, which we are not talking about deprecating: Lost in translation when th

Re: Chapel arrays vs. Fortran90 "allocatable" arrays

2018-06-23 Thread Damian McGuckin
Andy - I can appreciate your terror at tweaking legacy code. On Wed, 20 Jun 2018, Brad Chamberlain wrote: In rewriting to Chapel, could you just defer the declarations of the arrays until the point in the Fortran code where the dynamic allocations take place? While I understand the desire fo

Re: Concerns about deprecating external classes?

2018-06-23 Thread Damian McGuckin
Brad, On Tue, 19 Jun 2018, Brad Chamberlain wrote: It's been proposed that we deprecate our current concept of "extern classes" in the next release. This is a quick poll to see whether anyone has crucial code that makes use of them today. If you do, please let me know. If you mean being

Re: Optimize method calls

2018-03-24 Thread Damian McGuckin
On Wed, 21 Mar 2018, David G. Wonnacott wrote: for i in 0..w-1 {   xm1 = 0.0;   y1.resetScalars();   for j in 0..h-1 {     y1.set(i,j, a1*imgIn[i,j] + a2*xm1 + b1*y1.get_mRW() + b2*y1.get_pW());     xm1 = imgIn[i,j];   } } What is the advantage of using set/get as above instead of something li

Re: Floating point param expressions (was Re: Expressions for 'param')

2015-07-13 Thread Damian McGuckin
On Mon, 6 Jul 2015, Brad Chamberlain wrote: > I'm too close to bedtime to try this myself, but I'm not seeing why: > > const sqrtTwo = sqrt(fabs(-2.0)); > const sqrtHalf = sqrt(fabs(-2.0))*0.5; > writeln((sqrtTwo, sqrtHalf)); > > would necessarily break the back-end compiler's optimization of the

Re: Floating point param expressions (was Re: Expressions for 'param')

2015-07-06 Thread Damian McGuckin
Hi Brad, On Sun, 5 Jul 2015, Brad Chamberlain wrote: > Since then, when people have been surprised that it isn't supported, > it's been proposed that since 'param' machinery is very explicit in > Chapel, perhaps we could simply say "You said compute it at > compile-time, why did you think it

Expressions for 'param'

2015-07-05 Thread Damian McGuckin
CRITICALITY : NOT URGENT Is a param comprises of real expressions with results known at compile time likely to be supported at any time into the future. For example I want the program to know the most accurate value possible of say 2.0/3.0 to whatever precision is active Only the first param d

Expansion of inline proc with param limit

2015-07-01 Thread Damian McGuckin
I was really impressed that my little recursive routine fpSqrtRooty was expanded/unrolled explicitly so that there is overhead due to recursion. Pretty cool! - Damian // implement Newton's iteration for sqrt(s) where x is a guess // and n is the number of iterations left to be done on 'x' inli

Re: Generic Programming :Queried Types - if real(?w) is a queried type

2015-06-08 Thread Damian McGuckin
On Tue, 2 Jun 2015, Brad Chamberlain wrote: > I believe this ought to work and am _slightly_ surprised it does not. That > said, as I've mentioned on another thread recently, our wildcard formal > argument pattern matching support is a bit piecemeal at present and needs to > be beefed up, so I'

Re: feature requests and annoyances

2015-06-06 Thread Damian McGuckin
On Tue, 2 Jun 2015, Brad Chamberlain wrote: > I'm surprised that Michael didn't jump on this one, but I believe it should > be as easy as adding the code to the following line in > compiler/parser/chapel.lex: > > [ \t\r] processWhitespace(yyscanner); That's what I thought, so

Re: feature requests and annoyances

2015-06-02 Thread Damian McGuckin
On Tue, 2 Jun 2015, Michael Ferguson wrote: > > Would you prefer that these constants end up in a different module > that needed to be explicitly included? (e.g. use Math.Constants) ? > I (personally) think that since another module's variable called e can > shadow the Math one, it's reasonable fo

Generic Programming :Queried Types - if real(?w) is a queried type

2015-06-02 Thread Damian McGuckin
How does one make the wordlength of a return type match the wordlength of a routine argument, well some member of a tuple which is an argument? Thanks In Advance - Damian Consider the following? // this fails <-!! // proc testOfTuple1(b : (int(16), int(16), int(?w))) : real

Re: feature requests and annoyances

2015-06-02 Thread Damian McGuckin
Adding to the list, It would be really useful if, as other languages do, Chapel allows the exploitation Unix/Linux pagination tools that ignore the occurence of a Ctrl-L ('\f', form-feed, 0x0c) in the input stream rather than saying there is a syntax error. I am trying to do a 'vgrind' entry

Re: int(32) -> real(32) vs. real(64)?

2015-06-02 Thread Damian McGuckin
On Fri, 29 May 2015, Michael Dietrich wrote: > Zitat von Brad Chamberlain : > >> Where some options are: >> >> a) The compiler should complain that there isn't an appropriate overload >>of foo(). I.e., coercions from int(32) to real(32) are lossy, so >>should not happen automatically. >>

Re: feature requests and annoyances

2015-06-02 Thread Damian McGuckin
On Mon, 1 Jun 2015, Michael Ferguson wrote: >>> 3. Could the M_* constants from math.h be added to Math.chpl? >>>(Especially M_PI.) >> >> Yeah, I'd think we'd want to do that. I think the main challenge is Ditto. >> probably choosing names (e.g., I don't think M_PI is probably right for >>

Re: Math Module - mod function for reals

2015-05-27 Thread Damian McGuckin
Thanks for the quick reply. On Wed, 27 May 2015, Michael Ferguson wrote ... (with rearrangement a little) > I really want mod(x,y) for integers x,y to return a positive value > whenever y is positive (since I frequently use mod to bucket values into > an array). (DAMIAN's CHANGE) That gives t

Re: Math Module - mod function for reals

2015-05-26 Thread Damian McGuckin
On Wed, 27 May 2015, Damian McGuckin wrote: > The IEEE854 2008 standard (well IEC 60559 which is part of ISO) > > a)mandates 'rem' by (2). Almost everybody obeys it because it was > a relivatively recent addition. Julia does not. > > b)says nothing about

Re: Math Module - mod function for reals

2015-05-26 Thread Damian McGuckin
Basically the standard defines 6 roundings Rounding To Nearest either 1) (Half) Tied away from Zero 2) (Half) Tied to Even Rounding Towards (Directional Rounding) 3) +Infinity 4) -Infinity 5) Zero The IEEE854 2008 standard (well IEC 60559 which is part of ISO) a) mandates 'rem' by (2). Al

Re: Math Module - mod function for reals

2015-05-26 Thread Damian McGuckin
Just had a look at Julia and it defines * rem(x,y) remainder; satisfies x == div(x,y)*y + rem(x,y), implying that sign matches x. This violates the standard. * mod(x,y) modulus; satisfies x == fld(x,y)*y + mod(x,y), implying that sign matches y. This agrees with Chapel's current implementa

Re: Math Module - mod function for reals

2015-05-26 Thread Damian McGuckin
On Wed, 27 May 2015, Damian McGuckin wrote: > Do (1) now as you suggest, and eventually, check out explicitly with an email > to the Julia and D lists, The OCAMP docs says val mod_float : float -> float -> float mod_float a b returns the remainder of a with respect to b. The ret

Re: Math Module - mod function for reals

2015-05-26 Thread Damian McGuckin
On Tue, 26 May 2015, Michael Ferguson wrote: > So, are you saying that we should either: > > 1) use 'trunc' instead of 'floor' in the mod for reals function, or > 2) call C's fmod function to implement mod for reals? > > I (personally) think that either of these are reasonable options > (and I'd v

Math Module - mod function for reals

2015-05-23 Thread Damian McGuckin
Extracting a bit of code: /* Computes the mod operator on the two numbers, defined as ``mod(x,y) = x - y * floor(x / y)``. The return value has the same type as `x`. */ proc mod(x: real(?w), y: real(w)): real(w) { // This codes up the standard definition, according to W

Re: Query on Types

2015-05-23 Thread Damian McGuckin
On Thu, 21 May 2015, Michael Ferguson wrote: > On 5/21/15, 7:42 AM, "Damian McGuckin" wrote: >> >> Why would a 32 bit floating point number multiplied by a 32 bit integer >> yield a 64 bit quantity? Is Chapel trying to avoid overflow? > > Yes. That's

Query on Types

2015-05-21 Thread Damian McGuckin
Given var x : real(32) = 0.5:real(32); var i : int(32) = 12345; var m : x * i; if m.type == real(64) then { writeln("64 bits was seen"); } else { writeln("I expect 32 bits"); } produces

Re: Equivalent of sizeof() for a variable of expression

2015-05-20 Thread Damian McGuckin
On Wed, 20 May 2015, Vassily Litvinov wrote: > We have numBits(type t) and numBytes(type t) that are defined on certain > primitive types. We do not provide this functionality for the other types, I > believe. See the online library documentation: > > http://chapel.cray.com/docs/latest/modules/s

Equivalent of sizeof() for a variable of expression

2015-05-20 Thread Damian McGuckin
Dear Thinkers, Already in Chapel, there is an attribute of any variable or expression called '.type', such that, given definitions like var vr : real(64); var vi : int(32); then vr.type or even (vi * 55.5).type returns a concept/value/thing which is

Re: Manipulating IEEE 754 floating point numbers without function calls

2015-05-20 Thread Damian McGuckin
> Have a look at > README.extern > which you can read here or find in doc/{release,}/technotes I keep forgetting that directory as a source of documentation. Thanks - Damian Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037 Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | un

Re: Manipulating IEEE 754 floating point numbers without function calls

2015-05-20 Thread Damian McGuckin
On Wed, 20 May 2015, Michael Ferguson wrote: > On 5/20/15, 9:02 AM, "Jason Riedy" wrote: > >> And Damian McGuckin writes: >>> On Tue, 19 May 2015, Michael Ferguson wrote: >>> >>>> I have verified that GCC at least does not inline frexp. I don

Re: Manipulating IEEE 754 floating point numbers without function calls

2015-05-19 Thread Damian McGuckin
On Tue, 19 May 2015, Brad Chamberlain wrote: > * Personally, I don't have any opposition to supporting more standard > module/library-based support for floating point utility functions and > values along the lines of what you're proposing. It needs more discussion with more input from those w

Re: Manipulating IEEE 754 floating point numbers without function calls

2015-05-19 Thread Damian McGuckin
On Tue, 19 May 2015, Brad Chamberlain wrote: > [Oops, I'm realizing that I mentally conflated this IEEE 754 floating > point thread with the other "Some Floating Point Issues" thread due to > the similarity of the topics and the fact that my mailer sorted them > in-line with one another. They

Re: Manipulating IEEE 754 floating point numbers without function calls

2015-05-19 Thread Damian McGuckin
On Tue, 19 May 2015, Michael Ferguson wrote: > I have verified that GCC at least does not inline frexp. I don't > understand why it couldn't, but it didn't in my experiments. Neither > did clang... C/C++ does not know the details so cannot expand it. If frexp were implemented as a template in C++

Re: Manipulating IEEE 754 floating point numbers without function calls

2015-05-18 Thread Damian McGuckin
Hi Michael, On Mon, 18 May 2015, Michael Ferguson wrote: > I do have one question for you about this. The C function frexp breaks > up a floating point number into a normalized fraction (stored as a > double) and an exponent. Yes. frexp(double mantissa, int *exponent) frexpf(

Manipulating IEEE 754 floating point numbers without function calls

2015-05-17 Thread Damian McGuckin
or more specifically, extracting the components of such numbers, or assembling those numbers from their components. Among other things, I want to grab the mantissa from a 64bit (IEEE784) floating point number, i.e. the top 12 bits of a floating point number (excluding the sign bit) and I want

Some Floating Point Issues

2015-05-12 Thread Damian McGuckin
\ Hi I realise that Floating Point in Chapel is work in progress but it is still pretty good . So I will raise some points for discussion. Background == I am looking at among other things, ways to improve the numerical quality of the module 'Norm' which I would like to bring up to

Re: BLAS - Basic Linear Algebra

2015-04-23 Thread Damian McGuckin
Hi Brad On Thu, 23 Apr 2015, Brad Chamberlain wrote: > ,,, a user who has a good start on the effort to wrap BLAS (specifically > OpenBLAS) routines in Chapel, and we've been working to get him under a > CLA so that he can contribute it back; if I've understood the status > properly, it's lik

BLAS - Basic Linear Algebra

2015-04-23 Thread Damian McGuckin
Dear All, I know that some of what are Level 2 and Level 3 routines are given in the file 'hpl.chpl' of the benchmarks, has anybody got Routines, or a Module which implement BLAS for Chapel? It may just be an interface into some C routines, or as Chapel itself, especially given that many compon

Re: Use of Chapel for Finite/Boundary Element/Volume Applications

2015-04-20 Thread Damian McGuckin
On Mon, 20 Apr 2015, Brad Chamberlain wrote: > My guess as to why your standalone example works is that Chapel routines > are not fully type checked until they're called. Could it be that your > standalone code was never called and therefore never type-checked? You are very correct. OK, for t

Re: Use of Chapel for Finite/Boundary Element/Volume Applications

2015-04-20 Thread Damian McGuckin
On Mon, 13 Apr 2015, Brad Chamberlain wrote: > Chapel distinguished between multidimensional arrays: > > var A: [1..m, 1..n] real; // a 2D array > > and arrays of arrays (arrays whose elements are arrays): > > var B: [1..m] [1..n] real; > > The former says "give me a 2D array of reals

Wish List - C99 Style Hexadecimal Floating Point Constants

2015-04-19 Thread Damian McGuckin
Well strictly speaking the IEEE754 floating point standard, e.g. var half : real = 0x1p-1; // 0.5 var four : real = 0x1p2; // 4.0 var _128 : real = 0x1p7; // 128.0 Can somebody please stick that onto what is already very long list? If somebody wants to correctly point me

Re: List Comprehension and the ternary conditional 'if' or operator '?'

2015-04-14 Thread Damian McGuckin
On Tue, 14 Apr 2015, Brad Chamberlain wrote: > This form is supported by Chapel today: > > variable = if condition then resultA else resultB; That is perfect. I actually find it more readable than the C method. Regards - Damian Pacific Engineering Systems International, 277-279 Broadway,

Re: List Comprehension and the ternary conditional 'if' or operator '?'

2015-04-13 Thread Damian McGuckin
Ignore my email about ternary conditional 'if'. I obviously need glasses. Regards - Damian Pacific Engineering Systems International, 277-279 Broadway, Glebe NSW 2037 Ph:+61-2-8571-0847 .. Fx:+61-2-9692-9623 | unsolicited email not wanted here Views & opinions here are mine and not those of an

Re: List Comprehension and the ternary conditional 'if' or operator '?'

2015-04-13 Thread Damian McGuckin
On Tue, 14 Apr 2015, Damian McGuckin wrote: > variable := ( if condition then resultA else resultB ); Sorry, my fingers have cut+paste/brain-disconnect issues. Algol68 is variable := if condition then resultA else resultB fi; - Damian Pacific Engineering Systems Internatio

List Comprehension and the ternary conditional 'if' or operator '?'

2015-04-13 Thread Damian McGuckin
Hi, Is the use of [ i in SOMETHING ] statement; truly a list comprehension in say the Python sense or does it have limitations. Fortran's implied DO loop is a list comprehension in an extremely limited sense and then, only within READ/WRITE statements. Also, in the interests of succinc

Re: Use of Chapel for Finite/Boundary Element/Volume Applications

2015-04-13 Thread Damian McGuckin
Hi all, Looking at the following code to play with boundcode condition (masks) taken, and hacked, from the LULESU benchmark. Apologies if my use of tabs causes poor readability. /* Compile-time constants */ param XI_M= 0x003, XI_M_SYMM

Re: Use of Chapel for Finite/Boundary Element/Volume Applications

2015-04-13 Thread Damian McGuckin
Thanks Brad, On Mon, 13 Apr 2015, Brad Chamberlain wrote: > I'm not personally aware of any full-fledged FE/BE/FV codes running in > Chapel. Most users in these communities are taking a "wait and see" > approach with Chapel, waiting for distributed memory performance to > improve before comm

Use of Chapel for Finite/Boundary Element/Volume Applications

2015-04-12 Thread Damian McGuckin
Besides the LULESH benchmark, what projects has used Chapel much for finite element work or something similar? Does anybody have a fully fledged FE or BE (or FV) code/application running in Chapel? We are looking at refactoring/reworking/rewriting 3 small codes into Chapel. I would be interest