API: added diag(matrix)

This commit is contained in:
Philippe Tillet
2015-10-04 17:05:06 -04:00
parent 740f5def49
commit 07e7bd862c
3 changed files with 12 additions and 2 deletions

View File

@@ -118,7 +118,7 @@ std::string axpy::generate_impl(std::string const & suffix, math_expression cons
std::string array_access = "#scalartype #namereg = #pointer[#index];";
std::string matrix_row = dtype + " #namereg = " + vload(p_.simd_width, "#scalartype", "i", "#pointer + #row*#stride", "#ld", backend, false) + ";";
std::string matrix_column = dtype + " #namereg = " + vload(p_.simd_width, "#scalartype", "i*#stride", "#pointer + #column*#ld", "#stride", backend, false) + ";";
std::string matrix_diag = dtype + " #namereg = " + vload(p_.simd_width, "#scalartype", "i*(#ld + #stride)", "#pointer + (#diag_offset<0)?-#diag_offset:(#diag_offset*#ld)", "#ld + #stride", backend, false) + ";";
std::string matrix_diag = dtype + " #namereg = " + vload(p_.simd_width, "#scalartype", "i*(#ld + #stride)", "#pointer + ((#diag_offset<0)?-#diag_offset:(#diag_offset*#ld))", "#ld + #stride", backend, false) + ";";
process(stream, RHS_NODE_TYPE, {{"array1", array1}, {"matrix_row", matrix_row}, {"matrix_column", matrix_column},
{"matrix_diag", matrix_diag}, {"array_access", array_access}}, expressions, idx, mappings, processed);
}
@@ -165,7 +165,7 @@ std::string axpy::generate_impl(std::string const & suffix, math_expression cons
stream.dec_tab();
stream << "}" << std::endl;
// std::cout << stream.str() << std::endl;
std::cout << stream.str() << std::endl;
return stream.str();
}