Questions tagged [vmat]

The vMAT library implements a grab-bag of mathematical functions inspired by MATLAB.

This library is being developed as part of a facial recognition project. As such, it contains a small (but growing) set of matrix functions and related utilities which that project happens to use. It's an example of how MATLAB code can be expressed in vectorized Objective-C.

The official library page can be found on github.

10 questions
7
votes
1 answer

How do I express " = <= " using Eigen 3?

I am porting some MATLAB code to C++ using the Eigen 3 template library, and I am looking for a good mapping for this common MATLAB idiom: K>> [1 2 3 4 5] <= 3 ans = 1 1 1 0 0 So, compare an array and a scalar, returning an…
Kaelin Colclasure
  • 3,925
  • 1
  • 26
  • 36
4
votes
1 answer

How can I automate this sequence of lldb commands?

In order to work around a bug in Apple's lldb (rdar://13702081) I very frequently need to type two commands in sequence, like this: (lldb) p todo.matA (vMAT_Array *) $2 = 0x000000010400b5a0 (lldb) po $2.dump $3 = 0x0000000100503ce0
Kaelin Colclasure
  • 3,925
  • 1
  • 26
  • 36
3
votes
2 answers

Is it possible to enable _LIBCPP_DEBUG2 in the current Xcode 4.6.1 toolchain on Mountain Lion?

This thread is an early discussion of a debug mode for clang's libc++ that was to be enabled by defining _LIBCPP_DEBUG2 in the compiler command. Having just done battle with a mis-allocated std::vector<> I am interested in being able to turn this on…
Kaelin Colclasure
  • 3,925
  • 1
  • 26
  • 36
3
votes
2 answers

Is using a stride of 1 still critical to vDSP performance today?

In a helpful but somewhat dated November, 2006 article on vectorizing code with vDSP, the author makes the statement: Important to keep in mind is the fact that only operations with strides equal to one will deliver blazingly fast vectorized…
Kaelin Colclasure
  • 3,925
  • 1
  • 26
  • 36
2
votes
1 answer

Why does this functor's operator() need the trailing const modifier?

I am coming back to C++ (or well, technically, Objective-C++) after many years absence, so please bear with me. I am trying to use templates to implement a solution that would otherwise require a ton of cut-and-paste code. The excerpt below shows…
Kaelin Colclasure
  • 3,925
  • 1
  • 26
  • 36
1
vote
1 answer

Capturing the spec filename in a ruby DSL implementation?

I am writing a ruby DSL that will be used to code-generate a number of Objective-C++ functions. I would like the name of each function to be derived from the name of its ruby DSL source file. For example, given this source file…
Kaelin Colclasure
  • 3,925
  • 1
  • 26
  • 36
1
vote
1 answer

Is there a way to "force" MatrixBase::eval to happen on a template function argument?

I am working on code for a library that uses Eigen extensively, and frequently maps Eigen::Matrix objects with an NSObject subclass of my own design (vMAT_Array). Working with the library often requires marshaling matrices into vMAT_Array instances…
Kaelin Colclasure
  • 3,925
  • 1
  • 26
  • 36
1
vote
1 answer

What is a better way to specialize this template function for int8_t and uint8_t?

Consider the template dump function below: namespace { using namespace Eigen; using namespace std; using namespace vMAT; template NSString * dump(NSString * prefix, T * A, vMAT_Size sizeA) { …
Kaelin Colclasure
  • 3,925
  • 1
  • 26
  • 36
0
votes
2 answers

Why does using an STL std::vector as a __block variable cause memory corruption?

After some time and effort I have tracked down a memory smashing bug in my code to this function. I stopped the memory smashing by replacing the two __block vector variables with the combination of stack-allocated arrays to provide the storage…
Kaelin Colclasure
  • 3,925
  • 1
  • 26
  • 36
0
votes
1 answer

How do I make a C++ function implicitly convert a list of ints into a vector parameter?

I am working on a library whose functions commonly take a vector type (__v4si, or a vector of 4 signed ints) as a parameter. (Note that so far this has nothing to do with the C++ STL vectortemplate class; this is a more primitive construct used to…
Kaelin Colclasure
  • 3,925
  • 1
  • 26
  • 36