MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: "Esoteric of the week"

  • To: mathgroup at
  • Subject: [mg122011] Re: "Esoteric of the week"
  • From: "Oleksandr Rasputinov" <oleksandr_rasputinov at>
  • Date: Sun, 9 Oct 2011 03:51:08 -0400 (EDT)
  • Delivered-to:
  • References: <j6q5mt$ov1$>

On Sat, 08 Oct 2011 19:44:45 +0100, Bill Rowe <readnews at>  

> On 10/6/11 at 4:23 AM, weh at (Dr. Wolfgang Hintze) wrote:
>> What about setting up a regular column "esoteric of the week" naming
>> functions that are rarely used ?
> The difficulty is a determination of rarely used. Who decides?
> And how? ... For me at least, the operational definition of rarely
> used would be those functions I have to look up syntax to use correctly.

Along these lines, I would suggest a family of undocumented Internal`  
functions that can be quite useful:

	works just like Block, except that the definitions of the localized  
symbols are copied from the global environment (including Attributes,  
Options, etc.). Useful for temporarily overriding the properties of  
System` functions without going through the Unprotect/modify/Protect  
dance, for example.

{Internal`Bag, Internal`StuffBag, Internal`BagPart}:
	described by Daniel Lichtblau here:  
Apart from being useful for building your own data structures, Bags are  
considered to be scalars by the Mathematica compiler and can be used to  
build up lists inside compiled code without AppendTo (and its associated  
CopyTensor). (Sow/Reap use Bags but at present don't work in compiled code  
because their ability to associate a tag with each expression relies on  
pattern matching.)

	Somewhat similar to Partition, but only works with 1-d Lists and operates  
based on a structural specification as given by Dimensions. Similar to the  
RESHAPE function from Fortran 90. Say we have a list (which must be a  
full-rank tensor) with some nested structure:

lst = Partition[{{11, 12, 13}, {21, 22, 23}, {31, 32, 33}}, {2, 1}, 1];
dims = Dimensions[lst]

{2, 3, 2, 1}

lst == Internal`Deflatten[Flatten[lst], dims]


an important point to note about Internal`Deflatten is that a dimensional  
specification must not be given that would require more elements in the  
source array than actually exist in order to produce a full-rank tensor  
result. That is, for Internal`Deflatten[lst, dims], Times @@ dims <=  
Length@Flatten[lst] must be fulfilled, otherwise the kernel will crash.

  • Prev by Date: Re: Rank of a matrix depending on a variable
  • Next by Date: genetic algorithm
  • Previous by thread: Re: "Esoteric of the week"
  • Next by thread: Re: "Esoteric of the week"