From: Julian Stecklina
Subject: make-array question
Date: 
Message-ID: <87y9d0bxk8.fsf@jmmr.no-ip.com>
Hello,

I use make-array to create an array of rank 2 like this:

(make-array (list x y))

x and y are variables. The problem is that CMU CL reports the
following when compiling the above:

  (MAKE-ARRAY (LIST X Y))
Note: Unable to optimize because:
      Dimension list not constant; cannot open code array creation


Is there a way to create an multi-dimensional array (with known and
constant rank) without consing this additional list?

Regards,
Julian
-- 
Meine Hompage: http://julian.re6.de

Ich suche eine PCMCIA v1.x type I/II/III Netzwerkkarte.
Ich biete als Tauschobjekt eine v2 100MBit Karte in OVP.

From: Erik Naggum
Subject: Re: make-array question
Date: 
Message-ID: <3234179205274546@naggum.net>
* Julian Stecklina
| The problem is that CMU CL reports the following when compiling the above:

  The problem is that CMUCL is way too helpful.  Ignore the annoying warning,
  you are doing the right thing.
-- 
  Guide to non-spammers: If you want to send me a business proposal, please be
  specific and do not put "business proposal" in the Subject header.  If it is
  urgent, do not use the word "urgent".  If you need an immediate answer, give
  me a reason, do not shout "for your immediate attention".  Thank you.
From: Julian Stecklina
Subject: Re: make-array question
Date: 
Message-ID: <87bs9wvgxh.fsf@jmmr.no-ip.com>
Erik Naggum <····@naggum.net> writes:

> * Julian Stecklina
> | The problem is that CMU CL reports the following when compiling the above:
> 
>   The problem is that CMUCL is way too helpful.  Ignore the annoying warning,
>   you are doing the right thing.

Ok. Thank you. It's quite difficult to tell which of the many notices
CMUCL gives in my current source is really meaningful. :)

Regards,
Julian
-- 
Meine Hompage: http://julian.re6.de

Ich suche eine PCMCIA v1.x type I/II/III Netzwerkkarte.
Ich biete als Tauschobjekt eine v2 100MBit Karte in OVP.
From: Barry Margolin
Subject: Re: make-array question
Date: 
Message-ID: <OhIS8.10$Yy3.3321@paloalto-snr1.gtei.net>
In article <··············@jmmr.no-ip.com>,
Julian Stecklina  <··········@web.de> wrote:
>Erik Naggum <····@naggum.net> writes:
>
>> * Julian Stecklina
>> | The problem is that CMU CL reports the following when compiling the above:
>> 
>>   The problem is that CMUCL is way too helpful.  Ignore the annoying warning,
>>   you are doing the right thing.
>
>Ok. Thank you. It's quite difficult to tell which of the many notices
>CMUCL gives in my current source is really meaningful. :)

Try reading it.  It's just warning that it can't *optimize* something, not
that it can't do it.  Furthermore, the only thing that it can't optimize is
array creation.  Typically you create an array once and reference it many
times, and the latter is more likely to affect performance.  Unless you do
array creation in the inner loop of your program, this missing optimization
is likely tobe negligible.

-- 
Barry Margolin, ······@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.
From: Nils Goesche
Subject: Re: make-array question
Date: 
Message-ID: <lk3cv8haf1.fsf@pc022.bln.elmeg.de>
Julian Stecklina <··········@web.de> writes:

> Erik Naggum <····@naggum.net> writes:
> 
> > * Julian Stecklina
> > | The problem is that CMU CL reports the following when compiling the above:
> > 
> >   The problem is that CMUCL is way too helpful.  Ignore the annoying warning,
> >   you are doing the right thing.
> 
> Ok. Thank you. It's quite difficult to tell which of the many notices
> CMUCL gives in my current source is really meaningful. :)

IIRC you only get those if you optimize for speed; those notices can
be very helpful, then.

Regards,
-- 
Nils Goesche
"Don't ask for whom the <CTRL-G> tolls."

PGP key ID 0x42B32FC9
From: Julian Stecklina
Subject: Re: make-array question
Date: 
Message-ID: <877kkizy64.fsf@jmmr.no-ip.com>
Nils Goesche <······@cartan.de> writes:

> Julian Stecklina <··········@web.de> writes:
> 
> > Erik Naggum <····@naggum.net> writes:
> > 
> > > * Julian Stecklina
> > > | The problem is that CMU CL reports the following when compiling the above:
> > > 
> > >   The problem is that CMUCL is way too helpful.  Ignore the annoying warning,
> > >   you are doing the right thing.
> > 
> > Ok. Thank you. It's quite difficult to tell which of the many notices
> > CMUCL gives in my current source is really meaningful. :)
> 
> IIRC you only get those if you optimize for speed; those notices can
> be very helpful, then.

