What does "hidden_function keyword" mean?

asked 2020-06-20 03:14:27 +0200

Hello, everyone. I am very new to Sage, so I am still getting used to it and learning the terminology. Recently, I was trying to test Sage out and I entered vector(matrix([[]])) into the Sage terminal prompt, but it gave me an error message I did not understand:

sage: vector(matrix([[]]))
sage: vector(matrix([[]]))
ValueError                                Traceback (most recent call last)
<ipython-input-6-9573ec2e6342> in <module>()
----> 1 vector(matrix([[]]))

sage/modules/free_module_element.pyx in sage.modules.free_module_element.vector (build/cythonized/sage/modules/free_module_element.c:4462)()

/usr/lib/python2.7/dist-packages/sage/categories/finite_dimensional_modules_with_basis.pyc in _vector_(self, order)
    385             # We slightly break encapsulation for speed reasons
    386             return dense_free_module.element_class(dense_free_module,
--> 387                                                    self.dense_coefficient_list(order),
    388                                                    coerce=True, copy=False)

/usr/lib/python2.7/dist-packages/sage/categories/finite_dimensional_modules_with_basis.pyc in dense_coefficient_list(self, order)
    364             if order is None:
    365                 try:
--> 366                     order = sorted(self.parent().basis().keys())
    367                 except AttributeError: # Not a family, assume it is list-like
    368                     order = range(self.parent().dimension())

/usr/lib/python2.7/dist-packages/sage/matrix/matrix_space.pyc in basis(self)
   1187         return Family(keys, v.__getitem__,
   1188                       hidden_keys=list(range(self.dimension())),
-> 1189                       hidden_function=old_index)
   1191     def dimension(self):

/usr/lib/python2.7/dist-packages/sage/sets/family.pyc in Family(indices, function, hidden_keys, hidden_function, lazy, name)
    379     if hidden_keys == []:
    380         if hidden_function is not None:
--> 381             raise ValueError("hidden_function keyword only makes sense "
    382                              "together with hidden_keys keyword !")
    383         if function is None:

ValueError: hidden_function keyword only makes sense together with hidden_keys keyword !

When I originally ran this line of code, I was expecting it to just output the empty vector, $()$. However, instead, it gave me this cryptic error message about hidden_function and hidden_keys. Can someone please explain to me what this error message means? I can't find anything about this error message on Google. Thanks!

edit retag flag offensive close merge delete


Hi Noble Mushtak

OS and SageMath version ?

for me :OS Ubuntu 18.04 SageMath 9.1

When I enter vector(matrix([[]])) , I got (), its ok for me

ortollj gravatar imageortollj ( 2020-06-24 07:15:19 +0200 )edit

I am using Ubuntu 18.04, Sage 8.1.

Noble Mushtak gravatar imageNoble Mushtak ( 2020-06-30 15:10:52 +0200 )edit