我在python中试验OpenCl并且无法弄清楚我在这个简单的矩阵复制代码中做错了什么。
我的输入矩阵是:
[[1 2 3 4],
[5 6 7 8],
[9 10 11 12],
[13 14 15 16],
[17 18 19 20]]
我得到了这个输出:
[[1 2 3 4],
[5 6 7 8],
[9 10 0 0],
[0 0 0 0],
[0 0 0 0]]
为什么它只是我的矩阵的一部分被复制?我做错了什么?
这是我的代码:
<div class="moodle-dialogue-base" aria-hidden="false"><div class="yui3-widget-mask moodle-dialogue-lightbox" style="position: fixed; width: 100%; height: 100%; top: 0px; left: 0px; z-index: 102;"></div><div id="moodle-dialogue-yui_3_17_2_1_1516089654562_333" class="yui3-widget yui3-panel moodle-dialogue yui3-widget-positioned yui3-widget-modal yui3-widget-stacked moodle-has-zindex filepicker moodle-dialogue-focused yui3-dd-draggable" tabindex="0" style="height: 558px; width: 873px; left: 164px; top: 59px; z-index: 102;"><div id="moodle-dialogue-yui_3_17_2_1_1516089654562_333" role="dialog" aria-labelledby="moodle-dialogue-yui_3_17_2_1_1516089654562_333-header-text" class="moodle-dialogue-wrap moodle-dialogue-content yui3-widget-stdmod yui3-widget-content-expanded"><div id="moodle-dialogue-yui_3_17_2_1_1516089654562_333-header-text" class="moodle-dialogue-hd yui3-widget-hd" style="cursor: move;"><h3 id="fp-dialog-label_5a5db137a26bd">File picker</h3><span class="yui3-widget-buttons" id="yui_3_17_2_1_1516089654562_403"><button class="yui3-button closebutton" title="Close"></button></span></div><div class="moodle-dialogue-bd yui3-widget-bd" style="height: 0px;" id="yui_3_17_2_1_1516089654562_708"><div tabindex="0" class="file-picker fp-generallayout container-fluid row repository_upload" role="dialog" aria-live="assertive" id="filepicker-5a5db137a26bd" aria-labelledby="fp-dialog-label_5a5db137a26bd">
<div class="fp-repo-area col-md-3 nav nav-pills nav-stacked">
<div class="fp-repo nav-item first odd" id="fp-repo-5a5db137a26bd-3">
<a href="#" class="nav-link"><img class="fp-repo-icon" alt=" " width="16" height="16" src="https://moodle.cs.colorado.edu/theme/image.php/remui/repository_recent/1515344674/icon"> <span class="fp-repo-name">Recent files</span></a>
</div><div class="fp-repo nav-item even active" id="fp-repo-5a5db137a26bd-4">
<a href="#" class="nav-link"><img class="fp-repo-icon" alt=" " width="16" height="16" src="https://moodle.cs.colorado.edu/theme/image.php/remui/repository_upload/1515344674/icon"> <span class="fp-repo-name">Upload a file</span></a>
</div><div class="fp-repo nav-item odd" id="fp-repo-5a5db137a26bd-5">
<a href="#" class="nav-link"><img class="fp-repo-icon" alt=" " width="16" height="16" src="https://moodle.cs.colorado.edu/theme/image.php/remui/repository_url/1515344674/icon"> <span class="fp-repo-name">URL downloader</span></a>
</div><div class="fp-repo nav-item even" id="fp-repo-5a5db137a26bd-6">
<a href="#" class="nav-link"><img class="fp-repo-icon" alt=" " width="16" height="16" src="https://moodle.cs.colorado.edu/theme/image.php/remui/repository_user/1515344674/icon"> <span class="fp-repo-name">Private files</span></a>
</div><div class="fp-repo nav-item odd" id="fp-repo-5a5db137a26bd-7">
<a href="#" class="nav-link"><img class="fp-repo-icon" alt=" " width="16" height="16" src="https://moodle.cs.colorado.edu/theme/image.php/remui/repository_wikimedia/1515344674/icon"> <span class="fp-repo-name">Wikimedia</span></a>
</div></div>
<div class="col-md-9" id="yui_3_17_2_1_1516089654562_707">
<div class="fp-repo-items" tabindex="0" id="yui_3_17_2_1_1516089654562_706">
<div class="fp-navbar bg-faded card m-b-0 clearfix icon-no-spacing">
<div>
<div class="fp-toolbar empty" id="yui_3_17_2_1_1516089654562_515">
<div class="fp-tb-back disabled">
<a href="#" class="btn btn-secondary btn-sm">« Back</a>
</div>
<div class="fp-tb-search disabled">
<form method="POST" id="fp-tb-search-5a5db137a26bd"></form>
</div>
<div class="fp-tb-refresh disabled" id="yui_3_17_2_1_1516089654562_522">
<a title="Refresh" class="btn btn-secondary btn-sm" href="#">
<i class="icon fa fa-refresh fa-fw " aria-hidden="true" aria-label=""></i>
</a>
</div>
<div class="fp-tb-logout disabled" id="yui_3_17_2_1_1516089654562_517">
<a title="Logout" class="btn btn-secondary btn-sm" href="#">
<i class="icon fa fa-sign-out fa-fw " aria-hidden="true" aria-label=""></i>
</a>
</div>
<div class="fp-tb-manage disabled" id="yui_3_17_2_1_1516089654562_531">
<a title="Manage" class="btn btn-secondary btn-sm" href="#">
<i class="icon fa fa-cog fa-fw " aria-hidden="true" aria-label=""></i>
</a>
</div>
<div class="fp-tb-help disabled" id="yui_3_17_2_1_1516089654562_537">
<a title="Help" class="btn btn-secondary btn-sm" href="#">
<i class="icon fa fa-question-circle text-info fa-fw " aria-hidden="true" aria-label=""></i>
</a>
</div>
<div class="fp-tb-message disabled"></div>
<a id="fp-tb-manage-5a5db137a26bd-link" target="_blank" style="display: none;" href="null"></a><a id="fp-tb-help-5a5db137a26bd-link" target="_blank" style="display: none;" href="null"></a></div>
<div class="fp-viewbar btn-group pull-xs-right disabled">
<a role="button" title="Display folder with file icons" class="fp-vb-icons btn btn-secondary btn-sm checked" href="#" aria-disabled="true" tabindex="-1">
<i class="icon fa fa-th fa-fw " aria-hidden="true" aria-label=""></i>
</a>
<a role="button" title="Display folder with file details" class="fp-vb-details btn btn-secondary btn-sm" href="#" aria-disabled="true" tabindex="-1">
<i class="icon fa fa-list fa-fw " aria-hidden="true" aria-label=""></i>
</a>
<a role="button" title="Display folder as file tree" class="fp-vb-tree btn btn-secondary btn-sm" href="#" aria-disabled="true" tabindex="-1">
<i class="icon fa fa-folder fa-fw " aria-hidden="true" aria-label=""></i>
</a>
</div>
<div class="fp-clear-left"></div>
</div>
<div class="fp-pathbar empty"></div>
</div>
<div class="fp-content card" id="yui_3_17_2_1_1516089654562_712"><div class="fp-upload-form" id="yui_3_17_2_1_1516089654562_754">
<div class="fp-content-center" id="yui_3_17_2_1_1516089654562_753">
<form enctype="multipart/form-data" method="POST" class="form" id="repo-form_5a5db137a26bd">
<div class="fp-formset" id="yui_3_17_2_1_1516089654562_752">
<div class="fp-file form-group" id="yui_3_17_2_1_1516089654562_714">
<label for="yui_3_17_2_1_1516089654562_715">Attachment</label>
<div class="p-x-1" id="yui_3_17_2_1_1516089654562_751">
<input type="file" id="yui_3_17_2_1_1516089654562_715" name="repo_upload_file">
</div>
</div>
<div class="fp-saveas form-group" id="yui_3_17_2_1_1516089654562_717">
<label for="yui_3_17_2_1_1516089654562_718">Save as</label>
<input type="text" class="form-control" id="yui_3_17_2_1_1516089654562_718" name="title">
</div>
<div class="fp-setauthor form-group" id="yui_3_17_2_1_1516089654562_720">
<label for="yui_3_17_2_1_1516089654562_721">Author</label>
<input type="text" class="form-control" id="yui_3_17_2_1_1516089654562_721" name="author">
</div>
<div class="fp-setlicense control-group" id="yui_3_17_2_1_1516089654562_723">
<label for="yui_3_17_2_1_1516089654562_724">Choose license</label>
<select class="form-control" id="yui_3_17_2_1_1516089654562_724" name="license"><option value="unknown">Other</option><option value="allrightsreserved">All rights reserved</option><option value="public">Public domain</option><option value="cc">Creative Commons</option><option value="cc-nd">Creative Commons - NoDerivs</option><option value="cc-nc-nd">Creative Commons - No Commercial NoDerivs</option><option value="cc-nc">Creative Commons - No Commercial</option><option value="cc-nc-sa">Creative Commons - No Commercial ShareAlike</option><option value="cc-sa">Creative Commons - ShareAlike</option></select>
</div>
</div>
<input type="hidden" name="itemid" value="708518204"></form>
<div class="mdl-align">
<button class="fp-upload-btn btn-primary btn">Upload this file</button>
</div>
</div>
</div></div>
</div>
</div>
</div></div><div class="moodle-dialogue-ft yui3-widget-ft"></div></div></div></div>
答案 0 :(得分:2)
我知道我做错了什么:我的矩阵在python(64位机器)中声明为64位浮点数,而我在OpenCL代码中使用浮点指针似乎会导致问题。在OpenCL代码中将float更改为double可以解决问题:)