Most notices just complain about the bignum code. In fact 90% of the
notices say that X is not fixnum, so CMU CL is unable to open code/ is
forced to do a full call to GENERIC-+ etc. The other 10% is about
vectors, but I added declarations as I only deal with simple-vectors
and simple-arrays, so they disappeared.

Optimizing for speed when calculating determinants reduces consing
very much and results in very fast code, although the math is intended
for numbers of type rational to be versatile.

Regards,
Julian
-- 
Meine Hompage: http://julian.re6.de

Ich suche eine PCMCIA v1.x type I/II/III Netzwerkkarte.
Ich biete als Tauschobjekt eine v2 100MBit Karte in OVP.
From: Raymond Toy
Subject: Re: make-array question
Date: 
Message-ID: <4nhejjpn60.fsf@rtp.ericsson.se>
>>>>> "Julian" == Julian Stecklina <··········@web.de> writes:

    Julian> Nils Goesche <······@cartan.de> writes:
    >> Julian Stecklina <··········@web.de> writes:
    >> 
    >> > Erik Naggum <····@naggum.net> writes:
    >> > 
    >> > > * Julian Stecklina
    >> > > | The problem is that CMU CL reports the following when compiling the above:
    >> > > 
    >> > >   The problem is that CMUCL is way too helpful.  Ignore the annoying warning,
    >> > >   you are doing the right thing.
    >> > 
    >> > Ok. Thank you. It's quite difficult to tell which of the many notices
    >> > CMUCL gives in my current source is really meaningful. :)
    >> 
    >> IIRC you only get those if you optimize for speed; those notices can
    >> be very helpful, then.

    Julian> Most notices just complain about the bignum code. In fact 90% of the
    Julian> notices say that X is not fixnum, so CMU CL is unable to open code/ is
    Julian> forced to do a full call to GENERIC-+ etc. The other 10% is about
    Julian> vectors, but I added declarations as I only deal with simple-vectors
    Julian> and simple-arrays, so they disappeared.

If speed is really important, you might want to look at fixing those.
In some of my code, fixing those did more to speed things up than
anything else even though the code was working on double-floats.
Sometimes there are more integer operations than you might expect at
first glance.

    Julian> Optimizing for speed when calculating determinants reduces consing
    Julian> very much and results in very fast code, although the math is intended
    Julian> for numbers of type rational to be versatile.

If the math is really generic, it's been my experience that going to
speed 3 buys you very little because there's very little to be gained
because all the math has to be generic anyway.

But this is just pure speculation since I don't know what your code
does....

Ray
From: Gabe Garza
Subject: Re: make-array question
Date: 
Message-ID: <8z50mjjb.fsf@anubis.kynopolis.org>
Julian Stecklina <··········@web.de> writes:

> Erik Naggum <····@naggum.net> writes:
> 
> > * Julian Stecklina
> > | The problem is that CMU CL reports the following when compiling the above:
> > 
> >   The problem is that CMUCL is way too helpful.  Ignore the annoying warning,
> >   you are doing the right thing.
> 
> Ok. Thank you. It's quite difficult to tell which of the many notices
> CMUCL gives in my current source is really meaningful. :)
> 

Do you know about the EXT:INHIBIT-WARNINGS declaration yet?  It's
really useful: turn on optimization, compile the function(s), read the
warnings, fix what you want, then use EXT:INHIBIT-WARNINGS to tell
CMUCL to shut up. :)

Gabe Garza
From: Raymond Toy
Subject: Re: make-array question
Date: 
Message-ID: <4nlm8zr0m4.fsf@rtp.ericsson.se>
>>>>> "Gabe" == Gabe Garza <·······@ix.netcom.com> writes:

    Gabe> Julian Stecklina <··········@web.de> writes:
    >> Erik Naggum <····@naggum.net> writes:
    >> 
    >> > * Julian Stecklina
    >> > | The problem is that CMU CL reports the following when compiling the above:
    >> > 
    >> >   The problem is that CMUCL is way too helpful.  Ignore the annoying warning,
    >> >   you are doing the right thing.
    >> 
    >> Ok. Thank you. It's quite difficult to tell which of the many notices
    >> CMUCL gives in my current source is really meaningful. :)
    >> 

    Gabe> Do you know about the EXT:INHIBIT-WARNINGS declaration yet?  It's
    Gabe> really useful: turn on optimization, compile the function(s), read the
    Gabe> warnings, fix what you want, then use EXT:INHIBIT-WARNINGS to tell
    Gabe> CMUCL to shut up. :)

And then when you change the code to enhance something which causes
things to take ten times longer than they used to, you can't figure
out why because you've forgotten about that inhibit-warnings that
inhibited the useful warnings that would have pointed out the problem
right away.  (Whew, what a run-on sentence!)

:-)

I just live with the warnings.  Or better yet, don't compile with
speed = 3 for those routines because it probably doesn't matter.

Ray
From: Julian Stecklina
Subject: Re: make-array question
Date: 
Message-ID: <873cv6zy3g.fsf@jmmr.no-ip.com>
Gabe Garza <·······@ix.netcom.com> writes:

