What is a Closure Type? Understanding Boost uBLAS

AI Thread Summary
A "closure type" refers to a specific implementation detail found in the uBLAS package from boost.org, which is an implementation of the Basic Linear Algebra Subprograms (BLAS) using expression templates. Within this context, many classes include a nested typedef called "closure_type" and "const_closure_type." The purpose of these typedefs is not widely documented, leading to confusion among developers. Additionally, some classes feature a "same_closure" member function that checks for identity between instances, indicating a mechanism for self-referential comparison. However, the overall purpose and utility of closure types remain unclear, as existing resources do not provide sufficient information to fully understand their role in the codebase.
Hurkyl
Staff Emeritus
Science Advisor
Gold Member
Messages
14,922
Reaction score
28
What is a "closure type"?

I first encountered it by looking at the source of the uBLAS package from boost.org -- it's essentially an implementation of the BLAS using expression templates.

I noticed that a lot of the classes have a nested typedef called "closure_type" (and a "const_closure_type"), and I've never heard of such a thing.

Also, a couple of the classes define a "same_closure" member function which simply tests for identity. For example, from the "scalar_value" class:
Code:
        bool same_closure (const scalar_value &sv) const {
            return this == &sv;    // self closing on instances value
        }

And I haven't yet managed to discover the purpose of such a thing by looking through the source code, nor by googling for "closure type". (I get hits on closure type, but not enough info to infer what such a thing is, and the point of it)

Does anyone here know?
 
Computer science news on Phys.org
Because it's a non-standard coding to establish parameters to terminate an argument.
 
Could you say that again?
 
In my discussions elsewhere, I've noticed a lot of disagreement regarding AI. A question that comes up is, "Is AI hype?" Unfortunately, when this question is asked, the one asking, as far as I can tell, may mean one of three things which can lead to lots of confusion. I'll list them out now for clarity. 1. Can AI do everything a human can do and how close are we to that? 2. Are corporations and governments using the promise of AI to gain more power for themselves? 3. Are AI and transhumans...
Thread 'ChatGPT Examples, Good and Bad'
I've been experimenting with ChatGPT. Some results are good, some very very bad. I think examples can help expose the properties of this AI. Maybe you can post some of your favorite examples and tell us what they reveal about the properties of this AI. (I had problems with copy/paste of text and formatting, so I'm posting my examples as screen shots. That is a promising start. :smile: But then I provided values V=1, R1=1, R2=2, R3=3 and asked for the value of I. At first, it said...
Back
Top