在DolphinDB数据库中将矩阵的所有负元素设为0的最简单方法是什么?

时间:2019-11-12 22:47:35

标签: dolphindb

对于此特定问题,我使用(x + abs(x))\ 2。但是,有没有更直接,更通用的方法来做到这一点?

1 个答案:

答案 0 :(得分:0)

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/dashboard/video/external

Django Version: 3.0.1
Python Version: 3.7.3
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'app']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback (most recent call last):
  File "/Users/admin/venvs/django-project/lib/python3.7/site-packages/django/core/handlers/exception.py", line 34, in inner
    response = get_response(request)
  File "/Users/admin/venvs/django-project/lib/python3.7/site-packages/django/core/handlers/base.py", line 115, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/admin/venvs/django-project/lib/python3.7/site-packages/django/core/handlers/base.py", line 113, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/admin/venvs/django-project/lib/python3.7/site-packages/django/views/generic/base.py", line 71, in view
    return self.dispatch(request, *args, **kwargs)
  File "/Users/admin/venvs/django-project/lib/python3.7/site-packages/django/views/generic/base.py", line 97, in dispatch
    return handler(request, *args, **kwargs)
  File "/Users/admin/projects/django-video-site/video/app/utils/permission.py", line 17, in wrapper
    return func(self, request, *args, **kwargs)
  File "/Users/admin/projects/django-video-site/video/app/dashboard/views/video.py", line 22, in get
    return render_to_response(request, self.TEMPLATE, data=data)
  File "/Users/admin/projects/django-video-site/video/app/libs/base_render.py", line 43, in render_to_response
    return HttpResponse(mako_template.render(**result))
  File "/Users/admin/venvs/django-project/lib/python3.7/site-packages/mako/template.py", line 476, in render
    return runtime._render(self, self.callable_, args, data)
  File "/Users/admin/venvs/django-project/lib/python3.7/site-packages/mako/runtime.py", line 883, in _render
    **_kwargs_for_callable(callable_, data)
  File "/Users/admin/venvs/django-project/lib/python3.7/site-packages/mako/runtime.py", line 920, in _render_context
    _exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
  File "/Users/admin/venvs/django-project/lib/python3.7/site-packages/mako/runtime.py", line 947, in _exec_template
    callable_(context, *args, **kwargs)
  File "dashboard_video____base_html", line 35, in render_body
    <source code not available>
  File "dashboard_video_external_video_html", line 103, in render_content
    <source code not available>
  File "/Users/admin/venvs/django-project/lib/python3.7/site-packages/django/urls/base.py", line 87, in reverse
    return iri_to_uri(resolver._reverse_with_prefix(view, prefix, *args, **kwargs))
  File "/Users/admin/venvs/django-project/lib/python3.7/site-packages/django/urls/resolvers.py", line 637, in _reverse_with_prefix
    text_candidate_subs[k] = converters[k].to_url(v)
  File "/Users/admin/venvs/django-project/lib/python3.7/site-packages/django/urls/converters.py", line 12, in to_url
    return str(value)
  File "/Users/admin/venvs/django-project/lib/python3.7/site-packages/mako/runtime.py", line 230, in __str__
    raise NameError("Undefined")

Exception Type: NameError at /dashboard/video/external
Exception Value: Undefined