> Julian Stecklina <··········@web.de> writes:
> 
> > Erik Naggum <····@naggum.net> writes:
> > 
> > > * Julian Stecklina
> > > | The problem is that CMU CL reports the following when compiling the above:
> > > 
> > >   The problem is that CMUCL is way too helpful.  Ignore the annoying warning,
> > >   you are doing the right thing.
> > 
> > Ok. Thank you. It's quite difficult to tell which of the many notices
> > CMUCL gives in my current source is really meaningful. :)
> > 
> 
> Do you know about the EXT:INHIBIT-WARNINGS declaration yet?  It's
> really useful: turn on optimization, compile the function(s), read the
> warnings, fix what you want, then use EXT:INHIBIT-WARNINGS to tell
> CMUCL to shut up. :)

I do not talk about warnings. Warnings are often signs of wrong
code. I talk about notices that sometimes indicate bad, but not wrong
code.

Regards,
Julian

-- 
Meine Hompage: http://julian.re6.de

Ich suche eine PCMCIA v1.x type I/II/III Netzwerkkarte.
Ich biete als Tauschobjekt eine v2 100MBit Karte in OVP.
From: Gabe Garza
Subject: Re: make-array question
Date: 
Message-ID: <3cv6mu5s.fsf@anubis.kynopolis.org>
Julian Stecklina <··········@web.de> writes:

> Gabe Garza <·······@ix.netcom.com> writes:
> 
> > Julian Stecklina <··········@web.de> writes:
> > 
> > > Erik Naggum <····@naggum.net> writes:
> > > 
> > > > * Julian Stecklina
> > > > | The problem is that CMU CL reports the following when compiling the above:
> > > > 
> > > >   The problem is that CMUCL is way too helpful.  Ignore the annoying warning,
> > > >   you are doing the right thing.
> > > 
> > > Ok. Thank you. It's quite difficult to tell which of the many notices
> > > CMUCL gives in my current source is really meaningful. :)
> > > 
> > 
> > Do you know about the EXT:INHIBIT-WARNINGS declaration yet?  It's
> > really useful: turn on optimization, compile the function(s), read the
> > warnings, fix what you want, then use EXT:INHIBIT-WARNINGS to tell
> > CMUCL to shut up. :)
> 
> I do not talk about warnings. Warnings are often signs of wrong
> code. I talk about notices that sometimes indicate bad, but not wrong
> code.

From the CMUCL manual:

extensions:inhibit-warnings

This is a CMUCL extension that determines how little (or how much)
diagnostic output should be printed during compilation. This quality
is compared to other qualities to determine whether to print style
notes and warnings concerning those qualities. If speed is greater
than inhibit-warnings, then notes about how to improve speed will be
printed, etc. The default value is 1, so raising the value for any
standard quality above its default enables notes for that quality. If
inhibit-warnings is 3, then all notes and most non-serious warnings
are inhibited. This is useful with declare to suppress warnings about
unavoidable problems.

[end of manual quote]

Used judiciously, (e.g., putting it on optimized functions after
you've already examined the output like I suggested in my previous
message) it can really help cut down on CMUCL's notes.  

Gabe Garza
From: Kaz Kylheku
Subject: Re: make-array question
Date: 
Message-ID: <affv19$5i0$1@luna.vcn.bc.ca>
In article <··············@jmmr.no-ip.com>, Julian Stecklina wrote:
> Hello,
> 
> I use make-array to create an array of rank 2 like this:
> 
> (make-array (list x y))
> 
> x and y are variables. The problem is that CMU CL reports the
> following when compiling the above:
> 
>   (MAKE-ARRAY (LIST X Y))
> Note: Unable to optimize because:
>       Dimension list not constant; cannot open code array creation

Mere optimization warning.

> 
> Is there a way to create an multi-dimensional array (with known and
> constant rank) without consing this additional list?

If the ranks truly are constants, and you must avoid consing at all costs, you
can use read-time evaluation via the #.  reader macro to insert the values
into a quoted list:

	(eval-when (:compile-toplevel :load-toplevel :execute)
	  (defconstant *rows* 10)
	  (defconstant *columns* 10))

	;; ...

	(make-array '(#.*rows* #.*columns*))
From: Kalle Olavi Niemitalo
Subject: Re: make-array question
Date: 
Message-ID: <87k7ojhmot.fsf@Astalo.y2000.kon.iki.fi>
Kaz Kylheku <···@ashi.footprints.net> writes:

> In article <··············@jmmr.no-ip.com>, Julian Stecklina wrote:
> > Is there a way to create an multi-dimensional array (with known and
> > constant rank) without consing this additional list?
>
> If the ranks truly are constants, and you must avoid consing at
> all costs, you can use read-time evaluation via the #. reader
> macro to insert the values into a quoted list:

The rank is the number of dimensions, and it is a constant two.
The dimensions themselves apparently are not constants.