-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy patharray1d_8cu-example.html
More file actions
164 lines (162 loc) · 9.46 KB
/
array1d_8cu-example.html
File metadata and controls
164 lines (162 loc) · 9.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<!-- HTML header for doxygen 1.8.3.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>CUSP: array1d.cu</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-34296872-1");
pageTracker._trackPageview();
} catch(err) {}
</script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="45">
<tbody>
<tr style="height: 56px;">
<!-- <td id="projectlogo"><img alt="Logo" src="cusp_logo.png"/></td> -->
<td style="padding-left: 0.5em;">
<!-- <div id="projectname">CUSP -->
<div id="menubar"> </div>
<a href="https://github.com/cusplibrary/cusplibrary">
<img style="position: absolute; top: 0; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"
alt="Fork me on GitHub">
</a>
<ul id="menu">
<li><a href="/"><img src="cusp_logo.png" alt="CUSP" height=80px title="CUSP"/></a></li>
<!-- <li><a title="Quick Start Guide" href="https://github.com/cusplibrary/cusplibrary/wiki/Quick-Start-Guide">Get Started</a></li> -->
<li><a title="Quick Start Guide" href="md_quickstart.html">Get Started</a></li>
<li><a title="Examples" href="examples.html">Examples</a></li>
<li><a title="Join the cusp-users mailing list" href="http://groups.google.com/group/cusp-users">Mailing List</a></li>
<li><a title="Download latest Cusp source code" href="https://github.com/cusplibrary/cusplibrary/archive/v0.5.1.zip">Get Cusp</a></li>
</ul>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="modules.html"><span>Modules</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Groups</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="headertitle">
<div class="title">array1d.cu</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><span class="preprocessor">#include <<a class="code" href="array1d_8h.html">cusp/array1d.h</a>></span></div>
<div class="line"><span class="preprocessor">#include <<a class="code" href="blas_8h.html">cusp/blas/blas.h</a>></span></div>
<div class="line"><span class="preprocessor">#include <<a class="code" href="copy_8h.html">cusp/copy.h</a>></span></div>
<div class="line"><span class="preprocessor">#include <<a class="code" href="print_8h.html">cusp/print.h</a>></span></div>
<div class="line"></div>
<div class="line"><span class="comment">// This example shows how to create views to an array container.</span></div>
<div class="line"><span class="comment">// Views act like containers but do not own the underlying data.</span></div>
<div class="line"><span class="comment">// Like pointers, views are *lightweight* objects that *reference* data.</span></div>
<div class="line"></div>
<div class="line"><span class="keywordtype">int</span> main(<span class="keywordtype">void</span>)</div>
<div class="line">{</div>
<div class="line"> <span class="comment">// define array container type</span></div>
<div class="line"> <span class="keyword">typedef</span> <a name="_a0"></a><a class="code" href="classcusp_1_1array1d.html">cusp::array1d<int, cusp::device_memory></a> Array;</div>
<div class="line"></div>
<div class="line"> <span class="comment">// define array view type</span></div>
<div class="line"> <span class="keyword">typedef</span> Array::view View;</div>
<div class="line"></div>
<div class="line"> <span class="comment">// allocate array1d container with 10 elements</span></div>
<div class="line"> Array array(10,0);</div>
<div class="line"></div>
<div class="line"> <span class="comment">// create view to the first 5 elements of the array</span></div>
<div class="line"> View first_half(array.begin(), array.begin() + 5);</div>
<div class="line"></div>
<div class="line"> <span class="comment">// create view to the last 5 elements of the array</span></div>
<div class="line"> View last_half(array.begin() + 5, array.end());</div>
<div class="line"></div>
<div class="line"> <span class="comment">// fill the first half of the array with 1s</span></div>
<div class="line"> <a name="a1"></a><a class="code" href="group__blas.html#ga90e8a781b3c33d15f3493fb256f1d063">cusp::blas::fill</a>(first_half, 1);</div>
<div class="line"></div>
<div class="line"> <span class="comment">// fill the first half of the array with 2s</span></div>
<div class="line"> <a class="code" href="group__blas.html#ga90e8a781b3c33d15f3493fb256f1d063">cusp::blas::fill</a>(last_half, 2);</div>
<div class="line"></div>
<div class="line"> <span class="comment">// print the array</span></div>
<div class="line"> <a name="a2"></a><a class="code" href="group__io.html#gae830bdfc52775580d0cadee9ad8db187">cusp::print</a>(array);</div>
<div class="line"></div>
<div class="line"> <span class="comment">// copy the first half to the last half</span></div>
<div class="line"> <a name="a3"></a><a class="code" href="group__matrix__algorithms.html#ga6af17222e6fc7946fb002741c223b04f">cusp::copy</a>(first_half, last_half);</div>
<div class="line"></div>
<div class="line"> <span class="comment">// print the array</span></div>
<div class="line"> <a class="code" href="group__io.html#gae830bdfc52775580d0cadee9ad8db187">cusp::print</a>(array);</div>
<div class="line"></div>
<div class="line"> <span class="keywordflow">return</span> 0;</div>
<div class="line">}</div>
<div class="line"></div>
</div><!-- fragment --> </div><!-- contents -->
<!-- HTML footer for doxygen 1.8.3.1-->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated for CUSP by <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
<br>
© 2014 NVIDIA Corporation
</small></address>
</body>
</html>